def start_download(self, dict_changes): new_file_path, path_selected, type_path_selected, pool_id = self.get_file_path( dict_changes) table = dict_changes['table'] id_down = dict_changes['id'] subdir_url = 'storage' # all disk downloads create a desktop url_base = self.url_resources header_dict = {} if len(subdir_url) > 0: url_base = url_base + '/' + subdir_url if dict_changes.get('url-web', False) is not False: url = dict_changes['url-web'] elif dict_changes.get('url-isard', False) is not False: url_isard = dict_changes['url-isard'] url = url_base + '/' + table + '/' + url_isard if len(self.url_code) > 0: header_dict['Authorization'] = self.url_code else: logs.downloads.error(( 'web-url or isard-url must be keys in dictionary for domain {}' + ' to download disk file from internet. ').format(id_down)) exit() if new_file_path in self.finalished_threads: if new_file_path in self.download_threads.keys(): self.download_threads.pop(new_file_path) self.finalished_threads.remove(new_file_path) if table == 'domains': d_update_domain = dict_changes['create_dict'] d_update_domain['hardware']['disks'][0][ 'path_selected'] = path_selected update_domain_dict_create_dict(id_down, d_update_domain) if new_file_path not in self.download_threads: # launching download threads logs.downloads.debug( f'ready tu start DownloadThread --> url:{url} , path:{new_file_path}' ) self.download_threads[new_file_path] = DownloadThread( url, new_file_path, path_selected, table, id_down, header_dict, self.finalished_threads, self.manager, pool_id, type_path_selected) self.download_threads[new_file_path].daemon = True self.download_threads[new_file_path].start() else: logs.downloads.error( 'download thread launched previously to this path: {}'.format( new_file_path))
def run(self): # if self.table == 'domains': # type_path_selected = 'groups' # elif self.table in ['isos']: # type_path_selected = 'isos' # else: # type_path_selected = 'media' # # new_file, path_selected = get_path_to_disk(self.path, pool=self.pool, type_path=type_path_selected) # logs.downloads.debug("PATHS ___________________________________________________________________") # logs.downloads.debug(new_file) # logs.downloads.debug(path_selected) # logs.downloads.debug(pprint.pformat(self.__dict__)) # # hyp_to_disk_create = get_host_disk_operations_from_path(path_selected, pool=self.pool, # type_path=type_path_selected) # hypervisor to launch download command # wait to threads disk_operations are alive time_elapsed = 0 path_selected = self.path_selected while True: if len(self.manager.t_disk_operations) > 0: hyp_to_disk_create = get_host_disk_operations_from_path( path_selected, pool=self.pool_id, type_path=self.type_path_selected) logs.downloads.debug( f'Thread download started to in hypervisor: {hyp_to_disk_create}' ) if self.manager.t_disk_operations.get(hyp_to_disk_create, False) is not False: if self.manager.t_disk_operations[ hyp_to_disk_create].is_alive(): d = get_hyp_hostname_user_port_from_id( hyp_to_disk_create) self.hostname = d['hostname'] self.user = d['user'] self.port = d['port'] break sleep(0.2) time_elapsed += 0.2 if time_elapsed > TIMEOUT_WAITING_HYPERVISOR_TO_DOWNLOAD: logs.downloads.info( f'Timeout ({TIMEOUT_WAITING_HYPERVISOR_TO_DOWNLOAD} sec) waiting hypervisor online to download {url_base}' ) if self.table == 'domains': update_domain_status('DownloadFailed', self.id, detail="downloaded disk") else: update_status_table(self.table, 'DownloadFailed', self.id) self.finalished_threads.append(self.path) return False header_template = "--header '{header_key}: {header_value}' " headers = '' if URL_DOWNLOAD_INSECURE_SSL == True: insecure_option = '--insecure' else: insecure_option = '' dict_header = {} for k, v in self.dict_header.items(): headers += header_template.format(header_key=k, header_value=v) dict_header[k] = v # TEST IF url return an stream of data ok, error_msg = test_url_for_download( self.url, url_download_insecure_ssl=URL_DOWNLOAD_INSECURE_SSL, timeout_time_limit=TIMEOUT_WAITING_HYPERVISOR_TO_DOWNLOAD, dict_header=dict_header) if ok is False: logs.downloads.error(f'URL check failed for url: {self.url}') logs.downloads.error(f'Failed url check reason: {error_msg}') update_status_table(self.table, 'DownloadFailed', self.id, detail=error_msg) return False curl_template = "curl {insecure_option} -L -o '{path}' {headers} '{url}'" ssh_template = """ssh -oBatchMode=yes -p {port} {user}@{hostname} """ \ """ "mkdir -p '{path_dir}'; """ + curl_template + '"' logs.downloads.debug(ssh_template) ssh_command = ssh_template.format(port=self.port, user=self.user, hostname=self.hostname, path=self.path, path_dir=dirname(self.path), headers=headers, url=self.url, insecure_option=insecure_option) logs.downloads.debug("SSH COMMAND: {}".format(ssh_command)) p = subprocess.Popen(ssh_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid) rc = p.poll() update_status_table( self.table, 'Downloading', self.id, "downloading in hypervisor: {}".format(self.hostname)) while rc != 0: header = p.stderr.readline().decode('utf8') header2 = p.stderr.readline().decode('utf8') keys = [ 'total_percent', 'total', 'received_percent', 'received', 'xferd_percent', 'xferd', 'speed_download_average', 'speed_upload_average', 'time_total', 'time_spent', 'time_left', 'speed_current' ] line = "" while True: c = p.stderr.read(1).decode('utf8') if self.stop is True: curl_cmd = curl_template.format( path=self.path, headers=headers, url=self.url, insecure_option=insecure_option) # for pkill curl order is cleaned curl_cmd = curl_cmd.replace("'", "") curl_cmd = curl_cmd.replace(" ", " ") ssh_cmd_kill_curl = """ssh -p {port} {user}@{hostname} "pkill -f \\"^{curl_cmd}\\" " """.format( port=self.port, user=self.user, hostname=self.hostname, curl_cmd=curl_cmd) logs.downloads.info( 'download {} aborted, ready to send ssh kill to curl in hypervisor {}' .format(self.path, self.hostname)) # destroy curl in hypervisor p_kill_curl = subprocess.Popen(ssh_cmd_kill_curl, shell=True) p_kill_curl.wait(timeout=5) # destroy ssh command try: os.killpg(os.getpgid(p.pid), signal.SIGTERM) except Exception as e: logs.downloads.debug( 'ssh process not killed, has finalished') if self.table == 'media': remove_media(self.id) if self.table == 'domains': delete_domain(self.id) # update_status_table(self.table, 'DownloadFailed', self.id, detail="download aborted") return False if not c: break if c == '\r': if len(line) > 60: values = line.split() logs.downloads.debug(self.url) logs.downloads.debug(line) d_progress = dict(zip(keys, values)) try: d_progress['total_percent'] = int( float(d_progress['total_percent'])) d_progress['received_percent'] = int( float(d_progress['received_percent'])) if d_progress['received_percent'] > 1: pass except: d_progress['total_percent'] = 0 d_progress['received_percent'] = 0 update_download_percent(d_progress, self.table, self.id) line = p.stderr.read(60).decode('utf8') else: line = line + c rc = p.poll() if self.stop is True: return False else: logs.downloads.info('File downloaded: {}'.format(self.path)) assert rc == 0 if self.table == 'domains': # update_table_field(self.table, self.id, 'path_downloaded', self.path) d_update_domain = get_domain(self.id)['create_dict'] # d_update_domain = {'hardware': {'disks': [{}]}} d_update_domain['hardware']['disks'][0]['file'] = self.path update_domain_dict_create_dict(self.id, d_update_domain) self.finalished_threads.append(self.path) update_domain_status('Downloaded', self.id, detail="downloaded disk") update_domain_status('Updating', self.id, detail="downloaded disk") else: self.finalished_threads.append(self.path) update_table_field(self.table, self.id, 'path_downloaded', self.path) update_status_table(self.table, 'Downloaded', self.id)
def creating_disk_from_scratch(self, id_new): dict_domain = get_domain(id_new) pool_var = dict_domain['hypervisors_pools'] pool_id = pool_var if type(pool_var) is str else pool_var[0] dict_to_create = dict_domain['create_dict'] if 'disks' in dict_to_create['hardware'].keys(): if len(dict_to_create['hardware']['disks']) > 0: # for index_disk in range(len(dict_to_create['hardware']['disks'])): # relative_path = dict_to_create['hardware']['disks'][index_disk]['file'] # path_new_file, path_selected = get_path_to_disk(relative_path, pool=pool_id) # # UPDATE PATH IN DOMAIN # dict_to_create['hardware']['disks'][index_disk]['file'] = new_file # dict_to_create['hardware']['disks'][index_disk]['path_selected'] = path_selected relative_path = dict_to_create['hardware']['disks'][0]['file'] path_new_disk, path_selected = get_path_to_disk(relative_path, pool=pool_id) # UPDATE PATH IN DOMAIN d_update_domain = {'hardware': {'disks': [{}]}} d_update_domain['hardware']['disks'][0]['file'] = path_new_disk d_update_domain['hardware']['disks'][0][ 'path_selected'] = path_selected update_domain_dict_hardware(id_new, d_update_domain) update_domain_dict_create_dict(id_new, d_update_domain) size_str = dict_to_create['hardware']['disks'][0]['size'] hyp_to_disk_create = get_host_disk_operations_from_path( path_selected, pool=pool_id, type_path='groups') cmds = create_cmd_disk_from_scratch( path_new_disk=path_new_disk, size_str=size_str) action = {} action['type'] = 'create_disk_from_scratch' action['disk_path'] = path_new_disk action['index_disk'] = 0 action['domain'] = id_new action['ssh_commands'] = cmds try: update_domain_status( status='CreatingDiskFromScratch', id_domain=id_new, hyp_id=False, detail= 'Creating disk commands are launched in hypervisor {} ({} operations in queue)' .format( hyp_to_disk_create, self.manager. q_disk_operations[hyp_to_disk_create].qsize())) self.manager.q_disk_operations[hyp_to_disk_create].put( action) except Exception as e: update_domain_status( status='FailedCreatingDomain', id_domain=id_new, hyp_id=False, detail= 'Creating disk operation failed when insert action in queue for disk operations' ) log.error( 'Creating disk operation failed when insert action in queue for disk operations. Exception: {}' .format(e))
def creating_disk_from_scratch(self, id_new): dict_domain = get_domain(id_new) pool_var = dict_domain['hypervisors_pools'] pool_id = pool_var if type(pool_var) is str else pool_var[0] dict_to_create = dict_domain['create_dict'] if 'disks' in dict_to_create['hardware'].keys(): if len(dict_to_create['hardware']['disks']) > 0: # for index_disk in range(len(dict_to_create['hardware']['disks'])): # relative_path = dict_to_create['hardware']['disks'][index_disk]['file'] # path_new_file, path_selected = get_path_to_disk(relative_path, pool=pool_id) # # UPDATE PATH IN DOMAIN # dict_to_create['hardware']['disks'][index_disk]['file'] = new_file # dict_to_create['hardware']['disks'][index_disk]['path_selected'] = path_selected relative_path = dict_to_create['hardware']['disks'][0]['file'] path_new_disk, path_selected = get_path_to_disk(relative_path, pool=pool_id) # UPDATE PATH IN DOMAIN d_update_domain = {'hardware': {'disks': [{}]}} if len(dict_to_create['hardware']['disks']) > 0: ## supplementary disks for i, dict_other_disk in enumerate( dict_to_create['hardware']['disks'][1:]): path_other_disk, path_other_disk_selected = get_path_to_disk( dict_other_disk['file'], pool=pool_id, type_path=dict_other_disk['type_path']) d_update_domain['hardware']['disks'].append({}) d_update_domain['hardware']['disks'][ i + 1]['file'] = path_other_disk d_update_domain['hardware']['disks'][ i + 1]['path_selected'] = path_other_disk_selected d_update_domain['hardware']['disks'][ i + 1]['bus'] = dict_other_disk.get( 'bus', 'virtio') if dict_other_disk.get('readonly', True) is True: d_update_domain['hardware']['disks'][ i + 1]['readonly'] = True else: pass # TODO # update_media_write_access_by_domain(id_media,id_domain) d_update_domain['hardware']['disks'][0]['file'] = path_new_disk d_update_domain['hardware']['disks'][0][ 'path_selected'] = path_selected d_update_domain['hardware']['disks'][0][ 'size'] = dict_to_create['hardware']['disks'][0]['size'] if 'bus' in dict_to_create['hardware']['disks'][0].keys(): if dict_to_create['hardware']['disks'][0][ 'bus'] in BUS_TYPES: d_update_domain['hardware']['disks'][0][ 'bus'] = dict_to_create['hardware']['disks'][0][ 'bus'] update_domain_dict_hardware(id_new, d_update_domain) update_domain_dict_create_dict(id_new, d_update_domain) size_str = dict_to_create['hardware']['disks'][0]['size'] hyp_to_disk_create = get_host_disk_operations_from_path( path_selected, pool=pool_id, type_path='groups') cmds = create_cmd_disk_from_scratch( path_new_disk=path_new_disk, size_str=size_str) action = {} action['type'] = 'create_disk_from_scratch' action['disk_path'] = path_new_disk action['index_disk'] = 0 action['domain'] = id_new action['ssh_commands'] = cmds try: update_domain_status( status='CreatingDiskFromScratch', id_domain=id_new, hyp_id=False, detail= 'Creating disk commands are launched in hypervisor {} ({} operations in queue)' .format( hyp_to_disk_create, self.manager. q_disk_operations[hyp_to_disk_create].qsize())) self.manager.q_disk_operations[hyp_to_disk_create].put( action) except Exception as e: update_domain_status( status='FailedCreatingDomain', id_domain=id_new, hyp_id=False, detail= 'Creating disk operation failed when insert action in queue for disk operations' ) log.error( 'Creating disk operation failed when insert action in queue for disk operations. Exception: {}' .format(e)) else: update_domain_status(status='CreatingDomain', id_domain=id_new, hyp_id=False, detail='Creating domain withouth disks')
def run(self): # if self.table == 'domains': # type_path_selected = 'groups' # elif self.table in ['isos']: # type_path_selected = 'isos' # else: # type_path_selected = 'media' # # new_file, path_selected = get_path_to_disk(self.path, pool=self.pool, type_path=type_path_selected) # logs.downloads.debug("PATHS ___________________________________________________________________") # logs.downloads.debug(new_file) # logs.downloads.debug(path_selected) # logs.downloads.debug(pprint.pformat(self.__dict__)) # # hyp_to_disk_create = get_host_disk_operations_from_path(path_selected, pool=self.pool, # type_path=type_path_selected) header_template = "--header '{header_key}: {header_value}' " headers = '' if URL_DOWNLOAD_INSECURE_SSL == True: insecure_option = '--insecure' else: insecure_option = '' for k, v in self.dict_header.items(): headers += header_template.format(header_key=k, header_value=v) curl_template = "curl {insecure_option} -L -o '{path}' {headers} '{url}'" ssh_template = """ssh -oBatchMode=yes -p {port} {user}@{hostname} """ \ """ "mkdir -p '{path_dir}'; """ + curl_template + '"' logs.downloads.debug(ssh_template) ssh_command = ssh_template.format(port=self.port, user=self.user, hostname=self.hostname, path=self.path, path_dir=dirname(self.path), headers=headers, url=self.url, insecure_option=insecure_option) logs.downloads.debug("SSH COMMAND: {}".format(ssh_command)) p = subprocess.Popen(ssh_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid) rc = p.poll() update_status_table( self.table, 'Downloading', self.id, "downloading in hypervisor: {}".format(self.hostname)) while rc != 0: header = p.stderr.readline().decode('utf8') header2 = p.stderr.readline().decode('utf8') keys = [ 'total_percent', 'total', 'received_percent', 'received', 'xferd_percent', 'xferd', 'speed_download_average', 'speed_upload_average', 'time_total', 'time_spent', 'time_left', 'speed_current' ] line = "" while True: c = p.stderr.read(1).decode('utf8') if self.stop is True: curl_cmd = curl_template.format( path=self.path, headers=headers, url=self.url, insecure_option=insecure_option) #for pkill curl order is cleaned curl_cmd = curl_cmd.replace("'", "") curl_cmd = curl_cmd.replace(" ", " ") ssh_cmd_kill_curl = """ssh -p {port} {user}@{hostname} "pkill -f \\"^{curl_cmd}\\" " """.format( port=self.port, user=self.user, hostname=self.hostname, curl_cmd=curl_cmd) logs.downloads.info( 'download {} aborted, ready to send ssh kill to curl in hypervisor {}' .format(self.path, self.hostname)) #destroy curl in hypervisor p_kill_curl = subprocess.Popen(ssh_cmd_kill_curl, shell=True) p_kill_curl.wait(timeout=5) #destroy ssh command try: os.killpg(os.getpgid(p.pid), signal.SIGTERM) except Exception as e: logs.downloads.debug( 'ssh process not killed, has finalished') if self.table == 'media': remove_media(self.id) if self.table == 'domains': delete_domain(self.id) #update_status_table(self.table, 'FailedDownload', self.id, detail="download aborted") return False if not c: break if c == '\r': if len(line) > 60: logs.downloads.debug(line) values = line.split() logs.downloads.debug(self.url) logs.downloads.debug(line) d_progress = dict(zip(keys, values)) d_progress['total_percent'] = int( float(d_progress['total_percent'])) d_progress['received_percent'] = int( float(d_progress['received_percent'])) update_download_percent(d_progress, self.table, self.id) line = p.stderr.read(60).decode('utf8') else: line = line + c rc = p.poll() if self.stop is True: return False else: logs.downloads.info('File downloaded: {}'.format(self.path)) assert rc == 0 if self.table == 'domains': #update_table_field(self.table, self.id, 'path_downloaded', self.path) d_update_domain = get_domain(self.id)['create_dict'] #d_update_domain = {'hardware': {'disks': [{}]}} d_update_domain['hardware']['disks'][0]['file'] = self.path update_domain_dict_create_dict(self.id, d_update_domain) self.finalished_threads.append(self.path) update_domain_status('Downloaded', self.id, detail="downloaded disk") update_domain_status('Updating', self.id, detail="downloaded disk") else: self.finalished_threads.append(self.path) update_table_field(self.table, self.id, 'path_downloaded', self.path) update_status_table(self.table, 'Downloaded', self.id)
def run(self): # if self.table == 'domains': # type_path_selected = 'groups' # elif self.table in ['isos']: # type_path_selected = 'isos' # else: # type_path_selected = 'media' # # new_file, path_selected = get_path_to_disk(self.path, pool=self.pool, type_path=type_path_selected) # logs.downloads.debug("PATHS ___________________________________________________________________") # logs.downloads.debug(new_file) # logs.downloads.debug(path_selected) # logs.downloads.debug(pprint.pformat(self.__dict__)) # # hyp_to_disk_create = get_host_disk_operations_from_path(path_selected, pool=self.pool, # type_path=type_path_selected) header_template = "--header '{header_key}: {header_value}' " headers = '' for k, v in self.dict_header.items(): headers += header_template.format(header_key=k, header_value=v) ssh_template = """ssh -oBatchMode=yes -p {port} {user}@{hostname} """ \ """ "mkdir -p '{path_dir}'; curl -L -o '{path}' {headers} '{url}' " """ print(ssh_template) ssh_command = ssh_template.format(port=self.port, user=self.user, hostname=self.hostname, path=self.path, path_dir=dirname(self.path), headers=headers, url=self.url) print(ssh_command) logs.downloads.debug("SSH COMMAND: {}".format(ssh_command)) p = subprocess.Popen(ssh_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) rc = p.poll() update_status_table( self.table, 'Downloading', self.id, "downloading in hypervisor: {}".format(self.hostname)) while rc != 0: header = p.stderr.readline().decode('utf8') header2 = p.stderr.readline().decode('utf8') keys = [ 'total_percent', 'total', 'received_percent', 'received', 'xferd_percent', 'xferd', 'speed_download_average', 'speed_upload_average', 'time_total', 'time_spent', 'time_left', 'speed_current' ] line = "" while True: c = p.stderr.read(1).decode('utf8') if self.stop is True: update_domain_status(self.table, 'FailedDownload', id, detail="download aborted") break if not c: break if c == '\r': if len(line) > 60: logs.downloads.debug(line) values = line.split() print(self.url) print(line) d_progress = dict(zip(keys, values)) d_progress['total_percent'] = int( float(d_progress['total_percent'])) d_progress['received_percent'] = int( float(d_progress['received_percent'])) update_download_percent(d_progress, self.table, self.id) line = p.stderr.read(60).decode('utf8') else: line = line + c rc = p.poll() logs.downloads.info('File downloaded: {}'.format(self.path)) assert rc == 0 if self.table == 'domains': #update_table_field(self.table, self.id, 'path_downloaded', self.path) d_update_domain = get_domain(self.id)['create_dict'] #d_update_domain = {'hardware': {'disks': [{}]}} d_update_domain['hardware']['disks'][0]['file'] = self.path update_domain_dict_create_dict(self.id, d_update_domain) self.finalished_threads.append(self.path) update_domain_status('Downloaded', self.id, detail="downloaded disk") update_domain_status('Updating', self.id, detail="downloaded disk") else: self.finalished_threads.append(self.path) update_table_field(self.table, self.id, 'path_downloaded', self.path) update_status_table(self.table, 'Downloaded', self.id)
def creating_disk_from_scratch(self,id_new): dict_domain = get_domain(id_new) pool_var = dict_domain['hypervisors_pools'] pool_id = pool_var if type(pool_var) is str else pool_var[0] dict_to_create = dict_domain['create_dict'] if 'disks' in dict_to_create['hardware'].keys(): if len(dict_to_create['hardware']['disks']) > 0: # for index_disk in range(len(dict_to_create['hardware']['disks'])): # relative_path = dict_to_create['hardware']['disks'][index_disk]['file'] # path_new_file, path_selected = get_path_to_disk(relative_path, pool=pool_id) # # UPDATE PATH IN DOMAIN # dict_to_create['hardware']['disks'][index_disk]['file'] = new_file # dict_to_create['hardware']['disks'][index_disk]['path_selected'] = path_selected relative_path = dict_to_create['hardware']['disks'][0]['file'] path_new_disk, path_selected = get_path_to_disk(relative_path, pool=pool_id) # UPDATE PATH IN DOMAIN d_update_domain = {'hardware':{'disks':[{}]}} if len(dict_to_create['hardware']['disks']) > 0: ## supplementary disks for i,dict_other_disk in enumerate(dict_to_create['hardware']['disks'][1:]): path_other_disk, path_other_disk_selected = get_path_to_disk(dict_other_disk['file'], pool=pool_id, type_path=dict_other_disk['type_path']) d_update_domain['hardware']['disks'].append({}) d_update_domain['hardware']['disks'][i+1]['file'] = path_other_disk d_update_domain['hardware']['disks'][i+1]['path_selected'] = path_other_disk_selected d_update_domain['hardware']['disks'][i + 1]['bus'] = dict_other_disk.get('bus','virtio') if dict_other_disk.get('readonly',True) is True: d_update_domain['hardware']['disks'][i + 1]['readonly'] = True else: pass # TODO # update_media_write_access_by_domain(id_media,id_domain) d_update_domain['hardware']['disks'][0]['file'] = path_new_disk d_update_domain['hardware']['disks'][0]['path_selected'] = path_selected d_update_domain['hardware']['disks'][0]['size'] = dict_to_create['hardware']['disks'][0]['size'] if 'bus' in dict_to_create['hardware']['disks'][0].keys(): if dict_to_create['hardware']['disks'][0]['bus'] in BUS_TYPES: d_update_domain['hardware']['disks'][0]['bus'] = dict_to_create['hardware']['disks'][0]['bus'] update_domain_dict_hardware(id_new, d_update_domain) update_domain_dict_create_dict(id_new, d_update_domain) size_str = dict_to_create['hardware']['disks'][0]['size'] hyp_to_disk_create = get_host_disk_operations_from_path(path_selected, pool=pool_id, type_path='groups') cmds = create_cmd_disk_from_scratch(path_new_disk=path_new_disk, size_str=size_str) action = {} action['type'] = 'create_disk_from_scratch' action['disk_path'] = path_new_disk action['index_disk'] = 0 action['domain'] = id_new action['ssh_commands'] = cmds try: update_domain_status(status='CreatingDiskFromScratch', id_domain=id_new, hyp_id=False, detail='Creating disk commands are launched in hypervisor {} ({} operations in queue)'.format( hyp_to_disk_create, self.manager.q_disk_operations[hyp_to_disk_create].qsize())) self.manager.q_disk_operations[hyp_to_disk_create].put(action) except Exception as e: update_domain_status(status='FailedCreatingDomain', id_domain=id_new, hyp_id=False, detail='Creating disk operation failed when insert action in queue for disk operations') log.error( 'Creating disk operation failed when insert action in queue for disk operations. Exception: {}'.format( e)) else: update_domain_status(status='CreatingDomain', id_domain=id_new, hyp_id=False, detail='Creating domain withouth disks')