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 <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2017-11-15 15:18:43 +01:00
parent 481f8fdca1
commit f66e5896ad
4 changed files with 48 additions and 3 deletions

View File

@ -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);

View File

@ -0,0 +1 @@
qemuxml2argv-boot-floppy-q35.args

View File

@ -0,0 +1,34 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-2.4'>hvm</type>
<boot dev='fd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='floppy'>
<driver name='qemu' type='raw'/>
<source file='/tmp/firmware.img'/>
<target dev='fda' bus='fdc'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='sata' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pcie-root'>
<alias name='ua-MySataController'/>
</controller>
<controller type='fdc' index='0'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='none'/>
</devices>
</domain>

View File

@ -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);