From patchwork Wed Jan 23 21:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156404 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1201638jaa; Wed, 23 Jan 2019 13:33:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN6gzfsjUKziJH2orN/VJFlDbuITVsDJ1nPa54c182XE1fpvuGrf/PNB2CqfBNMzNJK3zN2g X-Received: by 2002:ac8:548a:: with SMTP id h10mr4250764qtq.15.1548279222330; Wed, 23 Jan 2019 13:33:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548279222; cv=none; d=google.com; s=arc-20160816; b=bXulo9+Bfv7StdlKI1nMJwSrL/LbimaJ+CYHvG3B+IqO+jK3tvE5+l61CebPXR9NY+ QkENhGXD53rTwJ2Dy3MQyHV+pPl3C/dUERQXRzpnaCuAS5B6UA/F2bhGqdJhWXoIE0Ex Pnk2AObGQh/CtkmJ0aZF6sdRl6hAUOlnIfyaIYNPulX11BSPasEYXsgPqiYDR2IPkT+2 NcFONY1P4yI9y/Rb4ItUi5Y2WkNAF9u5kGuJxOhufkrAhkGW9SoNOkVjZkBxx8bBWOdz oz6X0TdCfHG/gJLwogZTl3NgFs5O6jcRfK7VoNguoKlx/86c6y/sVfUyjwBve1IDsSuc rrng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=NCIsm0cmkwO5I9DF5MnqhQzaJLxn91RkRyb8bOdEYhk=; b=aODfzIvOtx8zXhXP83ejNWS1sPyPoJxuS8B+VtcKh1wTJms5GdY+Tm0PJ61ad8DmRo xE1ZmN8Tb+OUFBzDPvUp5Ov4kM/iBQiqoPuyOAVPlUjJ+kUpWLuKdTP6iayzySHjobf8 MBK9OQ1jtw5FbIkNITfPR8FgF+UBqxlezC2rVUrdCqlc4L51Yj2hakME4czMCO0nG4rc LDuiLTw6E8fYjF0D12eXY21yAICia4M9HNY0qvKUS2qXymHa309ZfHi1/5ClL7DVS8i5 bMGzpk/iizPl0Z5eMU4+JuMxzIQFgKBZBicN5iNXkcBEm+2Y+HSbAECzUFAF5w0nMIgx obtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id u37si4514926qtu.230.2019.01.23.13.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 13:33:42 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCB9719F34; Wed, 23 Jan 2019 21:33:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9380CBA96; Wed, 23 Jan 2019 21:33:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 30BF73F608; Wed, 23 Jan 2019 21:33:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NLXLMX032289 for ; Wed, 23 Jan 2019 16:33:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 321F2BA6D; Wed, 23 Jan 2019 21:33:21 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55FD2BA50; Wed, 23 Jan 2019 21:33:20 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 16:32:34 -0500 Message-Id: <066d7b1e62cd29e74604d00c8a5940bec53e84db.1548278585.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 06/25] qemu: command: Convert vhost-{vsock, scsi} to qemuBuildVirtioDevStr 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 23 Jan 2019 21:33:41 +0000 (UTC) Current code essentially duplicates the same logic, but misses some cases (like vhost-vsock-device). Signed-off-by: Cole Robinson --- src/qemu/qemu_command.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a1d991cefc..2dde4b9125 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4925,10 +4925,8 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, goto cleanup; } - if (dev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) - virBufferAddLit(&buf, "vhost-scsi-ccw"); - else - virBufferAddLit(&buf, "vhost-scsi-pci"); + if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0) + goto cleanup; virBufferAsprintf(&buf, ",wwpn=%s,vhostfd=%s,id=%s", hostsrc->wwpn, @@ -10347,11 +10345,9 @@ qemuBuildVsockDevStr(virDomainDefPtr def, virBuffer buf = VIR_BUFFER_INITIALIZER; char *ret = NULL; - if (vsock->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { - virBufferAddLit(&buf, "vhost-vsock-ccw"); - } else { - virBufferAddLit(&buf, "vhost-vsock-pci"); - } + + if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0) + goto cleanup; virBufferAsprintf(&buf, ",id=%s", vsock->info.alias); virBufferAsprintf(&buf, ",guest-cid=%u", vsock->guest_cid);