Esempio n. 1
0
    def __init__(self, host, bundle_dir, vmcfg, assignment):
        VM.__init__(self, host, bundle_dir, vmcfg, assignment)
        self.machinecfg = OneMachineConfig(vmcfg, self.machine)
        self.one_server = self.machinecfg.get_one_server()
        self.one_credentials = self.machinecfg.get_one_credentials()

        self.vm_id = int(self.machinecfg.get_one_vm_id())
        self.one_vm_hostname = self.machinecfg.get_one_vm_hostname()
        self.vm_username = self.machinecfg.guest_user()
        self.snapshot_id = 0

        # we cannot use the revert mechanism from outside
        asscfg = vmcfg.assignments()
        assert(False == asscfg.revert_to_snapshot(assignment))
Esempio n. 2
0
    def __init__(self, host, bundle_dir, sb_cfg):
        VM.__init__(self, host, bundle_dir, sb_cfg)
        self.machinecfg = OneMachineConfig(sb_cfg, 'Machine')
        self.asscfg = AssignmentConfig(sb_cfg)
        self.one_server = self.machinecfg.get_one_server()
        self.one_credentials = self.machinecfg.get_one_credentials()

        self.vm_id = int(self.machinecfg.get_one_vm_id())
        self.one_vm_hostname = self.machinecfg.get_one_vm_hostname()
        self.vm_username = self.machinecfg.guest_user()
        self.snapshot_id = 0

        # we cannot use the revert mechanism from outside
        assert(False == self.asscfg.revert_to_snapshot('Assignment'))
Esempio n. 3
0
    def __init__(self, host, bundle_dir, sb_cfg):
        VM.__init__(self, host, bundle_dir, sb_cfg)
        self.machinecfg = OneMachineConfig(sb_cfg, 'Machine')
        self.asscfg = AssignmentConfig(sb_cfg)
        self.one_server = self.machinecfg.get_one_server()
        self.one_credentials = self.machinecfg.get_one_credentials()

        self.vm_id = int(self.machinecfg.get_one_vm_id())
        self.one_vm_hostname = self.machinecfg.get_one_vm_hostname()
        self.vm_username = self.machinecfg.guest_user()
        self.snapshot_id = 0

        # we cannot use the revert mechanism from outside
        assert (False == self.asscfg.revert_to_snapshot('Assignment'))
Esempio n. 4
0
 def __init__(self, host, bundle_dir, sb_cfg):
     VM.__init__(self, host, bundle_dir, sb_cfg)
     self.hostname = self.machinecfg.get_vm_path()
Esempio n. 5
0
    def __init__(self, host, bundle_dir, sb_cfg):
        VM.__init__(self, host, bundle_dir, sb_cfg)
        self.machinecfg = VmwareMachineConfig(sb_cfg, 'Machine')
        self.vmwarecfg = VmwareConfig(sb_cfg, 'Tester')
        self.asscfg = AssignmentConfig(config = sb_cfg)
        self.testercfg = TesterConfig(config = sb_cfg)
        self.vmx_path = self.machinecfg.get_vmx_path()
        if self.vmx_path == None:
            self.vmx_path = self.get_submission_vmx_file()
        if self.vmx_path == None:
            # no vmx, nothing to do.
            _logger.error('Could not find a vmx to run')
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Unable to find .vmx file.\n'
            sys.exit(1)

        vmx_prefix = self.testercfg.vm_store_path('Tester')
        if vmx_prefix is not None:
            self.vmx_path = os.path.join(vmx_prefix, self.vmx_path)

        try:
            if self.vmwarecfg.vmware_type() == 3:
                self.vmhost = pyvix.vix.Host()
            elif self.vmwarecfg.vmware_type() == 2 or \
                    self.vmwarecfg.vmware_type() == 10:
                self.vmhost = pyvix.vix.Host(self.vmwarecfg.vmware_type(),
                                  self.vmwarecfg.vmware_url(),
                                  int(self.vmwarecfg.vmware_port()),
                                  self.vmwarecfg.vmware_username(),
                                  self.vmwarecfg.vmware_password())
        except pyvix.vix.VIXException:
            _logger.exception('Exception thrown: ' + type(e).__name__ + "\n" + ", ".join(e.args) + "\n" + e.__str__())
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Connecting to the host Vmware services failed.\n'
            sys.exit(1)

        if self.vmwarecfg.vmware_register_and_unregister():
            self.vmhost.registerVM(self.vmwarecfg.vmware_rel_vmx_path(self.vmx_path))

        vmx_path = self.vmx_path
        if not os.path.isfile(vmx_path):
            vmx_path = self.vmwarecfg.vmware_rel_vmx_path(self.vmx_path)

        if not os.path.isfile(vmx_path):
            # no vmx, nothing to do.
            _logger.error('Could not find a vmx to run')
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Unable to find .vmx file.\n'
            sys.exit(1)

        try:
            self.vminstance = self.vmhost.openVM(vmx_path)
        except pyvix.vix.VIXException:
            _logger.exception('Exception thrown: ' + type(e).__name__ + "\n" + ", ".join(e.args) + "\n" + e.__str__())
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Unable to open the .vmx file..\n'
            sys.exit(1)
Esempio n. 6
0
 def __init__(self, host, bundle_dir, vmcfg, assignment):
     VM.__init__(self, host, bundle_dir, vmcfg, assignment)
     self.hostname = self.machinecfg.get_vmx_path()
     self.path = self.getPath()
     print self.path
Esempio n. 7
0
    def __init__(self, host, bundle_dir, sb_cfg):
        VM.__init__(self, host, bundle_dir, sb_cfg)
        self.machinecfg = VmwareMachineConfig(sb_cfg, 'Machine')
        self.vmwarecfg = VmwareConfig(sb_cfg, 'Tester')
        self.asscfg = AssignmentConfig(config = sb_cfg)
        self.testercfg = TesterConfig(config = sb_cfg)
        self.vmx_path = self.machinecfg.get_vmx_path()
        if self.vmx_path == None:
            self.vmx_path = self.get_submission_vmx_file()
        if self.vmx_path == None:
            # no vmx, nothing to do.
            _logger.error('Could not find a vmx to run')
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Unable to find .vmx file.\n'
            sys.exit(1)

        vmx_prefix = self.testercfg.vm_store_path('Tester')
        if vmx_prefix is not None:
            self.vmx_path = os.path.join(vmx_prefix, self.vmx_path)

        try:
            if self.vmwarecfg.vmware_type() == 3:
                self.vmhost = pyvix.vix.Host()
            elif self.vmwarecfg.vmware_type() == 2 or \
                    self.vmwarecfg.vmware_type() == 10:
                self.vmhost = pyvix.vix.Host(self.vmwarecfg.vmware_type(),
                                  self.vmwarecfg.vmware_url(),
                                  int(self.vmwarecfg.vmware_port()),
                                  self.vmwarecfg.vmware_username(),
                                  self.vmwarecfg.vmware_password())
        except pyvix.vix.VIXException as e:
            _logger.exception('Exception thrown: ' + type(e).__name__ + "\n" + ", ".join(e.args) + "\n" + e.__str__())
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Connecting to the host Vmware services failed.\n'
            sys.exit(1)

        if self.vmwarecfg.vmware_register_and_unregister():
            self.vmhost.registerVM(self.vmwarecfg.vmware_rel_vmx_path(self.vmx_path))

        vmx_path = self.vmx_path
        if not os.path.isfile(vmx_path):
            vmx_path = self.vmwarecfg.vmware_rel_vmx_path(self.vmx_path)

        if not os.path.isfile(vmx_path):
            # no vmx, nothing to do.
            _logger.error('Could not find a vmx to run')
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Unable to find .vmx file.\n'
            sys.exit(1)

        try:
            self.vminstance = self.vmhost.openVM(vmx_path)
        except pyvix.vix.VIXException as e:
            _logger.exception('Exception thrown: ' + type(e).__name__ + "\n" + ", ".join(e.args) + "\n" + e.__str__())
            with open(self.error_fname, 'a') as handler:
                print >> handler, 'Error powering on the virtual machine.\n' + \
                                  'Unable to open the .vmx file..\n'
            sys.exit(1)
Esempio n. 8
0
 def __init__(self, host, bundle_dir, sb_cfg):
     VM.__init__(self, host, bundle_dir, sb_cfg)
     self.hostname = self.machinecfg.get_vm_path()
Esempio n. 9
0
 def __init__(self, host, bundle_dir, vmcfg, assignment):
     VM.__init__(self, host, bundle_dir, vmcfg, assignment)
     self.hostname = self.machinecfg.get_vmx_path()
     self.path = self.getPath()
     print self.path