[libvirt PATCH 1/2] conf: reformat virDomainDefCompatibleDevice for upcoming additional check

Laine Stump laine at redhat.com
Thu Sep 9 17:46:40 UTC 2021


The next patch will add another check similar to the existing check
for a change in alias name. This patch reformats the code in
preparation so that the next patch's purpose will be clear.

Signed-off-by: Laine Stump <laine at redhat.com>
---
 src/conf/domain_conf.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cb9e7218ff..fefc527901 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -28477,13 +28477,14 @@ virDomainDefCompatibleDevice(virDomainDef *def,
         data.oldInfo = virDomainDeviceGetInfo(oldDev);
 
     if (action == VIR_DOMAIN_DEVICE_ACTION_UPDATE &&
-        live &&
-        (data.newInfo && data.oldInfo &&
-         data.newInfo->alias && data.oldInfo->alias &&
-         STRNEQ(data.newInfo->alias, data.oldInfo->alias))) {
-        virReportError(VIR_ERR_OPERATION_DENIED, "%s",
-                       _("changing device alias is not allowed"));
-        return -1;
+        live && data.newInfo && data.oldInfo) {
+
+        if (data.newInfo->alias && data.oldInfo->alias &&
+            STRNEQ(data.newInfo->alias, data.oldInfo->alias)) {
+            virReportError(VIR_ERR_OPERATION_DENIED, "%s",
+                           _("changing device alias is not allowed"));
+            return -1;
+        }
     }
 
     if (!virDomainDefHasUSB(def) &&
-- 
2.31.1




More information about the libvir-list mailing list