From 84b3a3f0847edb4a23c95c076156b04e7dd0bbfd Mon Sep 17 00:00:00 2001 From: David Weinholz Date: Tue, 12 Nov 2019 16:34:10 +0100 Subject: [PATCH 1/3] updated config --- VirtualMachineService/config/config.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/VirtualMachineService/config/config.yml b/VirtualMachineService/config/config.yml index 7c69ef47..51782eda 100644 --- a/VirtualMachineService/config/config.yml +++ b/VirtualMachineService/config/config.yml @@ -7,15 +7,13 @@ openstack_connection: # If set to True the client will use a Gateway instead of providing floating IPs for each instance. use_gateway: True - # Id of the default simple vm security group - default_security_group: ec824d8f-0e45-4eb1-8f49-089867fef366 - - # id of default security from the openstack project (will be removed from vm after vm is created) - openstack_default_security_group: 26713dd3-26e9-41cf-b7cd-931a447923fb - 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 @@ -25,3 +23,4 @@ openstack_connection: # Used for gateway port calculation , x is always the last octet of the fixed ip (example : (x + 3) *3 ) ) ssh_port_calc_formular: 30000 + x udp_port_calc_formular: x * 10 + 30000 + From 6e1d45b35e1e6613c39e52eb9ca874d0935cb510 Mon Sep 17 00:00:00 2001 From: David Weinholz Date: Thu, 2 Jan 2020 22:05:37 +0100 Subject: [PATCH 2/3] feat(Cluster):cluster model --- .../VirtualMachineHandler.py | 43 +- .../VirtualMachineService-remote | 14 + .../VirtualMachineService.py | 476 ++++++++++++++++-- VirtualMachineService/ttypes.py | 158 ++++++ portal_client.thrift | 24 +- 5 files changed, 668 insertions(+), 47 deletions(-) diff --git a/VirtualMachineService/VirtualMachineHandler.py b/VirtualMachineService/VirtualMachineHandler.py index ac50bfeb..868e3491 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 @@ -1200,6 +1200,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. @@ -1229,6 +1237,37 @@ 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'] diff --git a/VirtualMachineService/VirtualMachineService-remote b/VirtualMachineService/VirtualMachineService-remote index 58e60afd..68cd1704 100755 --- a/VirtualMachineService/VirtualMachineService-remote +++ b/VirtualMachineService/VirtualMachineService-remote @@ -55,6 +55,8 @@ 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)') @@ -335,6 +337,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') diff --git a/VirtualMachineService/VirtualMachineService.py b/VirtualMachineService/VirtualMachineService.py index 739efb7d..7fad3dce 100644 --- a/VirtualMachineService/VirtualMachineService.py +++ b/VirtualMachineService/VirtualMachineService.py @@ -330,8 +330,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 @@ -339,6 +339,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. @@ -1622,8 +1641,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 @@ -1655,6 +1674,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. @@ -2263,6 +2349,8 @@ 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 @@ -3073,6 +3161,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) @@ -8051,6 +8185,262 @@ def __ne__(self, other): ) +class get_servers_by_bibigrid_id_args(object): + """ + Attributes: + - bibigrid_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: + 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.bibigrid_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_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() + + 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_servers_by_bibigrid_id_args) +get_servers_by_bibigrid_id_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'bibigrid_id', 'UTF8', None, ), # 1 +) + + +class get_servers_by_bibigrid_id_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.LIST: + self.success = [] + (_etype225, _size222) = iprot.readListBegin() + for _i226 in range(_size222): + _elem227 = VM() + _elem227.read(iprot) + self.success.append(_elem227) + iprot.readListEnd() + 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_servers_by_bibigrid_id_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter228 in self.success: + iter228.write(oprot) + oprot.writeListEnd() + 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_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 get_cluster_info_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('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() + + 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_args) +get_cluster_info_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'cluster_id', 'UTF8', None, ), # 1 +) + + +class get_cluster_info_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.STRUCT: + 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: @@ -8574,11 +8964,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype223, _vtype224, _size222) = iprot.readMapBegin() - for _i226 in range(_size222): - _key227 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - _val228 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.success[_key227] = _val228 + (_ktype230, _vtype231, _size229) = iprot.readMapBegin() + for _i233 in range(_size229): + _key234 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val235 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success[_key234] = _val235 iprot.readMapEnd() else: iprot.skip(ftype) @@ -8595,9 +8985,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 kiter229, viter230 in self.success.items(): - oprot.writeString(kiter229.encode('utf-8') if sys.version_info[0] == 2 else kiter229) - oprot.writeString(viter230.encode('utf-8') if sys.version_info[0] == 2 else viter230) + for kiter236, viter237 in self.success.items(): + oprot.writeString(kiter236.encode('utf-8') if sys.version_info[0] == 2 else kiter236) + oprot.writeString(viter237.encode('utf-8') if sys.version_info[0] == 2 else viter237) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -8662,11 +9052,11 @@ def read(self, iprot): elif fid == 3: if ftype == TType.LIST: self.worker_instance = [] - (_etype234, _size231) = iprot.readListBegin() - for _i235 in range(_size231): - _elem236 = ClusterInstance() - _elem236.read(iprot) - self.worker_instance.append(_elem236) + (_etype241, _size238) = iprot.readListBegin() + for _i242 in range(_size238): + _elem243 = ClusterInstance() + _elem243.read(iprot) + self.worker_instance.append(_elem243) iprot.readListEnd() else: iprot.skip(ftype) @@ -8696,8 +9086,8 @@ def write(self, oprot): if self.worker_instance is not None: oprot.writeFieldBegin('worker_instance', TType.LIST, 3) oprot.writeListBegin(TType.STRUCT, len(self.worker_instance)) - for iter237 in self.worker_instance: - iter237.write(oprot) + for iter244 in self.worker_instance: + iter244.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.user is not None: @@ -8753,11 +9143,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype239, _vtype240, _size238) = iprot.readMapBegin() - for _i242 in range(_size238): - _key243 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - _val244 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.success[_key243] = _val244 + (_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.success[_key250] = _val251 iprot.readMapEnd() else: iprot.skip(ftype) @@ -8774,9 +9164,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 kiter245, viter246 in self.success.items(): - oprot.writeString(kiter245.encode('utf-8') if sys.version_info[0] == 2 else kiter245) - oprot.writeString(viter246.encode('utf-8') if sys.version_info[0] == 2 else viter246) + for kiter252, viter253 in self.success.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) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -8886,11 +9276,11 @@ def read(self, iprot): if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype248, _vtype249, _size247) = iprot.readMapBegin() - for _i251 in range(_size247): - _key252 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - _val253 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.success[_key252] = _val253 + (_ktype255, _vtype256, _size254) = iprot.readMapBegin() + for _i258 in range(_size254): + _key259 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val260 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.success[_key259] = _val260 iprot.readMapEnd() else: iprot.skip(ftype) @@ -8907,9 +9297,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 kiter254, viter255 in self.success.items(): - oprot.writeString(kiter254.encode('utf-8') if sys.version_info[0] == 2 else kiter254) - oprot.writeString(viter255.encode('utf-8') if sys.version_info[0] == 2 else viter255) + for kiter261, viter262 in self.success.items(): + oprot.writeString(kiter261.encode('utf-8') if sys.version_info[0] == 2 else kiter261) + oprot.writeString(viter262.encode('utf-8') if sys.version_info[0] == 2 else viter262) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -9984,11 +10374,11 @@ def read(self, iprot): elif fid == 3: if ftype == TType.MAP: self.metadata = {} - (_ktype257, _vtype258, _size256) = iprot.readMapBegin() - for _i260 in range(_size256): - _key261 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - _val262 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() - self.metadata[_key261] = _val262 + (_ktype264, _vtype265, _size263) = iprot.readMapBegin() + for _i267 in range(_size263): + _key268 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + _val269 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + self.metadata[_key268] = _val269 iprot.readMapEnd() else: iprot.skip(ftype) @@ -10013,9 +10403,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 kiter263, viter264 in self.metadata.items(): - oprot.writeString(kiter263.encode('utf-8') if sys.version_info[0] == 2 else kiter263) - oprot.writeString(viter264.encode('utf-8') if sys.version_info[0] == 2 else viter264) + for kiter270, viter271 in self.metadata.items(): + oprot.writeString(kiter270.encode('utf-8') if sys.version_info[0] == 2 else kiter270) + oprot.writeString(viter271.encode('utf-8') if sys.version_info[0] == 2 else viter271) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() diff --git a/VirtualMachineService/ttypes.py b/VirtualMachineService/ttypes.py index f3cc5e95..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. @@ -1318,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 diff --git a/portal_client.thrift b/portal_client.thrift index 4724fcf5..ae8d1394 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. */ @@ -451,9 +462,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. From a1a7bd97dce79c238afc5da4cc77e0e8abc58ada Mon Sep 17 00:00:00 2001 From: David Weinholz Date: Thu, 9 Jan 2020 22:56:43 +0100 Subject: [PATCH 3/3] updated changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) 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)