Signed-off-by: Tim Wiederhake <twied...@redhat.com>
---
 src/conf/domain_conf.c  | 4 +++-
 src/conf/domain_conf.h  | 2 +-
 src/qemu/qemu_command.c | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 72d5545068..8b2a6dcf58 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14018,12 +14018,14 @@ virDomainShmemDefParseXML(virDomainXMLOption *xmlopt,
     if (def->model != VIR_DOMAIN_SHMEM_MODEL_IVSHMEM) {
         tmp = virXMLPropString(node, "role");
         if (tmp) {
-            if ((def->role = virDomainShmemRoleTypeFromString(tmp)) <= 0) {
+            int role;
+            if ((role = virDomainShmemRoleTypeFromString(tmp)) <= 0) {
                 virReportError(VIR_ERR_XML_ERROR,
                                _("Unknown shmem role type '%s'"), tmp);
                 goto cleanup;
             }
 
+            def->role = role;
             VIR_FREE(tmp);
         }
     }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8afffd2451..581ccb05a9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1956,7 +1956,7 @@ struct _virDomainShmemDef {
     char *name;
     unsigned long long size;
     virDomainShmemModel model;
-    int role; /* enum virDomainShmemRole */
+    virDomainShmemRole role;
     struct {
         bool enabled;
         virDomainChrSourceDef chr;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8fb331eea0..c17e1a987b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9120,7 +9120,7 @@ qemuBuildShmemDevStr(virDomainDef *def,
     } else {
         virBufferAsprintf(&buf, ",memdev=shmmem-%s", shmem->info.alias);
 
-        switch ((virDomainShmemRole) shmem->role) {
+        switch (shmem->role) {
         case VIR_DOMAIN_SHMEM_ROLE_MASTER:
             virBufferAddLit(&buf, ",master=on");
             break;
-- 
2.26.3

Reply via email to