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

Katerina Koukiou kkoukiou at redhat.com
Tue Jul 24 09:35:56 UTC 2018


On Fri, Jul 20, 2018 at 02:34:51PM -0400, Anya Harter wrote:
> Signed-off-by: Anya Harter <aharter at redhat.com>
> ---
>  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"/>
>        <arg name="flags" type="u" direction="in"/>
>      </method>
> +    <method name="Undefine">
> +      <annotation name="org.gtk.GDBus.DocString"
> +        value="See https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndefine"/>
> +    </method>
>    </interface>
>  </node>
> 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

With the flag argument removed:
Reviewed-by: Katerina Koukiou <kkoukiou at redhat.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180724/b8eb832d/attachment-0001.sig>


More information about the libvir-list mailing list