[libvirt PATCH 04/38] domain_conf: Use virXMLProp(OnOff|YesNo) in virDomainKeyWrapCipherDefParseXML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 47756ff0be..b6e505b384 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1441,10 +1441,9 @@ static int
 virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefPtr keywrap,
                                   xmlNodePtr node)
 {
-    int state_type;
+    virTristateSwitch state_type = VIR_TRISTATE_SWITCH_ABSENT;
     int name_type;
     g_autofree char *name = NULL;
-    g_autofree char *state = NULL;
 
     if (!(name = virXMLPropString(node, "name"))) {
         virReportError(VIR_ERR_CONF_SYNTAX, "%s",
@@ -1458,15 +1457,11 @@ virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefPtr keywrap,
         return -1;
     }
 
-    if (!(state = virXMLPropString(node, "state"))) {
-        virReportError(VIR_ERR_CONF_SYNTAX,
-                       _("missing state for cipher named %s"), name);
+    if (virXMLPropOnOff(node, "state", &state_type) < 0)
         return -1;
-    }
-
-    if ((state_type = virTristateSwitchTypeFromString(state)) < 0) {
+    if (state_type == VIR_TRISTATE_SWITCH_ABSENT) {
         virReportError(VIR_ERR_CONF_SYNTAX,
-                       _("%s is not a supported cipher state"), state);
+                       _("missing state for cipher named %s"), name);
         return -1;
     }
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux