Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 7b3cff6

Browse files
committed
Storage: Don't use libvirt VIR_STORAGE_VOL* flags unless they exist
1 parent f0570ed commit 7b3cff6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

virtinst/Storage.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
DEFAULT_DIR_TARGET_BASE = "/var/lib/libvirt/images/"
6262
DEFAULT_SCSI_TARGET = "/dev/disk/by-path"
6363

64+
# Pulled from libvirt, used for building on older versions
65+
VIR_STORAGE_VOL_FILE = 0
66+
VIR_STORAGE_VOL_BLOCK = 1
67+
6468
def is_create_vol_from_supported(conn):
6569
return support.check_pool_support(conn,
6670
support.SUPPORT_STORAGE_CREATEVOLFROM)
@@ -1222,7 +1226,7 @@ class FileVolume(StorageVolume):
12221226
"""
12231227
Build and install xml for use on pools which use file based storage
12241228
"""
1225-
_file_type = libvirt.VIR_STORAGE_VOL_FILE
1229+
_file_type = VIR_STORAGE_VOL_FILE
12261230

12271231
formats = ["raw", "bochs", "cloop", "cow", "dmg", "iso", "qcow",\
12281232
"qcow2", "vmdk", "vpc"]
@@ -1251,6 +1255,7 @@ class DiskVolume(StorageVolume):
12511255
"""
12521256
Build and install xml volumes for use on physical disk pools
12531257
"""
1258+
_file_type = VIR_STORAGE_VOL_BLOCK
12541259

12551260
# Register applicable property methods from parent class
12561261
perms = property(StorageObject.get_perms, StorageObject.set_perms)
@@ -1273,7 +1278,7 @@ class LogicalVolume(StorageVolume):
12731278
"""
12741279
Build and install logical volumes for lvm pools
12751280
"""
1276-
_file_type = libvirt.VIR_STORAGE_VOL_BLOCK
1281+
_file_type = VIR_STORAGE_VOL_BLOCK
12771282

12781283
# Register applicable property methods from parent class
12791284
perms = property(StorageObject.get_perms, StorageObject.set_perms)
@@ -1329,7 +1334,7 @@ def get_xml_config(self):
13291334
# """
13301335
# Build and install xml for use on iSCSI device pools
13311336
# """
1332-
# _file_type = libvirt.VIR_STORAGE_VOL_FILE
1337+
# _file_type = VIR_STORAGE_VOL_BLOCK
13331338
#
13341339
# def __init__(self, *args, **kwargs):
13351340
# raise NotImplementedError

0 commit comments

Comments
 (0)