mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-27 23:15:18 +00:00
qemuDomainDiskGetBackendAlias: Assume QEMU_CAPS_BLOCKDEV is supported
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f590850273
commit
54c0669ff5
@ -1935,7 +1935,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
|
|||||||
if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) {
|
if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_VHOST_USER) {
|
||||||
chardev = qemuDomainGetVhostUserChrAlias(disk->info.alias);
|
chardev = qemuDomainGetVhostUserChrAlias(disk->info.alias);
|
||||||
} else {
|
} else {
|
||||||
if (qemuDomainDiskGetBackendAlias(disk, qemuCaps, &drive) < 0)
|
if (qemuDomainDiskGetBackendAlias(disk, &drive) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7717,7 +7717,8 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver,
|
|||||||
* Returns the pointer to the node-name of the topmost layer used by @disk as
|
* Returns the pointer to the node-name of the topmost layer used by @disk as
|
||||||
* backend. Currently returns the nodename of the copy-on-read filter if enabled
|
* backend. Currently returns the nodename of the copy-on-read filter if enabled
|
||||||
* or the nodename of the top image's format driver. Empty disks return NULL.
|
* or the nodename of the top image's format driver. Empty disks return NULL.
|
||||||
* This must be used only when VIR_QEMU_CAPS_BLOCKDEV is enabled.
|
* This must be used only with disks instantiated via -blockdev (thus not
|
||||||
|
* for SD cards).
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
qemuDomainDiskGetTopNodename(virDomainDiskDef *disk)
|
qemuDomainDiskGetTopNodename(virDomainDiskDef *disk)
|
||||||
@ -7737,7 +7738,6 @@ qemuDomainDiskGetTopNodename(virDomainDiskDef *disk)
|
|||||||
/**
|
/**
|
||||||
* qemuDomainDiskGetBackendAlias:
|
* qemuDomainDiskGetBackendAlias:
|
||||||
* @disk: disk definition
|
* @disk: disk definition
|
||||||
* @qemuCaps: emulator capabilities
|
|
||||||
* @backendAlias: filled with the alias of the disk storage backend
|
* @backendAlias: filled with the alias of the disk storage backend
|
||||||
*
|
*
|
||||||
* Returns the correct alias for the disk backend. This may be the alias of
|
* Returns the correct alias for the disk backend. This may be the alias of
|
||||||
@ -7750,13 +7750,11 @@ qemuDomainDiskGetTopNodename(virDomainDiskDef *disk)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuDomainDiskGetBackendAlias(virDomainDiskDef *disk,
|
qemuDomainDiskGetBackendAlias(virDomainDiskDef *disk,
|
||||||
virQEMUCaps *qemuCaps,
|
|
||||||
char **backendAlias)
|
char **backendAlias)
|
||||||
{
|
{
|
||||||
*backendAlias = NULL;
|
*backendAlias = NULL;
|
||||||
|
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) ||
|
if (qemuDiskBusIsSD(disk->bus)) {
|
||||||
qemuDiskBusIsSD(disk->bus)) {
|
|
||||||
if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk)))
|
if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -10864,8 +10862,7 @@ qemuDomainPrepareDiskSource(virDomainDiskDef *disk,
|
|||||||
disk->src->format = VIR_STORAGE_FILE_RAW;
|
disk->src->format = VIR_STORAGE_FILE_RAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
|
if (!qemuDiskBusIsSD(disk->bus)) {
|
||||||
!qemuDiskBusIsSD(disk->bus)) {
|
|
||||||
if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0)
|
if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -732,10 +732,8 @@ qemuDomainDiskGetTopNodename(virDomainDiskDef *disk)
|
|||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
int qemuDomainDiskGetBackendAlias(virDomainDiskDef *disk,
|
int qemuDomainDiskGetBackendAlias(virDomainDiskDef *disk,
|
||||||
virQEMUCaps *qemuCaps,
|
|
||||||
char **backendAlias)
|
char **backendAlias)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
|
||||||
ATTRIBUTE_NONNULL(3) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
|
|
||||||
int qemuDomainStorageSourceChainAccessAllow(virQEMUDriver *driver,
|
int qemuDomainStorageSourceChainAccessAllow(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
|
@ -475,7 +475,7 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm,
|
|||||||
if (!(newbackend = qemuBuildStorageSourceChainAttachPrepareBlockdev(newsrc)))
|
if (!(newbackend = qemuBuildStorageSourceChainAttachPrepareBlockdev(newsrc)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuDomainDiskGetBackendAlias(disk, priv->qemuCaps, &nodename) < 0)
|
if (qemuDomainDiskGetBackendAlias(disk, &nodename) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user