def vm_create(self, vm_name, vm_type = "CernVM", vm_user = "******", vm_networkassoc = "", vm_image = "", vm_mem = 1, vm_cores = 1, vm_storage = 30, customization = None, vm_keepalive = 0, job_proxy_file_path = None, myproxy_creds_name = None, myproxy_server = None, myproxy_server_port = None, job_per_core = False, proxy_non_boot = False, vmimage_proxy_file = None, vmimage_proxy_file_path = None, vm_loc = ''): log.debug("Running new instance with Marketplace id %s in StratusLab" % str(vm_loc)) runner = None if vm_loc not in StratusLabCluster.__idMap: runner = Runner(vm_loc, StratusLabCluster._v_configHolder) #vm_loc: URL of VM or key? Does not seem to matter in Runner (l. 506) StratusLabCluster.__idMap[vm_loc] = runner else: runner = StratusLabCluster.__idMap[vm_loc] try: ids = runner.runInstance() log.debug("Created instances: %s" % str(ids)) #for new_id in ids: new_id = ids[len(ids) - 1] if not vm_keepalive and self.keep_alive: #if job didn't set a keep_alive use the clouds default vm_keepalive = self.keep_alive new_vm = cluster_tools.VM(name = vm_name, id = str(new_id), vmtype = vm_type, user = vm_user, network = vm_networkassoc, image = vm_image, memory = vm_mem, cpucores = vm_cores, storage = vm_storage, keep_alive = vm_keepalive, myproxy_creds_name = myproxy_creds_name, myproxy_server = myproxy_server, myproxy_server_port = myproxy_server_port, job_per_core = job_per_core) StratusLabCluster.__vmMap[str(new_id)] = vm_loc if vm_loc not in self.__runnerIds: self.__runnerIds[vm_loc] = [str(new_id),] else: self.__runnerIds[vm_loc].append(str(new_id)) self.vms.append(new_vm) try: self.resource_checkout(new_vm) except: log.exception("Unexpected error checking out resources when creating a VM. Programming error?") return self.ERROR #endfor return 0 except Exception, e: log.debug("Exception running new instance in StratusLab: %s" %str(e)) #import traceback #traceback.print_exc() return -1
def vm_create(self, vm_name, vm_type="CernVM", vm_user="******", vm_networkassoc="", vm_image="", vm_mem=1, vm_cores=1, vm_storage=30, vm_keepalive=0, myproxy_creds_name=None, myproxy_server=None, myproxy_server_port=None, job_per_core=False, vm_loc=''): self.log.debug( "Running new instance with Marketplace id %s in StratusLab", str(vm_loc)) runner = None if vm_loc not in StratusLabCluster.__idMap: #vm_loc: URL of VM or key? Does not seem to matter in Runner (l.506) runner = Runner(vm_loc, StratusLabCluster._v_configHolder) StratusLabCluster.__idMap[vm_loc] = runner else: runner = StratusLabCluster.__idMap[vm_loc] try: ids = runner.runInstance() self.log.debug("Created instances: %s", str(ids)) #for new_id in ids: new_id = ids[len(ids) - 1] #if job didnt't set a keep_alive use the clouds default if not vm_keepalive and self.keep_alive: vm_keepalive = self.keep_alive new_vm = cluster_tools.VM(name=vm_name, id=str(new_id), vmtype=vm_type, user=vm_user, network=vm_networkassoc, image=vm_image, memory=vm_mem, cpucores=vm_cores, storage=vm_storage, keep_alive=vm_keepalive, myproxy_creds_name=myproxy_creds_name, myproxy_server=myproxy_server, myproxy_server_port=myproxy_server_port, job_per_core=job_per_core) StratusLabCluster.__vmMap[str(new_id)] = vm_loc if vm_loc not in self.__runnerIds: self.__runnerIds[vm_loc] = [ str(new_id), ] else: self.__runnerIds[vm_loc].append(str(new_id)) self.vms.append(new_vm) try: self.resource_checkout(new_vm) except: self.log.exception( "Unexpected error checking out resources when creating a VM." " Programming error?") return self.ERROR #endfor return 0 except Exception, e: self.log.exception( "Exception running new instance in StratusLab: %s", str(e)) return -1
def vm_create(self, vm_name, vm_type="CernVM", vm_user="******", vm_networkassoc="", vm_cpuarch="", vm_image="", vm_mem=1, vm_cores=1, vm_storage=30, customization=None, vm_keepalive=0, job_proxy_file_path=None, myproxy_creds_name=None, myproxy_server=None, myproxy_server_port=None, job_per_core=False, proxy_non_boot=False, vmimage_proxy_file=None, vmimage_proxy_file_path=None, vm_loc=''): log.debug("Running new instance with Marketplace id %s in StratusLab" % str(vm_loc)) runner = None if vm_loc not in StratusLabCluster.__idMap: runner = Runner( vm_loc, StratusLabCluster._v_configHolder ) #vm_loc: URL of VM or key? Does not seem to matter in Runner (l. 506) StratusLabCluster.__idMap[vm_loc] = runner else: runner = StratusLabCluster.__idMap[vm_loc] try: ids = runner.runInstance() log.debug("Created instances: %s" % str(ids)) #for new_id in ids: new_id = ids[len(ids) - 1] new_vm = cluster_tools.VM(name=vm_name, id=str(new_id), vmtype=vm_type, user=vm_user, network=vm_networkassoc, cpuarch=vm_cpuarch, image=vm_image, memory=vm_mem, cpucores=vm_cores, storage=vm_storage, keep_alive=vm_keepalive, myproxy_creds_name=myproxy_creds_name, myproxy_server=myproxy_server, myproxy_server_port=myproxy_server_port, job_per_core=job_per_core) StratusLabCluster.__vmMap[str(new_id)] = vm_loc if vm_loc not in self.__runnerIds: self.__runnerIds[vm_loc] = [ str(new_id), ] else: self.__runnerIds[vm_loc].append(str(new_id)) self.vms.append(new_vm) try: self.resource_checkout(new_vm) except: log.exception( "Unexpected error checking out resources when creating a VM. Programming error?" ) return self.ERROR #endfor return 0 except Exception, e: log.debug("Exception running new instance in StratusLab: %s" % str(e)) #import traceback #traceback.print_exc() return -1