qemu: assume vnet-hdr feature is always available

This commit is contained in:
Daniel P. Berrange 2015-11-06 15:48:44 +00:00
parent 257e2056e7
commit 8e5a21ee05
15 changed files with 7 additions and 37 deletions

View File

@ -1081,7 +1081,6 @@ virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache)
static int
virQEMUCapsComputeCmdFlags(const char *help,
unsigned int version,
bool is_kvm,
unsigned int kvm_version,
virQEMUCapsPtr qemuCaps,
bool check_yajl ATTRIBUTE_UNUSED)
@ -1217,9 +1216,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
strstr(help, "sockets="))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY);
if (is_kvm && (version >= 10000 || kvm_version >= 74))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR);
if (strstr(help, ",vhost="))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
@ -1448,7 +1444,7 @@ int virQEMUCapsParseHelpStr(const char *qemu,
goto cleanup;
}
if (virQEMUCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version,
if (virQEMUCapsComputeCmdFlags(help, *version, *kvm_version,
qemuCaps, check_yajl) < 0)
goto cleanup;
@ -3204,7 +3200,6 @@ static qemuMonitorCallbacks callbacks = {
static void
virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
{
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNET_HDR);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2);

View File

@ -56,7 +56,7 @@ typedef enum {
X_QEMU_CAPS_NAME, /* Is the -name flag available */
X_QEMU_CAPS_UUID, /* Is the -uuid flag available */
X_QEMU_CAPS_DOMID, /* Xenner: -domid flag available */
QEMU_CAPS_VNET_HDR,
X_QEMU_CAPS_VNET_HDR,
QEMU_CAPS_MIGRATE_KVM_STDIO, /* avoid kvm tcp migration bug */
/* 10 */

View File

@ -219,7 +219,6 @@ qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
* @def: the definition of the VM (needed by 802.1Qbh and audit)
* @driver: pointer to the driver instance
* @net: pointer to the VM's interface description with direct device type
* @qemuCaps: flags for qemu
* @vmop: VM operation type
*
* Returns a filedescriptor on success or -1 in case of error.
@ -228,7 +227,6 @@ int
qemuPhysIfaceConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
virNetDevVPortProfileOp vmop)
{
int rc;
@ -237,8 +235,7 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
unsigned int macvlan_create_flags = VIR_NETDEV_MACVLAN_CREATE_WITH_TAP;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) &&
net->model && STREQ(net->model, "virtio"))
if (net->model && STREQ(net->model, "virtio"))
vnet_hdr = 1;
rc = virNetDevMacVLanCreateWithVPortProfile(
@ -367,7 +364,6 @@ int
qemuNetworkIfaceConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
int *tapfd,
size_t *tapfdSize)
{
@ -402,10 +398,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
template_ifname = true;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) &&
net->model && STREQ(net->model, "virtio")) {
if (net->model && STREQ(net->model, "virtio"))
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
}
if (virQEMUDriverIsPrivileged(driver)) {
if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
@ -8749,15 +8743,13 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
if (qemuNetworkIfaceConnect(def, driver, net,
qemuCaps, tapfd,
&tapfdSize) < 0)
tapfd, &tapfdSize) < 0)
goto cleanup;
} else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(tapfdName) < 0)
goto cleanup;
tapfdSize = 1;
tapfd[0] = qemuPhysIfaceConnect(def, driver, net,
qemuCaps, vmop);
tapfd[0] = qemuPhysIfaceConnect(def, driver, net, vmop);
if (tapfd[0] < 0)
goto cleanup;
}

View File

@ -228,7 +228,6 @@ char *qemuBuildRedirdevDevStr(virDomainDefPtr def,
int qemuNetworkIfaceConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
int *tapfd,
size_t *tapfdSize)
ATTRIBUTE_NONNULL(2);
@ -236,7 +235,6 @@ int qemuNetworkIfaceConnect(virDomainDefPtr def,
int qemuPhysIfaceConnect(virDomainDefPtr def,
virQEMUDriverPtr driver,
virDomainNetDefPtr net,
virQEMUCapsPtr qemuCaps,
virNetDevVPortProfileOp vmop);
int qemuOpenVhostNet(virDomainDefPtr def,

View File

@ -947,7 +947,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
goto cleanup;
memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
if (qemuNetworkIfaceConnect(vm->def, driver, net,
priv->qemuCaps, tapfd, &tapfdSize) < 0)
tapfd, &tapfdSize) < 0)
goto cleanup;
iface_connected = true;
if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, vhostfd, &vhostfdSize) < 0)
@ -961,7 +961,6 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
goto cleanup;
*vhostfd = -1;
if ((tapfd[0] = qemuPhysIfaceConnect(vm->def, driver, net,
priv->qemuCaps,
VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) < 0)
goto cleanup;
iface_connected = true;

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -1,5 +1,4 @@
<qemuCaps>
<flag name='vnet-hdr'/>
<flag name='migrate-qemu-tcp'/>
<flag name='migrate-qemu-exec'/>
<flag name='drive-cache-v2'/>

View File

@ -183,7 +183,6 @@ mymain(void)
QEMU_CAPS_VNC);
DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
QEMU_CAPS_DRIVE_BOOT,
QEMU_CAPS_VNET_HDR,
QEMU_CAPS_MIGRATE_QEMU_TCP,
QEMU_CAPS_MIGRATE_QEMU_EXEC,
QEMU_CAPS_DRIVE_CACHE_V2,
@ -241,7 +240,6 @@ mymain(void)
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
QEMU_CAPS_DRIVE_BOOT,
QEMU_CAPS_VNET_HDR,
QEMU_CAPS_MIGRATE_QEMU_TCP,
QEMU_CAPS_MIGRATE_QEMU_EXEC,
QEMU_CAPS_DRIVE_CACHE_V2,
@ -279,7 +277,6 @@ mymain(void)
QEMU_CAPS_VNC);
DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
QEMU_CAPS_DRIVE_BOOT,
QEMU_CAPS_VNET_HDR,
QEMU_CAPS_MIGRATE_QEMU_TCP,
QEMU_CAPS_MIGRATE_QEMU_EXEC,
QEMU_CAPS_DRIVE_CACHE_V2,
@ -347,7 +344,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
QEMU_CAPS_VNET_HDR,
QEMU_CAPS_MIGRATE_QEMU_TCP,
QEMU_CAPS_MIGRATE_QEMU_EXEC,
QEMU_CAPS_DRIVE_CACHE_V2,
@ -412,7 +408,6 @@ mymain(void)
QEMU_CAPS_DEVICE_E1000,
QEMU_CAPS_DEVICE_VIRTIO_NET);
DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
QEMU_CAPS_VNET_HDR,
QEMU_CAPS_MIGRATE_QEMU_TCP,
QEMU_CAPS_MIGRATE_QEMU_EXEC,
QEMU_CAPS_DRIVE_CACHE_V2,