+
+ # xxx opts undefined
+ def get_component_server_from_hrn(self, hrn):
+ # direct connection to the nodes component manager interface
+ user_cred = self.get_user_cred().save_to_string(save_parents=True)
+ records = self.registry.Resolve(hrn, user_cred)
+ records = filter_records('node', records)
+ if not records:
+ self.logger.warning("No such component:%r"% opts.component)
+ record = records[0]
+
+ return self.get_server(record['hostname'], CM_PORT, self.key_file, self.cert_file)
+
+ def get_server(self, host, port, keyfile, certfile):
+ """
+ Return an instance of an xmlrpc server connection
+ """
+ # port is appended onto the domain, before the path. Should look like:
+ # http://domain:port/path
+ host_parts = host.split('/')
+ host_parts[0] = host_parts[0] + ":" + str(port)
+ url = "http://%s" % "/".join(host_parts)
+ return xmlrpcprotocol.get_server(url, keyfile, certfile, self.options)
+
+ # xxx opts could be retrieved in self.options
+ def get_server_from_opts(self, opts):
+ """
+ Return instance of an xmlrpc connection to a slice manager, aggregate
+ or component server depending on the specified opts
+ """
+ server = self.slicemgr
+ # direct connection to an aggregate
+ if hasattr(opts, 'aggregate') and opts.aggregate:
+ server = self.get_server(opts.aggregate, opts.port, self.key_file, self.cert_file)
+ # direct connection to the nodes component manager interface
+ if hasattr(opts, 'component') and opts.component:
+ server = self.get_component_server_from_hrn(opts.component)
+
+ return server
+ #==========================================================================