A continuation of the migration of disk details to virstoragefile. This patch moves a single enum, but converting the name has quite a bit of fallout. * src/conf/domain_conf.h (virDomainDiskType): Move... * src/util/virstoragefile.h (virStorageType): ...and rename. * src/bhyve/bhyve_command.c (bhyveBuildDiskArgStr) (virBhyveProcessBuildLoadCmd): Update clients. * src/conf/domain_conf.c (virDomainDiskSourceDefParse) (virDomainDiskDefParseXML, virDomainDiskSourceDefFormatInternal) (virDomainDiskDefFormat, virDomainDiskGetActualType) (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType): Likewise. * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise. * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML) (virDomainSnapshotAlignDisks, virDomainSnapshotDiskDefFormat): Likewise. * src/esx/esx_driver.c (esxAutodetectSCSIControllerModel) (esxDomainDefineXML): Likewise. * src/locking/domain_lock.c (virDomainLockManagerAddDisk): Likewise. * src/lxc/lxc_controller.c (virLXCControllerSetupLoopDeviceDisk) (virLXCControllerSetupNBDDeviceDisk) (virLXCControllerSetupLoopDevices, virLXCControllerSetupDisk): Likewise. * src/parallels/parallels_driver.c (parallelsGetHddInfo): Likewise. * src/phyp/phyp_driver.c (phypDiskType): Likewise. * src/qemu/qemu_command.c (qemuGetDriveSourceString) (qemuDomainDiskGetSourceString, qemuBuildDriveStr) (qemuBuildCommandLine, qemuParseCommandLineDisk) (qemuParseCommandLine): Likewise. * src/qemu/qemu_conf.c (qemuCheckSharedDevice) (qemuTranslateDiskSourcePool) (qemuTranslateSnapshotDiskSourcePool): Likewise. * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse) (qemuDomainDetermineDiskChain): Likewise. * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo) (qemuDomainSnapshotPrepareDiskExternalBackingInactive) (qemuDomainSnapshotPrepareDiskExternalBackingActive) (qemuDomainSnapshotPrepareDiskExternalOverlayActive) (qemuDomainSnapshotPrepareDiskExternalOverlayInactive) (qemuDomainSnapshotPrepareDiskInternal) (qemuDomainSnapshotPrepare) (qemuDomainSnapshotCreateSingleDiskActive): Likewise. * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia): Likewise. * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise. * src/security/security_apparmor.c (AppArmorRestoreSecurityImageLabel) (AppArmorSetSecurityImageLabel): Likewise. * src/security/security_dac.c (virSecurityDACSetSecurityImageLabel) (virSecurityDACRestoreSecurityImageLabelInt) (virSecurityDACSetSecurityAllLabel): Likewise. * src/security/security_selinux.c (virSecuritySELinuxRestoreSecurityImageLabelInt) (virSecuritySELinuxSetSecurityImageLabel) (virSecuritySELinuxSetSecurityAllLabel): Likewise. * src/storage/storage_backend.c (virStorageFileBackendForType): Likewise. * src/storage/storage_backend_fs.c (virStorageFileBackendFile) (virStorageFileBackendBlock): Likewise. * src/storage/storage_backend_gluster.c (virStorageFileBackendGluster): Likewise. * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives) (vboxDomainAttachDeviceImpl, vboxDomainDetachDevice): Likewise. * src/vmware/vmware_conf.c (vmwareVmxPath): Likewise. * src/vmx/vmx.c (virVMXParseDisk, virVMXFormatDisk) (virVMXFormatFloppy): Likewise. * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr) (xenFormatSxprDisk): Likewise. * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise. * tests/securityselinuxlabeltest.c (testSELinuxLoadDef): Likewise. * src/libvirt_private.syms (domain_conf.h): Move symbols... (virstoragefile.h): ...as appropriate. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- The fallout is once again rather longer than I would like. And given that there is more to come, I'm not going to push this until after the 1.2.3 release. Peter, let me know if I should post these in a repo somewhere to make it easier for you to rebase your pending gluster patches on top of this. src/bhyve/bhyve_command.c | 4 +- src/conf/domain_conf.c | 51 ++++++++++------------- src/conf/domain_conf.h | 18 ++------ src/conf/snapshot_conf.c | 16 +++---- src/conf/snapshot_conf.h | 2 +- src/esx/esx_driver.c | 4 +- src/libvirt_private.syms | 4 +- src/locking/domain_lock.c | 6 +-- src/lxc/lxc_controller.c | 8 ++-- src/parallels/parallels_driver.c | 4 +- src/phyp/phyp_driver.c | 4 +- src/qemu/qemu_command.c | 72 ++++++++++++++++---------------- src/qemu/qemu_conf.c | 16 +++---- src/qemu/qemu_domain.c | 12 +++--- src/qemu/qemu_driver.c | 78 +++++++++++++++++------------------ src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_migration.c | 4 +- src/security/security_apparmor.c | 6 +-- src/security/security_dac.c | 6 +-- src/security/security_selinux.c | 6 +-- src/storage/storage_backend.c | 8 ++-- src/storage/storage_backend_fs.c | 4 +- src/storage/storage_backend_gluster.c | 2 +- src/util/virstoragefile.c | 7 ++++ src/util/virstoragefile.h | 15 +++++++ src/vbox/vbox_tmpl.c | 38 ++++++++--------- src/vmware/vmware_conf.c | 2 +- src/vmx/vmx.c | 38 ++++++++--------- src/xenxs/xen_sxpr.c | 18 ++++---- src/xenxs/xen_xm.c | 12 +++--- tests/securityselinuxlabeltest.c | 4 +- 31 files changed, 238 insertions(+), 233 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 3373cfc..139c7e2 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -148,7 +148,7 @@ bhyveBuildDiskArgStr(const virDomainDef *def, virCommandPtr cmd) return -1; } - if (virDomainDiskGetType(disk) != VIR_DOMAIN_DISK_TYPE_FILE) { + if (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("unsupported disk type")); return -1; @@ -252,7 +252,7 @@ virBhyveProcessBuildLoadCmd(bhyveConnPtr driver ATTRIBUTE_UNUSED, return NULL; } - if (virDomainDiskGetType(disk) != VIR_DOMAIN_DISK_TYPE_FILE) { + if (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("unsupported disk type")); return NULL; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 159a9c3..8c49d58 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -219,13 +219,6 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, "virtio-mmio", "isa") -VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST, - "block", - "file", - "dir", - "network", - "volume") - VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST, "disk", "cdrom", @@ -1294,7 +1287,7 @@ virDomainDiskSetType(virDomainDiskDefPtr def, int type) int virDomainDiskGetActualType(virDomainDiskDefPtr def) { - if (def->src.type == VIR_DOMAIN_DISK_TYPE_VOLUME && def->src.srcpool) + if (def->src.type == VIR_STORAGE_TYPE_VOLUME && def->src.srcpool) return def->src.srcpool->actualtype; return def->src.type; @@ -5048,16 +5041,16 @@ virDomainDiskSourceDefParse(xmlNodePtr node, memset(&host, 0, sizeof(host)); switch (type) { - case VIR_DOMAIN_DISK_TYPE_FILE: + case VIR_STORAGE_TYPE_FILE: *source = virXMLPropString(node, "file"); break; - case VIR_DOMAIN_DISK_TYPE_BLOCK: + case VIR_STORAGE_TYPE_BLOCK: *source = virXMLPropString(node, "dev"); break; - case VIR_DOMAIN_DISK_TYPE_DIR: + case VIR_STORAGE_TYPE_DIR: *source = virXMLPropString(node, "dir"); break; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: if (!(protocol = virXMLPropString(node, "protocol"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing network source protocol type")); @@ -5131,14 +5124,14 @@ virDomainDiskSourceDefParse(xmlNodePtr node, child = child->next; } break; - case VIR_DOMAIN_DISK_TYPE_VOLUME: + case VIR_STORAGE_TYPE_VOLUME: if (virDomainDiskSourcePoolDefParse(node, srcpool) < 0) goto cleanup; break; default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected disk type %s"), - virDomainDiskTypeToString(type)); + virStorageTypeToString(type)); goto cleanup; } @@ -5232,13 +5225,13 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, type = virXMLPropString(node, "type"); if (type) { - if ((def->src.type = virDomainDiskTypeFromString(type)) < 0) { + if ((def->src.type = virStorageTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown disk type '%s'"), type); goto error; } } else { - def->src.type = VIR_DOMAIN_DISK_TYPE_FILE; + def->src.type = VIR_STORAGE_TYPE_FILE; } snapshot = virXMLPropString(node, "snapshot"); @@ -5261,7 +5254,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, &def->src.srcpool) < 0) goto error; - if (def->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) { + if (def->src.type == VIR_STORAGE_TYPE_NETWORK) { if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI) expected_secret_usage = VIR_SECRET_USAGE_TYPE_ISCSI; else if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) @@ -5857,7 +5850,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, goto error; } - if (def->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) { + if (def->src.type == VIR_STORAGE_TYPE_NETWORK) { virReportError(VIR_ERR_XML_ERROR, _("Setting disk %s is not allowed for " "disk of network type"), @@ -14791,7 +14784,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, if (src || nhosts > 0 || srcpool || startupPolicy) { switch (type) { - case VIR_DOMAIN_DISK_TYPE_FILE: + case VIR_STORAGE_TYPE_FILE: virBufferAddLit(buf, "<source"); virBufferEscapeString(buf, " file='%s'", src); virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); @@ -14799,7 +14792,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags); break; - case VIR_DOMAIN_DISK_TYPE_BLOCK: + case VIR_STORAGE_TYPE_BLOCK: virBufferAddLit(buf, "<source"); virBufferEscapeString(buf, " dev='%s'", src); virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); @@ -14807,14 +14800,14 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags); break; - case VIR_DOMAIN_DISK_TYPE_DIR: + case VIR_STORAGE_TYPE_DIR: virBufferAddLit(buf, "<source"); virBufferEscapeString(buf, " dir='%s'", src); virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy); virBufferAddLit(buf, "/>\n"); break; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: virBufferAsprintf(buf, "<source protocol='%s'", virDomainDiskProtocolTypeToString(protocol)); virBufferEscapeString(buf, " name='%s'", src); @@ -14842,7 +14835,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, } break; - case VIR_DOMAIN_DISK_TYPE_VOLUME: + case VIR_STORAGE_TYPE_VOLUME: virBufferAddLit(buf, "<source"); if (srcpool) { @@ -14860,7 +14853,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf, default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected disk type %s"), - virDomainDiskTypeToString(type)); + virStorageTypeToString(type)); return -1; } } @@ -14893,7 +14886,7 @@ virDomainDiskDefFormat(virBufferPtr buf, virDomainDiskDefPtr def, unsigned int flags) { - const char *type = virDomainDiskTypeToString(def->src.type); + const char *type = virStorageTypeToString(def->src.type); const char *device = virDomainDiskDeviceTypeToString(def->device); const char *bus = virDomainDiskBusTypeToString(def->bus); const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode); @@ -18546,8 +18539,8 @@ virDomainDiskDefForeachPath(virDomainDiskDefPtr disk, const char *path = virDomainDiskGetSource(disk); int type = virDomainDiskGetType(disk); - if (!path || type == VIR_DOMAIN_DISK_TYPE_NETWORK || - (type == VIR_DOMAIN_DISK_TYPE_VOLUME && + if (!path || type == VIR_STORAGE_TYPE_NETWORK || + (type == VIR_STORAGE_TYPE_VOLUME && disk->src.srcpool && disk->src.srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT)) return 0; @@ -19397,13 +19390,13 @@ virDomainDiskSourceIsBlockType(virDomainDiskDefPtr def) if (!virDomainDiskGetSource(def)) return false; - if (virDomainDiskGetType(def) == VIR_DOMAIN_DISK_TYPE_BLOCK) + if (virDomainDiskGetType(def) == VIR_STORAGE_TYPE_BLOCK) return true; /* For volume types, check the srcpool. * If it's a block type source pool, then it's possible */ - if (virDomainDiskGetType(def) == VIR_DOMAIN_DISK_TYPE_VOLUME && + if (virDomainDiskGetType(def) == VIR_STORAGE_TYPE_VOLUME && def->src.srcpool && def->src.srcpool->voltype == VIR_STORAGE_VOL_BLOCK) { /* We don't think the volume accessed by remote URI is diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cbf2dca..247b2f8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -462,18 +462,9 @@ struct _virDomainHostdevDef { virDomainDeviceInfoPtr info; /* Guest address */ }; -/* Types of disk backends (host resource) */ -enum virDomainDiskType { - VIR_DOMAIN_DISK_TYPE_BLOCK, - VIR_DOMAIN_DISK_TYPE_FILE, - VIR_DOMAIN_DISK_TYPE_DIR, - VIR_DOMAIN_DISK_TYPE_NETWORK, - VIR_DOMAIN_DISK_TYPE_VOLUME, - VIR_DOMAIN_DISK_TYPE_LAST -}; - -/* Types of disk frontend (guest view) */ +/* Types of disk frontend (guest view). For backends (host view), see + * virStorageType in util/virstoragefile.h */ enum virDomainDiskDevice { VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM, @@ -651,7 +642,7 @@ struct _virDomainDiskSourcePoolDef { char *volume; /* volume name */ int voltype; /* enum virStorageVolType, internal only */ int pooltype; /* enum virStoragePoolType, internal only */ - int actualtype; /* enum virDomainDiskType, internal only */ + int actualtype; /* enum virStorageType, internal only */ int mode; /* enum virDomainDiskSourcePoolMode */ }; typedef virDomainDiskSourcePoolDef *virDomainDiskSourcePoolDefPtr; @@ -663,7 +654,7 @@ typedef virDomainDiskSourceDef *virDomainDiskSourceDefPtr; * backing chains, multiple source disks join to form a single guest * view. TODO Move this to util/ */ struct _virDomainDiskSourceDef { - int type; /* enum virDomainDiskType */ + int type; /* enum virStorageType */ char *path; int protocol; /* enum virDomainDiskProtocol */ size_t nhosts; @@ -2636,7 +2627,6 @@ VIR_ENUM_DECL(virDomainLifecycleCrash) VIR_ENUM_DECL(virDomainPMState) VIR_ENUM_DECL(virDomainDevice) VIR_ENUM_DECL(virDomainDeviceAddress) -VIR_ENUM_DECL(virDomainDisk) VIR_ENUM_DECL(virDomainDiskDevice) VIR_ENUM_DECL(virDomainDiskGeometryTrans) VIR_ENUM_DECL(virDomainDiskBus) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 9f4ea7f..ebb3bb4 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -134,15 +134,15 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, } if ((type = virXMLPropString(node, "type"))) { - if ((def->type = virDomainDiskTypeFromString(type)) < 0 || - def->type == VIR_DOMAIN_DISK_TYPE_VOLUME || - def->type == VIR_DOMAIN_DISK_TYPE_DIR) { + if ((def->type = virStorageTypeFromString(type)) < 0 || + def->type == VIR_STORAGE_TYPE_VOLUME || + def->type == VIR_STORAGE_TYPE_DIR) { virReportError(VIR_ERR_XML_ERROR, _("unknown disk snapshot type '%s'"), type); goto cleanup; } } else { - def->type = VIR_DOMAIN_DISK_TYPE_FILE; + def->type = VIR_STORAGE_TYPE_FILE; } for (cur = node->children; cur; cur = cur->next) { @@ -543,7 +543,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, goto cleanup; disk->index = i; disk->snapshot = def->dom->disks[i]->snapshot; - disk->type = VIR_DOMAIN_DISK_TYPE_FILE; + disk->type = VIR_STORAGE_TYPE_FILE; if (!disk->snapshot) disk->snapshot = default_snapshot; } @@ -561,11 +561,11 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, const char *tmp; struct stat sb; - if (disk->type != VIR_DOMAIN_DISK_TYPE_FILE) { + if (disk->type != VIR_STORAGE_TYPE_FILE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot generate external snapshot name " "for disk '%s' on a '%s' device"), - disk->name, virDomainDiskTypeToString(disk->type)); + disk->name, virStorageTypeToString(disk->type)); goto cleanup; } @@ -629,7 +629,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, return; } - virBufferAsprintf(buf, " type='%s'>\n", virDomainDiskTypeToString(type)); + virBufferAsprintf(buf, " type='%s'>\n", virStorageTypeToString(type)); virBufferAdjustIndent(buf, 2); if (disk->format > 0) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index fc73438..f6fec88 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -51,7 +51,7 @@ struct _virDomainSnapshotDiskDef { char *name; /* name matching the <target dev='...' of the domain */ int index; /* index within snapshot->dom->disks that matches name */ int snapshot; /* enum virDomainSnapshotLocation */ - int type; /* enum virDomainDiskType */ + int type; /* enum virStorageType */ char *file; /* new source file when snapshot is external */ int format; /* enum virStorageFileFormat */ int protocol; /* network source protocol */ diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ff44881..5b12bd4 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -389,7 +389,7 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model, if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK || def->bus != VIR_DOMAIN_DISK_BUS_SCSI || - virDomainDiskGetType(def) != VIR_DOMAIN_DISK_TYPE_FILE || + virDomainDiskGetType(def) != VIR_STORAGE_TYPE_FILE || !src || !STRPREFIX(src, "[")) { /* * This isn't a file-based SCSI disk device with a datastore related @@ -3122,7 +3122,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) for (i = 0; i < def->ndisks; ++i) { if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK && - virDomainDiskGetType(def->disks[i]) == VIR_DOMAIN_DISK_TYPE_FILE) { + virDomainDiskGetType(def->disks[i]) == VIR_STORAGE_TYPE_FILE) { disk = def->disks[i]; break; } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 96f637d..29b47b7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -217,8 +217,6 @@ virDomainDiskSetFormat; virDomainDiskSetSource; virDomainDiskSetType; virDomainDiskSourceIsBlockType; -virDomainDiskTypeFromString; -virDomainDiskTypeToString; virDomainEmulatorPinAdd; virDomainEmulatorPinDel; virDomainFeatureStateTypeFromString; @@ -1842,6 +1840,8 @@ virStorageNetHostDefCopy; virStorageNetHostDefFree; virStorageNetHostTransportTypeFromString; virStorageNetHostTransportTypeToString; +virStorageTypeFromString; +virStorageTypeToString; # util/virstring.h diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c index 01ea441..4b3f4d4 100644 --- a/src/locking/domain_lock.c +++ b/src/locking/domain_lock.c @@ -78,9 +78,9 @@ static int virDomainLockManagerAddDisk(virLockManagerPtr lock, if (!src) return 0; - if (!(type == VIR_DOMAIN_DISK_TYPE_BLOCK || - type == VIR_DOMAIN_DISK_TYPE_FILE || - type == VIR_DOMAIN_DISK_TYPE_DIR)) + if (!(type == VIR_STORAGE_TYPE_BLOCK || + type == VIR_STORAGE_TYPE_FILE || + type == VIR_STORAGE_TYPE_DIR)) return 0; if (disk->readonly) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 3bc15cc..1d3a74b 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -395,7 +395,7 @@ static int virLXCControllerSetupLoopDeviceDisk(virDomainDiskDefPtr disk) * We now change it into a block device type, so that * the rest of container setup 'just works' */ - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_BLOCK); if (virDomainDiskSetSource(disk, loname) < 0) goto cleanup; @@ -465,7 +465,7 @@ static int virLXCControllerSetupNBDDeviceDisk(virDomainDiskDefPtr disk) * We now change it into a block device type, so that * the rest of container setup 'just works' */ - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_BLOCK); if (virDomainDiskSetSource(disk, dev) < 0) { VIR_FREE(dev); return -1; @@ -536,7 +536,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl) const char *driver = virDomainDiskGetDriver(disk); int format = virDomainDiskGetFormat(disk); - if (virDomainDiskGetType(disk) != VIR_DOMAIN_DISK_TYPE_FILE) + if (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE) continue; /* If no driverName is set, we prefer 'loop' for @@ -1677,7 +1677,7 @@ static int virLXCControllerSetupDisk(virLXCControllerPtr ctrl, mode_t mode; char *tmpsrc = def->src.path; - if (virDomainDiskGetType(def) != VIR_DOMAIN_DISK_TYPE_BLOCK) { + if (virDomainDiskGetType(def) != VIR_STORAGE_TYPE_BLOCK) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Can't setup disk for non-block device")); goto cleanup; diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index c72da0f..a0d5f8c 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -302,7 +302,7 @@ parallelsGetHddInfo(virDomainDefPtr def, disk->device = VIR_DOMAIN_DISK_DEVICE_DISK; if (virJSONValueObjectHasKey(value, "real") == 1) { - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_BLOCK); if (!(tmp = virJSONValueObjectGetString(value, "real"))) { parallelsParseError(); @@ -312,7 +312,7 @@ parallelsGetHddInfo(virDomainDefPtr def, if (virDomainDiskSetSource(disk, tmp) < 0) return -1; } else { - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); if (!(tmp = virJSONValueObjectGetString(value, "image"))) { parallelsParseError(); diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index d0b0166..fc3e7db 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -3087,9 +3087,9 @@ phypDiskType(virConnectPtr conn, char *backing_device) goto cleanup; if (STREQ(ret, "LVPOOL")) - disk_type = VIR_DOMAIN_DISK_TYPE_BLOCK; + disk_type = VIR_STORAGE_TYPE_BLOCK; else if (STREQ(ret, "FBPOOL")) - disk_type = VIR_DOMAIN_DISK_TYPE_FILE; + disk_type = VIR_STORAGE_TYPE_FILE; cleanup: VIR_FREE(ret); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c43a0f7..b3ad7b1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3833,10 +3833,10 @@ qemuGetDriveSourceString(int type, { *path = NULL; - switch ((enum virDomainDiskType) type) { - case VIR_DOMAIN_DISK_TYPE_BLOCK: - case VIR_DOMAIN_DISK_TYPE_FILE: - case VIR_DOMAIN_DISK_TYPE_DIR: + switch ((enum virStorageType) type) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: + case VIR_STORAGE_TYPE_DIR: if (!src) return 1; @@ -3845,7 +3845,7 @@ qemuGetDriveSourceString(int type, break; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: if (!(*path = qemuBuildNetworkDriveURI(protocol, src, nhosts, @@ -3855,8 +3855,8 @@ qemuGetDriveSourceString(int type, return -1; break; - case VIR_DOMAIN_DISK_TYPE_VOLUME: - case VIR_DOMAIN_DISK_TYPE_LAST: + case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_LAST: break; } @@ -3874,7 +3874,7 @@ qemuDomainDiskGetSourceString(virConnectPtr conn, *source = NULL; - if (actualType == VIR_DOMAIN_DISK_TYPE_NETWORK && + if (actualType == VIR_STORAGE_TYPE_NETWORK && disk->src.auth.username && (disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI || disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) { @@ -4019,7 +4019,7 @@ qemuBuildDriveStr(virConnectPtr conn, virBufferAddLit(&opt, "file="); switch (actualType) { - case VIR_DOMAIN_DISK_TYPE_DIR: + case VIR_STORAGE_TYPE_DIR: /* QEMU only supports magic FAT format for now */ if (disk->src.format > 0 && disk->src.format != VIR_STORAGE_FILE_FAT) { @@ -4042,10 +4042,10 @@ qemuBuildDriveStr(virConnectPtr conn, break; - case VIR_DOMAIN_DISK_TYPE_BLOCK: + case VIR_STORAGE_TYPE_BLOCK: if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - disk->src.type == VIR_DOMAIN_DISK_TYPE_VOLUME ? + disk->src.type == VIR_STORAGE_TYPE_VOLUME ? _("tray status 'open' is invalid for block type volume") : _("tray status 'open' is invalid for block type disk")); goto error; @@ -4106,7 +4106,7 @@ qemuBuildDriveStr(virConnectPtr conn, goto error; } if (disk->src.format > 0 && - disk->src.type != VIR_DOMAIN_DISK_TYPE_DIR && + disk->src.type != VIR_STORAGE_TYPE_DIR && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT)) virBufferAsprintf(&opt, ",format=%s", virStorageFileFormatTypeToString(disk->src.format)); @@ -4320,7 +4320,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def, bus); goto error; } - if (disk->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) { + if (disk->src.type == VIR_STORAGE_TYPE_NETWORK) { if (disk->src.protocol != VIR_DOMAIN_DISK_PROTOCOL_ISCSI) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk device='lun' is not supported for protocol='%s'"), @@ -8633,7 +8633,7 @@ qemuBuildCommandLine(virConnectPtr conn, const char *fmt; virDomainDiskDefPtr disk = def->disks[i]; - if ((disk->src.type == VIR_DOMAIN_DISK_TYPE_BLOCK) && + if ((disk->src.type == VIR_STORAGE_TYPE_BLOCK) && (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("tray status 'open' is invalid for " @@ -8672,7 +8672,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (disk->src.type == VIR_DOMAIN_DISK_TYPE_DIR) { + if (disk->src.type == VIR_STORAGE_TYPE_DIR) { /* QEMU only supports magic FAT format for now */ if (disk->src.format > 0 && disk->src.format != VIR_STORAGE_FILE_FAT) { @@ -8693,7 +8693,7 @@ qemuBuildCommandLine(virConnectPtr conn, if (virAsprintf(&file, fmt, disk->src) < 0) goto error; - } else if (disk->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) { + } else if (disk->src.type == VIR_STORAGE_TYPE_NETWORK) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("network disks are only supported with -drive")); } else { @@ -10201,7 +10201,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, else def->bus = VIR_DOMAIN_DISK_BUS_IDE; def->device = VIR_DOMAIN_DISK_DEVICE_DISK; - def->src.type = VIR_DOMAIN_DISK_TYPE_FILE; + def->src.type = VIR_STORAGE_TYPE_FILE; for (i = 0; i < nkeywords; i++) { if (STREQ(keywords[i], "file")) { @@ -10209,10 +10209,10 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, def->src.path = values[i]; values[i] = NULL; if (STRPREFIX(def->src.path, "/dev/")) - def->src.type = VIR_DOMAIN_DISK_TYPE_BLOCK; + def->src.type = VIR_STORAGE_TYPE_BLOCK; else if (STRPREFIX(def->src.path, "nbd:") || STRPREFIX(def->src.path, "nbd+")) { - def->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + def->src.type = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_NBD; if (qemuParseNBDString(def) < 0) @@ -10220,7 +10220,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, } else if (STRPREFIX(def->src.path, "rbd:")) { char *p = def->src.path; - def->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + def->src.type = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD; if (VIR_STRDUP(def->src.path, p + strlen("rbd:")) < 0) goto error; @@ -10233,13 +10233,13 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, VIR_FREE(p); } else if (STRPREFIX(def->src.path, "gluster:") || STRPREFIX(def->src.path, "gluster+")) { - def->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + def->src.type = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER; if (qemuParseGlusterString(def) < 0) goto error; } else if (STRPREFIX(def->src.path, "iscsi:")) { - def->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + def->src.type = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI; if (qemuParseISCSIString(def) < 0) @@ -10248,7 +10248,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, char *p = def->src.path; char *port, *vdi; - def->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + def->src.type = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG; if (VIR_STRDUP(def->src.path, p + strlen("sheepdog:")) < 0) goto error; @@ -10280,9 +10280,9 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, goto error; } } else - def->src.type = VIR_DOMAIN_DISK_TYPE_FILE; + def->src.type = VIR_STORAGE_TYPE_FILE; } else { - def->src.type = VIR_DOMAIN_DISK_TYPE_FILE; + def->src.type = VIR_STORAGE_TYPE_FILE; } } else if (STREQ(keywords[i], "if")) { if (STREQ(values[i], "ide")) { @@ -10417,7 +10417,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, if (!def->src.path && def->device == VIR_DOMAIN_DISK_DEVICE_DISK && - def->src.type != VIR_DOMAIN_DISK_TYPE_NETWORK) { + def->src.type != VIR_STORAGE_TYPE_NETWORK) { virReportError(VIR_ERR_INTERNAL_ERROR, _("missing file parameter in drive '%s'"), val); goto error; @@ -11502,23 +11502,23 @@ qemuParseCommandLine(virCapsPtr qemuCaps, goto error; if (STRPREFIX(val, "/dev/")) - disk->src.type = VIR_DOMAIN_DISK_TYPE_BLOCK; + disk->src.type = VIR_STORAGE_TYPE_BLOCK; else if (STRPREFIX(val, "nbd:")) { - disk->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + disk->src.type = VIR_STORAGE_TYPE_NETWORK; disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_NBD; } else if (STRPREFIX(val, "rbd:")) { - disk->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + disk->src.type = VIR_STORAGE_TYPE_NETWORK; disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD; val += strlen("rbd:"); } else if (STRPREFIX(val, "gluster")) { - disk->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + disk->src.type = VIR_STORAGE_TYPE_NETWORK; disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER; } else if (STRPREFIX(val, "sheepdog:")) { - disk->src.type = VIR_DOMAIN_DISK_TYPE_NETWORK; + disk->src.type = VIR_STORAGE_TYPE_NETWORK; disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG; val += strlen("sheepdog:"); } else - disk->src.type = VIR_DOMAIN_DISK_TYPE_FILE; + disk->src.type = VIR_STORAGE_TYPE_FILE; if (STREQ(arg, "-cdrom")) { disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM; if (((def->os.arch == VIR_ARCH_PPC64) && @@ -11547,7 +11547,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, if (VIR_STRDUP(disk->src.path, val) < 0) goto error; - if (disk->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) { + if (disk->src.type == VIR_STORAGE_TYPE_NETWORK) { char *port; switch (disk->src.protocol) { @@ -11794,9 +11794,9 @@ qemuParseCommandLine(virCapsPtr qemuCaps, if (VIR_STRDUP(disk->src.path, val + strlen("disk:")) < 0) goto error; if (STRPREFIX(disk->src.path, "/dev/")) - disk->src.type = VIR_DOMAIN_DISK_TYPE_BLOCK; + disk->src.type = VIR_STORAGE_TYPE_BLOCK; else - disk->src.type = VIR_DOMAIN_DISK_TYPE_FILE; + disk->src.type = VIR_STORAGE_TYPE_FILE; disk->device = VIR_DOMAIN_DISK_DEVICE_DISK; disk->bus = VIR_DOMAIN_DISK_BUS_USB; disk->removable = VIR_DOMAIN_FEATURE_STATE_DEFAULT; @@ -12027,7 +12027,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, char *hosts, *port, *saveptr = NULL, *token; virDomainDiskDefPtr first_rbd_disk = NULL; for (i = 0; i < def->ndisks; i++) { - if (def->disks[i]->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK && + if (def->disks[i]->src.type == VIR_STORAGE_TYPE_NETWORK && def->disks[i]->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) { first_rbd_disk = def->disks[i]; break; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 78ab02a..dd851c6 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -793,7 +793,7 @@ qemuCheckSharedDevice(virHashTablePtr sharedDevices, disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)) goto cleanup; - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_VOLUME) { + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_VOLUME) { virReportError(VIR_ERR_OPERATION_INVALID, _("sgio of shared disk 'pool=%s' 'volume=%s' conflicts " "with other active domains"), @@ -1269,7 +1269,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn, int ret = -1; virErrorPtr savedError = NULL; - if (def->src.type != VIR_DOMAIN_DISK_TYPE_VOLUME) + if (def->src.type != VIR_STORAGE_TYPE_VOLUME) return 0; if (!def->src.srcpool) @@ -1332,15 +1332,15 @@ qemuTranslateDiskSourcePool(virConnectPtr conn, switch (info.type) { case VIR_STORAGE_VOL_FILE: - def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_FILE; + def->src.srcpool->actualtype = VIR_STORAGE_TYPE_FILE; break; case VIR_STORAGE_VOL_DIR: - def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_DIR; + def->src.srcpool->actualtype = VIR_STORAGE_TYPE_DIR; break; case VIR_STORAGE_VOL_BLOCK: - def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_BLOCK; + def->src.srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK; break; case VIR_STORAGE_VOL_NETWORK: @@ -1369,13 +1369,13 @@ qemuTranslateDiskSourcePool(virConnectPtr conn, def->src.srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST; /* fallthrough */ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST: - def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_BLOCK; + def->src.srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK; if (!(def->src.path = virStorageVolGetPath(vol))) goto cleanup; break; case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT: - def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_NETWORK; + def->src.srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK; def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI; if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0) @@ -1422,7 +1422,7 @@ int qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainSnapshotDiskDefPtr def) { - if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME) + if (def->type != VIR_STORAGE_TYPE_VOLUME) return 0; virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 36cb2c6..cdd4601 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -873,8 +873,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, if (cfg->allowDiskFormatProbing) { /* default disk format for drives */ if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE && - (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_FILE || - virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_BLOCK)) + (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE || + virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK)) virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_AUTO); /* default disk format for mirrored drive */ @@ -889,8 +889,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, /* default disk format for drives */ if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE && - (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_FILE || - virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_BLOCK)) + (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE || + virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK)) virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW); /* default disk format for mirrored drive */ @@ -2404,8 +2404,8 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, int type = virDomainDiskGetType(disk); if (!src || - type == VIR_DOMAIN_DISK_TYPE_NETWORK || - type == VIR_DOMAIN_DISK_TYPE_VOLUME) + type == VIR_STORAGE_TYPE_NETWORK || + type == VIR_STORAGE_TYPE_VOLUME) goto cleanup; if (disk->backingChain) { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 60dbb7f..b1c22c0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10433,7 +10433,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, /* ..but if guest is not using raw disk format and on a block device, * then query highest allocated extent from QEMU */ - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_BLOCK && + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK && format != VIR_STORAGE_FILE_RAW && S_ISBLK(sb.st_mode)) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -12350,12 +12350,12 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) { int actualType = virDomainDiskGetActualType(disk); - switch ((enum virDomainDiskType) actualType) { - case VIR_DOMAIN_DISK_TYPE_BLOCK: - case VIR_DOMAIN_DISK_TYPE_FILE: + switch ((enum virStorageType) actualType) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: return 0; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: switch ((enum virDomainDiskProtocol) disk->src.protocol) { case VIR_DOMAIN_DISK_PROTOCOL_NBD: case VIR_DOMAIN_DISK_PROTOCOL_RBD: @@ -12376,12 +12376,12 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk) } break; - case VIR_DOMAIN_DISK_TYPE_DIR: - case VIR_DOMAIN_DISK_TYPE_VOLUME: - case VIR_DOMAIN_DISK_TYPE_LAST: + case VIR_STORAGE_TYPE_DIR: + case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("external inactive snapshots are not supported on " - "'%s' disks"), virDomainDiskTypeToString(actualType)); + "'%s' disks"), virStorageTypeToString(actualType)); return -1; } @@ -12394,7 +12394,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk) { int actualType = virDomainDiskGetActualType(disk); - if (actualType == VIR_DOMAIN_DISK_TYPE_BLOCK && + if (actualType == VIR_STORAGE_TYPE_BLOCK && disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("external active snapshots are not supported on scsi " @@ -12411,12 +12411,12 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d { int actualType = virDomainSnapshotDiskGetActualType(disk); - switch ((enum virDomainDiskType) actualType) { - case VIR_DOMAIN_DISK_TYPE_BLOCK: - case VIR_DOMAIN_DISK_TYPE_FILE: + switch ((enum virStorageType) actualType) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: return 0; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: switch ((enum virDomainDiskProtocol) disk->protocol) { case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER: return 0; @@ -12440,12 +12440,12 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d } break; - case VIR_DOMAIN_DISK_TYPE_DIR: - case VIR_DOMAIN_DISK_TYPE_VOLUME: - case VIR_DOMAIN_DISK_TYPE_LAST: + case VIR_STORAGE_TYPE_DIR: + case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("external active snapshots are not supported on " - "'%s' disks"), virDomainDiskTypeToString(actualType)); + "'%s' disks"), virStorageTypeToString(actualType)); return -1; } @@ -12458,18 +12458,18 @@ qemuDomainSnapshotPrepareDiskExternalOverlayInactive(virDomainSnapshotDiskDefPtr { int actualType = virDomainSnapshotDiskGetActualType(disk); - switch ((enum virDomainDiskType) actualType) { - case VIR_DOMAIN_DISK_TYPE_BLOCK: - case VIR_DOMAIN_DISK_TYPE_FILE: + switch ((enum virStorageType) actualType) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: return 0; - case VIR_DOMAIN_DISK_TYPE_NETWORK: - case VIR_DOMAIN_DISK_TYPE_DIR: - case VIR_DOMAIN_DISK_TYPE_VOLUME: - case VIR_DOMAIN_DISK_TYPE_LAST: + case VIR_STORAGE_TYPE_NETWORK: + case VIR_STORAGE_TYPE_DIR: + case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("external inactive snapshots are not supported on " - "'%s' disks"), virDomainDiskTypeToString(actualType)); + "'%s' disks"), virStorageTypeToString(actualType)); return -1; } @@ -12555,12 +12555,12 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn, actualType = virDomainDiskGetActualType(disk); - switch ((enum virDomainDiskType) actualType) { - case VIR_DOMAIN_DISK_TYPE_BLOCK: - case VIR_DOMAIN_DISK_TYPE_FILE: + switch ((enum virStorageType) actualType) { + case VIR_STORAGE_TYPE_BLOCK: + case VIR_STORAGE_TYPE_FILE: return 0; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: switch ((enum virDomainDiskProtocol) disk->src.protocol) { case VIR_DOMAIN_DISK_PROTOCOL_NBD: case VIR_DOMAIN_DISK_PROTOCOL_RBD: @@ -12581,12 +12581,12 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn, } break; - case VIR_DOMAIN_DISK_TYPE_DIR: - case VIR_DOMAIN_DISK_TYPE_VOLUME: - case VIR_DOMAIN_DISK_TYPE_LAST: + case VIR_STORAGE_TYPE_DIR: + case VIR_STORAGE_TYPE_VOLUME: + case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, _("internal inactive snapshots are not supported on " - "'%s' disks"), virDomainDiskTypeToString(actualType)); + "'%s' disks"), virStorageTypeToString(actualType)); return -1; } @@ -12636,7 +12636,7 @@ qemuDomainSnapshotPrepare(virConnectPtr conn, active) < 0) goto cleanup; - if (dom_disk->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK && + if (dom_disk->src.type == VIR_STORAGE_TYPE_NETWORK && (dom_disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG || dom_disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) { break; @@ -12789,10 +12789,10 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, goto cleanup; switch (snap->type) { - case VIR_DOMAIN_DISK_TYPE_BLOCK: + case VIR_STORAGE_TYPE_BLOCK: reuse = true; /* fallthrough */ - case VIR_DOMAIN_DISK_TYPE_FILE: + case VIR_STORAGE_TYPE_FILE: /* create the stub file and set selinux labels; manipulate disk in * place, in a way that can be reverted on failure. */ @@ -12812,7 +12812,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, } break; - case VIR_DOMAIN_DISK_TYPE_NETWORK: + case VIR_STORAGE_TYPE_NETWORK: switch (snap->protocol) { case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER: if (!(newhosts = virStorageNetHostDefCopy(snap->nhosts, snap->hosts))) @@ -12836,7 +12836,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, default: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("snapshots are not supported on '%s' volumes"), - virDomainDiskTypeToString(snap->type)); + virStorageTypeToString(snap->type)); goto cleanup; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 19d96cb..e81bc7a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -138,7 +138,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, int type = virDomainDiskGetType(disk); int diskFormat = virDomainDiskGetFormat(disk); - if (type != VIR_DOMAIN_DISK_TYPE_DIR) { + if (type != VIR_STORAGE_TYPE_DIR) { if (diskFormat > 0) { format = virStorageFileFormatTypeToString(diskFormat); } else { diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4732b64..7fb455d 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1533,7 +1533,7 @@ qemuMigrationIsSafe(virDomainDefPtr def) disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE) { int rc; - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_FILE) { + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE) { if ((rc = virStorageFileIsSharedFS(src)) < 0) return false; else if (rc == 0) @@ -1542,7 +1542,7 @@ qemuMigrationIsSafe(virDomainDefPtr def) return false; else if (rc == 1) continue; - } else if (disk->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK && + } else if (disk->src.type == VIR_STORAGE_TYPE_NETWORK && disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) { continue; } diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index e969a69..ec8c101 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -1,7 +1,7 @@ /* * AppArmor security driver for libvirt * - * Copyright (C) 2011-2013 Red Hat, Inc. + * Copyright (C) 2011-2014 Red Hat, Inc. * Copyright (C) 2009-2010 Canonical Ltd. * * This library is free software; you can redistribute it and/or @@ -688,7 +688,7 @@ AppArmorRestoreSecurityImageLabel(virSecurityManagerPtr mgr, virDomainDefPtr def, virDomainDiskDefPtr disk) { - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK) + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK) return 0; return reload_profile(mgr, def, NULL, false); @@ -711,7 +711,7 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr, return 0; if (!virDomainDiskGetSource(disk) || - virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK) + virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK) return 0; if (secdef->imagelabel) { diff --git a/src/security/security_dac.c b/src/security/security_dac.c index b418ada..00c81d0 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -355,7 +355,7 @@ virSecurityDACSetSecurityImageLabel(virSecurityManagerPtr mgr, if (!priv->dynamicOwnership) return 0; - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK) + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK) return 0; params[0] = mgr; @@ -379,7 +379,7 @@ virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr, if (!priv->dynamicOwnership) return 0; - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK) + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK) return 0; /* Don't restore labels on readoly/shared disks, because @@ -905,7 +905,7 @@ virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr, for (i = 0; i < def->ndisks; i++) { /* XXX fixme - we need to recursively label the entire tree :-( */ - if (virDomainDiskGetType(def->disks[i]) == VIR_DOMAIN_DISK_TYPE_DIR) + if (virDomainDiskGetType(def->disks[i]) == VIR_STORAGE_TYPE_DIR) continue; if (virSecurityDACSetSecurityImageLabel(mgr, def, diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index b55ae38..aa21a22 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1163,7 +1163,7 @@ virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr, if (disk->readonly || disk->shared) return 0; - if (!src || virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK) + if (!src || virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK) return 0; /* If we have a shared FS & doing migrated, we must not @@ -1263,7 +1263,7 @@ virSecuritySELinuxSetSecurityImageLabel(virSecurityManagerPtr mgr, if (cbdata.secdef->norelabel) return 0; - if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK) + if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK) return 0; return virDomainDiskDefForeachPath(disk, @@ -2272,7 +2272,7 @@ virSecuritySELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr, for (i = 0; i < def->ndisks; i++) { /* XXX fixme - we need to recursively label the entire tree :-( */ - if (virDomainDiskGetType(def->disks[i]) == VIR_DOMAIN_DISK_TYPE_DIR) { + if (virDomainDiskGetType(def->disks[i]) == VIR_STORAGE_TYPE_DIR) { VIR_WARN("Unable to relabel directory tree %s for disk %s", virDomainDiskGetSource(def->disks[i]), def->disks[i]->dst); diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 5b3b536..e0fba3f 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1,7 +1,7 @@ /* * storage_backend.c: internal storage driver backend contract * - * Copyright (C) 2007-2013 Red Hat, Inc. + * Copyright (C) 2007-2014 Red Hat, Inc. * Copyright (C) 2007-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -1175,7 +1175,7 @@ virStorageFileBackendForType(int type, for (i = 0; fileBackends[i]; i++) { if (fileBackends[i]->type == type) { - if (type == VIR_DOMAIN_DISK_TYPE_NETWORK && + if (type == VIR_STORAGE_TYPE_NETWORK && fileBackends[i]->protocol != protocol) continue; @@ -1183,7 +1183,7 @@ virStorageFileBackendForType(int type, } } - if (type == VIR_DOMAIN_DISK_TYPE_NETWORK) { + if (type == VIR_STORAGE_TYPE_NETWORK) { virReportError(VIR_ERR_INTERNAL_ERROR, _("missing storage backend for network files " "using %s protocol"), @@ -1191,7 +1191,7 @@ virStorageFileBackendForType(int type, } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("missing storage backend for '%s' storage"), - virDomainDiskTypeToString(type)); + virStorageTypeToString(type)); } return NULL; diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 0f8da06..084ae56 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1363,7 +1363,7 @@ virStorageFileBackendFileStat(virStorageFilePtr file, virStorageFileBackend virStorageFileBackendFile = { - .type = VIR_DOMAIN_DISK_TYPE_FILE, + .type = VIR_STORAGE_TYPE_FILE, .storageFileUnlink = virStorageFileBackendFileUnlink, .storageFileStat = virStorageFileBackendFileStat, @@ -1371,7 +1371,7 @@ virStorageFileBackend virStorageFileBackendFile = { virStorageFileBackend virStorageFileBackendBlock = { - .type = VIR_DOMAIN_DISK_TYPE_BLOCK, + .type = VIR_STORAGE_TYPE_BLOCK, .storageFileStat = virStorageFileBackendFileStat, }; diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index 84c5fe2..7b38fcb 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -610,7 +610,7 @@ virStorageFileBackendGlusterStat(virStorageFilePtr file, virStorageFileBackend virStorageFileBackendGluster = { - .type = VIR_DOMAIN_DISK_TYPE_NETWORK, + .type = VIR_STORAGE_TYPE_NETWORK, .protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER, .backendInit = virStorageFileBackendGlusterInit, diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 320473d..2e78472 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -53,6 +53,13 @@ VIR_LOG_INIT("util.storagefile"); +VIR_ENUM_IMPL(virStorage, VIR_STORAGE_TYPE_LAST, + "block", + "file", + "dir", + "network", + "volume") + VIR_ENUM_IMPL(virStorageFileFormat, VIR_STORAGE_FILE_LAST, "none", diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 7b8a7f7..3de7f2a 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -35,6 +35,21 @@ * beyond this size, in practice that doesn't matter. */ # define VIR_STORAGE_MAX_HEADER 0x8200 + +/* Types of disk backends (host resource) */ +enum virStorageType { + VIR_STORAGE_TYPE_BLOCK, + VIR_STORAGE_TYPE_FILE, + VIR_STORAGE_TYPE_DIR, + VIR_STORAGE_TYPE_NETWORK, + VIR_STORAGE_TYPE_VOLUME, + + VIR_STORAGE_TYPE_LAST +}; + +VIR_ENUM_DECL(virStorage) + + enum virStorageFileFormat { VIR_STORAGE_FILE_AUTO_SAFE = -2, VIR_STORAGE_FILE_AUTO = -1, diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 5839184..4eed78e 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -2772,7 +2772,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { def->disks[i]->device = VIR_DOMAIN_DISK_DEVICE_DISK; def->disks[i]->bus = VIR_DOMAIN_DISK_BUS_IDE; virDomainDiskSetType(def->disks[i], - VIR_DOMAIN_DISK_TYPE_FILE); + VIR_STORAGE_TYPE_FILE); } } } @@ -2975,7 +2975,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { def->disks[diskCount]->readonly = true; virDomainDiskSetType(def->disks[diskCount], - VIR_DOMAIN_DISK_TYPE_FILE); + VIR_STORAGE_TYPE_FILE); VBOX_RELEASE(medium); VBOX_RELEASE(storageController); @@ -3251,7 +3251,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_CDROM; def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE; virDomainDiskSetType(def->disks[def->ndisks - 1], - VIR_DOMAIN_DISK_TYPE_FILE); + VIR_STORAGE_TYPE_FILE); def->disks[def->ndisks - 1]->readonly = true; ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location)); ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "hdc")); @@ -3298,7 +3298,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC; virDomainDiskSetType(def->disks[def->ndisks - 1], - VIR_DOMAIN_DISK_TYPE_FILE); + VIR_STORAGE_TYPE_FILE); def->disks[def->ndisks - 1]->readonly = false; ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location)); ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "fda")); @@ -3911,7 +3911,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) ? "True" : "False")); if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) { + if (type == VIR_STORAGE_TYPE_FILE && src) { IDVDDrive *dvdDrive = NULL; /* Currently CDROM/DVD Drive is always IDE * Secondary Master so neglecting the following @@ -3962,10 +3962,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) VBOX_UTF16_FREE(dvdfileUtf16); VBOX_RELEASE(dvdDrive); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) { + if (type == VIR_STORAGE_TYPE_FILE && src) { IHardDisk *hardDisk = NULL; PRUnichar *hddfileUtf16 = NULL; vboxIID hdduuid = VBOX_IID_INITIALIZER; @@ -4066,10 +4066,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) vboxIIDUnalloc(&hdduuid); VBOX_UTF16_FREE(hddEmpty); VBOX_UTF16_FREE(hddfileUtf16); - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } else if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) { + if (type == VIR_STORAGE_TYPE_FILE && src) { IFloppyDrive *floppyDrive; machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { @@ -4119,7 +4119,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) } VBOX_RELEASE(floppyDrive); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } } @@ -4193,7 +4193,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) VIR_DEBUG("disk(%zu) shared: %s", i, (def->disks[i]->shared ? "True" : "False")); - if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) { + if (type == VIR_STORAGE_TYPE_FILE && src) { IMedium *medium = NULL; PRUnichar *mediumUUID = NULL; PRUnichar *mediumFileUtf16 = NULL; @@ -5536,7 +5536,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, int type = virDomainDiskGetType(dev->data.disk); if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) { + if (type == VIR_STORAGE_TYPE_FILE && src) { IDVDDrive *dvdDrive = NULL; /* Currently CDROM/DVD Drive is always IDE * Secondary Master so neglecting the following @@ -5582,10 +5582,10 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, VBOX_UTF16_FREE(dvdfileUtf16); VBOX_RELEASE(dvdDrive); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } else if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) { + if (type == VIR_STORAGE_TYPE_FILE && src) { IFloppyDrive *floppyDrive; machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { @@ -5632,7 +5632,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, } VBOX_RELEASE(floppyDrive); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } #else /* VBOX_API_VERSION >= 3001000 */ @@ -5769,7 +5769,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) int type = virDomainDiskGetType(dev->data.disk); if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (type == VIR_STORAGE_TYPE_FILE) { IDVDDrive *dvdDrive = NULL; /* Currently CDROM/DVD Drive is always IDE * Secondary Master so neglecting the following @@ -5787,10 +5787,10 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) } VBOX_RELEASE(dvdDrive); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } else if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (type == VIR_STORAGE_TYPE_FILE) { IFloppyDrive *floppyDrive; machine->vtbl->GetFloppyDrive(machine, &floppyDrive); if (floppyDrive) { @@ -5815,7 +5815,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) } VBOX_RELEASE(floppyDrive); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { } } #else /* VBOX_API_VERSION >= 3001000 */ diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 118c7c3..6aba4f8 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -406,7 +406,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) for (i = 0; i < vmdef->ndisks; ++i) { if (vmdef->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK && - virDomainDiskGetType(vmdef->disks[i]) == VIR_DOMAIN_DISK_TYPE_FILE) { + virDomainDiskGetType(vmdef->disks[i]) == VIR_STORAGE_TYPE_FILE) { disk = vmdef->disks[i]; break; } diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 32ddd05..a7129e8 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2187,7 +2187,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con } } - virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(*def, VIR_STORAGE_TYPE_FILE); if (!(tmp = ctx->parseFileName(fileName, ctx->opaque))) goto cleanup; if (virDomainDiskSetSource(*def, tmp) < 0) { @@ -2231,7 +2231,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con } } - virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(*def, VIR_STORAGE_TYPE_FILE); if (!(tmp = ctx->parseFileName(fileName, ctx->opaque))) goto cleanup; if (virDomainDiskSetSource(*def, tmp) < 0) { @@ -2248,7 +2248,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con */ goto ignore; } else if (STRCASEEQ(deviceType, "atapi-cdrom")) { - virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK); if (STRCASEEQ(fileName, "auto detect")) { ignore_value(virDomainDiskSetSource(*def, NULL)); @@ -2259,7 +2259,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con } else if (STRCASEEQ(deviceType, "cdrom-raw")) { /* Raw access CD-ROMs actually are device='lun' */ (*def)->device = VIR_DOMAIN_DISK_DEVICE_LUN; - virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK); if (STRCASEEQ(fileName, "auto detect")) { ignore_value(virDomainDiskSetSource(*def, NULL)); @@ -2277,13 +2277,13 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con } } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (fileType != NULL && STRCASEEQ(fileType, "device")) { - virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK); if (virDomainDiskSetSource(*def, fileName) < 0) goto cleanup; } else if (fileType != NULL && STRCASEEQ(fileType, "file")) { char *tmp; - virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(*def, VIR_STORAGE_TYPE_FILE); if (!(tmp = ctx->parseFileName(fileName, ctx->opaque))) goto cleanup; if (virDomainDiskSetSource(*def, tmp) < 0) { @@ -3438,14 +3438,14 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, } /* We only support type='file' and type='block' */ - if (type != VIR_DOMAIN_DISK_TYPE_FILE && - type != VIR_DOMAIN_DISK_TYPE_BLOCK) { + if (type != VIR_STORAGE_TYPE_FILE && + type != VIR_STORAGE_TYPE_BLOCK) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("%s %s '%s' has unsupported type '%s', expecting " "'%s' or '%s'"), busType, deviceType, def->dst, diskType, - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + virStorageTypeToString(VIR_STORAGE_TYPE_FILE), + virStorageTypeToString(VIR_STORAGE_TYPE_BLOCK)); return -1; } @@ -3467,11 +3467,11 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, } if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK && - type == VIR_DOMAIN_DISK_TYPE_FILE) { + type == VIR_STORAGE_TYPE_FILE) { vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ? "scsi-hardDisk" : "ata-hardDisk"; } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { - if (type == VIR_DOMAIN_DISK_TYPE_FILE) + if (type == VIR_STORAGE_TYPE_FILE) vmxDeviceType = "cdrom-image"; else vmxDeviceType = "atapi-cdrom"; @@ -3489,7 +3489,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n", busType, controllerOrBus, unit, vmxDeviceType); - if (type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (type == VIR_STORAGE_TYPE_FILE) { const char *src = virDomainDiskGetSource(def); if (src && ! virFileHasSuffix(src, fileExt)) { @@ -3510,7 +3510,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, busType, controllerOrBus, unit, fileName); VIR_FREE(fileName); - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { const char *src = virDomainDiskGetSource(def); if (!src && @@ -3567,7 +3567,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferAsprintf(buffer, "floppy%d.present = \"true\"\n", unit); - if (type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (type == VIR_STORAGE_TYPE_FILE) { virBufferAsprintf(buffer, "floppy%d.fileType = \"file\"\n", unit); if (src) { @@ -3582,7 +3582,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, VIR_FREE(fileName); } - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { virBufferAsprintf(buffer, "floppy%d.fileType = \"device\"\n", unit); if (src) { @@ -3593,9 +3593,9 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Floppy '%s' has unsupported type '%s', expecting '%s' " "or '%s'"), def->dst, - virDomainDiskTypeToString(type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + virStorageTypeToString(type), + virStorageTypeToString(VIR_STORAGE_TYPE_FILE), + virStorageTypeToString(VIR_STORAGE_TYPE_BLOCK)); return -1; } diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 1165b98..29316a4 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -447,17 +447,17 @@ xenParseSxprDisks(virDomainDefPtr def, so we assume common case here. If blktap becomes omnipotent, we can revisit this, perhaps stat()'ing the src file in question */ - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); } else if (STREQ(virDomainDiskGetDriver(disk), "phy")) { - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_BLOCK); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_BLOCK); } else if (STREQ(virDomainDiskGetDriver(disk), "file")) { - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); } } else { /* No CDROM media so can't really tell. We'll just call if a FILE for now and update when media is inserted later */ - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); } if (STREQLEN(dst, "ioemu:", 6)) @@ -1310,7 +1310,7 @@ xenParseSxpr(const struct sexpr *root, virDomainDiskDefFree(disk); goto error; } - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM; if (VIR_STRDUP(disk->dst, "hdc") < 0) { virDomainDiskDefFree(disk); @@ -1345,7 +1345,7 @@ xenParseSxpr(const struct sexpr *root, VIR_FREE(disk); goto error; } - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY; if (VIR_STRDUP(disk->dst, fds[i]) < 0) { virDomainDiskDefFree(disk); @@ -1801,9 +1801,9 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, } else { int type = virDomainDiskGetType(def); - if (type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (type == VIR_STORAGE_TYPE_FILE) { virBufferEscapeSexpr(buf, "(uname 'file:%s')", src); - } else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + } else if (type == VIR_STORAGE_TYPE_BLOCK) { if (src[0] == '/') virBufferEscapeSexpr(buf, "(uname 'phy:%s')", src); else @@ -1812,7 +1812,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported disk type %s"), - virDomainDiskTypeToString(type)); + virStorageTypeToString(type)); return -1; } } diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 9e4050d..c0422cf 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -592,8 +592,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, /* phy: type indicates a block device */ virDomainDiskSetType(disk, STREQ(virDomainDiskGetDriver(disk), "phy") ? - VIR_DOMAIN_DISK_TYPE_BLOCK : - VIR_DOMAIN_DISK_TYPE_FILE); + VIR_STORAGE_TYPE_BLOCK : + VIR_STORAGE_TYPE_FILE); /* Check for a :cdrom/:disk postfix */ disk->device = VIR_DOMAIN_DISK_DEVICE_DISK; @@ -635,7 +635,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (VIR_ALLOC(disk) < 0) goto cleanup; - virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE); + virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE); disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM; if (virDomainDiskSetDriver(disk, "file") < 0) goto cleanup; @@ -1214,16 +1214,16 @@ xenFormatXMDisk(virConfValuePtr list, virBufferAsprintf(&buf, "%s:", type); } else { switch (virDomainDiskGetType(disk)) { - case VIR_DOMAIN_DISK_TYPE_FILE: + case VIR_STORAGE_TYPE_FILE: virBufferAddLit(&buf, "file:"); break; - case VIR_DOMAIN_DISK_TYPE_BLOCK: + case VIR_STORAGE_TYPE_BLOCK: virBufferAddLit(&buf, "phy:"); break; default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported disk type %s"), - virDomainDiskTypeToString(virDomainDiskGetType(disk))); + virStorageTypeToString(virDomainDiskGetType(disk))); goto cleanup; } } diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c index ce5e6a8..047356e 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -169,8 +169,8 @@ testSELinuxLoadDef(const char *testname) goto cleanup; for (i = 0; i < def->ndisks; i++) { - if (def->disks[i]->src.type != VIR_DOMAIN_DISK_TYPE_FILE && - def->disks[i]->src.type != VIR_DOMAIN_DISK_TYPE_BLOCK) + if (def->disks[i]->src.type != VIR_STORAGE_TYPE_FILE && + def->disks[i]->src.type != VIR_STORAGE_TYPE_BLOCK) continue; if (testSELinuxMungePath(&def->disks[i]->src.path) < 0) -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list