[virt-tools-list] [libosinfo 04/11] loader: Parse OsinfoInstallConfigParam::value-map from XML

Christophe Fergeau cfergeau at redhat.com
Mon Dec 10 16:46:00 UTC 2012


---
 data/schemas/libosinfo.rng           | 3 +++
 osinfo/osinfo_install_config_param.h | 5 +++--
 osinfo/osinfo_loader.c               | 7 +++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/data/schemas/libosinfo.rng b/data/schemas/libosinfo.rng
index 51b0c20..4094710 100644
--- a/data/schemas/libosinfo.rng
+++ b/data/schemas/libosinfo.rng
@@ -519,6 +519,9 @@
                 <attribute name="policy">
                   <ref name='policies'/>
                 </attribute>
+                <optional>
+                  <attribute name="value-map"/>
+                </optional>
               </element>
             </oneOrMore>
           </element>
diff --git a/osinfo/osinfo_install_config_param.h b/osinfo/osinfo_install_config_param.h
index ba5a77c..b0f2217 100644
--- a/osinfo/osinfo_install_config_param.h
+++ b/osinfo/osinfo_install_config_param.h
@@ -37,8 +37,9 @@
 #define OSINFO_IS_INSTALL_CONFIG_PARAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_INSTALL_CONFIG_PARAM))
 #define OSINFO_INSTALL_CONFIG_PARAM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_INSTALL_CONFIG_PARAM, OsinfoInstallConfigParamClass))
 
-#define OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME   "name"
-#define OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY "policy"
+#define OSINFO_INSTALL_CONFIG_PARAM_PROP_DATAMAP "value-map"
+#define OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME    "name"
+#define OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY  "policy"
 
 typedef struct _OsinfoInstallConfigParam        OsinfoInstallConfigParam;
 typedef struct _OsinfoInstallConfigParamClass   OsinfoInstallConfigParamClass;
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index f4918a8..c79304f 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -663,12 +663,19 @@ static void osinfo_loader_install_config_params(OsinfoLoader *loader,
     for (i = 0 ; i < nnodes ; i++) {
         gchar *name = (gchar *)xmlGetProp(nodes[i], BAD_CAST OSINFO_INSTALL_CONFIG_PARAM_PROP_NAME);
         gchar *policy = (gchar *)xmlGetProp(nodes[i], BAD_CAST OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY);
+        gchar *mapid = (gchar *)xmlGetProp(nodes[i], BAD_CAST OSINFO_INSTALL_CONFIG_PARAM_PROP_DATAMAP);
         OsinfoInstallConfigParam *param = osinfo_install_config_param_new(name);
         osinfo_entity_set_param(OSINFO_ENTITY(param),
                                 OSINFO_INSTALL_CONFIG_PARAM_PROP_POLICY,
                                 policy);
         osinfo_install_script_add_config_param(OSINFO_INSTALL_SCRIPT(entity),
                                                param);
+        if (mapid != NULL) {
+            OsinfoDatamap *map;
+            map = osinfo_loader_get_datamap(loader, mapid);
+            if (map != NULL)
+                osinfo_install_config_param_set_value_map(param, map);
+        }
 
         xmlFree(name);
         xmlFree(policy);
-- 
1.8.0.1




More information about the virt-tools-list mailing list