mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
qemu: alias: Generate 'qomName' of disk with useraliases
Commit fb64e176f4f forgot to delete the check that short-circuits the disk alias creation if the alias is already present. The side effect of this is that the creation qomName which is necessary to be able to refer to disk frontends when -blockdev is used was skipped when user aliases are used. Fix it by deleting the check. Also prevent any potential memory leaks from calling this function repeatedly by creating the qomName only when it's not present. https://bugzilla.redhat.com/show_bug.cgi?id=1741838 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c10f09786d
commit
b8222be583
@ -182,9 +182,6 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def,
|
|||||||
const char *prefix = virDomainDiskBusTypeToString(disk->bus);
|
const char *prefix = virDomainDiskBusTypeToString(disk->bus);
|
||||||
int controllerModel = -1;
|
int controllerModel = -1;
|
||||||
|
|
||||||
if (disk->info.alias)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!disk->info.alias) {
|
if (!disk->info.alias) {
|
||||||
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
|
||||||
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||||
@ -220,7 +217,8 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def,
|
|||||||
* on the alias in qemu. While certain disk types use just the alias, some
|
* on the alias in qemu. While certain disk types use just the alias, some
|
||||||
* need the full path into /machine/peripheral as a historical artifact.
|
* need the full path into /machine/peripheral as a historical artifact.
|
||||||
*/
|
*/
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
if (!diskPriv->qomName &&
|
||||||
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||||
switch ((virDomainDiskBus) disk->bus) {
|
switch ((virDomainDiskBus) disk->bus) {
|
||||||
case VIR_DOMAIN_DISK_BUS_FDC:
|
case VIR_DOMAIN_DISK_BUS_FDC:
|
||||||
case VIR_DOMAIN_DISK_BUS_IDE:
|
case VIR_DOMAIN_DISK_BUS_IDE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user