From nobody Sat May 11 10:58:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530037645498230.4584042396707; Tue, 26 Jun 2018 11:27:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7CA330C10E0; Tue, 26 Jun 2018 18:27:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2709130001E9; Tue, 26 Jun 2018 18:27:21 +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 91F0F1800B69; Tue, 26 Jun 2018 18:27:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5QIREgO013857 for ; Tue, 26 Jun 2018 14:27:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8C139CC9; Tue, 26 Jun 2018 18:27:14 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-200.phx2.redhat.com [10.3.116.200]) by smtp.corp.redhat.com (Postfix) with ESMTP id 737A050C7E for ; Tue, 26 Jun 2018 18:27:12 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 26 Jun 2018 14:27:10 -0400 Message-Id: <20180626182710.27214-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] lxc: Rearrange order in lxcDomainUpdateDeviceFlags 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 26 Jun 2018 18:27:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Although commit e3497f3f noted that the LIVE option doesn't matter and removed the call to virDomainDefCompatibleDevice, it didn't go quite far enough and change the order of the checks. Since we don't have the possibility of LIVE succeeding and thus the need for a delayed update in order to write the CONFIG change let's just merge the saving of the config into one if statement. Signed-off-by: John Ferlan --- src/lxc/lxc_driver.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index bde0ff6ad4..6afb36765a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -4862,6 +4862,12 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr d= om, goto endjob; } =20 + if (flags & VIR_DOMAIN_AFFECT_LIVE) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Unable to modify live devices")); + goto endjob; + } + if (flags & VIR_DOMAIN_AFFECT_CONFIG) { /* Make a copy for updated domain. */ vmdef =3D virDomainObjCopyPersistentDef(vm, caps, driver->xmlopt); @@ -4872,17 +4878,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr d= om, * device we're going to update. */ if ((ret =3D lxcDomainUpdateDeviceConfig(vmdef, dev)) < 0) goto endjob; - } - - if (flags & VIR_DOMAIN_AFFECT_LIVE) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("Unable to modify live devices")); - - goto endjob; - } =20 - /* Finally, if no error until here, we can save config. */ - if (flags & VIR_DOMAIN_AFFECT_CONFIG) { ret =3D virDomainSaveConfig(cfg->configDir, driver->caps, vmdef); if (!ret) { virDomainObjAssignDef(vm, vmdef, false, NULL); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list