summaryrefslogtreecommitdiff
path: root/morphlib/exts/virtualbox-ssh.write
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/exts/virtualbox-ssh.write')
-rwxr-xr-xmorphlib/exts/virtualbox-ssh.write31
1 files changed, 6 insertions, 25 deletions
diff --git a/morphlib/exts/virtualbox-ssh.write b/morphlib/exts/virtualbox-ssh.write
index 39ea8f86..1b4de89c 100755
--- a/morphlib/exts/virtualbox-ssh.write
+++ b/morphlib/exts/virtualbox-ssh.write
@@ -20,6 +20,8 @@
VirtualBox is assumed to be running on a remote machine, which is
accessed over ssh. The machine gets created, but not started.
+See file virtualbox-ssh.write.help for documentation
+
'''
@@ -36,30 +38,10 @@ import morphlib.writeexts
class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
- '''Create a VirtualBox virtual machine during Morph's deployment.
-
- The location command line argument is the pathname of the disk image
- to be created. The user is expected to provide the location argument
- using the following syntax:
-
- vbox+ssh://HOST/GUEST/PATH
-
- where:
-
- * HOST is the host on which VirtualBox is running
- * GUEST is the name of the guest virtual machine on that host
- * PATH is the path to the disk image that should be created,
- on that host
-
- The extension will connect to HOST via ssh to run VirtualBox's
- command line management tools.
-
- '''
-
def process_args(self, args):
if len(args) != 2:
raise cliapp.AppException('Wrong number of command line args')
-
+
temp_root, location = args
ssh_host, vm_name, vdi_path = self.parse_location(location)
autostart = self.get_environment_boolean('AUTOSTART')
@@ -88,7 +70,7 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
def parse_location(self, location):
'''Parse the location argument to get relevant data.'''
-
+
x = urlparse.urlparse(location)
if x.scheme != 'vbox+ssh':
raise cliapp.AppException(
@@ -169,11 +151,11 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
attach_disks = self.parse_attach_disks()
for device_no, disk in enumerate(attach_disks, 1):
- cmd = ['storageattach', vm_name,
+ cmd = ['storageattach', vm_name,
'--storagectl', 'SATA Controller',
'--port', str(device_no),
'--device', '0',
- '--type', 'hdd',
+ '--type', 'hdd',
'--medium', disk]
commands.append(cmd)
@@ -242,4 +224,3 @@ class VirtualBoxPlusSshWriteExtension(morphlib.writeexts.WriteExtension):
return iface
VirtualBoxPlusSshWriteExtension().run()
-