qemu: assume various QEMU 0.10 features are always available

The -sdl and -net ...name=XXX arguments were both introduced
in QEMU 0.10, so the QEMU driver can assume they are always
available.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2015-11-09 16:20:08 +00:00
parent 72edc90a65
commit 4e8993a250
26 changed files with 39 additions and 74 deletions

View File

@ -1227,9 +1227,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
if (strstr(help, "-machine"))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
if (version >= 10000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_0_10);
if (version >= 11000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
@ -3165,7 +3162,6 @@ static qemuMonitorCallbacks callbacks = {
static void
virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
{
virQEMUCapsSet(qemuCaps, QEMU_CAPS_0_10);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_PATH);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_CHARDEV);

View File

@ -68,7 +68,7 @@ typedef enum {
/* 15 */
X_QEMU_CAPS_VGA, /* Is -vga avail */
QEMU_CAPS_0_10, /* features added in qemu-0.10.0 or later */
X_QEMU_CAPS_0_10, /* features added in qemu-0.10.0 or later */
QEMU_CAPS_PCIDEVICE, /* PCI device assignment supported */
QEMU_CAPS_MEM_PATH, /* mmap'ped guest backing supported */
QEMU_CAPS_DRIVE_SERIAL, /* -driver serial= available */
@ -328,10 +328,6 @@ typedef enum {
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
/* Aliases for some of the capabilities defined above */
# define QEMU_CAPS_NET_NAME QEMU_CAPS_0_10 /* -net ...,name=str */
# define QEMU_CAPS_HOST_NET_ADD QEMU_CAPS_0_10 /* host_net_add command */
typedef struct _virQEMUCaps virQEMUCaps;
typedef virQEMUCaps *virQEMUCapsPtr;

View File

@ -1164,8 +1164,6 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
if (qemuAssignDeviceDiskAlias(def, def->disks[i], qemuCaps) < 0)
return -1;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NET_NAME) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
for (i = 0; i < def->nnets; i++) {
/* type='hostdev' interfaces are also on the hostdevs list,
* and will have their alias assigned with other hostdevs.
@ -1176,7 +1174,6 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
return -1;
}
}
}
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
return 0;
@ -8514,8 +8511,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
{
switch ((virDomainGraphicsType) graphics->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_0_10) &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL)) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("sdl not supported by '%s'"), def->emulator);
return -1;
@ -8538,7 +8534,6 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
/* New QEMU has this flag to let us explicitly ask for
* SDL graphics. This is better than relying on the
* default, since the default changes :-( */
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL))
virCommandAddArg(cmd, "-sdl");
break;
@ -10551,11 +10546,6 @@ qemuBuildCommandLine(virConnectPtr conn,
}
}
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_0_10) && sdl + vnc + spice > 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("only 1 graphics device is supported"));
goto error;
}
if (sdl > 1 || vnc > 1 || spice > 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("only 1 graphics device of each type "
@ -12991,6 +12981,11 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
virDomainGraphicsDefFree(vnc);
goto error;
}
} else if (STREQ(arg, "-sdl")) {
virDomainGraphicsDefPtr sdl;
if (VIR_ALLOC(sdl) < 0)
goto error;
sdl->type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
} else if (STREQ(arg, "-m")) {
int mem;
WANT_VALUE();

View File

@ -908,12 +908,6 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
goto cleanup;
}
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_HOST_NET_ADD)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("installed qemu version does not support host_net_add"));
goto cleanup;
}
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
@ -998,8 +992,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
goto cleanup;
}
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NET_NAME) ||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0)
goto cleanup;
}

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='0.10'/>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>

View File

@ -154,7 +154,6 @@ mymain(void)
DO_TEST("qemu-0.12.1", 12001, 0, 0,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_ENABLE_KVM,
QEMU_CAPS_SDL,
QEMU_CAPS_CHARDEV,
@ -179,7 +178,6 @@ mymain(void)
QEMU_CAPS_KVM,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_PCIDEVICE,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_CHARDEV,
@ -229,7 +227,6 @@ mymain(void)
QEMU_CAPS_KVM,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_PCIDEVICE,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_SDL,
@ -260,7 +257,6 @@ mymain(void)
QEMU_CAPS_KVM,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_PCIDEVICE,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_SDL,
@ -320,7 +316,6 @@ mymain(void)
QEMU_CAPS_KVM,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_PCIDEVICE,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_CHARDEV,
@ -377,7 +372,6 @@ mymain(void)
QEMU_CAPS_KVM,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_PCIDEVICE,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_CHARDEV,
@ -441,7 +435,6 @@ mymain(void)
QEMU_CAPS_DRIVE_CACHE_UNSAFE,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_SDL,
QEMU_CAPS_CHARDEV,
@ -521,7 +514,6 @@ mymain(void)
QEMU_CAPS_DRIVE_CACHE_UNSAFE,
QEMU_CAPS_DRIVE_SERIAL,
QEMU_CAPS_DRIVE_READONLY,
QEMU_CAPS_0_10,
QEMU_CAPS_MEM_PATH,
QEMU_CAPS_SDL,
QEMU_CAPS_CHARDEV,

View File

@ -72,7 +72,6 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
/* for attach & detach qemu must support -device */
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE);
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_NET_NAME);
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI);
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE);
if (event)

View File

@ -21,4 +21,5 @@ DISPLAY=:0.1 \
-serial none \
-parallel none \
-full-screen \
-sdl \
-vga cirrus

View File

@ -20,4 +20,5 @@ DISPLAY=:0.1 \
-net none \
-serial none \
-parallel none \
-sdl \
-vga std

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139 \
-net socket,connect=192.168.0.1:5558,vlan=0 \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139,name=net0 \
-net socket,connect=192.168.0.1:5558,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=rtl8139 \
-net tap,ifname=nic02,script=/etc/qemu-ifup,vlan=0 \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=rtl8139,name=net0 \
-net tap,ifname=nic02,script=/etc/qemu-ifup,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=rtl8139 \
-net tap,script=/etc/qemu-ifup,vlan=0 \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=rtl8139,name=net0 \
-net tap,script=/etc/qemu-ifup,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139 \
-net socket,mcast=192.0.0.1:5558,vlan=0 \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139,name=net0 \
-net socket,mcast=192.0.0.1:5558,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139 \
-net socket,listen=192.168.0.1:5558,vlan=0 \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139,name=net0 \
-net socket,listen=192.168.0.1:5558,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,8 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139 \
-net socket,udp=192.168.10.1:5555,localaddr=192.168.10.1:5556,vlan=0 \
-net nic,macaddr=52:54:00:8c:b9:05,vlan=0,model=rtl8139,name=net0 \
-net socket,udp=192.168.10.1:5555,localaddr=192.168.10.1:5556,vlan=0,\
name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=rtl8139 \
-net user,vlan=0 \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=rtl8139,name=net0 \
-net user,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -17,7 +17,7 @@ QEMU_AUDIO_DRV=none \
-boot c \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0,format=raw \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=virtio \
-net user,vlan=0 \
-net nic,macaddr=00:11:22:33:44:55,vlan=0,model=virtio,name=net0 \
-net user,vlan=0,name=hostnet0 \
-serial none \
-parallel none

View File

@ -910,8 +910,8 @@ mymain(void)
VIR_FREE(driver.config->vncSASLdir);
VIR_FREE(driver.config->vncTLSx509certdir);
DO_TEST("graphics-sdl", NONE);
DO_TEST("graphics-sdl-fullscreen", NONE);
DO_TEST("graphics-sdl", QEMU_CAPS_SDL);
DO_TEST("graphics-sdl-fullscreen", QEMU_CAPS_SDL);
DO_TEST("nographics", NONE);
DO_TEST("nographics-vga",
QEMU_CAPS_VGA_NONE);
@ -988,7 +988,7 @@ mymain(void)
QEMU_CAPS_DEVICE, QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
DO_TEST("net-eth", NONE);
DO_TEST("net-eth-ifname", NONE);
DO_TEST("net-eth-names", QEMU_CAPS_NET_NAME);
DO_TEST("net-eth-names", NONE);
DO_TEST("net-client", NONE);
DO_TEST("net-server", NONE);
DO_TEST("net-mcast", NONE);