Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_driver.c | 12 ------------
src/qemu/qemu_process.c | 13 +++++++++++++
tests/qemuxml2argvdata/qemuxml2argv-controller-order.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-hugepages-numa.args | 2 +-
.../qemuxml2argv-video-device-pciaddr-default.args | 2 +-
5 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 396e64c..d4d3d5b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7060,18 +7060,6 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
net->mac = mac;
}
- /* do fake auto-alloc of graphics ports, if such config is used */
- for (i = 0; i < vm->def->ngraphics; ++i) {
- virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
- if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- if (qemuProcessVNCAllocatePorts(driver, graphics, false) < 0)
- goto cleanup;
- } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
- if (qemuProcessSPICEAllocatePorts(driver, cfg, graphics, false) < 0)
- goto cleanup;
- }
- }
-
if (!(cmd = qemuProcessCreatePretendCmd(conn, driver, vm, NULL,
qemuCheckFips(), true,
VIR_QEMU_PROCESS_START_COLD)))
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e2f22de..86b13bd 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5144,6 +5144,19 @@ qemuProcessPrepareDomain(virConnectPtr conn,
priv->autoNodeset)))
goto cleanup;
}
+ } else {
+ /* If we are pretending to create only QEMU command line or for tests
+ * do fake allocation of graphics ports. */
+ for (i = 0; i < vm->def->ngraphics; ++i) {
+ virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
+ if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+ if (qemuProcessVNCAllocatePorts(driver, graphics, false) < 0)
+ goto cleanup;
+ } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
+ if (qemuProcessSPICEAllocatePorts(driver, cfg, graphics, false) < 0)
+ goto cleanup;
+ }
+ }
}
/*
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-controller-order.args
b/tests/qemuxml2argvdata/qemuxml2argv-controller-order.args
index b47193a..b46685f 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-controller-order.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-controller-order.args
@@ -37,7 +37,7 @@ media=cdrom,id=drive-ide0-1-0 \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\
id=channel0,name=com.redhat.spice.0 \
-device usb-tablet,id=input0 \
--spice port=0 \
+-spice port=5901,tls-port=5902,addr=0.0.0.0,x509-dir=/etc/pki/libvirt-spice \
-vga cirrus \
-device intel-hda,id=sound0,bus=pci.0,addr=0x4 \
-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-numa.args
b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-numa.args
index 56956a3..ae8ef71 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-numa.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-numa.args
@@ -47,7 +47,7 @@ id=channel0,name=org.qemu.guest_agent.0 \
-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,\
id=channel1,name=com.redhat.spice.0 \
-device usb-tablet,id=input0 \
--spice port=0 \
+-spice port=5901,tls-port=5902,addr=127.0.0.1,x509-dir=/etc/pki/libvirt-spice \
-vga qxl \
-global qxl-vga.ram_size=67108864 \
-global qxl-vga.vram_size=67108864 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
index c85c550..40937b8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-video-device-pciaddr-default.args
@@ -19,7 +19,7 @@ QEMU_AUDIO_DRV=none \
-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\
id=drive-ide0-0-0,cache=none \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
--vnc 127.0.0.1:-5900 \
+-vnc 127.0.0.1:0 \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,\
addr=0x3 \
-device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \
--
2.8.2