From nobody Wed Nov 27 04:45:08 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=1559208939; cv=none; d=zoho.com; s=zohoarc; b=i6Vgi2kMrsOm4j1SWQ09Y60Jp75mIDfkYWXN4yXbixaUPRVPHPZwDWOt4wekj7y8R8Bt9XKyMoFAUieH+BqQbLTzJwk+p/RacTxDmWfqW4oAjlB8eASqmahze5yyC/MmZJBiJhOuppeKuckJuObuG6rMUqckFiF95igqyvudu3k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559208939; 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=pQBH25bxi5HbOAjKpYxLxiWwrf2vnppqr5VmCS+VZYs=; b=Z+wc027gpoRq6RllMWpUWRyLUVfIHAwoR0fEf5rPoypiEQxcDKi8tKZeeFxVfLSlXalxA2MomZsiANg0/uQLI7lpkgQN7uz3kuDV6oWNi9zqRPwChziV0LLQkJc0nD9cp2cCzWaHn/+Iv3vbxpnO3gaMeSj/AXnBoMYaeVrM0Zk= 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 1559208939924644.0190520725727; Thu, 30 May 2019 02:35:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DA902E97D5; Thu, 30 May 2019 09:35:33 +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 05426348F4; Thu, 30 May 2019 09:35:32 +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 AD6981806B0E; Thu, 30 May 2019 09:35:31 +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 x4U9YKrB027534 for ; Thu, 30 May 2019 05:34:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4757B7B001; Thu, 30 May 2019 09:34:20 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D9D960C7E; Thu, 30 May 2019 09:34:19 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 30 May 2019 11:34:04 +0200 Message-Id: <517128acb505d222e65eb19febd24e4e25b1eb86.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 9/9] libxl: 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 30 May 2019 09:35:38 +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/libxl/libxl_domain.c | 3 ++- src/libxl/libxl_driver.c | 34 ++++++++++++++++++++++++---------- src/libxl/libxl_migration.c | 10 ++++------ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 2d8569e592..a2c90f0461 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -115,6 +115,7 @@ libxlDomainObjBeginJob(libxlDriverPrivatePtr driver ATT= RIBUTE_UNUSED, libxlDomainObjPrivatePtr 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; @@ -141,7 +142,7 @@ libxlDomainObjBeginJob(libxlDriverPrivatePtr driver ATT= RIBUTE_UNUSED, VIR_WARN("Cannot start job (%s) for domain %s;" " current job is (%s) owned by (%d)", libxlDomainJobTypeToString(job), - obj->def->name, + domName, libxlDomainJobTypeToString(priv->job.active), priv->job.owner); =20 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 809d298ac1..1bd7148345 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -606,22 +606,29 @@ libxlAddDom0(libxlDriverPrivatePtr driver) 0))) goto cleanup; =20 + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) { + virDomainObjListRemove(driver->domains, vm); + goto cleanup; + } + virDomainObjAssignDef(vm, def, false, &oldDef); def =3D NULL; =20 vm->persistent =3D 1; virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED= ); if (virDomainDefSetVcpusMax(vm->def, d_info.vcpu_max_id + 1, driver->x= mlopt)) - goto cleanup; + goto endjob; =20 if (virDomainDefSetVcpus(vm->def, d_info.vcpu_online) < 0) - goto cleanup; + goto endjob; vm->def->mem.cur_balloon =3D d_info.current_memkb; if (libxlDriverGetDom0MaxmemConf(cfg, &maxmem) < 0) maxmem =3D d_info.current_memkb; virDomainDefSetMemoryTotal(vm->def, maxmem); =20 ret =3D 0; + endjob: + libxlDomainObjEndJob(driver, vm); =20 cleanup: libxl_dominfo_dispose(&d_info); @@ -1035,15 +1042,15 @@ libxlDomainCreateXML(virConnectPtr conn, const char= *xml, VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE))) goto cleanup; =20 - virDomainObjAssignDef(vm, def, true, NULL); - def =3D NULL; - if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) { if (!vm->persistent) virDomainObjListRemove(driver->domains, vm); goto cleanup; } =20 + virDomainObjAssignDef(vm, def, true, NULL); + def =3D NULL; + if (libxlDomainStartNew(driver, vm, (flags & VIR_DOMAIN_START_PAUSED) !=3D 0) < 0) { if (!vm->persistent) @@ -1955,15 +1962,15 @@ libxlDomainRestoreFlags(virConnectPtr conn, const c= har *from, VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE))) goto cleanup; =20 - virDomainObjAssignDef(vm, def, true, NULL); - def =3D NULL; - if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) { if (!vm->persistent) virDomainObjListRemove(driver->domains, vm); goto cleanup; } =20 + virDomainObjAssignDef(vm, def, true, NULL); + def =3D NULL; + ret =3D libxlDomainStartRestore(driver, vm, (flags & VIR_DOMAIN_SAVE_PAUSED) !=3D 0, fd, hdr.version); @@ -2855,16 +2862,20 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const= char *xml, unsigned int flag 0))) goto cleanup; =20 + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) { + virDomainObjListRemove(driver->domains, vm); + goto cleanup; + } + virDomainObjAssignDef(vm, def, false, &oldDef); def =3D NULL; - vm->persistent =3D 1; =20 if (virDomainSaveConfig(cfg->configDir, cfg->caps, vm->newDef ? vm->newDef : vm->def) < 0) { virDomainObjListRemove(driver->domains, vm); - goto cleanup; + goto endjob; } =20 dom =3D virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); @@ -2874,6 +2885,9 @@ libxlDomainDefineXMLFlags(virConnectPtr conn, const c= har *xml, unsigned int flag VIR_DOMAIN_EVENT_DEFINED_ADDED : VIR_DOMAIN_EVENT_DEFINED_UPDATED); =20 + endjob: + libxlDomainObjEndJob(driver, vm); + cleanup: virDomainDefFree(def); virDomainDefFree(oldDef); diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 35403380d0..64bc10bc34 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -571,9 +571,6 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dco= nn, VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE))) goto error; =20 - virDomainObjAssignDef(vm, *def, true, NULL); - *def =3D NULL; - /* * Unless an error is encountered in this function, the job will * be terminated in the finish phase. @@ -581,6 +578,8 @@ libxlDomainMigrationDstPrepareTunnel3(virConnectPtr dco= nn, if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto error; =20 + virDomainObjAssignDef(vm, *def, true, NULL); + *def =3D NULL; priv =3D vm->privateData; =20 if (taint_hook) { @@ -680,9 +679,6 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn, VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE))) goto error; =20 - virDomainObjAssignDef(vm, *def, true, NULL); - *def =3D NULL; - /* * Unless an error is encountered in this function, the job will * be terminated in the finish phase. @@ -690,6 +686,8 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn, if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto error; =20 + virDomainObjAssignDef(vm, *def, true, NULL); + *def =3D NULL; priv =3D vm->privateData; =20 if (taint_hook) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list