The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Sys::Virt::StorageVol - Represent & manage a libvirt storage volume

DESCRIPTION

The Sys::Virt::StorageVol module represents a storage volume managed by libvirt. A storage volume is always associated with a containing storage pool (Sys::Virt::StoragePool).

METHODS

my $name = $vol->get_name()

Returns a string with a locally unique name of the storage vol

my $name = $vol->get_key()

Returns a string with a globally unique key for the storage vol

my $name = $vol->get_path()

Returns a string with a locally unique file path of the storage vol

my $xml = $vol->get_xml_description()

Returns an XML document containing a complete description of the storage vol's configuration

$vol->delete($flags)

Immediately delete the storage volume freeing its storage resources. The flags parameter indicates any special action to be taken when deleting the volume.

$vol->wipe($flags = 0)

Clear the data in the storage volume to avoid future information leak. The flags parameter indicates any special approach to be taken when wiping the data. It defaults to zero, which causes the volume to be filled with zeros.

my %info = $vol->get_info()

Retrieve live information about the storage volume. The returned %info hash contains three keys. type indicates whether the volume is a file or block device. capacity provides the maximum logical size of the volume. allocation provides the current physical usage of the volume. The allocation may be less than the capacity for sparse, or grow-on-demand volumes. The allocation may also be larger than the capacity, if there is a metadata overhead for the volume format.

$vol->download($st, $offset, $length);

Download data from $vol using the stream $st. If $offset and $length are non-zero, then restrict data to the specified volume byte range.

$vol->upload($st, $offset, $length);

Upload data to $vol using the stream $st. If $offset and $length are non-zero, then restrict data to the specified volume byte range.

CONSTANTS

The following sets of constants are useful when dealing with storage volumes

VOLUME TYPES

The following constants are useful for interpreting the type field in the hash returned by the get_info method

Sys::Virt::StorageVol::TYPE_FILE

The volume is a plain file

Sys::Virt::StorageVol::TYPE_BLOCK

The volume is a block device

Sys::Virt::StorageVol::TYPE_DIR

The volume is a directory

DELETE MODES

The following constants are useful for the flags parameter of the delete method

Sys::Virt::StorageVol::DELETE_NORMAL

Do a plain delete without any attempt to scrub data.

Sys::Virt::StorageVol::DELETE_ZEROED

Zero out current allocated blocks when deleteing the volume

AUTHORS

Daniel P. Berrange <berrange@redhat.com>

COPYRIGHT

Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2009 Daniel P. Berrange

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file.

SEE ALSO

Sys::Virt, Sys::Virt::Error, http://libvirt.org