Re: [libvirt] [dbus PATCH v2 07/17] Implement Undefine method for Interface Interface

2018-07-24 Thread Katerina Koukiou
On Fri, Jul 20, 2018 at 02:34:51PM -0400, Anya Harter wrote:
> Signed-off-by: Anya Harter 
> ---
>  data/org.libvirt.Interface.xml |  4 
>  src/interface.c| 21 +
>  tests/test_interface.py|  5 +
>  3 files changed, 30 insertions(+)
> 
> diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml
> index f5ec281..4534b97 100644
> --- a/data/org.libvirt.Interface.xml
> +++ b/data/org.libvirt.Interface.xml
> @@ -13,5 +13,9 @@
>  value="See 
> https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy"/>
>
>  
> +
> +   +value="See 
> https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndefine"/>
> +
>
>  
> diff --git a/src/interface.c b/src/interface.c
> index 077b10d..a2d1cef 100644
> --- a/src/interface.c
> +++ b/src/interface.c
> @@ -70,6 +70,26 @@ virtDBusInterfaceDestroy(GVariant *inArgs,
>  virtDBusUtilSetLastVirtError(error);
>  }
>  
> +static void
> +virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSED,
> +  GUnixFDList *inFDs G_GNUC_UNUSED,
> +  const gchar *objectPath,
> +  gpointer userData,
> +  GVariant **outArgs G_GNUC_UNUSED,
> +  GUnixFDList **outFDs G_GNUC_UNUSED,
> +  GError **error)
> +{
> +virtDBusConnect *connect = userData;
> +g_autoptr(virInterface) interface = NULL;
> +
> +interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
> +if (!interface)
> +return;
> +
> +if (virInterfaceUndefine(interface) < 0)
> +virtDBusUtilSetLastVirtError(error);
> +}
> +
>  static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
>  { 0 }
>  };
> @@ -77,6 +97,7 @@ static virtDBusGDBusPropertyTable 
> virtDBusInterfacePropertyTable[] = {
>  static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
>  { "Create", virtDBusInterfaceCreate },
>  { "Destroy", virtDBusInterfaceDestroy },
> +{ "Undefine", virtDBusInterfaceUndefine },
>  { 0 }
>  };
>  
> diff --git a/tests/test_interface.py b/tests/test_interface.py
> index 62fd517..4a83672 100755
> --- a/tests/test_interface.py
> +++ b/tests/test_interface.py
> @@ -7,6 +7,11 @@ class TestInterface(libvirttest.BaseTestClass):
>  """ Tests for methods and properties of the Interface interface
>  """
>  
> +def test_interface_undefine(self):
> +_,interface_obj = self.interface_create()
> +interface_obj.Destroy(0)
> +interface_obj.Undefine(0)

Undefine does not take any flags.

> +
>  def test_interface_destroy(self):
>  _,interface_obj = self.interface_create()
>  interface_obj.Destroy(0)
> -- 
> 2.17.1
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

With the flag argument removed:
Reviewed-by: Katerina Koukiou 



signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [dbus PATCH v2 07/17] Implement Undefine method for Interface Interface

2018-07-20 Thread Anya Harter
Signed-off-by: Anya Harter 
---
 data/org.libvirt.Interface.xml |  4 
 src/interface.c| 21 +
 tests/test_interface.py|  5 +
 3 files changed, 30 insertions(+)

diff --git a/data/org.libvirt.Interface.xml b/data/org.libvirt.Interface.xml
index f5ec281..4534b97 100644
--- a/data/org.libvirt.Interface.xml
+++ b/data/org.libvirt.Interface.xml
@@ -13,5 +13,9 @@
 value="See 
https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy"/>
   
 
+
+  https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndefine"/>
+
   
 
diff --git a/src/interface.c b/src/interface.c
index 077b10d..a2d1cef 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -70,6 +70,26 @@ virtDBusInterfaceDestroy(GVariant *inArgs,
 virtDBusUtilSetLastVirtError(error);
 }
 
+static void
+virtDBusInterfaceUndefine(GVariant *inArgs G_GNUC_UNUSED,
+  GUnixFDList *inFDs G_GNUC_UNUSED,
+  const gchar *objectPath,
+  gpointer userData,
+  GVariant **outArgs G_GNUC_UNUSED,
+  GUnixFDList **outFDs G_GNUC_UNUSED,
+  GError **error)
+{
+virtDBusConnect *connect = userData;
+g_autoptr(virInterface) interface = NULL;
+
+interface = virtDBusInterfaceGetVirInterface(connect, objectPath, error);
+if (!interface)
+return;
+
+if (virInterfaceUndefine(interface) < 0)
+virtDBusUtilSetLastVirtError(error);
+}
+
 static virtDBusGDBusPropertyTable virtDBusInterfacePropertyTable[] = {
 { 0 }
 };
@@ -77,6 +97,7 @@ static virtDBusGDBusPropertyTable 
virtDBusInterfacePropertyTable[] = {
 static virtDBusGDBusMethodTable virtDBusInterfaceMethodTable[] = {
 { "Create", virtDBusInterfaceCreate },
 { "Destroy", virtDBusInterfaceDestroy },
+{ "Undefine", virtDBusInterfaceUndefine },
 { 0 }
 };
 
diff --git a/tests/test_interface.py b/tests/test_interface.py
index 62fd517..4a83672 100755
--- a/tests/test_interface.py
+++ b/tests/test_interface.py
@@ -7,6 +7,11 @@ class TestInterface(libvirttest.BaseTestClass):
 """ Tests for methods and properties of the Interface interface
 """
 
+def test_interface_undefine(self):
+_,interface_obj = self.interface_create()
+interface_obj.Destroy(0)
+interface_obj.Undefine(0)
+
 def test_interface_destroy(self):
 _,interface_obj = self.interface_create()
 interface_obj.Destroy(0)
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list