[PATCH 2/5] snapshot: remote protocol for getparent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mostly straight-forward, although this is the first API that
returns a new snapshot based on a snapshot rather than a domain.

* src/remote/remote_protocol.x
(REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT): New rpc.
(remote_domain_snapshot_get_parent_args)
(remote_domain_snapshot_get_parent_ret): New structs.
* src/rpc/gendispatch.pl: Adjust generator.
* src/remote/remote_driver.c (remote_driver): Use it.
* src/remote_protocol-structs: Update.
---
 src/remote/remote_driver.c   |    1 +
 src/remote/remote_protocol.x |   12 +++++++++++-
 src/remote_protocol-structs  |    8 ++++++++
 src/rpc/gendispatch.pl       |    4 +++-
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 1217d94..740dd75 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -4412,6 +4412,7 @@ static virDriver remote_driver = {
     .domainSnapshotListNames = remoteDomainSnapshotListNames, /* 0.8.0 */
     .domainSnapshotLookupByName = remoteDomainSnapshotLookupByName, /* 0.8.0 */
     .domainHasCurrentSnapshot = remoteDomainHasCurrentSnapshot, /* 0.8.0 */
+    .domainSnapshotGetParent = remoteDomainSnapshotGetParent, /* 0.9.7 */
     .domainSnapshotCurrent = remoteDomainSnapshotCurrent, /* 0.8.0 */
     .domainRevertToSnapshot = remoteDomainRevertToSnapshot, /* 0.8.0 */
     .domainSnapshotDelete = remoteDomainSnapshotDelete, /* 0.8.0 */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 455e324..3504e34 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2081,6 +2081,15 @@ struct remote_domain_has_current_snapshot_ret {
     int result;
 };

+struct remote_domain_snapshot_get_parent_args {
+    remote_nonnull_domain_snapshot snap;
+    unsigned int flags;
+};
+
+struct remote_domain_snapshot_get_parent_ret {
+    remote_nonnull_domain_snapshot snap;
+};
+
 struct remote_domain_snapshot_current_args {
     remote_nonnull_domain dom;
     unsigned int flags;
@@ -2509,7 +2518,8 @@ enum remote_procedure {

     REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB = 241, /* skipgen skipgen */
     REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED = 242, /* autogen autogen */
-    REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS = 243 /* skipgen skipgen */
+    REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS = 243, /* skipgen skipgen */
+    REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT = 244 /* autogen autogen */

     /*
      * Notice how the entries are grouped in sets of 10 ?
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 810b19c..53705bf 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1568,6 +1568,13 @@ struct remote_domain_has_current_snapshot_args {
 struct remote_domain_has_current_snapshot_ret {
         int                        result;
 };
+struct remote_domain_snapshot_get_parent_args {
+        remote_nonnull_domain_snapshot snap;
+        u_int                      flags;
+};
+struct remote_domain_snapshot_get_parent_ret {
+        remote_nonnull_domain_snapshot snap;
+};
 struct remote_domain_snapshot_current_args {
         remote_nonnull_domain      dom;
         u_int                      flags;
@@ -1958,4 +1965,5 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB = 241,
         REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED = 242,
         REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS = 243,
+        REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT = 244,
 };
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index fcd1a26..039d785 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -1273,7 +1273,9 @@ elsif ($opt_k) {
                         $single_ret_type = "int";
                     } else {
                         if ($name eq "domain_snapshot") {
-                            push(@ret_list, "rv = get_nonnull_$name(dom, ret.$arg_name);");
+                            my $dom = "$priv_src";
+                            $dom =~ s/->conn//;
+                            push(@ret_list, "rv = get_nonnull_$name($dom, ret.$arg_name);");
                         } else {
                             push(@ret_list, "rv = get_nonnull_$name($priv_src, ret.$arg_name);");
                         }
-- 
1.7.4.4

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]