Exemple #1
0
 def testGetAll(self):
     """Test VirtualMachine.getAll()"""
     # Make sure we have at least one vm
     machine = VirtualMachine.open(self.testVMpath)
     machine.register()
     vms = VirtualMachine.getAll()
     self.assertTrue(len(vms) > 0)
     self.assertTrue(isinstance(vms[0], VirtualMachine))
     machine.unregister()
Exemple #2
0
 def invoke(cls, args):
     """Invoke the command. Return exit code for program."""
     vms = VirtualMachine.getAll()
     for vm in vms:
         try:
             print vm.name
         except VirtualBoxException as e:
             if verbosityLevel > 1:
                 errorMsg("Unknown machine: %s" % e)
     return 0
Exemple #3
0
 def invoke(cls, args):
     """Invoke the command. Return exit code for program."""
     vms = VirtualMachine.getAll()
     for vm in vms:
         try:
             print vm.name
         except VirtualBoxException as e:
             if verbosityLevel > 1:
                 errorMsg("Unknown machine: %s"%e)
     return 0
Exemple #4
0
 def invoke(cls, args):
     if len(args) == 0:
         vms = VirtualMachine.getAll()
         verboseMsg("Registered VMs:")
         for vm in vms:
             try:
                 print "\t%s" % vm
             except Exception as e:
                 errorMsg("Could not display VM: %s" % str(e))
     else:
         for vmName in args:
             try:
                 vm = VirtualMachine.find(vmName)
                 print_vm(vm)
             except Exception as e:
                 errorMsg("Could not display information about VM \"%s\": %s" % (vmName, str(e)))
Exemple #5
0
 def invoke(cls, args):
     if len(args) == 0:
         vms = VirtualMachine.getAll()
         verboseMsg("Registered VMs:")
         for vm in vms:
             try:
                 print "\t%s" % vm
             except Exception as e:
                 errorMsg("Could not display VM: %s" % str(e))
     else:
         for vmName in args:
             try:
                 vm = VirtualMachine.find(vmName)
                 print_vm(vm)
             except Exception as e:
                 errorMsg(
                     "Could not display information about VM \"%s\": %s" %
                     (vmName, str(e)))