From nobody Wed Nov 27 04:42:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1559208930; cv=none; d=zoho.com; s=zohoarc; b=JqvfTQfmqs6FuIFGOsT37FwencUscxfBS/VBNzWgOMVYQgfISNaFL+46qI9V51Tl2K4HdWosnt9MoV/eZZxcVZVKsCK3wOpNE1pItP9F1vlspc66P66cuCfxRDVfvVbI9o0W0LW0l/OBbccjE6sJRA5Tf49WNZwHNufcU19hRRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559208930; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qxoy26Qzhu1/QO4Lj9lBTqgWsFMtj4UeSLe6Wg7y2x8=; b=C9ZjlgXsm+EeGu3uTb2OgONbi3T9NeonYfY8eLum4vt30FIZm51GjfuN89Qd89ctzx8mX75Xq+T4lsr/3AEDZs+ib5ouCTOtSf9PwUysoL6N6GxXgDL2SQwG/gfkDO7b2YnQmcPD1rH/bt1qhESqurZVOY/AwXDjxxM7KCzvBpk= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559208930227476.30749300044556; Thu, 30 May 2019 02:35:30 -0700 (PDT) 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 93D333082263; Thu, 30 May 2019 09:35:23 +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 640D87D5C8; Thu, 30 May 2019 09:35:23 +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 10B67206D2; Thu, 30 May 2019 09:35:23 +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 x4U9YJiZ027526 for ; Thu, 30 May 2019 05:34:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50D4B60C7E; Thu, 30 May 2019 09:34:19 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A99397D536; Thu, 30 May 2019 09:34:18 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 30 May 2019 11:34:03 +0200 Message-Id: <2ef24feb0ad4a04e1df2e92af3793af608bfeaa2.1559208506.git.mprivozn@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 Cc: nshirokovskiy@virtuozzo.com Subject: [libvirt] [PATCH 8/9] lxc: Grab modify job for changing domain XML 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: , Content-Transfer-Encoding: quoted-printable 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.45]); Thu, 30 May 2019 09:35:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The reasoning here is the same as in qemu driver fixed in previous commit. Long story short, changing an XML of a domain requires modify job to be acquired. Signed-off-by: Michal Privoznik --- src/lxc/lxc_domain.c | 3 ++- src/lxc/lxc_driver.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 51a9fd36eb..609cfa6dae 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -93,6 +93,7 @@ virLXCDomainObjBeginJob(virLXCDriverPtr driver ATTRIBUTE_= UNUSED, virLXCDomainObjPrivatePtr priv =3D obj->privateData; unsigned long long now; unsigned long long then; + const char *domName =3D NULLSTR(obj->def ? obj->def->name : NULL); =20 if (virTimeMillisNow(&now) < 0) return -1; @@ -117,7 +118,7 @@ virLXCDomainObjBeginJob(virLXCDriverPtr driver ATTRIBUT= E_UNUSED, VIR_WARN("Cannot start job (%s) for domain %s;" " current job is (%s) owned by (%d)", virLXCDomainJobTypeToString(job), - obj->def->name, + domName, virLXCDomainJobTypeToString(priv->job.active), priv->job.owner); =20 diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index eaf26563f5..2bd1274c90 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -448,6 +448,12 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char= *xml, unsigned int flags) driver->xmlopt, 0))) goto cleanup; =20 + if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) { + if (!vm->persistent) + virDomainObjListRemove(driver->domains, vm); + goto cleanup; + } + virDomainObjAssignDef(vm, def, false, &oldDef); def =3D NULL; vm->persistent =3D 1; @@ -455,7 +461,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char = *xml, unsigned int flags) if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->newDef ? vm->newDef : vm->def) < 0) { virDomainObjListRemove(driver->domains, vm); - goto cleanup; + goto endjob; } =20 event =3D virDomainEventLifecycleNewFromObj(vm, @@ -466,6 +472,9 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char = *xml, unsigned int flags) =20 dom =3D virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); =20 + endjob: + virLXCDomainObjEndJob(driver, vm); + cleanup: virDomainDefFree(def); virDomainDefFree(oldDef); @@ -1196,15 +1205,15 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE))) goto cleanup; =20 + if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) { + if (!vm->persistent) + virDomainObjListRemove(driver->domains, vm); + goto cleanup; + } + virDomainObjAssignDef(vm, def, true, NULL); def =3D NULL; =20 - if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) { - if (!vm->persistent) - virDomainObjListRemove(driver->domains, vm); - goto cleanup; - } - if (virLXCProcessStart(conn, driver, vm, nfiles, files, (flags & VIR_DOMAIN_START_AUTODESTROY), --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list