From patchwork Sun Oct 9 15:51:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gema Gomez X-Patchwork-Id: 77433 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1166432qge; Mon, 10 Oct 2016 05:07:26 -0700 (PDT) X-Received: by 10.31.130.16 with SMTP id e16mr19482952vkd.158.1476101246865; Mon, 10 Oct 2016 05:07:26 -0700 (PDT) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id u23si9031581uaa.9.2016.10.10.05.07.25 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Oct 2016 05:07:26 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9AC3SAL009480; Mon, 10 Oct 2016 08:03:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u99FpjvS031280 for ; Sun, 9 Oct 2016 11:51:45 -0400 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u99Fpj5g019420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 9 Oct 2016 11:51:45 -0400 Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D70E3B3C5 for ; Sun, 9 Oct 2016 15:51:44 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id l131so80278024lfl.2 for ; Sun, 09 Oct 2016 08:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r3M0rLlwq0mAJIxZY8unLicwN4pgyOX8DNCQ/ykJPSE=; b=Wo8EDhgdmFkAO1IP4G5ccne4lFzJyt9C2yiX8hB5UGQymudGwmTzooJA16VQNJQSjk vbnxxxzXdl3HWAZdp2PQgIerFTHPIvK+HeAOAMZOQwDyU1uAtz3f+wBqINhZ/1btO1m9 573Ttgd9ZuFcOQZjy+qoWSsLViXPztTGZanKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r3M0rLlwq0mAJIxZY8unLicwN4pgyOX8DNCQ/ykJPSE=; b=YzGwXQ40hYAcbBfEQJeHKkY/pBWLVAfyHiAs38MG0D5NpS11zPQu2gid9gqOwU7SL/ dAkDUSLXDnOFCcJv1FX2lst2JStPJraoj2+229ba0rzaCyBpKT07nju7SLH3UrJlToKD VqSw9/LZE1LGSb2vyKdjDCeSE+xJEA4fIzrYvxB8mbrl+UY63gKN7i7e3VJzbIhPrg1T 7iJy0X1G6r6Br0trUDK3N2dxqmzvhNArXgp4plVL5ygjAVZQ7/GwkJDXJxc6A5igB5mV bhyOFBx+rm7u845Y18i3cuZwGhFHEDq7nEa4SqkX6Hw8g/GI6hpG4k+m9oRndxgFtXfN vCjw== X-Gm-Message-State: AA6/9Rn7DER5eZBD06sJxlvEjEcLTrsYVHL6U6ioF58w6I9mJvcptacA57ZI2D7/Qc+oueDX X-Received: by 10.194.236.228 with SMTP id ux4mr23003609wjc.135.1476028300531; Sun, 09 Oct 2016 08:51:40 -0700 (PDT) Received: from gema-pc.home (host109-157-34-4.range109-157.btcentralplus.com. [109.157.34.4]) by smtp.gmail.com with ESMTPSA id lf9sm31593038wjb.22.2016.10.09.08.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Oct 2016 08:51:39 -0700 (PDT) From: Gema Gomez To: libvir-list@redhat.com Date: Sun, 9 Oct 2016 16:51:09 +0100 Message-Id: <20161009155109.10871-2-gema.gomez-solano@linaro.org> In-Reply-To: <20161009155109.10871-1-gema.gomez-solano@linaro.org> References: <20161009155109.10871-1-gema.gomez-solano@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 09 Oct 2016 15:51:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 09 Oct 2016 15:51:44 +0000 (UTC) for IP:'209.85.215.48' DOMAIN:'mail-lf0-f48.google.com' HELO:'mail-lf0-f48.google.com' FROM:'gema.gomez-solano@linaro.org' RCPT:'' X-RedHat-Spam-Score: 0.079 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.215.48 mail-lf0-f48.google.com 209.85.215.48 mail-lf0-f48.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 10 Oct 2016 08:03:26 -0400 Cc: Gema Gomez Subject: [libvirt] [PATCH] qemu: hotplug: support auth for scsi hotplug 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 Add any key objects to qemu when hotplugging a scsi drive with secinfo. Support for this was added in a previous commit for normal drives, but not for SCSI drives. --- src/qemu/qemu_hotplug.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.10.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 72dd93b..a450492 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -601,13 +601,16 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, char *devstr = NULL; bool driveAdded = false; bool encobjAdded = false; + bool secobjAdded = false; char *drivealias = NULL; int ret = -1; int rv; virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virJSONValuePtr encobjProps = NULL; + virJSONValuePtr secobjProps = NULL; qemuDomainDiskPrivatePtr diskPriv; qemuDomainSecretInfoPtr encinfo; + qemuDomainSecretInfoPtr secinfo; if (qemuDomainPrepareDisk(driver, vm, disk, NULL, false) < 0) goto cleanup; @@ -639,6 +642,12 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, goto error; diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); + secinfo = diskPriv->secinfo; + if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) { + if (qemuBuildSecretInfoProps(secinfo, &secobjProps) < 0) + goto error; + } + encinfo = diskPriv->encinfo; if (encinfo && qemuBuildSecretInfoProps(encinfo, &encobjProps) < 0) goto error; @@ -657,6 +666,15 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, qemuDomainObjEnterMonitor(driver, vm); + if (secobjProps) { + rv = qemuMonitorAddObject(priv->mon, "secret", secinfo->s.aes.alias, + secobjProps); + secobjProps = NULL; /* qemuMonitorAddObject consumes */ + if (rv < 0) + goto exit_monitor; + secobjAdded = true; + } + if (encobjProps) { rv = qemuMonitorAddObject(priv->mon, "secret", encinfo->s.aes.alias, encobjProps); @@ -682,6 +700,7 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, ret = 0; cleanup: + virJSONValueFree(secobjProps); virJSONValueFree(encobjProps); qemuDomainSecretDiskDestroy(disk); VIR_FREE(devstr); @@ -696,6 +715,8 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drivealias, drivestr); } + if (secobjAdded) + ignore_value(qemuMonitorDelObject(priv->mon, secinfo->s.aes.alias)); if (encobjAdded) ignore_value(qemuMonitorDelObject(priv->mon, encinfo->s.aes.alias)); if (orig_err) {