Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx> --- data/org.libvirt.Domain.xml | 7 +++++++ src/domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/data/org.libvirt.Domain.xml b/data/org.libvirt.Domain.xml index ffb40d1..1d2d760 100644 --- a/data/org.libvirt.Domain.xml +++ b/data/org.libvirt.Domain.xml @@ -136,6 +136,13 @@ <arg name="xml" type="s" direction="in"/> <arg name="flags" type="u" direction="in"/> </method> + <method name="FSFreeze"> + <annotation name="org.gtk.GDBus.DocString" + value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFSFreeze"/> + <arg name="mountpoints" type="as" direction="in"/> + <arg name="flags" type="u" direction="in"/> + <arg name="frozenFilesystems" type="u" direction="out"/> + </method> <method name="FSTrim"> <annotation name="org.gtk.GDBus.DocString" value="See https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFSTrim diff --git a/src/domain.c b/src/domain.c index 5e59094..9a6ff1d 100644 --- a/src/domain.c +++ b/src/domain.c @@ -677,6 +677,46 @@ virtDBusDomainDetachDevice(GVariant *inArgs, virtDBusUtilSetLastVirtError(error); } +static void +virtDBusDomainFSFreeze(GVariant *inArgs, + GUnixFDList *inFDs G_GNUC_UNUSED, + const gchar *objectPath, + gpointer userData, + GVariant **outArgs, + GUnixFDList **outFDs G_GNUC_UNUSED, + GError **error) +{ + virtDBusConnect *connect = userData; + g_autoptr(virDomain) domain = NULL; + g_autofree const gchar **mountpoints = NULL; + const gchar **tmp; + GVariantIter *iter; + gsize nmountpoints = 0; + guint flags; + gint ret; + + g_variant_get(inArgs, "(asu)", &iter, &flags); + + nmountpoints = g_variant_iter_n_children(iter); + if (nmountpoints > 0) { + mountpoints = g_new0(const gchar*, nmountpoints); + tmp = mountpoints; + while (g_variant_iter_loop(iter, "&s", tmp)) + tmp++; + g_variant_iter_free(iter); + } + + domain = virtDBusDomainGetVirDomain(connect, objectPath, error); + if (!domain) + return; + + ret = virDomainFSFreeze(domain, mountpoints, nmountpoints, flags); + if (ret < 0) + return virtDBusUtilSetLastVirtError(error); + + *outArgs = g_variant_new("(u)", ret); +} + static void virtDBusDomainFSTrim(GVariant *inArgs, GUnixFDList *inFDs G_GNUC_UNUSED, @@ -1582,6 +1622,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "DelIOThread", virtDBusDomainDelIOThread }, { "Destroy", virtDBusDomainDestroy }, { "DetachDevice", virtDBusDomainDetachDevice }, + { "FSFreeze", virtDBusDomainFSFreeze }, { "FSTrim", virtDBusDomainFSTrim }, { "GetBlkioParameters", virtDBusDomainGetBlkioParameters }, { "GetJobInfo", virtDBusDomainGetJobInfo }, -- 2.15.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list