From: Michal Privoznik Date: Wed, 15 Nov 2017 14:18:43 +0000 (+0100) Subject: qemuBuildDriveDevStr: Prefer default alias for SATA bus X-Git-Tag: v3.10.0-rc1~97 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f66e5896ad6013c2f31eef1c909999b33ba8847e;p=thirdparty%2Flibvirt.git qemuBuildDriveDevStr: Prefer default alias for SATA bus https://bugzilla.redhat.com/show_bug.cgi?id=1434451 Just like in 9324f67a572f9b32 we need to put default sata alias (which is hardcoded to "ide", obvious, right?) onto the command line instead of the one provided by user. Signed-off-by: Michal Privoznik --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9c24ee6534..ea6c8dc52e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2020,9 +2020,18 @@ qemuBuildDriveDevStr(const virDomainDef *def, virBufferAddLit(&opt, "ide-drive"); } - if (!(contAlias = virDomainControllerAliasFind(def, VIR_DOMAIN_CONTROLLER_TYPE_SATA, - disk->info.addr.drive.controller))) - goto error; + /* When domain has builtin SATA controller we don't put it onto cmd + * line. Therefore we can't set its alias. In that case, use the + * default one. */ + if (qemuDomainIsQ35(def) && + disk->info.addr.drive.controller == 0) { + contAlias = "ide"; + } else { + if (!(contAlias = virDomainControllerAliasFind(def, + VIR_DOMAIN_CONTROLLER_TYPE_SATA, + disk->info.addr.drive.controller))) + goto error; + } virBufferAsprintf(&opt, ",bus=%s.%d", contAlias, disk->info.addr.drive.unit); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.args b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.args new file mode 120000 index 0000000000..e029bc0ec8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.args @@ -0,0 +1 @@ +qemuxml2argv-boot-floppy-q35.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.xml b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.xml new file mode 100644 index 0000000000..a288b86117 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e7f33ae001..781c649bff 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2840,6 +2840,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC, QEMU_CAPS_HDA_DUPLEX); + DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI); if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir);