+
+ 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:
+ print "No such component:", opts.component
+ record = records[0]
+
+ return self.get_server(record['hostname'], CM_PORT, self.key_file, \
+ self.cert_file, self.options.debug)
+
+ def get_server(self, host, port, keyfile, certfile, debug):
+ """
+ Return an instnace of an xmlrpc server connection
+ """
+ url = "http://%s:%s" % (host, port)
+ return xmlrpcprotocol.get_server(url, keyfile, certfile, debug)
+
+ 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, self.options.debug)
+ # 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
+ #==========================================================================