diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e62f505..1da03b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## (2020-01-09) + + +#### Features + +* **Cluster:** + * cluster model ([6e1d45b3](6e1d45b3)) + * terminate and create ([738e2b65](738e2b65)) + ## (2020-01-06) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index 96e5e09a..b9f7453b 100644 --- a/VirtualMachineService/VirtualMachineHandler.py +++ b/VirtualMachineService/VirtualMachineHandler.py @@ -13,7 +13,7 @@ from ttypes import otherException from ttypes import flavorNotFoundException from ttypes import ressourceException - from ttypes import Flavor, Image, VM, PlaybookResult, Backend + from ttypes import Flavor, Image, VM, PlaybookResult, Backend, ClusterInfo from constants import VERSION from ancon.Playbook import Playbook, THEIA, GUACAMOLE @@ -26,7 +26,7 @@ from .ttypes import otherException from .ttypes import flavorNotFoundException from .ttypes import ressourceException - from .ttypes import Flavor, Image, VM, PlaybookResult, Backend + from .ttypes import Flavor, Image, VM, PlaybookResult, Backend, ClusterInfo from .constants import VERSION from .ancon.Playbook import Playbook, THEIA, GUACAMOLE @@ -148,6 +148,16 @@ def __init__(self, config): ] self.AVAIALABILITY_ZONE = cfg["openstack_connection"]["availability_zone"] # try to initialize forc connection + try: + self.BIBIGRID_URL = cfg["bibigrid"]["bibigrid_url"] + self.SUB_NETWORK = cfg["bibigrid"]["sub_network"] + self.logger.info(msg="Bibigrd url loaded: {0}".format(self.BIBIGRID_URL)) + except Exception as e: + self.logger.exception(e) + self.logger.info("Bibigrid not loaded.") + self.BIBIGRID_URL = None + self.SUB_NETWORK = None + try: self.RE_BACKEND_URL = cfg["forc"]["forc_url"] self.FORC_API_KEY = os.environ["FORC_API_KEY"] @@ -749,7 +759,8 @@ def start_server_with_custom_key(self, flavor, image, servername, metadata, disk ).name) if GUACAMOLE in resenv: custom_security_groups.append(self.create_security_group( - name=servername + "_guacamole", resenv=resenv, description="Guacamole", ssh=False + name=servername + "_guacamole", resenv=resenv, description="Guacamole", + ssh=False ).name) try: @@ -763,7 +774,6 @@ def start_server_with_custom_key(self, flavor, image, servername, metadata, disk server_name=servername, metadata=metadata) init_script = self.create_mount_init_script(volume_id=volume_id) - server = self.conn.create_server( name=servername, image=image.id, @@ -855,7 +865,8 @@ def create_backend(self, elixir_id, user_key_url, template, template_version, up self.logger.exception(e) return {} try: - response = req.post(post_url, json=backend_info, timeout=(30, 30), headers={"X-API-KEY": self.FORC_API_KEY}) + response = req.post(post_url, json=backend_info, timeout=(30, 30), + headers={"X-API-KEY": self.FORC_API_KEY}) try: data = response.json() except Exception as e: @@ -947,7 +958,8 @@ def get_backend_by_id(self, id): def delete_backend(self, id): delete_url = "{0}/backends/{1}".format(self.RE_BACKEND_URL, id) try: - response = req.delete(delete_url, timeout=(30, 30), headers={"X-API-KEY": self.FORC_API_KEY}) + response = req.delete(delete_url, timeout=(30, 30), + headers={"X-API-KEY": self.FORC_API_KEY}) if response.status_code != 200: return str(response.json()) elif response.status_code == 200: @@ -990,7 +1002,8 @@ def get_templates_by_template(self, template_name): self.logger.info(msg="create_backend timed out. {0}".format(e)) def check_template(self, template_name, template_version): - get_url = "{0}/templates/{1}/{2}".format(self.RE_BACKEND_URL, template_name, template_version) + get_url = "{0}/templates/{1}/{2}".format(self.RE_BACKEND_URL, template_name, + template_version) try: response = req.get(get_url, timeout=(30, 30), headers={"X-API-KEY": self.FORC_API_KEY}) if response.status_code == 401: @@ -1252,6 +1265,14 @@ def add_security_group_to_server(self, http, https, udp, server_id): return True + def get_servers_by_bibigrid_id(self, bibigrid_id): + filters = {"bibigrid_id": bibigrid_id, "name": bibigrid_id} + servers = self.conn.list_servers(filters=filters) + thrift_servers = [] + for server in servers: + thrift_servers.append(self.openstack_server_to_thrift_server(server)) + return thrift_servers + def get_ip_ports(self, openstack_id): """ Get Ip and Port of the sever. @@ -1281,6 +1302,60 @@ def get_ip_ports(self, openstack_id): ) return {} + def get_cluster_info(self, cluster_id): + headers = {"content-Type": "application/json"} + body = {"mode": "openstack"} + request_url = self.BIBIGRID_URL + 'list' + self.logger.info(request_url) + + response = req.get(url=request_url, json=body, headers=headers, + verify=False) + self.logger.info(response.json()) + infos = response.json()["info"] + for info in infos: + self.logger.info(cluster_id) + self.logger.info(info) + self.logger.info(info["cluster-id"]) + self.logger.info(cluster_id == info["cluster-id"]) + if info["cluster-id"] == cluster_id: + cluster_info = ClusterInfo(launch_date=info["launch date"], + group_id=info["group-id"], + network_id=info["network-id"], + public_ip=info["public-ip"], + subnet_id=info["subnet-id"], + user=info["user"], + inst_counter=info["# inst"], + cluster_id=info["cluster-id"], + key_name=info["key name"]) + self.logger.info("CLuster info : {}".format(cluster_info)) + return cluster_info + + return None + + + def start_cluster(self, public_key, master_instance, worker_instances, user): + master_instance = master_instance.__dict__ + del master_instance['count'] + wI = [] + for wk in worker_instances: + self.logger.info(wk) + wI.append(wk.__dict__) + headers = {"content-Type": "application/json"} + body = {"mode": "openstack", "subnet": self.SUB_NETWORK, "user": user, "sshUser": "ubuntu", + "availabilityZone": self.AVAIALABILITY_ZONE, "masterInstance": master_instance, + "workerInstances": wI} + request_url = self.BIBIGRID_URL + 'create' + response = req.post(url=request_url, json=body, headers=headers, + verify=False) + self.logger.info(response.json()) + return response.json() + + + def terminate_cluster(self, cluster_id): + response = req.delete(url="{}terminate/{}".format(self.BIBIGRID_URL, cluster_id)) + self.logger.info(response.json()) + return response.json() + def create_snapshot(self, openstack_id, name, elixir_id, base_tag, description): """ Create an Snapshot from an server. diff --git a/VirtualMachineService/VirtualMachineServer.py b/VirtualMachineService/VirtualMachineServer.py index 984f38fe..85d2e0e9 100644 --- a/VirtualMachineService/VirtualMachineServer.py +++ b/VirtualMachineService/VirtualMachineServer.py @@ -8,7 +8,8 @@ try: from VirtualMachineService.VirtualMachineHandler import VirtualMachineHandler -except Exception: +except Exception as e: + print(e) from VirtualMachineHandler import VirtualMachineHandler from thrift.transport import TSSLSocket diff --git a/VirtualMachineService/VirtualMachineService-remote b/VirtualMachineService/VirtualMachineService-remote index 5a7dcaa8..2741a6ca 100755 --- a/VirtualMachineService/VirtualMachineService-remote +++ b/VirtualMachineService/VirtualMachineService-remote @@ -56,10 +56,14 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' bool add_security_group_to_server(bool http, bool https, bool udp, string server_id)') print(' get_servers()') print(' get_servers_by_ids( server_ids)') + print(' get_servers_by_bibigrid_id(string bibigrid_id)') + print(' ClusterInfo get_cluster_info(string cluster_id)') print(' VM get_server(string openstack_id)') print(' bool stop_server(string openstack_id)') print(' string create_snapshot(string openstack_id, string name, string elixir_id, string base_tag, string description)') print(' get_limits()') + print(' start_cluster(string public_key, ClusterInstance master_instance, worker_instance, string user)') + print(' terminate_cluster(string cluster_id)') print(' bool delete_image(string image_id)') print(' bool delete_volume_attachment(string volume_id, string server_id)') print(' bool delete_volume(string volume_id)') @@ -340,6 +344,18 @@ elif cmd == 'get_servers_by_ids': sys.exit(1) pp.pprint(client.get_servers_by_ids(eval(args[0]),)) +elif cmd == 'get_servers_by_bibigrid_id': + if len(args) != 1: + print('get_servers_by_bibigrid_id requires 1 args') + sys.exit(1) + pp.pprint(client.get_servers_by_bibigrid_id(args[0],)) + +elif cmd == 'get_cluster_info': + if len(args) != 1: + print('get_cluster_info requires 1 args') + sys.exit(1) + pp.pprint(client.get_cluster_info(args[0],)) + elif cmd == 'get_server': if len(args) != 1: print('get_server requires 1 args') @@ -364,6 +380,18 @@ elif cmd == 'get_limits': sys.exit(1) pp.pprint(client.get_limits()) +elif cmd == 'start_cluster': + if len(args) != 4: + print('start_cluster requires 4 args') + sys.exit(1) + pp.pprint(client.start_cluster(args[0], eval(args[1]), eval(args[2]), args[3],)) + +elif cmd == 'terminate_cluster': + if len(args) != 1: + print('terminate_cluster requires 1 args') + sys.exit(1) + pp.pprint(client.terminate_cluster(args[0],)) + elif cmd == 'delete_image': if len(args) != 1: print('delete_image requires 1 args') diff --git a/VirtualMachineService/VirtualMachineService.py b/VirtualMachineService/VirtualMachineService.py index d4f4008c..5a58e0a5 100644 --- a/VirtualMachineService/VirtualMachineService.py +++ b/VirtualMachineService/VirtualMachineService.py @@ -341,8 +341,8 @@ def get_servers(self): def get_servers_by_ids(self, server_ids): """ - * Get list of servers by ids - * + * Get list of servers by ids + * Parameters: - server_ids @@ -350,6 +350,25 @@ def get_servers_by_ids(self, server_ids): """ pass + def get_servers_by_bibigrid_id(self, bibigrid_id): + """ + * Get servers by bibigrid cluster id. + * + + Parameters: + - bibigrid_id + + """ + pass + + def get_cluster_info(self, cluster_id): + """ + Parameters: + - cluster_id + + """ + pass + def get_server(self, openstack_id): """ Get a Server. @@ -398,6 +417,25 @@ def get_limits(self): """ pass + def start_cluster(self, public_key, master_instance, worker_instance, user): + """ + Parameters: + - public_key + - master_instance + - worker_instance + - user + + """ + pass + + def terminate_cluster(self, cluster_id): + """ + Parameters: + - cluster_id + + """ + pass + def delete_image(self, image_id): """ Delete Image. @@ -1649,8 +1687,8 @@ def recv_get_servers(self): def get_servers_by_ids(self, server_ids): """ - * Get list of servers by ids - * + * Get list of servers by ids + * Parameters: - server_ids @@ -1682,6 +1720,73 @@ def recv_get_servers_by_ids(self): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "get_servers_by_ids failed: unknown result") + def get_servers_by_bibigrid_id(self, bibigrid_id): + """ + * Get servers by bibigrid cluster id. + * + + Parameters: + - bibigrid_id + + """ + self.send_get_servers_by_bibigrid_id(bibigrid_id) + return self.recv_get_servers_by_bibigrid_id() + + def send_get_servers_by_bibigrid_id(self, bibigrid_id): + self._oprot.writeMessageBegin('get_servers_by_bibigrid_id', TMessageType.CALL, self._seqid) + args = get_servers_by_bibigrid_id_args() + args.bibigrid_id = bibigrid_id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_get_servers_by_bibigrid_id(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = get_servers_by_bibigrid_id_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "get_servers_by_bibigrid_id failed: unknown result") + + def get_cluster_info(self, cluster_id): + """ + Parameters: + - cluster_id + + """ + self.send_get_cluster_info(cluster_id) + return self.recv_get_cluster_info() + + def send_get_cluster_info(self, cluster_id): + self._oprot.writeMessageBegin('get_cluster_info', TMessageType.CALL, self._seqid) + args = get_cluster_info_args() + args.cluster_id = cluster_id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_get_cluster_info(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = get_cluster_info_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "get_cluster_info failed: unknown result") + def get_server(self, openstack_id): """ Get a Server. @@ -1835,6 +1940,76 @@ def recv_get_limits(self): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "get_limits failed: unknown result") + def start_cluster(self, public_key, master_instance, worker_instance, user): + """ + Parameters: + - public_key + - master_instance + - worker_instance + - user + + """ + self.send_start_cluster(public_key, master_instance, worker_instance, user) + return self.recv_start_cluster() + + def send_start_cluster(self, public_key, master_instance, worker_instance, user): + self._oprot.writeMessageBegin('start_cluster', TMessageType.CALL, self._seqid) + args = start_cluster_args() + args.public_key = public_key + args.master_instance = master_instance + args.worker_instance = worker_instance + args.user = user + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_start_cluster(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = start_cluster_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "start_cluster failed: unknown result") + + def terminate_cluster(self, cluster_id): + """ + Parameters: + - cluster_id + + """ + self.send_terminate_cluster(cluster_id) + return self.recv_terminate_cluster() + + def send_terminate_cluster(self, cluster_id): + self._oprot.writeMessageBegin('terminate_cluster', TMessageType.CALL, self._seqid) + args = terminate_cluster_args() + args.cluster_id = cluster_id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_terminate_cluster(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = terminate_cluster_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "terminate_cluster failed: unknown result") + def delete_image(self, image_id): """ Delete Image. @@ -2221,10 +2396,14 @@ def __init__(self, handler): self._processMap["add_security_group_to_server"] = Processor.process_add_security_group_to_server self._processMap["get_servers"] = Processor.process_get_servers self._processMap["get_servers_by_ids"] = Processor.process_get_servers_by_ids + self._processMap["get_servers_by_bibigrid_id"] = Processor.process_get_servers_by_bibigrid_id + self._processMap["get_cluster_info"] = Processor.process_get_cluster_info self._processMap["get_server"] = Processor.process_get_server self._processMap["stop_server"] = Processor.process_stop_server self._processMap["create_snapshot"] = Processor.process_create_snapshot self._processMap["get_limits"] = Processor.process_get_limits + self._processMap["start_cluster"] = Processor.process_start_cluster + self._processMap["terminate_cluster"] = Processor.process_terminate_cluster self._processMap["delete_image"] = Processor.process_delete_image self._processMap["delete_volume_attachment"] = Processor.process_delete_volume_attachment self._processMap["delete_volume"] = Processor.process_delete_volume @@ -3052,6 +3231,52 @@ def process_get_servers_by_ids(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_get_servers_by_bibigrid_id(self, seqid, iprot, oprot): + args = get_servers_by_bibigrid_id_args() + args.read(iprot) + iprot.readMessageEnd() + result = get_servers_by_bibigrid_id_result() + try: + result.success = self._handler.get_servers_by_bibigrid_id(args.bibigrid_id) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("get_servers_by_bibigrid_id", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_get_cluster_info(self, seqid, iprot, oprot): + args = get_cluster_info_args() + args.read(iprot) + iprot.readMessageEnd() + result = get_cluster_info_result() + try: + result.success = self._handler.get_cluster_info(args.cluster_id) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("get_cluster_info", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_get_server(self, seqid, iprot, oprot): args = get_server_args() args.read(iprot) @@ -3153,6 +3378,52 @@ def process_get_limits(self, seqid, iprot, oprot): oprot.writeMessageEnd() oprot.trans.flush() + def process_start_cluster(self, seqid, iprot, oprot): + args = start_cluster_args() + args.read(iprot) + iprot.readMessageEnd() + result = start_cluster_result() + try: + result.success = self._handler.start_cluster(args.public_key, args.master_instance, args.worker_instance, args.user) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("start_cluster", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_terminate_cluster(self, seqid, iprot, oprot): + args = terminate_cluster_args() + args.read(iprot) + iprot.readMessageEnd() + result = terminate_cluster_result() + try: + result.success = self._handler.terminate_cluster(args.cluster_id) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("terminate_cluster", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_delete_image(self, seqid, iprot, oprot): args = delete_image_args() args.read(iprot) @@ -8124,16 +8395,16 @@ def __ne__(self, other): ) -class get_server_args(object): +class get_servers_by_bibigrid_id_args(object): """ Attributes: - - openstack_id: Id of the server. + - bibigrid_id """ - def __init__(self, openstack_id=None,): - self.openstack_id = openstack_id + def __init__(self, bibigrid_id=None,): + self.bibigrid_id = bibigrid_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -8146,7 +8417,7 @@ def read(self, iprot): break if fid == 1: if ftype == TType.STRING: - self.openstack_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.bibigrid_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) else: @@ -8158,10 +8429,10 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('get_server_args') - if self.openstack_id is not None: - oprot.writeFieldBegin('openstack_id', TType.STRING, 1) - oprot.writeString(self.openstack_id.encode('utf-8') if sys.version_info[0] == 2 else self.openstack_id) + oprot.writeStructBegin('get_servers_by_bibigrid_id_args') + if self.bibigrid_id is not None: + oprot.writeFieldBegin('bibigrid_id', TType.STRING, 1) + oprot.writeString(self.bibigrid_id.encode('utf-8') if sys.version_info[0] == 2 else self.bibigrid_id) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8179,25 +8450,23 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(get_server_args) -get_server_args.thrift_spec = ( +all_structs.append(get_servers_by_bibigrid_id_args) +get_servers_by_bibigrid_id_args.thrift_spec = ( None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 + (1, TType.STRING, 'bibigrid_id', 'UTF8', None, ), # 1 ) -class get_server_result(object): +class get_servers_by_bibigrid_id_result(object): """ Attributes: - success - - e """ - def __init__(self, success=None, e=None,): + def __init__(self, success=None,): self.success = success - self.e = e def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -8209,15 +8478,14 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRUCT: - self.success = VM() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.e = serverNotFoundException() - self.e.read(iprot) + if ftype == TType.LIST: + self.success = [] + (_etype239, _size236) = iprot.readListBegin() + for _i240 in range(_size236): + _elem241 = VM() + _elem241.read(iprot) + self.success.append(_elem241) + iprot.readListEnd() else: iprot.skip(ftype) else: @@ -8229,14 +8497,13 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('get_server_result') + oprot.writeStructBegin('get_servers_by_bibigrid_id_result') if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.e is not None: - oprot.writeFieldBegin('e', TType.STRUCT, 1) - self.e.write(oprot) + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter242 in self.success: + iter242.write(oprot) + oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8254,23 +8521,22 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(get_server_result) -get_server_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [VM, None], None, ), # 0 - (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +all_structs.append(get_servers_by_bibigrid_id_result) +get_servers_by_bibigrid_id_result.thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT, [VM, None], False), None, ), # 0 ) -class stop_server_args(object): +class get_cluster_info_args(object): """ Attributes: - - openstack_id: Id of the server. + - cluster_id """ - def __init__(self, openstack_id=None,): - self.openstack_id = openstack_id + def __init__(self, cluster_id=None,): + self.cluster_id = cluster_id def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -8283,7 +8549,7 @@ def read(self, iprot): break if fid == 1: if ftype == TType.STRING: - self.openstack_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.cluster_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) else: @@ -8295,10 +8561,10 @@ def write(self, oprot): if oprot._fast_encode is not None and self.thrift_spec is not None: oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) return - oprot.writeStructBegin('stop_server_args') - if self.openstack_id is not None: - oprot.writeFieldBegin('openstack_id', TType.STRING, 1) - oprot.writeString(self.openstack_id.encode('utf-8') if sys.version_info[0] == 2 else self.openstack_id) + oprot.writeStructBegin('get_cluster_info_args') + if self.cluster_id is not None: + oprot.writeFieldBegin('cluster_id', TType.STRING, 1) + oprot.writeString(self.cluster_id.encode('utf-8') if sys.version_info[0] == 2 else self.cluster_id) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8316,25 +8582,23 @@ def __eq__(self, other): def __ne__(self, other): return not (self == other) -all_structs.append(stop_server_args) -stop_server_args.thrift_spec = ( +all_structs.append(get_cluster_info_args) +get_cluster_info_args.thrift_spec = ( None, # 0 - (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 + (1, TType.STRING, 'cluster_id', 'UTF8', None, ), # 1 ) -class stop_server_result(object): +class get_cluster_info_result(object): """ Attributes: - success - - e """ - def __init__(self, success=None, e=None,): + def __init__(self, success=None,): self.success = success - self.e = e def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -8346,14 +8610,277 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.BOOL: - self.success = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 1: if ftype == TType.STRUCT: - self.e = serverNotFoundException() - self.e.read(iprot) + self.success = ClusterInfo() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('get_cluster_info_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(get_cluster_info_result) +get_cluster_info_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [ClusterInfo, None], None, ), # 0 +) + + +class get_server_args(object): + """ + Attributes: + - openstack_id: Id of the server. + + """ + + + def __init__(self, openstack_id=None,): + self.openstack_id = openstack_id + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.openstack_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('get_server_args') + if self.openstack_id is not None: + oprot.writeFieldBegin('openstack_id', TType.STRING, 1) + oprot.writeString(self.openstack_id.encode('utf-8') if sys.version_info[0] == 2 else self.openstack_id) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(get_server_args) +get_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) + + +class get_server_result(object): + """ + Attributes: + - success + - e + + """ + + + def __init__(self, success=None, e=None,): + self.success = success + self.e = e + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = VM() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.e = serverNotFoundException() + self.e.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('get_server_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.e is not None: + oprot.writeFieldBegin('e', TType.STRUCT, 1) + self.e.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(get_server_result) +get_server_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [VM, None], None, ), # 0 + (1, TType.STRUCT, 'e', [serverNotFoundException, None], None, ), # 1 +) + + +class stop_server_args(object): + """ + Attributes: + - openstack_id: Id of the server. + + """ + + + def __init__(self, openstack_id=None,): + self.openstack_id = openstack_id + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.openstack_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('stop_server_args') + if self.openstack_id is not None: + oprot.writeFieldBegin('openstack_id', TType.STRING, 1) + oprot.writeString(self.openstack_id.encode('utf-8') if sys.version_info[0] == 2 else self.openstack_id) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(stop_server_args) +stop_server_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'openstack_id', 'UTF8', None, ), # 1 +) + + +class stop_server_result(object): + """ + Attributes: + - success + - e + + """ + + + def __init__(self, success=None, e=None,): + self.success = success + self.e = e + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.BOOL: + self.success = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.e = serverNotFoundException() + self.e.read(iprot) else: iprot.skip(ftype) else: @@ -8647,11 +9174,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype237, _vtype238, _size236) = iprot.readMapBegin() - for _i240 in range(_size236): - _key241 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - _val242 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.success[_key241] = _val242 + (_ktype244, _vtype245, _size243) = iprot.readMapBegin() + for _i247 in range(_size243): + _key248 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val249 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success[_key248] = _val249 iprot.readMapEnd() else: iprot.skip(ftype) @@ -8668,9 +9195,9 @@ def write(self, oprot): if self.success is not None: oprot.writeFieldBegin('success', TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter243, viter244 in self.success.items(): - oprot.writeString(kiter243.encode('utf-8') if sys.version_info[0] == 2 else kiter243) - oprot.writeString(viter244.encode('utf-8') if sys.version_info[0] == 2 else viter244) + for kiter250, viter251 in self.success.items(): + oprot.writeString(kiter250.encode('utf-8') if sys.version_info[0] == 2 else kiter250) + oprot.writeString(viter251.encode('utf-8') if sys.version_info[0] == 2 else viter251) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -8695,6 +9222,318 @@ def __ne__(self, other): ) +class start_cluster_args(object): + """ + Attributes: + - public_key + - master_instance + - worker_instance + - user + + """ + + + def __init__(self, public_key=None, master_instance=None, worker_instance=None, user=None,): + self.public_key = public_key + self.master_instance = master_instance + self.worker_instance = worker_instance + self.user = user + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.public_key = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.master_instance = ClusterInstance() + self.master_instance.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.worker_instance = [] + (_etype255, _size252) = iprot.readListBegin() + for _i256 in range(_size252): + _elem257 = ClusterInstance() + _elem257.read(iprot) + self.worker_instance.append(_elem257) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.user = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('start_cluster_args') + if self.public_key is not None: + oprot.writeFieldBegin('public_key', TType.STRING, 1) + oprot.writeString(self.public_key.encode('utf-8') if sys.version_info[0] == 2 else self.public_key) + oprot.writeFieldEnd() + if self.master_instance is not None: + oprot.writeFieldBegin('master_instance', TType.STRUCT, 2) + self.master_instance.write(oprot) + oprot.writeFieldEnd() + if self.worker_instance is not None: + oprot.writeFieldBegin('worker_instance', TType.LIST, 3) + oprot.writeListBegin(TType.STRUCT, len(self.worker_instance)) + for iter258 in self.worker_instance: + iter258.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.user is not None: + oprot.writeFieldBegin('user', TType.STRING, 4) + oprot.writeString(self.user.encode('utf-8') if sys.version_info[0] == 2 else self.user) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(start_cluster_args) +start_cluster_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'public_key', 'UTF8', None, ), # 1 + (2, TType.STRUCT, 'master_instance', [ClusterInstance, None], None, ), # 2 + (3, TType.LIST, 'worker_instance', (TType.STRUCT, [ClusterInstance, None], False), None, ), # 3 + (4, TType.STRING, 'user', 'UTF8', None, ), # 4 +) + + +class start_cluster_result(object): + """ + Attributes: + - success + + """ + + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.MAP: + self.success = {} + (_ktype260, _vtype261, _size259) = iprot.readMapBegin() + for _i263 in range(_size259): + _key264 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val265 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success[_key264] = _val265 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('start_cluster_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.MAP, 0) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) + for kiter266, viter267 in self.success.items(): + oprot.writeString(kiter266.encode('utf-8') if sys.version_info[0] == 2 else kiter266) + oprot.writeString(viter267.encode('utf-8') if sys.version_info[0] == 2 else viter267) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(start_cluster_result) +start_cluster_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 +) + + +class terminate_cluster_args(object): + """ + Attributes: + - cluster_id + + """ + + + def __init__(self, cluster_id=None,): + self.cluster_id = cluster_id + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.cluster_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('terminate_cluster_args') + if self.cluster_id is not None: + oprot.writeFieldBegin('cluster_id', TType.STRING, 1) + oprot.writeString(self.cluster_id.encode('utf-8') if sys.version_info[0] == 2 else self.cluster_id) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(terminate_cluster_args) +terminate_cluster_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'cluster_id', 'UTF8', None, ), # 1 +) + + +class terminate_cluster_result(object): + """ + Attributes: + - success + + """ + + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.MAP: + self.success = {} + (_ktype269, _vtype270, _size268) = iprot.readMapBegin() + for _i272 in range(_size268): + _key273 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val274 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success[_key273] = _val274 + iprot.readMapEnd() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('terminate_cluster_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.MAP, 0) + oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) + for kiter275, viter276 in self.success.items(): + oprot.writeString(kiter275.encode('utf-8') if sys.version_info[0] == 2 else kiter275) + oprot.writeString(viter276.encode('utf-8') if sys.version_info[0] == 2 else viter276) + oprot.writeMapEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) +all_structs.append(terminate_cluster_result) +terminate_cluster_result.thrift_spec = ( + (0, TType.MAP, 'success', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 0 +) + + class delete_image_args(object): """ Attributes: @@ -9745,11 +10584,11 @@ def read(self, iprot): elif fid == 3: if ftype == TType.MAP: self.metadata = {} - (_ktype246, _vtype247, _size245) = iprot.readMapBegin() - for _i249 in range(_size245): - _key250 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - _val251 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.metadata[_key250] = _val251 + (_ktype278, _vtype279, _size277) = iprot.readMapBegin() + for _i281 in range(_size277): + _key282 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val283 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.metadata[_key282] = _val283 iprot.readMapEnd() else: iprot.skip(ftype) @@ -9774,9 +10613,9 @@ def write(self, oprot): if self.metadata is not None: oprot.writeFieldBegin('metadata', TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.metadata)) - for kiter252, viter253 in self.metadata.items(): - oprot.writeString(kiter252.encode('utf-8') if sys.version_info[0] == 2 else kiter252) - oprot.writeString(viter253.encode('utf-8') if sys.version_info[0] == 2 else viter253) + for kiter284, viter285 in self.metadata.items(): + oprot.writeString(kiter284.encode('utf-8') if sys.version_info[0] == 2 else kiter284) + oprot.writeString(viter285.encode('utf-8') if sys.version_info[0] == 2 else viter285) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() diff --git a/VirtualMachineService/config/config.yml b/VirtualMachineService/config/config.yml index 873e27e0..e6101728 100644 --- a/VirtualMachineService/config/config.yml +++ b/VirtualMachineService/config/config.yml @@ -10,6 +10,12 @@ openstack_connection: set_password: False # network where the project is located network: portalexternalnetwork + + # subnetwork for starting Clusters + sub_network: portalexternalsubnetwork + + + floating_ip_network: external # The name of the availability zone the server should be placed. availability_zone: default @@ -20,6 +26,10 @@ openstack_connection: ssh_port_calc_formular: 30000 + x udp_port_calc_formular: x * 10 + 30000 +bibigrid: + # Url for Bibigrid API + bibigrid_url: https://172.21.0.1:8443/bibigrid/ + sub_network: portalexternalsubnetwork forc: forc_url: https://proxy-dev.bi.denbi.de:5000/ forc_allowed: diff --git a/VirtualMachineService/ttypes.py b/VirtualMachineService/ttypes.py index df56fcfd..3ba8a4de 100644 --- a/VirtualMachineService/ttypes.py +++ b/VirtualMachineService/ttypes.py @@ -117,6 +117,151 @@ def __ne__(self, other): return not (self == other) +class ClusterInfo(object): + """ + Attributes: + - launch_date + - group_id + - network_id + - public_ip + - subnet_id + - user + - inst_counter + - cluster_id + - key_name + + """ + + + def __init__(self, launch_date=None, group_id=None, network_id=None, public_ip=None, subnet_id=None, user=None, inst_counter=None, cluster_id=None, key_name=None,): + self.launch_date = launch_date + self.group_id = group_id + self.network_id = network_id + self.public_ip = public_ip + self.subnet_id = subnet_id + self.user = user + self.inst_counter = inst_counter + self.cluster_id = cluster_id + self.key_name = key_name + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.launch_date = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.network_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.public_ip = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 5: + if ftype == TType.STRING: + self.subnet_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 6: + if ftype == TType.STRING: + self.user = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 7: + if ftype == TType.I32: + self.inst_counter = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 8: + if ftype == TType.STRING: + self.cluster_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 9: + if ftype == TType.STRING: + self.key_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('ClusterInfo') + if self.launch_date is not None: + oprot.writeFieldBegin('launch_date', TType.STRING, 1) + oprot.writeString(self.launch_date.encode('utf-8') if sys.version_info[0] == 2 else self.launch_date) + oprot.writeFieldEnd() + if self.group_id is not None: + oprot.writeFieldBegin('group_id', TType.STRING, 2) + oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id) + oprot.writeFieldEnd() + if self.network_id is not None: + oprot.writeFieldBegin('network_id', TType.STRING, 3) + oprot.writeString(self.network_id.encode('utf-8') if sys.version_info[0] == 2 else self.network_id) + oprot.writeFieldEnd() + if self.public_ip is not None: + oprot.writeFieldBegin('public_ip', TType.STRING, 4) + oprot.writeString(self.public_ip.encode('utf-8') if sys.version_info[0] == 2 else self.public_ip) + oprot.writeFieldEnd() + if self.subnet_id is not None: + oprot.writeFieldBegin('subnet_id', TType.STRING, 5) + oprot.writeString(self.subnet_id.encode('utf-8') if sys.version_info[0] == 2 else self.subnet_id) + oprot.writeFieldEnd() + if self.user is not None: + oprot.writeFieldBegin('user', TType.STRING, 6) + oprot.writeString(self.user.encode('utf-8') if sys.version_info[0] == 2 else self.user) + oprot.writeFieldEnd() + if self.inst_counter is not None: + oprot.writeFieldBegin('inst_counter', TType.I32, 7) + oprot.writeI32(self.inst_counter) + oprot.writeFieldEnd() + if self.cluster_id is not None: + oprot.writeFieldBegin('cluster_id', TType.STRING, 8) + oprot.writeString(self.cluster_id.encode('utf-8') if sys.version_info[0] == 2 else self.cluster_id) + oprot.writeFieldEnd() + if self.key_name is not None: + oprot.writeFieldBegin('key_name', TType.STRING, 9) + oprot.writeString(self.key_name.encode('utf-8') if sys.version_info[0] == 2 else self.key_name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class Flavor(object): """ This Struct defines a Flavor. @@ -659,6 +804,89 @@ def __ne__(self, other): return not (self == other) +class ClusterInstance(object): + """ + Attributes: + - type + - image + - count + + """ + + + def __init__(self, type=None, image=None, count=None,): + self.type = type + self.image = image + self.count = count + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec]) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.type = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.image = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.count = iprot.readI32() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('ClusterInstance') + if self.type is not None: + oprot.writeFieldBegin('type', TType.STRING, 1) + oprot.writeString(self.type.encode('utf-8') if sys.version_info[0] == 2 else self.type) + oprot.writeFieldEnd() + if self.image is not None: + oprot.writeFieldBegin('image', TType.STRING, 2) + oprot.writeString(self.image.encode('utf-8') if sys.version_info[0] == 2 else self.image) + oprot.writeFieldEnd() + if self.count is not None: + oprot.writeFieldBegin('count', TType.I32, 3) + oprot.writeI32(self.count) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.type is None: + raise TProtocolException(message='Required field type is unset!') + if self.image is None: + raise TProtocolException(message='Required field image is unset!') + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class PlaybookResult(object): """ This Struct defines the result of a playbook run. @@ -1235,6 +1463,19 @@ def __ne__(self, other): (4, TType.STRING, 'template', 'UTF8', None, ), # 4 (5, TType.STRING, 'template_version', 'UTF8', None, ), # 5 ) +all_structs.append(ClusterInfo) +ClusterInfo.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'launch_date', 'UTF8', None, ), # 1 + (2, TType.STRING, 'group_id', 'UTF8', None, ), # 2 + (3, TType.STRING, 'network_id', 'UTF8', None, ), # 3 + (4, TType.STRING, 'public_ip', 'UTF8', None, ), # 4 + (5, TType.STRING, 'subnet_id', 'UTF8', None, ), # 5 + (6, TType.STRING, 'user', 'UTF8', None, ), # 6 + (7, TType.I32, 'inst_counter', None, None, ), # 7 + (8, TType.STRING, 'cluster_id', 'UTF8', None, ), # 8 + (9, TType.STRING, 'key_name', 'UTF8', None, ), # 9 +) all_structs.append(Flavor) Flavor.thrift_spec = ( None, # 0 @@ -1277,6 +1518,13 @@ def __ne__(self, other): (12, TType.I32, 'diskspace', None, None, ), # 12 (13, TType.STRING, 'volume_id', 'UTF8', None, ), # 13 ) +all_structs.append(ClusterInstance) +ClusterInstance.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'type', 'UTF8', None, ), # 1 + (2, TType.STRING, 'image', 'UTF8', None, ), # 2 + (3, TType.I32, 'count', None, None, ), # 3 +) all_structs.append(PlaybookResult) PlaybookResult.thrift_spec = ( None, # 0 diff --git a/portal_client.thrift b/portal_client.thrift index 981c87be..7e003b7c 100644 --- a/portal_client.thrift +++ b/portal_client.thrift @@ -6,7 +6,6 @@ typedef i32 int /** The Version of the Portal-Client*/ const string VERSION= '1.0.0' - struct Backend { 1: i64 id, 2: string owner, @@ -15,6 +14,18 @@ struct Backend { 5: string template_version } +struct ClusterInfo { +1:optional string launch_date +2: optional string group_id +3: optional string network_id +4: optional string public_ip +5: optional string subnet_id +6:optional string user +7:optional int inst_counter +8:optional string cluster_id +9:optional string key_name +} + /** * This Struct defines a Flavor. */ @@ -120,6 +131,13 @@ struct VM { 13:optional string volume_id } +struct ClusterInstance{ + +1: required string type +2: required string image +3: optional int count +} + /** * This Struct defines the result of a playbook run. */ @@ -450,9 +468,18 @@ service VirtualMachineService { /** * Get list of servers by ids -**/ + **/ list get_servers_by_ids(1:list server_ids) + /** + * Get servers by bibigrid cluster id. + **/ + list get_servers_by_bibigrid_id(1:string bibigrid_id) + + ClusterInfo get_cluster_info(1:string cluster_id) + + + /** * Get a Server. @@ -509,6 +536,10 @@ service VirtualMachineService { */ map get_limits() + map start_cluster(1:string public_key,2: ClusterInstance master_instance,3:list worker_instance,4:string user) + + map terminate_cluster(1:string cluster_id) + /** * Delete Image. * Return: True if deleted, False if not