corrections in vmmanager.py
authormb
Wed, 04 Dec 2013 18:01:06 +0100
changeset 1127aa3b16eebb
parent 10 67b71eb218aa
child 12 11dc05750aea
child 13 4457d7071a23
corrections in vmmanager.py
server/vmmanager/vmmanager.py
server/windows/USBEventSvc/USBEventSvc.sdf
server/windows/USBEventSvc/USBEventSvc.v12.suo
     1.1 --- a/server/vmmanager/vmmanager.py	Wed Dec 04 15:00:32 2013 +0100
     1.2 +++ b/server/vmmanager/vmmanager.py	Wed Dec 04 18:01:06 2013 +0100
     1.3 @@ -74,8 +74,8 @@
     1.4      
     1.5      #list the hostonly IFs exposed by the VBox host
     1.6      def getHostOnlyIFs(self):
     1.7 -        cmd = ['VBoxManage list hostonlyifs']
     1.8 -        result = self.execute(cmd)
     1.9 +        cmd = 'VBoxManage list hostonlyifs'
    1.10 +        result = self.execute(cmd)[1]
    1.11          if result=='':
    1.12              return None
    1.13          props = dict((k.strip(),v.strip().strip('"')) for k,v in (line.split(':', 1) for line in result.strip().splitlines()))
    1.14 @@ -107,7 +107,7 @@
    1.15      # list all existing VMs registered with VBox
    1.16      def listVM(self):
    1.17          cmd = 'VBoxManage list vms'
    1.18 -        result = self.execute(cmd)
    1.19 +        result = self.execute(cmd)[1]
    1.20          vms = list(k.strip().strip('"') for k,_ in (line.split(' ') for line in result.splitlines()))
    1.21          return vms
    1.22      
    1.23 @@ -153,17 +153,17 @@
    1.24          cmd = 'vboxmanage dhcpserver modify --ifname \"VirtualBox Host-Only Ethernet Adapter\" --ip 192.168.56.1 --netmask 255.255.255.0 --lowerip 192.168.56.100 --upperip 192.168.56.255'
    1.25          self.execute(cmd)
    1.26      
    1.27 -    #create new virtual machine instance based on template vm named SecurityVM (\SecurityVM\SecurityVM.vdi)
    1.28 +    #create new virtual machine instance based on template vm named SecurityDVM (\SecurityDVM\SecurityDVM.vmdk)
    1.29      def createVM(self, vm_name):
    1.30          hostonly_if = self.getHostOnlyIFs()
    1.31          machineFolder = self.getDefaultMachineFolder()
    1.32 -        cmd = 'VBoxManage createvm --name ' + vm_name, ' --ostype Debian --register'
    1.33 +        cmd = 'VBoxManage createvm --name ' + vm_name + ' --ostype Debian --register'
    1.34          self.execute(cmd)
    1.35 -        cmd = 'VBoxManage modifyvm ' + vm_name + ' --memory 512 --vram 10 --cpus 1 --usb on --usbehci on --nic1 hostonly --hostonlyadapter1 ' + hostonly_if['Name'] + ' --nic2 nat' 
    1.36 +        cmd = 'VBoxManage modifyvm ' + vm_name + ' --memory 512 --vram 10 --cpus 1 --usb on --usbehci on --nic1 hostonly --hostonlyadapter1 \"' + hostonly_if['Name'] + '\" --nic2 nat' 
    1.37          self.execute(cmd)
    1.38 -        cmd = 'VBoxManage storagectl ' + vm_name + ' --name contr1 --add sata --sataportcount 2'
    1.39 +        cmd = 'VBoxManage storagectl ' + vm_name + ' --name contr1 --add sata --portcount 2'
    1.40          self.execute(cmd)
    1.41 -        cmd = 'VBoxManage storageattach ' + vm_name + ' --storagectl contr1 --port 0 --device 0 --type hdd --mtype normal --medium '+ machineFolder + '\SecurityVM\SecurityVM.vdi'
    1.42 +        cmd = 'VBoxManage storageattach ' + vm_name + ' --storagectl contr1 --port 0 --device 0 --type hdd --mtype normal --medium \"'+ machineFolder + '\SecurityDVM\SecurityDVM.vmdk\"'
    1.43          self.execute(cmd)
    1.44          return
    1.45      
    1.46 @@ -301,9 +301,12 @@
    1.47      man.cygwin_path = 'c:\\cygwin64\\bin\\'
    1.48      #man.handleDeviceChange()
    1.49      #print man.listSDVM()
    1.50 -    man.configureHostNetworking()
    1.51 -    vm_name = "SecurityDVM0"
    1.52 -    man.genCertificateISO(vm_name)
    1.53 +    #man.configureHostNetworking()
    1.54 +    new_vm = man.generateSDVMName()
    1.55 +    man.createVM(new_vm)
    1.56 +    man.genCertificateISO(new_vm)
    1.57 +    man.attachCertificateISO(new_vm)
    1.58 +    
    1.59      #man.attachCertificateISO(vm_name)
    1.60      #man.sshGuestExecute(vm_name, "ls")
    1.61      #man.sshGuestX11Execute(vm_name, "iceweasel")
     2.1 Binary file server/windows/USBEventSvc/USBEventSvc.sdf has changed
     3.1 Binary file server/windows/USBEventSvc/USBEventSvc.v12.suo has changed