Blob Blame History Raw
From df13becf4eaaa541ba56f0a30dd31a54d7b00e9c Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Thu, 15 Sep 2016 14:56:10 +0200
Subject: [PATCH] Make sure all object paths are passed and extracted as such

The type signature for a DBus object path is "o". Now that the LVM DBus API
properly sets types of its accepted and returned values, we can finally safely
use the signature in all expected places.

(cherry picked from commit e8117786aad76773d96b9a8d977e53077535b9bc)
---
 src/plugins/lvm-dbus.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
index 9500dcb..1276548 100644
--- a/src/plugins/lvm-dbus.c
+++ b/src/plugins/lvm-dbus.c
@@ -711,7 +711,7 @@ static BDLVMPVdata* get_pv_data_from_props (GVariant *props, GError **error) {
     g_variant_dict_lookup (&dict, "PeStart", "t", &(data->pe_start));
 
     /* returns an object path for the VG */
-    g_variant_dict_lookup (&dict, "Vg", "s", &value);
+    g_variant_dict_lookup (&dict, "Vg", "o", &value);
     if (g_strcmp0 (value, "/") == 0) {
         /* no VG, the PV is not part of any VG */
         g_variant_dict_clear (&dict);
@@ -1152,10 +1152,10 @@ gboolean bd_lvm_pvmove (gchar *src, gchar *dest, GError **error) {
         g_free (src_path);
         return FALSE;
     }
-    g_variant_get (prop, "s", &vg_obj_path);
+    g_variant_get (prop, "o", &vg_obj_path);
 
     g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
-    g_variant_builder_add_value (&builder, g_variant_new ("s", src_path));
+    g_variant_builder_add_value (&builder, g_variant_new ("o", src_path));
     g_variant_builder_add_value (&builder, g_variant_new ("(tt)", (guint64) 0, (guint64) 0));
     if (dest) {
         dest_var = g_variant_new ("(ott)", dest_path, (guint64) 0, (guint64) 0);
@@ -2367,7 +2367,7 @@ gboolean bd_lvm_cache_attach (gchar *vg_name, gchar *data_lv, gchar *cache_pool_
     if (!lv_obj_path)
         return FALSE;
     g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
-    g_variant_builder_add_value (&builder, g_variant_new ("s", lv_obj_path));
+    g_variant_builder_add_value (&builder, g_variant_new ("o", lv_obj_path));
     params = g_variant_builder_end (&builder);
     g_variant_builder_clear (&builder);
 
@@ -2476,7 +2476,7 @@ gchar* bd_lvm_cache_pool_name (gchar *vg_name, gchar *cached_lv, GError **error)
     g_free (lv_spec);
     if (!prop)
         return NULL;
-    g_variant_get (prop, "s", &pool_obj_path);
+    g_variant_get (prop, "o", &pool_obj_path);
     prop = get_object_property (pool_obj_path, LV_CMN_INTF, "Name", error);
     g_free (pool_obj_path);
     if (!prop)
@@ -2650,7 +2650,7 @@ gchar* bd_lvm_data_lv_name (gchar *vg_name, gchar *lv_name, GError **error) {
         g_clear_error (error);
         return NULL;
     }
-    g_variant_get (prop, "s", &obj_path);
+    g_variant_get (prop, "o", &obj_path);
     g_variant_unref (prop);
 
     if (g_strcmp0 (obj_path, "/") == 0) {
@@ -2699,7 +2699,7 @@ gchar* bd_lvm_metadata_lv_name (gchar *vg_name, gchar *lv_name, GError **error)
         g_clear_error (error);
         return NULL;
     }
-    g_variant_get (prop, "s", &obj_path);
+    g_variant_get (prop, "o", &obj_path);
     g_variant_unref (prop);
 
     if (g_strcmp0 (obj_path, "/") == 0) {
-- 
2.9.3