From nobody Thu Apr 25 22:39:45 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=1565345755; cv=none; d=zoho.com; s=zohoarc; b=nTVepUnRXGP1oEM6a152l4qr7Bm9qRZT//Ou/MYg69xqc8W7PwwCcuFYQZwJxoaZUKwaNeCUagncH1OWQPdB5IWW6JpMQOCt1n3taO4E7whUhlrxb4vM6AQkwNvtCSGSHbTTWCyxHWedd/F7/+vYwlQ4owxmhkR6VIP7Ki8x35g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565345755; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=wS/mccSzXP309oU0cDi0pgQt6eQVGtXYgZDJ0cl/bWg=; b=imeKaopwBThQN5YMW1rLwL9xvFiWPCbfxwKeJDbjakQLd/1rDiixdwD2yPk5SHkykfz4Ikc08JxcwYIkRdmwF9febBgKYma47cUs8WEgW1bwyoDtBY5Duw9bcnmVU7VF2cH3YVHxRLaWSgvHL0PLVXfIA0XR6GpuDyJg9OSD+MQ= 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 1565345755681503.32597482118854; Fri, 9 Aug 2019 03:15:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FD5F30C5859; Fri, 9 Aug 2019 10:15:54 +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 EE270600CC; Fri, 9 Aug 2019 10:15:53 +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 629D22551B; Fri, 9 Aug 2019 10:15:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x79AFqMd024997 for ; Fri, 9 Aug 2019 06:15:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C1155D9DC; Fri, 9 Aug 2019 10:15:52 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 730B65D9D3; Fri, 9 Aug 2019 10:15:48 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Fri, 9 Aug 2019 12:15:43 +0200 Message-Id: <618fa97a0bb0c193df72e39d13dfb4174b0f1a8b.1565345731.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: stefanb@linux.ibm.com Subject: [libvirt] [PATCH] Revert "tpm: Check TPM XML device configuration changes after edit" 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 09 Aug 2019 10:15:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Redefining a domain via virDomainDefineXML should not give different results based on an already existing definition. Also, there's a crasher somewhere in the code: https://bugzilla.redhat.com/show_bug.cgi?id=3D1739338 This reverts commit 94b3aa55f83ada33a9fdda66068d58ef1a56c0a5 Reviewed-by: Jiri Denemark --- src/conf/domain_conf.c | 56 --------------------------------------- src/conf/domain_conf.h | 3 --- src/libvirt_private.syms | 1 - src/qemu/qemu_driver.c | 28 -------------------- src/qemu/qemu_extdevice.c | 2 +- src/qemu/qemu_extdevice.h | 3 --- 6 files changed, 1 insertion(+), 92 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0456369d55..f54acd0c2a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31461,59 +31461,3 @@ virDomainGraphicsNeedsAutoRenderNode(const virDoma= inGraphicsDef *graphics) =20 return true; } - - -static int -virDomainCheckTPMChanges(virDomainDefPtr def, - virDomainDefPtr newDef) -{ - bool oldEnc, newEnc; - - if (!def->tpm) - return 0; - - switch (def->tpm->type) { - case VIR_DOMAIN_TPM_TYPE_EMULATOR: - if (virFileExists(def->tpm->data.emulator.storagepath)) { - /* VM has been started */ - /* Once a VM was started with an encrypted state we allow - * less configuration changes. - */ - oldEnc =3D def->tpm->data.emulator.hassecretuuid; - if (oldEnc && def->tpm->type !=3D newDef->tpm->type) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Changing the type of TPM is not allowed"= )); - return -1; - } - if (oldEnc && !newDef->tpm) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Removing an encrypted TPM is not allowed= ")); - return -1; - } - newEnc =3D newDef->tpm->data.emulator.hassecretuuid; - if (oldEnc !=3D newEnc) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("TPM state encryption cannot be changed " - "once VM was started")); - return -1; - } - } - break; - case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH: - case VIR_DOMAIN_TPM_TYPE_LAST: - break; - } - - return 0; -} - - -int -virDomainCheckDeviceChanges(virDomainDefPtr def, - virDomainDefPtr newDef) -{ - if (!def || !newDef) - return 0; - - return virDomainCheckTPMChanges(def, newDef); -} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 57ca2a8ad1..2d7350e675 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3641,6 +3641,3 @@ virDomainGraphicsGetRenderNode(const virDomainGraphic= sDef *graphics); =20 bool virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics); - -int -virDomainCheckDeviceChanges(virDomainDefPtr def, virDomainDefPtr newDef); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cae8febf8d..7a3feb8efa 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -217,7 +217,6 @@ virDomainBootTypeFromString; virDomainBootTypeToString; virDomainCapabilitiesPolicyTypeToString; virDomainCapsFeatureTypeToString; -virDomainCheckDeviceChanges; virDomainChrConsoleTargetTypeFromString; virDomainChrConsoleTargetTypeToString; virDomainChrDefForeach; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ff83d1c024..0fccf3dc37 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -53,7 +53,6 @@ #include "qemu_migration_params.h" #include "qemu_blockjob.h" #include "qemu_security.h" -#include "qemu_extdevice.h" =20 #include "virerror.h" #include "virlog.h" @@ -7760,30 +7759,6 @@ qemuDomainCreate(virDomainPtr dom) return qemuDomainCreateWithFlags(dom, 0); } =20 -static int -qemuDomainCheckDeviceChanges(virQEMUDriverPtr driver, - virDomainDefPtr def) -{ - virDomainObjPtr vm; - int ret; - - vm =3D virDomainObjListFindByUUID(driver->domains, def->uuid); - if (!vm) - return 0; - - if (qemuExtDevicesInitPaths(driver, vm->def) < 0) { - ret =3D -1; - goto cleanup; - } - - ret =3D virDomainCheckDeviceChanges(vm->def, def); - - cleanup: - virDomainObjEndAPI(&vm); - - return ret; -} - static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml, @@ -7820,9 +7795,6 @@ qemuDomainDefineXMLFlags(virConnectPtr conn, if (virDomainDefineXMLFlagsEnsureACL(conn, def) < 0) goto cleanup; =20 - if (qemuDomainCheckDeviceChanges(driver, def) < 0) - goto cleanup; - if (!(vm =3D virDomainObjListAdd(driver->domains, def, driver->xmlopt, 0, &oldDef))) diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index af52466421..dc032aa60c 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -79,7 +79,7 @@ qemuExtDeviceLogCommand(qemuDomainLogContextPtr logCtxt, * stored and we can remove directories and files in case of domain XML * changes. */ -int +static int qemuExtDevicesInitPaths(virQEMUDriverPtr driver, virDomainDefPtr def) { diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h index 5a53c79f38..039b3e60dd 100644 --- a/src/qemu/qemu_extdevice.h +++ b/src/qemu/qemu_extdevice.h @@ -54,6 +54,3 @@ bool qemuExtDevicesHasDevice(virDomainDefPtr def); int qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver, virDomainDefPtr def, virCgroupPtr cgroup); - -int qemuExtDevicesInitPaths(virQEMUDriverPtr driver, - virDomainDefPtr def); --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list