mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) != VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("unsupported disk type"));
|
_("unsupported disk type"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -252,7 +252,7 @@ virBhyveProcessBuildLoadCmd(bhyveConnPtr driver ATTRIBUTE_UNUSED,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) != VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("unsupported disk type"));
|
_("unsupported disk type"));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -219,13 +219,6 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
|
|||||||
"virtio-mmio",
|
"virtio-mmio",
|
||||||
"isa")
|
"isa")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
|
||||||
"block",
|
|
||||||
"file",
|
|
||||||
"dir",
|
|
||||||
"network",
|
|
||||||
"volume")
|
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
|
VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
|
||||||
"disk",
|
"disk",
|
||||||
"cdrom",
|
"cdrom",
|
||||||
@ -1294,7 +1287,7 @@ virDomainDiskSetType(virDomainDiskDefPtr def, int type)
|
|||||||
int
|
int
|
||||||
virDomainDiskGetActualType(virDomainDiskDefPtr def)
|
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.srcpool->actualtype;
|
||||||
|
|
||||||
return def->src.type;
|
return def->src.type;
|
||||||
@ -5048,16 +5041,16 @@ virDomainDiskSourceDefParse(xmlNodePtr node,
|
|||||||
memset(&host, 0, sizeof(host));
|
memset(&host, 0, sizeof(host));
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
*source = virXMLPropString(node, "file");
|
*source = virXMLPropString(node, "file");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
*source = virXMLPropString(node, "dev");
|
*source = virXMLPropString(node, "dev");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
*source = virXMLPropString(node, "dir");
|
*source = virXMLPropString(node, "dir");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
if (!(protocol = virXMLPropString(node, "protocol"))) {
|
if (!(protocol = virXMLPropString(node, "protocol"))) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("missing network source protocol type"));
|
_("missing network source protocol type"));
|
||||||
@ -5131,14 +5124,14 @@ virDomainDiskSourceDefParse(xmlNodePtr node,
|
|||||||
child = child->next;
|
child = child->next;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
if (virDomainDiskSourcePoolDefParse(node, srcpool) < 0)
|
if (virDomainDiskSourcePoolDefParse(node, srcpool) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected disk type %s"),
|
_("unexpected disk type %s"),
|
||||||
virDomainDiskTypeToString(type));
|
virStorageTypeToString(type));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5232,13 +5225,13 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
|
|
||||||
type = virXMLPropString(node, "type");
|
type = virXMLPropString(node, "type");
|
||||||
if (type) {
|
if (type) {
|
||||||
if ((def->src.type = virDomainDiskTypeFromString(type)) < 0) {
|
if ((def->src.type = virStorageTypeFromString(type)) < 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("unknown disk type '%s'"), type);
|
_("unknown disk type '%s'"), type);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
def->src.type = VIR_DOMAIN_DISK_TYPE_FILE;
|
def->src.type = VIR_STORAGE_TYPE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot = virXMLPropString(node, "snapshot");
|
snapshot = virXMLPropString(node, "snapshot");
|
||||||
@ -5261,7 +5254,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
&def->src.srcpool) < 0)
|
&def->src.srcpool) < 0)
|
||||||
goto error;
|
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)
|
if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI)
|
||||||
expected_secret_usage = VIR_SECRET_USAGE_TYPE_ISCSI;
|
expected_secret_usage = VIR_SECRET_USAGE_TYPE_ISCSI;
|
||||||
else if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)
|
else if (def->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)
|
||||||
@ -5857,7 +5850,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) {
|
if (def->src.type == VIR_STORAGE_TYPE_NETWORK) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("Setting disk %s is not allowed for "
|
_("Setting disk %s is not allowed for "
|
||||||
"disk of network type"),
|
"disk of network type"),
|
||||||
@ -14791,7 +14784,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf,
|
|||||||
|
|
||||||
if (src || nhosts > 0 || srcpool || startupPolicy) {
|
if (src || nhosts > 0 || srcpool || startupPolicy) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
virBufferAddLit(buf, "<source");
|
virBufferAddLit(buf, "<source");
|
||||||
virBufferEscapeString(buf, " file='%s'", src);
|
virBufferEscapeString(buf, " file='%s'", src);
|
||||||
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
|
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
|
||||||
@ -14799,7 +14792,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf,
|
|||||||
virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
|
virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
virBufferAddLit(buf, "<source");
|
virBufferAddLit(buf, "<source");
|
||||||
virBufferEscapeString(buf, " dev='%s'", src);
|
virBufferEscapeString(buf, " dev='%s'", src);
|
||||||
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
|
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
|
||||||
@ -14807,14 +14800,14 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf,
|
|||||||
virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
|
virDomainDiskSourceDefFormatSeclabel(buf, nseclabels, seclabels, flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
virBufferAddLit(buf, "<source");
|
virBufferAddLit(buf, "<source");
|
||||||
virBufferEscapeString(buf, " dir='%s'", src);
|
virBufferEscapeString(buf, " dir='%s'", src);
|
||||||
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
|
virBufferEscapeString(buf, " startupPolicy='%s'", startupPolicy);
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
virBufferAsprintf(buf, "<source protocol='%s'",
|
virBufferAsprintf(buf, "<source protocol='%s'",
|
||||||
virDomainDiskProtocolTypeToString(protocol));
|
virDomainDiskProtocolTypeToString(protocol));
|
||||||
virBufferEscapeString(buf, " name='%s'", src);
|
virBufferEscapeString(buf, " name='%s'", src);
|
||||||
@ -14842,7 +14835,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
virBufferAddLit(buf, "<source");
|
virBufferAddLit(buf, "<source");
|
||||||
|
|
||||||
if (srcpool) {
|
if (srcpool) {
|
||||||
@ -14860,7 +14853,7 @@ virDomainDiskSourceDefFormatInternal(virBufferPtr buf,
|
|||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected disk type %s"),
|
_("unexpected disk type %s"),
|
||||||
virDomainDiskTypeToString(type));
|
virStorageTypeToString(type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14893,7 +14886,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
|
|||||||
virDomainDiskDefPtr def,
|
virDomainDiskDefPtr def,
|
||||||
unsigned int flags)
|
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 *device = virDomainDiskDeviceTypeToString(def->device);
|
||||||
const char *bus = virDomainDiskBusTypeToString(def->bus);
|
const char *bus = virDomainDiskBusTypeToString(def->bus);
|
||||||
const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
|
const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
|
||||||
@ -18546,8 +18539,8 @@ virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
|
|||||||
const char *path = virDomainDiskGetSource(disk);
|
const char *path = virDomainDiskGetSource(disk);
|
||||||
int type = virDomainDiskGetType(disk);
|
int type = virDomainDiskGetType(disk);
|
||||||
|
|
||||||
if (!path || type == VIR_DOMAIN_DISK_TYPE_NETWORK ||
|
if (!path || type == VIR_STORAGE_TYPE_NETWORK ||
|
||||||
(type == VIR_DOMAIN_DISK_TYPE_VOLUME &&
|
(type == VIR_STORAGE_TYPE_VOLUME &&
|
||||||
disk->src.srcpool &&
|
disk->src.srcpool &&
|
||||||
disk->src.srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT))
|
disk->src.srcpool->mode == VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT))
|
||||||
return 0;
|
return 0;
|
||||||
@ -19397,13 +19390,13 @@ virDomainDiskSourceIsBlockType(virDomainDiskDefPtr def)
|
|||||||
if (!virDomainDiskGetSource(def))
|
if (!virDomainDiskGetSource(def))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (virDomainDiskGetType(def) == VIR_DOMAIN_DISK_TYPE_BLOCK)
|
if (virDomainDiskGetType(def) == VIR_STORAGE_TYPE_BLOCK)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* For volume types, check the srcpool.
|
/* For volume types, check the srcpool.
|
||||||
* If it's a block type source pool, then it's possible
|
* 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 &&
|
||||||
def->src.srcpool->voltype == VIR_STORAGE_VOL_BLOCK) {
|
def->src.srcpool->voltype == VIR_STORAGE_VOL_BLOCK) {
|
||||||
/* We don't think the volume accessed by remote URI is
|
/* We don't think the volume accessed by remote URI is
|
||||||
|
@ -462,18 +462,9 @@ struct _virDomainHostdevDef {
|
|||||||
virDomainDeviceInfoPtr info; /* Guest address */
|
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). For backends (host view), see
|
||||||
};
|
* virStorageType in util/virstoragefile.h */
|
||||||
|
|
||||||
/* Types of disk frontend (guest view) */
|
|
||||||
enum virDomainDiskDevice {
|
enum virDomainDiskDevice {
|
||||||
VIR_DOMAIN_DISK_DEVICE_DISK,
|
VIR_DOMAIN_DISK_DEVICE_DISK,
|
||||||
VIR_DOMAIN_DISK_DEVICE_CDROM,
|
VIR_DOMAIN_DISK_DEVICE_CDROM,
|
||||||
@ -651,7 +642,7 @@ struct _virDomainDiskSourcePoolDef {
|
|||||||
char *volume; /* volume name */
|
char *volume; /* volume name */
|
||||||
int voltype; /* enum virStorageVolType, internal only */
|
int voltype; /* enum virStorageVolType, internal only */
|
||||||
int pooltype; /* enum virStoragePoolType, internal only */
|
int pooltype; /* enum virStoragePoolType, internal only */
|
||||||
int actualtype; /* enum virDomainDiskType, internal only */
|
int actualtype; /* enum virStorageType, internal only */
|
||||||
int mode; /* enum virDomainDiskSourcePoolMode */
|
int mode; /* enum virDomainDiskSourcePoolMode */
|
||||||
};
|
};
|
||||||
typedef virDomainDiskSourcePoolDef *virDomainDiskSourcePoolDefPtr;
|
typedef virDomainDiskSourcePoolDef *virDomainDiskSourcePoolDefPtr;
|
||||||
@ -663,7 +654,7 @@ typedef virDomainDiskSourceDef *virDomainDiskSourceDefPtr;
|
|||||||
* backing chains, multiple source disks join to form a single guest
|
* backing chains, multiple source disks join to form a single guest
|
||||||
* view. TODO Move this to util/ */
|
* view. TODO Move this to util/ */
|
||||||
struct _virDomainDiskSourceDef {
|
struct _virDomainDiskSourceDef {
|
||||||
int type; /* enum virDomainDiskType */
|
int type; /* enum virStorageType */
|
||||||
char *path;
|
char *path;
|
||||||
int protocol; /* enum virDomainDiskProtocol */
|
int protocol; /* enum virDomainDiskProtocol */
|
||||||
size_t nhosts;
|
size_t nhosts;
|
||||||
@ -2636,7 +2627,6 @@ VIR_ENUM_DECL(virDomainLifecycleCrash)
|
|||||||
VIR_ENUM_DECL(virDomainPMState)
|
VIR_ENUM_DECL(virDomainPMState)
|
||||||
VIR_ENUM_DECL(virDomainDevice)
|
VIR_ENUM_DECL(virDomainDevice)
|
||||||
VIR_ENUM_DECL(virDomainDeviceAddress)
|
VIR_ENUM_DECL(virDomainDeviceAddress)
|
||||||
VIR_ENUM_DECL(virDomainDisk)
|
|
||||||
VIR_ENUM_DECL(virDomainDiskDevice)
|
VIR_ENUM_DECL(virDomainDiskDevice)
|
||||||
VIR_ENUM_DECL(virDomainDiskGeometryTrans)
|
VIR_ENUM_DECL(virDomainDiskGeometryTrans)
|
||||||
VIR_ENUM_DECL(virDomainDiskBus)
|
VIR_ENUM_DECL(virDomainDiskBus)
|
||||||
|
@ -134,15 +134,15 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((type = virXMLPropString(node, "type"))) {
|
if ((type = virXMLPropString(node, "type"))) {
|
||||||
if ((def->type = virDomainDiskTypeFromString(type)) < 0 ||
|
if ((def->type = virStorageTypeFromString(type)) < 0 ||
|
||||||
def->type == VIR_DOMAIN_DISK_TYPE_VOLUME ||
|
def->type == VIR_STORAGE_TYPE_VOLUME ||
|
||||||
def->type == VIR_DOMAIN_DISK_TYPE_DIR) {
|
def->type == VIR_STORAGE_TYPE_DIR) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("unknown disk snapshot type '%s'"), type);
|
_("unknown disk snapshot type '%s'"), type);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
def->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
def->type = VIR_STORAGE_TYPE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cur = node->children; cur; cur = cur->next) {
|
for (cur = node->children; cur; cur = cur->next) {
|
||||||
@ -543,7 +543,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
disk->index = i;
|
disk->index = i;
|
||||||
disk->snapshot = def->dom->disks[i]->snapshot;
|
disk->snapshot = def->dom->disks[i]->snapshot;
|
||||||
disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
disk->type = VIR_STORAGE_TYPE_FILE;
|
||||||
if (!disk->snapshot)
|
if (!disk->snapshot)
|
||||||
disk->snapshot = default_snapshot;
|
disk->snapshot = default_snapshot;
|
||||||
}
|
}
|
||||||
@ -561,11 +561,11 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
|
|||||||
const char *tmp;
|
const char *tmp;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (disk->type != VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (disk->type != VIR_STORAGE_TYPE_FILE) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("cannot generate external snapshot name "
|
_("cannot generate external snapshot name "
|
||||||
"for disk '%s' on a '%s' device"),
|
"for disk '%s' on a '%s' device"),
|
||||||
disk->name, virDomainDiskTypeToString(disk->type));
|
disk->name, virStorageTypeToString(disk->type));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(buf, " type='%s'>\n", virDomainDiskTypeToString(type));
|
virBufferAsprintf(buf, " type='%s'>\n", virStorageTypeToString(type));
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
|
||||||
if (disk->format > 0)
|
if (disk->format > 0)
|
||||||
|
@ -51,7 +51,7 @@ struct _virDomainSnapshotDiskDef {
|
|||||||
char *name; /* name matching the <target dev='...' of the domain */
|
char *name; /* name matching the <target dev='...' of the domain */
|
||||||
int index; /* index within snapshot->dom->disks that matches name */
|
int index; /* index within snapshot->dom->disks that matches name */
|
||||||
int snapshot; /* enum virDomainSnapshotLocation */
|
int snapshot; /* enum virDomainSnapshotLocation */
|
||||||
int type; /* enum virDomainDiskType */
|
int type; /* enum virStorageType */
|
||||||
char *file; /* new source file when snapshot is external */
|
char *file; /* new source file when snapshot is external */
|
||||||
int format; /* enum virStorageFileFormat */
|
int format; /* enum virStorageFileFormat */
|
||||||
int protocol; /* network source protocol */
|
int protocol; /* network source protocol */
|
||||||
|
@ -389,7 +389,7 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model,
|
|||||||
|
|
||||||
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK ||
|
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK ||
|
||||||
def->bus != VIR_DOMAIN_DISK_BUS_SCSI ||
|
def->bus != VIR_DOMAIN_DISK_BUS_SCSI ||
|
||||||
virDomainDiskGetType(def) != VIR_DOMAIN_DISK_TYPE_FILE ||
|
virDomainDiskGetType(def) != VIR_STORAGE_TYPE_FILE ||
|
||||||
!src || !STRPREFIX(src, "[")) {
|
!src || !STRPREFIX(src, "[")) {
|
||||||
/*
|
/*
|
||||||
* This isn't a file-based SCSI disk device with a datastore related
|
* 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) {
|
for (i = 0; i < def->ndisks; ++i) {
|
||||||
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
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];
|
disk = def->disks[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -217,8 +217,6 @@ virDomainDiskSetFormat;
|
|||||||
virDomainDiskSetSource;
|
virDomainDiskSetSource;
|
||||||
virDomainDiskSetType;
|
virDomainDiskSetType;
|
||||||
virDomainDiskSourceIsBlockType;
|
virDomainDiskSourceIsBlockType;
|
||||||
virDomainDiskTypeFromString;
|
|
||||||
virDomainDiskTypeToString;
|
|
||||||
virDomainEmulatorPinAdd;
|
virDomainEmulatorPinAdd;
|
||||||
virDomainEmulatorPinDel;
|
virDomainEmulatorPinDel;
|
||||||
virDomainFeatureStateTypeFromString;
|
virDomainFeatureStateTypeFromString;
|
||||||
@ -1842,6 +1840,8 @@ virStorageNetHostDefCopy;
|
|||||||
virStorageNetHostDefFree;
|
virStorageNetHostDefFree;
|
||||||
virStorageNetHostTransportTypeFromString;
|
virStorageNetHostTransportTypeFromString;
|
||||||
virStorageNetHostTransportTypeToString;
|
virStorageNetHostTransportTypeToString;
|
||||||
|
virStorageTypeFromString;
|
||||||
|
virStorageTypeToString;
|
||||||
|
|
||||||
|
|
||||||
# util/virstring.h
|
# util/virstring.h
|
||||||
|
@ -78,9 +78,9 @@ static int virDomainLockManagerAddDisk(virLockManagerPtr lock,
|
|||||||
if (!src)
|
if (!src)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(type == VIR_DOMAIN_DISK_TYPE_BLOCK ||
|
if (!(type == VIR_STORAGE_TYPE_BLOCK ||
|
||||||
type == VIR_DOMAIN_DISK_TYPE_FILE ||
|
type == VIR_STORAGE_TYPE_FILE ||
|
||||||
type == VIR_DOMAIN_DISK_TYPE_DIR))
|
type == VIR_STORAGE_TYPE_DIR))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (disk->readonly)
|
if (disk->readonly)
|
||||||
|
@ -395,7 +395,7 @@ static int virLXCControllerSetupLoopDeviceDisk(virDomainDiskDefPtr disk)
|
|||||||
* We now change it into a block device type, so that
|
* We now change it into a block device type, so that
|
||||||
* the rest of container setup 'just works'
|
* 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)
|
if (virDomainDiskSetSource(disk, loname) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ static int virLXCControllerSetupNBDDeviceDisk(virDomainDiskDefPtr disk)
|
|||||||
* We now change it into a block device type, so that
|
* We now change it into a block device type, so that
|
||||||
* the rest of container setup 'just works'
|
* 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) {
|
if (virDomainDiskSetSource(disk, dev) < 0) {
|
||||||
VIR_FREE(dev);
|
VIR_FREE(dev);
|
||||||
return -1;
|
return -1;
|
||||||
@ -536,7 +536,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl)
|
|||||||
const char *driver = virDomainDiskGetDriver(disk);
|
const char *driver = virDomainDiskGetDriver(disk);
|
||||||
int format = virDomainDiskGetFormat(disk);
|
int format = virDomainDiskGetFormat(disk);
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) != VIR_DOMAIN_DISK_TYPE_FILE)
|
if (virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_FILE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If no driverName is set, we prefer 'loop' for
|
/* If no driverName is set, we prefer 'loop' for
|
||||||
@ -1677,7 +1677,7 @@ static int virLXCControllerSetupDisk(virLXCControllerPtr ctrl,
|
|||||||
mode_t mode;
|
mode_t mode;
|
||||||
char *tmpsrc = def->src.path;
|
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",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Can't setup disk for non-block device"));
|
_("Can't setup disk for non-block device"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -302,7 +302,7 @@ parallelsGetHddInfo(virDomainDefPtr def,
|
|||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
||||||
|
|
||||||
if (virJSONValueObjectHasKey(value, "real") == 1) {
|
if (virJSONValueObjectHasKey(value, "real") == 1) {
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_BLOCK);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_BLOCK);
|
||||||
|
|
||||||
if (!(tmp = virJSONValueObjectGetString(value, "real"))) {
|
if (!(tmp = virJSONValueObjectGetString(value, "real"))) {
|
||||||
parallelsParseError();
|
parallelsParseError();
|
||||||
@ -312,7 +312,7 @@ parallelsGetHddInfo(virDomainDefPtr def,
|
|||||||
if (virDomainDiskSetSource(disk, tmp) < 0)
|
if (virDomainDiskSetSource(disk, tmp) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
|
|
||||||
if (!(tmp = virJSONValueObjectGetString(value, "image"))) {
|
if (!(tmp = virJSONValueObjectGetString(value, "image"))) {
|
||||||
parallelsParseError();
|
parallelsParseError();
|
||||||
|
@ -3087,9 +3087,9 @@ phypDiskType(virConnectPtr conn, char *backing_device)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (STREQ(ret, "LVPOOL"))
|
if (STREQ(ret, "LVPOOL"))
|
||||||
disk_type = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
disk_type = VIR_STORAGE_TYPE_BLOCK;
|
||||||
else if (STREQ(ret, "FBPOOL"))
|
else if (STREQ(ret, "FBPOOL"))
|
||||||
disk_type = VIR_DOMAIN_DISK_TYPE_FILE;
|
disk_type = VIR_STORAGE_TYPE_FILE;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(ret);
|
VIR_FREE(ret);
|
||||||
|
@ -3833,10 +3833,10 @@ qemuGetDriveSourceString(int type,
|
|||||||
{
|
{
|
||||||
*path = NULL;
|
*path = NULL;
|
||||||
|
|
||||||
switch ((enum virDomainDiskType) type) {
|
switch ((enum virStorageType) type) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
if (!src)
|
if (!src)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -3845,7 +3845,7 @@ qemuGetDriveSourceString(int type,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
if (!(*path = qemuBuildNetworkDriveURI(protocol,
|
if (!(*path = qemuBuildNetworkDriveURI(protocol,
|
||||||
src,
|
src,
|
||||||
nhosts,
|
nhosts,
|
||||||
@ -3855,8 +3855,8 @@ qemuGetDriveSourceString(int type,
|
|||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
case VIR_DOMAIN_DISK_TYPE_LAST:
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3874,7 +3874,7 @@ qemuDomainDiskGetSourceString(virConnectPtr conn,
|
|||||||
|
|
||||||
*source = NULL;
|
*source = NULL;
|
||||||
|
|
||||||
if (actualType == VIR_DOMAIN_DISK_TYPE_NETWORK &&
|
if (actualType == VIR_STORAGE_TYPE_NETWORK &&
|
||||||
disk->src.auth.username &&
|
disk->src.auth.username &&
|
||||||
(disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI ||
|
(disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_ISCSI ||
|
||||||
disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) {
|
disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) {
|
||||||
@ -4019,7 +4019,7 @@ qemuBuildDriveStr(virConnectPtr conn,
|
|||||||
virBufferAddLit(&opt, "file=");
|
virBufferAddLit(&opt, "file=");
|
||||||
|
|
||||||
switch (actualType) {
|
switch (actualType) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
/* QEMU only supports magic FAT format for now */
|
/* QEMU only supports magic FAT format for now */
|
||||||
if (disk->src.format > 0 &&
|
if (disk->src.format > 0 &&
|
||||||
disk->src.format != VIR_STORAGE_FILE_FAT) {
|
disk->src.format != VIR_STORAGE_FILE_FAT) {
|
||||||
@ -4042,10 +4042,10 @@ qemuBuildDriveStr(virConnectPtr conn,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) {
|
if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
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 volume") :
|
||||||
_("tray status 'open' is invalid for block type disk"));
|
_("tray status 'open' is invalid for block type disk"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -4106,7 +4106,7 @@ qemuBuildDriveStr(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (disk->src.format > 0 &&
|
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))
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT))
|
||||||
virBufferAsprintf(&opt, ",format=%s",
|
virBufferAsprintf(&opt, ",format=%s",
|
||||||
virStorageFileFormatTypeToString(disk->src.format));
|
virStorageFileFormatTypeToString(disk->src.format));
|
||||||
@ -4320,7 +4320,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
|
|||||||
bus);
|
bus);
|
||||||
goto error;
|
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) {
|
if (disk->src.protocol != VIR_DOMAIN_DISK_PROTOCOL_ISCSI) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("disk device='lun' is not supported for protocol='%s'"),
|
_("disk device='lun' is not supported for protocol='%s'"),
|
||||||
@ -8633,7 +8633,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
const char *fmt;
|
const char *fmt;
|
||||||
virDomainDiskDefPtr disk = def->disks[i];
|
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)) {
|
(disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("tray status 'open' is invalid for "
|
_("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 */
|
/* QEMU only supports magic FAT format for now */
|
||||||
if (disk->src.format > 0 &&
|
if (disk->src.format > 0 &&
|
||||||
disk->src.format != VIR_STORAGE_FILE_FAT) {
|
disk->src.format != VIR_STORAGE_FILE_FAT) {
|
||||||
@ -8693,7 +8693,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
|
|
||||||
if (virAsprintf(&file, fmt, disk->src) < 0)
|
if (virAsprintf(&file, fmt, disk->src) < 0)
|
||||||
goto error;
|
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",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("network disks are only supported with -drive"));
|
_("network disks are only supported with -drive"));
|
||||||
} else {
|
} else {
|
||||||
@ -10201,7 +10201,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
else
|
else
|
||||||
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
||||||
def->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
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++) {
|
for (i = 0; i < nkeywords; i++) {
|
||||||
if (STREQ(keywords[i], "file")) {
|
if (STREQ(keywords[i], "file")) {
|
||||||
@ -10209,10 +10209,10 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
def->src.path = values[i];
|
def->src.path = values[i];
|
||||||
values[i] = NULL;
|
values[i] = NULL;
|
||||||
if (STRPREFIX(def->src.path, "/dev/"))
|
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:") ||
|
else if (STRPREFIX(def->src.path, "nbd:") ||
|
||||||
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;
|
def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_NBD;
|
||||||
|
|
||||||
if (qemuParseNBDString(def) < 0)
|
if (qemuParseNBDString(def) < 0)
|
||||||
@ -10220,7 +10220,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
} else if (STRPREFIX(def->src.path, "rbd:")) {
|
} else if (STRPREFIX(def->src.path, "rbd:")) {
|
||||||
char *p = def->src.path;
|
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;
|
def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD;
|
||||||
if (VIR_STRDUP(def->src.path, p + strlen("rbd:")) < 0)
|
if (VIR_STRDUP(def->src.path, p + strlen("rbd:")) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -10233,13 +10233,13 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
VIR_FREE(p);
|
VIR_FREE(p);
|
||||||
} else if (STRPREFIX(def->src.path, "gluster:") ||
|
} else if (STRPREFIX(def->src.path, "gluster:") ||
|
||||||
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;
|
def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER;
|
||||||
|
|
||||||
if (qemuParseGlusterString(def) < 0)
|
if (qemuParseGlusterString(def) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else if (STRPREFIX(def->src.path, "iscsi:")) {
|
} 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;
|
def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
|
||||||
|
|
||||||
if (qemuParseISCSIString(def) < 0)
|
if (qemuParseISCSIString(def) < 0)
|
||||||
@ -10248,7 +10248,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
char *p = def->src.path;
|
char *p = def->src.path;
|
||||||
char *port, *vdi;
|
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;
|
def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG;
|
||||||
if (VIR_STRDUP(def->src.path, p + strlen("sheepdog:")) < 0)
|
if (VIR_STRDUP(def->src.path, p + strlen("sheepdog:")) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -10280,9 +10280,9 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
def->src.type = VIR_DOMAIN_DISK_TYPE_FILE;
|
def->src.type = VIR_STORAGE_TYPE_FILE;
|
||||||
} else {
|
} else {
|
||||||
def->src.type = VIR_DOMAIN_DISK_TYPE_FILE;
|
def->src.type = VIR_STORAGE_TYPE_FILE;
|
||||||
}
|
}
|
||||||
} else if (STREQ(keywords[i], "if")) {
|
} else if (STREQ(keywords[i], "if")) {
|
||||||
if (STREQ(values[i], "ide")) {
|
if (STREQ(values[i], "ide")) {
|
||||||
@ -10417,7 +10417,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
|||||||
|
|
||||||
if (!def->src.path &&
|
if (!def->src.path &&
|
||||||
def->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
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,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing file parameter in drive '%s'"), val);
|
_("missing file parameter in drive '%s'"), val);
|
||||||
goto error;
|
goto error;
|
||||||
@ -11502,23 +11502,23 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (STRPREFIX(val, "/dev/"))
|
if (STRPREFIX(val, "/dev/"))
|
||||||
disk->src.type = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
disk->src.type = VIR_STORAGE_TYPE_BLOCK;
|
||||||
else if (STRPREFIX(val, "nbd:")) {
|
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;
|
disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_NBD;
|
||||||
} else if (STRPREFIX(val, "rbd:")) {
|
} 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;
|
disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD;
|
||||||
val += strlen("rbd:");
|
val += strlen("rbd:");
|
||||||
} else if (STRPREFIX(val, "gluster")) {
|
} 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;
|
disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER;
|
||||||
} else if (STRPREFIX(val, "sheepdog:")) {
|
} 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;
|
disk->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG;
|
||||||
val += strlen("sheepdog:");
|
val += strlen("sheepdog:");
|
||||||
} else
|
} else
|
||||||
disk->src.type = VIR_DOMAIN_DISK_TYPE_FILE;
|
disk->src.type = VIR_STORAGE_TYPE_FILE;
|
||||||
if (STREQ(arg, "-cdrom")) {
|
if (STREQ(arg, "-cdrom")) {
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||||
if (((def->os.arch == VIR_ARCH_PPC64) &&
|
if (((def->os.arch == VIR_ARCH_PPC64) &&
|
||||||
@ -11547,7 +11547,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
if (VIR_STRDUP(disk->src.path, val) < 0)
|
if (VIR_STRDUP(disk->src.path, val) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (disk->src.type == VIR_DOMAIN_DISK_TYPE_NETWORK) {
|
if (disk->src.type == VIR_STORAGE_TYPE_NETWORK) {
|
||||||
char *port;
|
char *port;
|
||||||
|
|
||||||
switch (disk->src.protocol) {
|
switch (disk->src.protocol) {
|
||||||
@ -11794,9 +11794,9 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
if (VIR_STRDUP(disk->src.path, val + strlen("disk:")) < 0)
|
if (VIR_STRDUP(disk->src.path, val + strlen("disk:")) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
if (STRPREFIX(disk->src.path, "/dev/"))
|
if (STRPREFIX(disk->src.path, "/dev/"))
|
||||||
disk->src.type = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
disk->src.type = VIR_STORAGE_TYPE_BLOCK;
|
||||||
else
|
else
|
||||||
disk->src.type = VIR_DOMAIN_DISK_TYPE_FILE;
|
disk->src.type = VIR_STORAGE_TYPE_FILE;
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
||||||
disk->bus = VIR_DOMAIN_DISK_BUS_USB;
|
disk->bus = VIR_DOMAIN_DISK_BUS_USB;
|
||||||
disk->removable = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
|
disk->removable = VIR_DOMAIN_FEATURE_STATE_DEFAULT;
|
||||||
@ -12027,7 +12027,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
|||||||
char *hosts, *port, *saveptr = NULL, *token;
|
char *hosts, *port, *saveptr = NULL, *token;
|
||||||
virDomainDiskDefPtr first_rbd_disk = NULL;
|
virDomainDiskDefPtr first_rbd_disk = NULL;
|
||||||
for (i = 0; i < def->ndisks; i++) {
|
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) {
|
def->disks[i]->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
|
||||||
first_rbd_disk = def->disks[i];
|
first_rbd_disk = def->disks[i];
|
||||||
break;
|
break;
|
||||||
|
@ -793,7 +793,7 @@ qemuCheckSharedDevice(virHashTablePtr sharedDevices,
|
|||||||
disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED))
|
disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_VOLUME) {
|
if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_VOLUME) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
_("sgio of shared disk 'pool=%s' 'volume=%s' conflicts "
|
_("sgio of shared disk 'pool=%s' 'volume=%s' conflicts "
|
||||||
"with other active domains"),
|
"with other active domains"),
|
||||||
@ -1269,7 +1269,7 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
virErrorPtr savedError = NULL;
|
virErrorPtr savedError = NULL;
|
||||||
|
|
||||||
if (def->src.type != VIR_DOMAIN_DISK_TYPE_VOLUME)
|
if (def->src.type != VIR_STORAGE_TYPE_VOLUME)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!def->src.srcpool)
|
if (!def->src.srcpool)
|
||||||
@ -1332,15 +1332,15 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
|
|||||||
|
|
||||||
switch (info.type) {
|
switch (info.type) {
|
||||||
case VIR_STORAGE_VOL_FILE:
|
case VIR_STORAGE_VOL_FILE:
|
||||||
def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_FILE;
|
def->src.srcpool->actualtype = VIR_STORAGE_TYPE_FILE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_STORAGE_VOL_DIR:
|
case VIR_STORAGE_VOL_DIR:
|
||||||
def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_DIR;
|
def->src.srcpool->actualtype = VIR_STORAGE_TYPE_DIR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_STORAGE_VOL_BLOCK:
|
case VIR_STORAGE_VOL_BLOCK:
|
||||||
def->src.srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_BLOCK;
|
def->src.srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_STORAGE_VOL_NETWORK:
|
case VIR_STORAGE_VOL_NETWORK:
|
||||||
@ -1369,13 +1369,13 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
|
|||||||
def->src.srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST;
|
def->src.srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST:
|
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)))
|
if (!(def->src.path = virStorageVolGetPath(vol)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT:
|
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;
|
def->src.protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
|
||||||
|
|
||||||
if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
|
if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
|
||||||
@ -1422,7 +1422,7 @@ int
|
|||||||
qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
qemuTranslateSnapshotDiskSourcePool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
virDomainSnapshotDiskDefPtr def)
|
virDomainSnapshotDiskDefPtr def)
|
||||||
{
|
{
|
||||||
if (def->type != VIR_DOMAIN_DISK_TYPE_VOLUME)
|
if (def->type != VIR_STORAGE_TYPE_VOLUME)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
@ -873,8 +873,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|||||||
if (cfg->allowDiskFormatProbing) {
|
if (cfg->allowDiskFormatProbing) {
|
||||||
/* default disk format for drives */
|
/* default disk format for drives */
|
||||||
if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
|
if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
|
||||||
(virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_FILE ||
|
(virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
|
||||||
virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_BLOCK))
|
virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
|
||||||
virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_AUTO);
|
virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_AUTO);
|
||||||
|
|
||||||
/* default disk format for mirrored drive */
|
/* default disk format for mirrored drive */
|
||||||
@ -889,8 +889,8 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|||||||
|
|
||||||
/* default disk format for drives */
|
/* default disk format for drives */
|
||||||
if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
|
if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
|
||||||
(virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_FILE ||
|
(virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
|
||||||
virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_BLOCK))
|
virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
|
||||||
virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);
|
virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);
|
||||||
|
|
||||||
/* default disk format for mirrored drive */
|
/* default disk format for mirrored drive */
|
||||||
@ -2404,8 +2404,8 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
|||||||
int type = virDomainDiskGetType(disk);
|
int type = virDomainDiskGetType(disk);
|
||||||
|
|
||||||
if (!src ||
|
if (!src ||
|
||||||
type == VIR_DOMAIN_DISK_TYPE_NETWORK ||
|
type == VIR_STORAGE_TYPE_NETWORK ||
|
||||||
type == VIR_DOMAIN_DISK_TYPE_VOLUME)
|
type == VIR_STORAGE_TYPE_VOLUME)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (disk->backingChain) {
|
if (disk->backingChain) {
|
||||||
|
@ -10433,7 +10433,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
|
|||||||
/* ..but if guest is not using raw disk format and on a block device,
|
/* ..but if guest is not using raw disk format and on a block device,
|
||||||
* then query highest allocated extent from QEMU
|
* 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 &&
|
format != VIR_STORAGE_FILE_RAW &&
|
||||||
S_ISBLK(sb.st_mode)) {
|
S_ISBLK(sb.st_mode)) {
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
@ -12350,12 +12350,12 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
|
|||||||
{
|
{
|
||||||
int actualType = virDomainDiskGetActualType(disk);
|
int actualType = virDomainDiskGetActualType(disk);
|
||||||
|
|
||||||
switch ((enum virDomainDiskType) actualType) {
|
switch ((enum virStorageType) actualType) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
switch ((enum virDomainDiskProtocol) disk->src.protocol) {
|
switch ((enum virDomainDiskProtocol) disk->src.protocol) {
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_NBD:
|
case VIR_DOMAIN_DISK_PROTOCOL_NBD:
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
|
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
|
||||||
@ -12376,12 +12376,12 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
case VIR_DOMAIN_DISK_TYPE_LAST:
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("external inactive snapshots are not supported on "
|
_("external inactive snapshots are not supported on "
|
||||||
"'%s' disks"), virDomainDiskTypeToString(actualType));
|
"'%s' disks"), virStorageTypeToString(actualType));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12394,7 +12394,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk)
|
|||||||
{
|
{
|
||||||
int actualType = virDomainDiskGetActualType(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) {
|
disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("external active snapshots are not supported on scsi "
|
_("external active snapshots are not supported on scsi "
|
||||||
@ -12411,12 +12411,12 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
|
|||||||
{
|
{
|
||||||
int actualType = virDomainSnapshotDiskGetActualType(disk);
|
int actualType = virDomainSnapshotDiskGetActualType(disk);
|
||||||
|
|
||||||
switch ((enum virDomainDiskType) actualType) {
|
switch ((enum virStorageType) actualType) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
switch ((enum virDomainDiskProtocol) disk->protocol) {
|
switch ((enum virDomainDiskProtocol) disk->protocol) {
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
|
case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
|
||||||
return 0;
|
return 0;
|
||||||
@ -12440,12 +12440,12 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
case VIR_DOMAIN_DISK_TYPE_LAST:
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("external active snapshots are not supported on "
|
_("external active snapshots are not supported on "
|
||||||
"'%s' disks"), virDomainDiskTypeToString(actualType));
|
"'%s' disks"), virStorageTypeToString(actualType));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12458,18 +12458,18 @@ qemuDomainSnapshotPrepareDiskExternalOverlayInactive(virDomainSnapshotDiskDefPtr
|
|||||||
{
|
{
|
||||||
int actualType = virDomainSnapshotDiskGetActualType(disk);
|
int actualType = virDomainSnapshotDiskGetActualType(disk);
|
||||||
|
|
||||||
switch ((enum virDomainDiskType) actualType) {
|
switch ((enum virStorageType) actualType) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
case VIR_DOMAIN_DISK_TYPE_LAST:
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("external inactive snapshots are not supported on "
|
_("external inactive snapshots are not supported on "
|
||||||
"'%s' disks"), virDomainDiskTypeToString(actualType));
|
"'%s' disks"), virStorageTypeToString(actualType));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12555,12 +12555,12 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
|
|||||||
|
|
||||||
actualType = virDomainDiskGetActualType(disk);
|
actualType = virDomainDiskGetActualType(disk);
|
||||||
|
|
||||||
switch ((enum virDomainDiskType) actualType) {
|
switch ((enum virStorageType) actualType) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
switch ((enum virDomainDiskProtocol) disk->src.protocol) {
|
switch ((enum virDomainDiskProtocol) disk->src.protocol) {
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_NBD:
|
case VIR_DOMAIN_DISK_PROTOCOL_NBD:
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
|
case VIR_DOMAIN_DISK_PROTOCOL_RBD:
|
||||||
@ -12581,12 +12581,12 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_DIR:
|
case VIR_STORAGE_TYPE_DIR:
|
||||||
case VIR_DOMAIN_DISK_TYPE_VOLUME:
|
case VIR_STORAGE_TYPE_VOLUME:
|
||||||
case VIR_DOMAIN_DISK_TYPE_LAST:
|
case VIR_STORAGE_TYPE_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("internal inactive snapshots are not supported on "
|
_("internal inactive snapshots are not supported on "
|
||||||
"'%s' disks"), virDomainDiskTypeToString(actualType));
|
"'%s' disks"), virStorageTypeToString(actualType));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12636,7 +12636,7 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
|
|||||||
active) < 0)
|
active) < 0)
|
||||||
goto cleanup;
|
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_SHEEPDOG ||
|
||||||
dom_disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) {
|
dom_disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD)) {
|
||||||
break;
|
break;
|
||||||
@ -12789,10 +12789,10 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
switch (snap->type) {
|
switch (snap->type) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
reuse = true;
|
reuse = true;
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
|
|
||||||
/* create the stub file and set selinux labels; manipulate disk in
|
/* create the stub file and set selinux labels; manipulate disk in
|
||||||
* place, in a way that can be reverted on failure. */
|
* place, in a way that can be reverted on failure. */
|
||||||
@ -12812,7 +12812,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_TYPE_NETWORK:
|
case VIR_STORAGE_TYPE_NETWORK:
|
||||||
switch (snap->protocol) {
|
switch (snap->protocol) {
|
||||||
case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
|
case VIR_DOMAIN_DISK_PROTOCOL_GLUSTER:
|
||||||
if (!(newhosts = virStorageNetHostDefCopy(snap->nhosts, snap->hosts)))
|
if (!(newhosts = virStorageNetHostDefCopy(snap->nhosts, snap->hosts)))
|
||||||
@ -12836,7 +12836,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
|
|||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||||
_("snapshots are not supported on '%s' volumes"),
|
_("snapshots are not supported on '%s' volumes"),
|
||||||
virDomainDiskTypeToString(snap->type));
|
virStorageTypeToString(snap->type));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
|
|||||||
int type = virDomainDiskGetType(disk);
|
int type = virDomainDiskGetType(disk);
|
||||||
int diskFormat = virDomainDiskGetFormat(disk);
|
int diskFormat = virDomainDiskGetFormat(disk);
|
||||||
|
|
||||||
if (type != VIR_DOMAIN_DISK_TYPE_DIR) {
|
if (type != VIR_STORAGE_TYPE_DIR) {
|
||||||
if (diskFormat > 0) {
|
if (diskFormat > 0) {
|
||||||
format = virStorageFileFormatTypeToString(diskFormat);
|
format = virStorageFileFormatTypeToString(diskFormat);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1533,7 +1533,7 @@ qemuMigrationIsSafe(virDomainDefPtr def)
|
|||||||
disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE) {
|
disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE) {
|
||||||
if ((rc = virStorageFileIsSharedFS(src)) < 0)
|
if ((rc = virStorageFileIsSharedFS(src)) < 0)
|
||||||
return false;
|
return false;
|
||||||
else if (rc == 0)
|
else if (rc == 0)
|
||||||
@ -1542,7 +1542,7 @@ qemuMigrationIsSafe(virDomainDefPtr def)
|
|||||||
return false;
|
return false;
|
||||||
else if (rc == 1)
|
else if (rc == 1)
|
||||||
continue;
|
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) {
|
disk->src.protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AppArmor security driver for libvirt
|
* 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.
|
* Copyright (C) 2009-2010 Canonical Ltd.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -688,7 +688,7 @@ AppArmorRestoreSecurityImageLabel(virSecurityManagerPtr mgr,
|
|||||||
virDomainDefPtr def,
|
virDomainDefPtr def,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
{
|
{
|
||||||
if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
|
if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return reload_profile(mgr, def, NULL, false);
|
return reload_profile(mgr, def, NULL, false);
|
||||||
@ -711,7 +711,7 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!virDomainDiskGetSource(disk) ||
|
if (!virDomainDiskGetSource(disk) ||
|
||||||
virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
|
virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (secdef->imagelabel) {
|
if (secdef->imagelabel) {
|
||||||
|
@ -355,7 +355,7 @@ virSecurityDACSetSecurityImageLabel(virSecurityManagerPtr mgr,
|
|||||||
if (!priv->dynamicOwnership)
|
if (!priv->dynamicOwnership)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
|
if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
params[0] = mgr;
|
params[0] = mgr;
|
||||||
@ -379,7 +379,7 @@ virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
|
|||||||
if (!priv->dynamicOwnership)
|
if (!priv->dynamicOwnership)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
|
if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Don't restore labels on readoly/shared disks, because
|
/* Don't restore labels on readoly/shared disks, because
|
||||||
@ -905,7 +905,7 @@ virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
for (i = 0; i < def->ndisks; i++) {
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
/* XXX fixme - we need to recursively label the entire tree :-( */
|
/* 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;
|
continue;
|
||||||
if (virSecurityDACSetSecurityImageLabel(mgr,
|
if (virSecurityDACSetSecurityImageLabel(mgr,
|
||||||
def,
|
def,
|
||||||
|
@ -1163,7 +1163,7 @@ virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
|
|||||||
if (disk->readonly || disk->shared)
|
if (disk->readonly || disk->shared)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!src || virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
|
if (!src || virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* If we have a shared FS & doing migrated, we must not
|
/* If we have a shared FS & doing migrated, we must not
|
||||||
@ -1263,7 +1263,7 @@ virSecuritySELinuxSetSecurityImageLabel(virSecurityManagerPtr mgr,
|
|||||||
if (cbdata.secdef->norelabel)
|
if (cbdata.secdef->norelabel)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virDomainDiskGetType(disk) == VIR_DOMAIN_DISK_TYPE_NETWORK)
|
if (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return virDomainDiskDefForeachPath(disk,
|
return virDomainDiskDefForeachPath(disk,
|
||||||
@ -2272,7 +2272,7 @@ virSecuritySELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
for (i = 0; i < def->ndisks; i++) {
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
/* XXX fixme - we need to recursively label the entire tree :-( */
|
/* 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",
|
VIR_WARN("Unable to relabel directory tree %s for disk %s",
|
||||||
virDomainDiskGetSource(def->disks[i]),
|
virDomainDiskGetSource(def->disks[i]),
|
||||||
def->disks[i]->dst);
|
def->disks[i]->dst);
|
||||||
|
@ -1175,7 +1175,7 @@ virStorageFileBackendForType(int type,
|
|||||||
|
|
||||||
for (i = 0; fileBackends[i]; i++) {
|
for (i = 0; fileBackends[i]; i++) {
|
||||||
if (fileBackends[i]->type == type) {
|
if (fileBackends[i]->type == type) {
|
||||||
if (type == VIR_DOMAIN_DISK_TYPE_NETWORK &&
|
if (type == VIR_STORAGE_TYPE_NETWORK &&
|
||||||
fileBackends[i]->protocol != protocol)
|
fileBackends[i]->protocol != protocol)
|
||||||
continue;
|
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,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing storage backend for network files "
|
_("missing storage backend for network files "
|
||||||
"using %s protocol"),
|
"using %s protocol"),
|
||||||
@ -1191,7 +1191,7 @@ virStorageFileBackendForType(int type,
|
|||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing storage backend for '%s' storage"),
|
_("missing storage backend for '%s' storage"),
|
||||||
virDomainDiskTypeToString(type));
|
virStorageTypeToString(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1377,7 +1377,7 @@ virStorageFileBackendFileStat(virStorageFilePtr file,
|
|||||||
|
|
||||||
|
|
||||||
virStorageFileBackend virStorageFileBackendFile = {
|
virStorageFileBackend virStorageFileBackendFile = {
|
||||||
.type = VIR_DOMAIN_DISK_TYPE_FILE,
|
.type = VIR_STORAGE_TYPE_FILE,
|
||||||
|
|
||||||
.storageFileUnlink = virStorageFileBackendFileUnlink,
|
.storageFileUnlink = virStorageFileBackendFileUnlink,
|
||||||
.storageFileStat = virStorageFileBackendFileStat,
|
.storageFileStat = virStorageFileBackendFileStat,
|
||||||
@ -1385,7 +1385,7 @@ virStorageFileBackend virStorageFileBackendFile = {
|
|||||||
|
|
||||||
|
|
||||||
virStorageFileBackend virStorageFileBackendBlock = {
|
virStorageFileBackend virStorageFileBackendBlock = {
|
||||||
.type = VIR_DOMAIN_DISK_TYPE_BLOCK,
|
.type = VIR_STORAGE_TYPE_BLOCK,
|
||||||
|
|
||||||
.storageFileStat = virStorageFileBackendFileStat,
|
.storageFileStat = virStorageFileBackendFileStat,
|
||||||
};
|
};
|
||||||
|
@ -668,7 +668,7 @@ virStorageFileBackendGlusterStat(virStorageFilePtr file,
|
|||||||
|
|
||||||
|
|
||||||
virStorageFileBackend virStorageFileBackendGluster = {
|
virStorageFileBackend virStorageFileBackendGluster = {
|
||||||
.type = VIR_DOMAIN_DISK_TYPE_NETWORK,
|
.type = VIR_STORAGE_TYPE_NETWORK,
|
||||||
.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
|
.protocol = VIR_DOMAIN_DISK_PROTOCOL_GLUSTER,
|
||||||
|
|
||||||
.backendInit = virStorageFileBackendGlusterInit,
|
.backendInit = virStorageFileBackendGlusterInit,
|
||||||
|
@ -53,6 +53,13 @@
|
|||||||
|
|
||||||
VIR_LOG_INIT("util.storagefile");
|
VIR_LOG_INIT("util.storagefile");
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virStorage, VIR_STORAGE_TYPE_LAST,
|
||||||
|
"block",
|
||||||
|
"file",
|
||||||
|
"dir",
|
||||||
|
"network",
|
||||||
|
"volume")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virStorageFileFormat,
|
VIR_ENUM_IMPL(virStorageFileFormat,
|
||||||
VIR_STORAGE_FILE_LAST,
|
VIR_STORAGE_FILE_LAST,
|
||||||
"none",
|
"none",
|
||||||
|
@ -35,6 +35,21 @@
|
|||||||
* beyond this size, in practice that doesn't matter. */
|
* beyond this size, in practice that doesn't matter. */
|
||||||
# define VIR_STORAGE_MAX_HEADER 0x8200
|
# 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 {
|
enum virStorageFileFormat {
|
||||||
VIR_STORAGE_FILE_AUTO_SAFE = -2,
|
VIR_STORAGE_FILE_AUTO_SAFE = -2,
|
||||||
VIR_STORAGE_FILE_AUTO = -1,
|
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]->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
||||||
def->disks[i]->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
def->disks[i]->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
||||||
virDomainDiskSetType(def->disks[i],
|
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;
|
def->disks[diskCount]->readonly = true;
|
||||||
|
|
||||||
virDomainDiskSetType(def->disks[diskCount],
|
virDomainDiskSetType(def->disks[diskCount],
|
||||||
VIR_DOMAIN_DISK_TYPE_FILE);
|
VIR_STORAGE_TYPE_FILE);
|
||||||
|
|
||||||
VBOX_RELEASE(medium);
|
VBOX_RELEASE(medium);
|
||||||
VBOX_RELEASE(storageController);
|
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]->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||||
def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
||||||
virDomainDiskSetType(def->disks[def->ndisks - 1],
|
virDomainDiskSetType(def->disks[def->ndisks - 1],
|
||||||
VIR_DOMAIN_DISK_TYPE_FILE);
|
VIR_STORAGE_TYPE_FILE);
|
||||||
def->disks[def->ndisks - 1]->readonly = true;
|
def->disks[def->ndisks - 1]->readonly = true;
|
||||||
ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location));
|
ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location));
|
||||||
ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "hdc"));
|
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]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
|
||||||
def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC;
|
def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC;
|
||||||
virDomainDiskSetType(def->disks[def->ndisks - 1],
|
virDomainDiskSetType(def->disks[def->ndisks - 1],
|
||||||
VIR_DOMAIN_DISK_TYPE_FILE);
|
VIR_STORAGE_TYPE_FILE);
|
||||||
def->disks[def->ndisks - 1]->readonly = false;
|
def->disks[def->ndisks - 1]->readonly = false;
|
||||||
ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location));
|
ignore_value(virDomainDiskSetSource(def->disks[def->ndisks - 1], location));
|
||||||
ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "fda"));
|
ignore_value(VIR_STRDUP(def->disks[def->ndisks - 1]->dst, "fda"));
|
||||||
@ -3911,7 +3911,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||||||
? "True" : "False"));
|
? "True" : "False"));
|
||||||
|
|
||||||
if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
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;
|
IDVDDrive *dvdDrive = NULL;
|
||||||
/* Currently CDROM/DVD Drive is always IDE
|
/* Currently CDROM/DVD Drive is always IDE
|
||||||
* Secondary Master so neglecting the following
|
* Secondary Master so neglecting the following
|
||||||
@ -3962,10 +3962,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||||||
VBOX_UTF16_FREE(dvdfileUtf16);
|
VBOX_UTF16_FREE(dvdfileUtf16);
|
||||||
VBOX_RELEASE(dvdDrive);
|
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) {
|
} 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;
|
IHardDisk *hardDisk = NULL;
|
||||||
PRUnichar *hddfileUtf16 = NULL;
|
PRUnichar *hddfileUtf16 = NULL;
|
||||||
vboxIID hdduuid = VBOX_IID_INITIALIZER;
|
vboxIID hdduuid = VBOX_IID_INITIALIZER;
|
||||||
@ -4066,10 +4066,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||||||
vboxIIDUnalloc(&hdduuid);
|
vboxIIDUnalloc(&hdduuid);
|
||||||
VBOX_UTF16_FREE(hddEmpty);
|
VBOX_UTF16_FREE(hddEmpty);
|
||||||
VBOX_UTF16_FREE(hddfileUtf16);
|
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) {
|
} 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;
|
IFloppyDrive *floppyDrive;
|
||||||
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
|
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
|
||||||
if (floppyDrive) {
|
if (floppyDrive) {
|
||||||
@ -4119,7 +4119,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
|
|||||||
}
|
}
|
||||||
VBOX_RELEASE(floppyDrive);
|
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
|
VIR_DEBUG("disk(%zu) shared: %s", i, (def->disks[i]->shared
|
||||||
? "True" : "False"));
|
? "True" : "False"));
|
||||||
|
|
||||||
if (type == VIR_DOMAIN_DISK_TYPE_FILE && src) {
|
if (type == VIR_STORAGE_TYPE_FILE && src) {
|
||||||
IMedium *medium = NULL;
|
IMedium *medium = NULL;
|
||||||
PRUnichar *mediumUUID = NULL;
|
PRUnichar *mediumUUID = NULL;
|
||||||
PRUnichar *mediumFileUtf16 = NULL;
|
PRUnichar *mediumFileUtf16 = NULL;
|
||||||
@ -5536,7 +5536,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
|
|||||||
int type = virDomainDiskGetType(dev->data.disk);
|
int type = virDomainDiskGetType(dev->data.disk);
|
||||||
|
|
||||||
if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
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;
|
IDVDDrive *dvdDrive = NULL;
|
||||||
/* Currently CDROM/DVD Drive is always IDE
|
/* Currently CDROM/DVD Drive is always IDE
|
||||||
* Secondary Master so neglecting the following
|
* Secondary Master so neglecting the following
|
||||||
@ -5582,10 +5582,10 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
|
|||||||
VBOX_UTF16_FREE(dvdfileUtf16);
|
VBOX_UTF16_FREE(dvdfileUtf16);
|
||||||
VBOX_RELEASE(dvdDrive);
|
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) {
|
} 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;
|
IFloppyDrive *floppyDrive;
|
||||||
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
|
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
|
||||||
if (floppyDrive) {
|
if (floppyDrive) {
|
||||||
@ -5632,7 +5632,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
VBOX_RELEASE(floppyDrive);
|
VBOX_RELEASE(floppyDrive);
|
||||||
}
|
}
|
||||||
} else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
} else if (type == VIR_STORAGE_TYPE_BLOCK) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* VBOX_API_VERSION >= 3001000 */
|
#else /* VBOX_API_VERSION >= 3001000 */
|
||||||
@ -5769,7 +5769,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml)
|
|||||||
int type = virDomainDiskGetType(dev->data.disk);
|
int type = virDomainDiskGetType(dev->data.disk);
|
||||||
|
|
||||||
if (dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
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;
|
IDVDDrive *dvdDrive = NULL;
|
||||||
/* Currently CDROM/DVD Drive is always IDE
|
/* Currently CDROM/DVD Drive is always IDE
|
||||||
* Secondary Master so neglecting the following
|
* Secondary Master so neglecting the following
|
||||||
@ -5787,10 +5787,10 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml)
|
|||||||
}
|
}
|
||||||
VBOX_RELEASE(dvdDrive);
|
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) {
|
} 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;
|
IFloppyDrive *floppyDrive;
|
||||||
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
|
machine->vtbl->GetFloppyDrive(machine, &floppyDrive);
|
||||||
if (floppyDrive) {
|
if (floppyDrive) {
|
||||||
@ -5815,7 +5815,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml)
|
|||||||
}
|
}
|
||||||
VBOX_RELEASE(floppyDrive);
|
VBOX_RELEASE(floppyDrive);
|
||||||
}
|
}
|
||||||
} else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
} else if (type == VIR_STORAGE_TYPE_BLOCK) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* VBOX_API_VERSION >= 3001000 */
|
#else /* VBOX_API_VERSION >= 3001000 */
|
||||||
|
@ -406,7 +406,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath)
|
|||||||
|
|
||||||
for (i = 0; i < vmdef->ndisks; ++i) {
|
for (i = 0; i < vmdef->ndisks; ++i) {
|
||||||
if (vmdef->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
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];
|
disk = vmdef->disks[i];
|
||||||
break;
|
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)))
|
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
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)))
|
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
||||||
@ -2250,7 +2250,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
*/
|
*/
|
||||||
goto ignore;
|
goto ignore;
|
||||||
} else if (STRCASEEQ(deviceType, "atapi-cdrom")) {
|
} else if (STRCASEEQ(deviceType, "atapi-cdrom")) {
|
||||||
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK);
|
virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK);
|
||||||
|
|
||||||
if (STRCASEEQ(fileName, "auto detect")) {
|
if (STRCASEEQ(fileName, "auto detect")) {
|
||||||
ignore_value(virDomainDiskSetSource(*def, NULL));
|
ignore_value(virDomainDiskSetSource(*def, NULL));
|
||||||
@ -2261,7 +2261,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
} else if (STRCASEEQ(deviceType, "cdrom-raw")) {
|
} else if (STRCASEEQ(deviceType, "cdrom-raw")) {
|
||||||
/* Raw access CD-ROMs actually are device='lun' */
|
/* Raw access CD-ROMs actually are device='lun' */
|
||||||
(*def)->device = VIR_DOMAIN_DISK_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")) {
|
if (STRCASEEQ(fileName, "auto detect")) {
|
||||||
ignore_value(virDomainDiskSetSource(*def, NULL));
|
ignore_value(virDomainDiskSetSource(*def, NULL));
|
||||||
@ -2279,13 +2279,13 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|||||||
}
|
}
|
||||||
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
} else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
||||||
if (fileType != NULL && STRCASEEQ(fileType, "device")) {
|
if (fileType != NULL && STRCASEEQ(fileType, "device")) {
|
||||||
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_BLOCK);
|
virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK);
|
||||||
if (virDomainDiskSetSource(*def, fileName) < 0)
|
if (virDomainDiskSetSource(*def, fileName) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (fileType != NULL && STRCASEEQ(fileType, "file")) {
|
} else if (fileType != NULL && STRCASEEQ(fileType, "file")) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
virDomainDiskSetType(*def, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(*def, VIR_STORAGE_TYPE_FILE);
|
||||||
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
if (virDomainDiskSetSource(*def, tmp) < 0) {
|
||||||
@ -3440,14 +3440,14 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We only support type='file' and type='block' */
|
/* We only support type='file' and type='block' */
|
||||||
if (type != VIR_DOMAIN_DISK_TYPE_FILE &&
|
if (type != VIR_STORAGE_TYPE_FILE &&
|
||||||
type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
type != VIR_STORAGE_TYPE_BLOCK) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("%s %s '%s' has unsupported type '%s', expecting "
|
_("%s %s '%s' has unsupported type '%s', expecting "
|
||||||
"'%s' or '%s'"), busType, deviceType, def->dst,
|
"'%s' or '%s'"), busType, deviceType, def->dst,
|
||||||
diskType,
|
diskType,
|
||||||
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
|
virStorageTypeToString(VIR_STORAGE_TYPE_FILE),
|
||||||
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
|
virStorageTypeToString(VIR_STORAGE_TYPE_BLOCK));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3469,11 +3469,11 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
|
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) ?
|
vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ?
|
||||||
"scsi-hardDisk" : "ata-hardDisk";
|
"scsi-hardDisk" : "ata-hardDisk";
|
||||||
} else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
} 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";
|
vmxDeviceType = "cdrom-image";
|
||||||
else
|
else
|
||||||
vmxDeviceType = "atapi-cdrom";
|
vmxDeviceType = "atapi-cdrom";
|
||||||
@ -3491,7 +3491,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n",
|
virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n",
|
||||||
busType, controllerOrBus, unit, vmxDeviceType);
|
busType, controllerOrBus, unit, vmxDeviceType);
|
||||||
|
|
||||||
if (type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (type == VIR_STORAGE_TYPE_FILE) {
|
||||||
const char *src = virDomainDiskGetSource(def);
|
const char *src = virDomainDiskGetSource(def);
|
||||||
|
|
||||||
if (src && ! virFileHasSuffix(src, fileExt)) {
|
if (src && ! virFileHasSuffix(src, fileExt)) {
|
||||||
@ -3512,7 +3512,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
busType, controllerOrBus, unit, fileName);
|
busType, controllerOrBus, unit, fileName);
|
||||||
|
|
||||||
VIR_FREE(fileName);
|
VIR_FREE(fileName);
|
||||||
} else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
} else if (type == VIR_STORAGE_TYPE_BLOCK) {
|
||||||
const char *src = virDomainDiskGetSource(def);
|
const char *src = virDomainDiskGetSource(def);
|
||||||
|
|
||||||
if (!src &&
|
if (!src &&
|
||||||
@ -3569,7 +3569,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
|
|
||||||
virBufferAsprintf(buffer, "floppy%d.present = \"true\"\n", unit);
|
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);
|
virBufferAsprintf(buffer, "floppy%d.fileType = \"file\"\n", unit);
|
||||||
|
|
||||||
if (src) {
|
if (src) {
|
||||||
@ -3584,7 +3584,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
|
|
||||||
VIR_FREE(fileName);
|
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);
|
virBufferAsprintf(buffer, "floppy%d.fileType = \"device\"\n", unit);
|
||||||
|
|
||||||
if (src) {
|
if (src) {
|
||||||
@ -3595,9 +3595,9 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Floppy '%s' has unsupported type '%s', expecting '%s' "
|
_("Floppy '%s' has unsupported type '%s', expecting '%s' "
|
||||||
"or '%s'"), def->dst,
|
"or '%s'"), def->dst,
|
||||||
virDomainDiskTypeToString(type),
|
virStorageTypeToString(type),
|
||||||
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE),
|
virStorageTypeToString(VIR_STORAGE_TYPE_FILE),
|
||||||
virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK));
|
virStorageTypeToString(VIR_STORAGE_TYPE_BLOCK));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,17 +447,17 @@ xenParseSxprDisks(virDomainDefPtr def,
|
|||||||
so we assume common case here. If blktap becomes
|
so we assume common case here. If blktap becomes
|
||||||
omnipotent, we can revisit this, perhaps stat()'ing
|
omnipotent, we can revisit this, perhaps stat()'ing
|
||||||
the src file in question */
|
the src file in question */
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
} else if (STREQ(virDomainDiskGetDriver(disk), "phy")) {
|
} 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")) {
|
} else if (STREQ(virDomainDiskGetDriver(disk), "file")) {
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* No CDROM media so can't really tell. We'll just
|
/* No CDROM media so can't really tell. We'll just
|
||||||
call if a FILE for now and update when media
|
call if a FILE for now and update when media
|
||||||
is inserted later */
|
is inserted later */
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STREQLEN(dst, "ioemu:", 6))
|
if (STREQLEN(dst, "ioemu:", 6))
|
||||||
@ -1310,7 +1310,7 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
virDomainDiskDefFree(disk);
|
virDomainDiskDefFree(disk);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||||
if (VIR_STRDUP(disk->dst, "hdc") < 0) {
|
if (VIR_STRDUP(disk->dst, "hdc") < 0) {
|
||||||
virDomainDiskDefFree(disk);
|
virDomainDiskDefFree(disk);
|
||||||
@ -1345,7 +1345,7 @@ xenParseSxpr(const struct sexpr *root,
|
|||||||
VIR_FREE(disk);
|
VIR_FREE(disk);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
|
||||||
if (VIR_STRDUP(disk->dst, fds[i]) < 0) {
|
if (VIR_STRDUP(disk->dst, fds[i]) < 0) {
|
||||||
virDomainDiskDefFree(disk);
|
virDomainDiskDefFree(disk);
|
||||||
@ -1801,9 +1801,9 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
|
|||||||
} else {
|
} else {
|
||||||
int type = virDomainDiskGetType(def);
|
int type = virDomainDiskGetType(def);
|
||||||
|
|
||||||
if (type == VIR_DOMAIN_DISK_TYPE_FILE) {
|
if (type == VIR_STORAGE_TYPE_FILE) {
|
||||||
virBufferEscapeSexpr(buf, "(uname 'file:%s')", src);
|
virBufferEscapeSexpr(buf, "(uname 'file:%s')", src);
|
||||||
} else if (type == VIR_DOMAIN_DISK_TYPE_BLOCK) {
|
} else if (type == VIR_STORAGE_TYPE_BLOCK) {
|
||||||
if (src[0] == '/')
|
if (src[0] == '/')
|
||||||
virBufferEscapeSexpr(buf, "(uname 'phy:%s')", src);
|
virBufferEscapeSexpr(buf, "(uname 'phy:%s')", src);
|
||||||
else
|
else
|
||||||
@ -1812,7 +1812,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
|
|||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("unsupported disk type %s"),
|
_("unsupported disk type %s"),
|
||||||
virDomainDiskTypeToString(type));
|
virStorageTypeToString(type));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -592,8 +592,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
|||||||
/* phy: type indicates a block device */
|
/* phy: type indicates a block device */
|
||||||
virDomainDiskSetType(disk,
|
virDomainDiskSetType(disk,
|
||||||
STREQ(virDomainDiskGetDriver(disk), "phy") ?
|
STREQ(virDomainDiskGetDriver(disk), "phy") ?
|
||||||
VIR_DOMAIN_DISK_TYPE_BLOCK :
|
VIR_STORAGE_TYPE_BLOCK :
|
||||||
VIR_DOMAIN_DISK_TYPE_FILE);
|
VIR_STORAGE_TYPE_FILE);
|
||||||
|
|
||||||
/* Check for a :cdrom/:disk postfix */
|
/* Check for a :cdrom/:disk postfix */
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
||||||
@ -635,7 +635,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
|||||||
if (VIR_ALLOC(disk) < 0)
|
if (VIR_ALLOC(disk) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_FILE);
|
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_FILE);
|
||||||
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||||
if (virDomainDiskSetDriver(disk, "file") < 0)
|
if (virDomainDiskSetDriver(disk, "file") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1214,16 +1214,16 @@ xenFormatXMDisk(virConfValuePtr list,
|
|||||||
virBufferAsprintf(&buf, "%s:", type);
|
virBufferAsprintf(&buf, "%s:", type);
|
||||||
} else {
|
} else {
|
||||||
switch (virDomainDiskGetType(disk)) {
|
switch (virDomainDiskGetType(disk)) {
|
||||||
case VIR_DOMAIN_DISK_TYPE_FILE:
|
case VIR_STORAGE_TYPE_FILE:
|
||||||
virBufferAddLit(&buf, "file:");
|
virBufferAddLit(&buf, "file:");
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_DISK_TYPE_BLOCK:
|
case VIR_STORAGE_TYPE_BLOCK:
|
||||||
virBufferAddLit(&buf, "phy:");
|
virBufferAddLit(&buf, "phy:");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unsupported disk type %s"),
|
_("unsupported disk type %s"),
|
||||||
virDomainDiskTypeToString(virDomainDiskGetType(disk)));
|
virStorageTypeToString(virDomainDiskGetType(disk)));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,8 +169,8 @@ testSELinuxLoadDef(const char *testname)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < def->ndisks; i++) {
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
if (def->disks[i]->src.type != VIR_DOMAIN_DISK_TYPE_FILE &&
|
if (def->disks[i]->src.type != VIR_STORAGE_TYPE_FILE &&
|
||||||
def->disks[i]->src.type != VIR_DOMAIN_DISK_TYPE_BLOCK)
|
def->disks[i]->src.type != VIR_STORAGE_TYPE_BLOCK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (testSELinuxMungePath(&def->disks[i]->src.path) < 0)
|
if (testSELinuxMungePath(&def->disks[i]->src.path) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user