mirror of https://gitee.com/openkylin/libvirt.git
conf: move host disk type to util/
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@redhat.com>
This commit is contained in:
parent
52fb53119a
commit
16ac4c9d64
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1377,7 +1377,7 @@ virStorageFileBackendFileStat(virStorageFilePtr file,
|
|||
|
||||
|
||||
virStorageFileBackend virStorageFileBackendFile = {
|
||||
.type = VIR_DOMAIN_DISK_TYPE_FILE,
|
||||
.type = VIR_STORAGE_TYPE_FILE,
|
||||
|
||||
.storageFileUnlink = virStorageFileBackendFileUnlink,
|
||||
.storageFileStat = virStorageFileBackendFileStat,
|
||||
|
@ -1385,7 +1385,7 @@ virStorageFileBackend virStorageFileBackendFile = {
|
|||
|
||||
|
||||
virStorageFileBackend virStorageFileBackendBlock = {
|
||||
.type = VIR_DOMAIN_DISK_TYPE_BLOCK,
|
||||
.type = VIR_STORAGE_TYPE_BLOCK,
|
||||
|
||||
.storageFileStat = virStorageFileBackendFileStat,
|
||||
};
|
||||
|
|
|
@ -668,7 +668,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,
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -2189,7 +2189,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) {
|
||||
|
@ -2233,7 +2233,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) {
|
||||
|
@ -2250,7 +2250,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));
|
||||
|
@ -2261,7 +2261,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));
|
||||
|
@ -2279,13 +2279,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) {
|
||||
|
@ -3440,14 +3440,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;
|
||||
}
|
||||
|
||||
|
@ -3469,11 +3469,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";
|
||||
|
@ -3491,7 +3491,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)) {
|
||||
|
@ -3512,7 +3512,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 &&
|
||||
|
@ -3569,7 +3569,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) {
|
||||
|
@ -3584,7 +3584,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) {
|
||||
|
@ -3595,9 +3595,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue