[Libguestfs] [PATCH 4/4] stub server side mount command

Mo Morsi mmorsi at redhat.com
Fri May 10 12:19:48 UTC 2013


---
 p2v/server/virt-p2v-server.pl | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/p2v/server/virt-p2v-server.pl b/p2v/server/virt-p2v-server.pl
index c15efb2..f9dbc07 100755
--- a/p2v/server/virt-p2v-server.pl
+++ b/p2v/server/virt-p2v-server.pl
@@ -58,6 +58,7 @@ $SIG{'PIPE'} = 'IGNORE';
 use constant MSG_OPTIONS        => 'OPTIONS';
 use constant MSG_METADATA       => 'METADATA';
 use constant MSG_PATH           => 'PATH';
+use constant MSG_MOUNT          => 'MOUNT'
 use constant MSG_CONVERT        => 'CONVERT';
 use constant MSG_LIST_PROFILES  => 'LIST_PROFILES';
 use constant MSG_SET_PROFILE    => 'SET_PROFILE';
@@ -68,6 +69,7 @@ my @MSGS = (
     MSG_METADATA,
     MSG_OPTIONS,
     MSG_PATH,
+    MSG_MOUNT,
     MSG_CONVERT,
     MSG_LIST_PROFILES,
     MSG_SET_PROFILE,
@@ -181,6 +183,13 @@ eval {
             receive_path($path, $length);
         }
 
+        # MOUNT uri disk_type
+        elsif ($type eq MSG_MOUNT) {
+            my $uri = $msg->{args}[1];
+            my $disk_type = $msg->{args}[1];
+            mount_disk($uri, $disk_type);
+        }
+
         # CONVERT
         elsif ($type eq MSG_CONVERT) {
             convert();
@@ -358,6 +367,8 @@ sub convert
                             $_->{dst}->get_path(),
                             $_->{dst}->get_format() ] } @{$meta->{disks}};
 
+        # TODO also add disks stored in $meta->{mounts}
+
         $g = new Sys::VirtConvert::GuestfsHandle(
             \@disks,
             $transferiso,
@@ -411,6 +422,16 @@ sub convert
     p2v_return_ok();
 }
 
+sub mount_disk
+{
+    my ($uri,$disk_type) = @_;
+
+    # TODO create local devices mapped to remote uri
+    #      if nbd use nbd-client, if iscsi use iscsiadm
+    #      store local device paths in $meta->{mounts}
+    p2v_return_ok();
+}
+
 sub unexpected_msg
 {
     my $msg = shift;
-- 
1.7.11.7




More information about the Libguestfs mailing list