From patchwork Fri Jan 22 19:30:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 60198 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp51453lbb; Fri, 22 Jan 2016 11:33:32 -0800 (PST) X-Received: by 10.140.22.210 with SMTP id 76mr5877965qgn.70.1453491196512; Fri, 22 Jan 2016 11:33:16 -0800 (PST) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id a126si8550078qkb.100.2016.01.22.11.33.15 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 11:33:16 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUtGL001572; Fri, 22 Jan 2016 14:30:55 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUgsY019897 for ; Fri, 22 Jan 2016 14:30:42 -0500 Received: from colepc.redhat.com (ovpn-113-198.phx2.redhat.com [10.3.113.198]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MJUaPS002518; Fri, 22 Jan 2016 14:30:42 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 22 Jan 2016 14:30:20 -0500 Message-Id: <68be92f5c86549d2f105a2795e013b243474d6f0.1453489952.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/17] qemu: Drop some simple uses of QEMU_CAPS_DEVICE X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com --- src/qemu/qemu_command.c | 82 +++++++++---------------------------------------- 1 file changed, 15 insertions(+), 67 deletions(-) -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dade9f5..594cee6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -471,12 +471,9 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, static bool qemuDomainSupportsNicdev(virDomainDefPtr def, - virQEMUCapsPtr qemuCaps, + virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED, virDomainNetDefPtr net) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - return false; - /* non-virtio ARM nics require legacy -net nic */ if (((def->os.arch == VIR_ARCH_ARMV7L) || (def->os.arch == VIR_ARCH_AARCH64)) && @@ -1185,9 +1182,6 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) } } - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) - return 0; - for (i = 0; i < def->nfss; i++) { if (virAsprintf(&def->fss[i]->info.alias, "fs%zu", i) < 0) return -1; @@ -1873,7 +1867,6 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm, VIR_WARN("Unable to release CCW address on %s", NULLSTR(devstr)); else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) && virDomainPCIAddressReleaseSlot(priv->pciaddrs, &info->addr.pci) < 0) VIR_WARN("Unable to release PCI address on %s", @@ -3734,9 +3727,7 @@ qemuBuildDriveStr(virConnectPtr conn, int busid = -1, unitid = -1; char *source = NULL; int actualType = virStorageSourceGetActualType(disk->src); - bool usesDeviceArg = ( - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && - (disk->bus != VIR_DOMAIN_DISK_BUS_SD)); + bool usesDeviceArg = (disk->bus != VIR_DOMAIN_DISK_BUS_SD); if (idx < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -9632,22 +9623,15 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none"); } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - /* Disable global config files and default devices */ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG)) - virCommandAddArg(cmd, "-no-user-config"); - else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG)) - virCommandAddArg(cmd, "-nodefconfig"); - virCommandAddArg(cmd, "-nodefaults"); - } + /* Disable global config files and default devices */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG)) + virCommandAddArg(cmd, "-no-user-config"); + else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG)) + virCommandAddArg(cmd, "-nodefconfig"); + virCommandAddArg(cmd, "-nodefaults"); /* Serial graphics adapter */ if (def->os.bios.useserial == VIR_TRISTATE_BOOL_YES) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("qemu does not support -device")); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("qemu does not support SGA")); @@ -10233,10 +10217,8 @@ qemuBuildCommandLine(virConnectPtr conn, /* Unfortunately it is not possible to use -device for SD devices. Fortunately, those don't need static PCI addresses, so we don't really care that we can't use -device */ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) - withDeviceArg = true; - } + if (disk->bus != VIR_DOMAIN_DISK_BUS_SD) + withDeviceArg = true; optstr = qemuBuildDriveStr(conn, disk, emitBootindex ? false : !!bootindex, qemuCaps); @@ -10519,8 +10501,7 @@ qemuBuildCommandLine(virConnectPtr conn, char *devstr; /* Use -chardev with -device if they are available */ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV)) { virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(¶llel->source, parallel->info.alias, @@ -10547,8 +10528,7 @@ qemuBuildCommandLine(virConnectPtr conn, switch (channel->targetType) { case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("guestfwd requires QEMU to support -chardev & -device")); goto error; @@ -10569,12 +10549,6 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtio channel requires QEMU to support -device")); - goto error; - } - /* * TODO: Refactor so that we generate this (and onther * things) somewhere else then where we are building the @@ -10622,11 +10596,6 @@ qemuBuildCommandLine(virConnectPtr conn, switch (console->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("sclp console requires QEMU to support -device")); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCLP_S390)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("sclp console requires QEMU to support s390-sclp")); @@ -10646,12 +10615,6 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtio channel requires QEMU to support -device")); - goto error; - } - virCommandAddArg(cmd, "-chardev"); if (!(devstr = qemuBuildChrChardevStr(&console->source, console->info.alias, @@ -10782,8 +10745,7 @@ qemuBuildCommandLine(virConnectPtr conn, const char *dev = qemuDeviceVideoTypeToString(primaryVideoType); if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && - (def->videos[0]->vram || def->videos[0]->ram) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { + (def->videos[0]->vram || def->videos[0]->ram)) { unsigned int ram = def->videos[0]->ram; unsigned int vram = def->videos[0]->vram; unsigned int vgamem = def->videos[0]->vgamem; @@ -10819,8 +10781,7 @@ qemuBuildCommandLine(virConnectPtr conn, } } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && - def->videos[0]->vram && + if (def->videos[0]->vram && ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) || (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA && @@ -10866,11 +10827,6 @@ qemuBuildCommandLine(virConnectPtr conn, } } - } else { - /* If we have -device, then we set -nodefault already */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_NONE)) - virCommandAddArgList(cmd, "-vga", "none", NULL); } /* Add sound hardware */ @@ -11009,13 +10965,6 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, devstr); VIR_FREE(devstr); - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("redirected devices are not supported by this QEMU")); - goto error; - } - - virCommandAddArg(cmd, "-device"); if (!(devstr = qemuBuildRedirdevDevStr(def, redirdev, qemuCaps))) goto error; @@ -11156,8 +11105,7 @@ qemuBuildCommandLine(virConnectPtr conn, /* SCSI */ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) { - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { char *drvstr; virCommandAddArg(cmd, "-drive");