volume

Manage storage volumes.

class compute.storage.volume.DiskConfig(disk_type: str, source: str | pathlib.Path, target: str, readonly: bool = False)

Disk XML config builder.

Generate XML config for attaching or detaching storage volumes to compute instances.

__init__(disk_type: str, source: str | pathlib.Path, target: str, readonly: bool = False) None
to_xml() str

Return XML config for libvirt.

class compute.storage.volume.Volume(pool: virStoragePool, vol: virStorageVol)

Storage volume manipulating class.

__init__(pool: virStoragePool, vol: virStorageVol)

Initialise Volume.

Parameters:
  • pool – libvirt virStoragePool object

  • vol – libvirt virStorageVol object

clone(vol_conf: VolumeConfig) None

Make a copy of volume to the same storage pool.

Parameters:

VolumeInfo (vol_info) – New storage volume dataclass object

delete() None

Delete volume from storage pool.

dump_xml() str

Return volume XML description as string.

resize(capacity: int, unit: DataUnit) None

Resize volume.

Parameters:
  • int (capacity) – Volume new capacity.

  • DataUnit (unit) – Data unit. Internally converts into bytes.

class compute.storage.volume.VolumeConfig(name: str, path: str, capacity: int)

Storage volume XML config builder.

Generate XML config for creating a volume in a libvirt storage pool.

__init__(name: str, path: str, capacity: int) None
to_xml() str

Return XML config for libvirt.