[libvirt] [PATCH v4 3/6] libvirt-gconfig: Accept on/off as boolean attributes
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Fri Apr 15 13:38:21 UTC 2016
gvir_config_object_get_attribute_boolean() currently only accepts yes/no
as boolean attribute values. Let's also accept on/off as valid values
too.
This will come handy in a following patch that adds 'hostdev' handling
API.
---
libvirt-gconfig/libvirt-gconfig-object.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..f44cc4c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -690,9 +690,9 @@ gvir_config_object_get_attribute_boolean(GVirConfigObject *object,
const char *str;
str = gvir_config_object_get_attribute(object, node_name, attr_name);
- if (g_strcmp0(str, "yes") == 0) {
+ if (g_strcmp0(str, "yes") == 0 || g_strcmp0(str, "on") == 0) {
return TRUE;
- } else if (g_strcmp0(str, "no") == 0) {
+ } else if (g_strcmp0(str, "no") == 0 || g_strcmp0(str, "off") == 0) {
return FALSE;
} else {
return default_value;
--
2.5.5
More information about the libvir-list
mailing list