summaryrefslogtreecommitdiff
path: root/morphlib/exts/virtualbox-ssh.write
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-09-05 15:55:28 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-09-05 15:55:28 +0000
commitef6a4743aaaada781685ed6988917f299dbcfcda (patch)
treeefb4ebd14cf8123bc6a20e5c7b2c3fc7351ca035 /morphlib/exts/virtualbox-ssh.write
parentaea1029044b7e0d4578f3896bf85898f33791c89 (diff)
parent19ceccea15e712616b1c5a48339be10fcadba41b (diff)
downloadmorph-ef6a4743aaaada781685ed6988917f299dbcfcda.tar.gz
Merge branch 'baserock/liw/xfer-hole'
Reviewed by various people.
Diffstat (limited to 'morphlib/exts/virtualbox-ssh.write')
-rwxr-xr-xmorphlib/exts/virtualbox-ssh.write19
1 files changed, 14 insertions, 5 deletions
diff --git a/morphlib/exts/virtualbox-ssh.write b/morphlib/exts/virtualbox-ssh.write
index 42585f5e..39ea8f86 100755
--- a/morphlib/exts/virtualbox-ssh.write
+++ b/morphlib/exts/virtualbox-ssh.write
@@ -102,11 +102,20 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
'''Transfer raw disk image to VirtualBox host, and convert to VDI.'''
self.status(msg='Transfer disk and convert to VDI')
- with open(raw_disk, 'rb') as f:
- cliapp.ssh_runcmd(ssh_host,
- ['VBoxManage', 'convertfromraw', 'stdin', vdi_path,
- str(os.path.getsize(raw_disk))],
- stdin=f)
+
+ st = os.lstat(raw_disk)
+ xfer_hole_path = morphlib.util.get_data_path('xfer-hole')
+ recv_hole = morphlib.util.get_data('recv-hole')
+
+ ssh_remote_cmd = [
+ 'sh', '-c', recv_hole,
+ 'dummy-argv0', 'vbox', vdi_path, str(st.st_size),
+ ]
+
+ cliapp.runcmd(
+ ['python', xfer_hole_path, raw_disk],
+ ['ssh', ssh_host] + map(cliapp.shell_quote, ssh_remote_cmd),
+ stdout=None, stderr=None)
def virtualbox_version(self, ssh_host):
'Get the version number of the VirtualBox running on the remote host.'