def update_node(self,node,**props): platform = props["platform"] if platform != "kvm": raise Exception("Wrong platform %s found, while expecting %s" % \ (platform, "kvm")) hostname = get_prop(props, "hostname") username = get_prop(props, "username", "root") password = get_prop(props, "password") use_keys = get_prop(props, "use_keys") address = get_prop(props, "address") is_remote = get_prop(props, "is_remote", False) ssh_port = get_prop(props, "ssh_port", 22) migration_port = get_prop(props, "migration_port", 8002) node.username=username node.password=password node.use_keys=use_keys node.address=address node.is_remote=is_remote node.ssh_port=ssh_port node.migration_port=migration_port node.set_node_credentials("",ssh_port = ssh_port,username = username,\ password = password,use_keys = use_keys) return node
def update_node(self, **props): hostname = get_prop(props, 'hostname') username = get_prop(props, 'username', 'root') password = get_prop(props, 'password') address = get_prop(props, 'address') ssh_port = get_prop(props, 'ssh_port', 22) use_keys = password == None if password == None: use_keys = hostname != 'localhost' else: use_keys = password == None is_remote = hostname != 'localhost' self.hostname = hostname self.username = username self.password = password self.use_keys = use_keys self.address = address self.is_remote = is_remote self.ssh_port = ssh_port self.set_node_credentials('', ssh_port = ssh_port, username = username, password = password, use_keys = use_keys) return None
def create_node(self, **props): # validate input keys = props.keys() missing = [] for k in ('hostname', ): if k not in keys: missing.append(k) if len(missing) > 0: raise Exception("Missing properties " + to_str(missing)) platform = props["platform"] if platform != "kvm": raise Exception("Wrong platform %s found, while expecting %s" % \ (platform, "kvm")) # use defaults if self.config : # see base class pass # pick up some defaults from here. # here some hard coded ones. hostname = get_prop(props, "hostname") username = get_prop(props, "username", "root") password = get_prop(props, "password") use_keys = get_prop(props, "use_keys") address = get_prop(props, "address") is_remote = get_prop(props, "is_remote", False) ssh_port = get_prop(props, "ssh_port", 22) migration_port = get_prop(props, "migration_port", 8002) # construct and return object node = KVMNode( hostname = hostname, username= username, password= password, isRemote= is_remote, ssh_port = ssh_port, migration_port = migration_port, helper = None, #store = self.store, use_keys = use_keys, address = address) return node
def create_node(self, **props): keys = props.keys() missing = [] for k in ('hostname',): if k not in keys: missing.append(k) if len(missing) > 0: raise Exception('Missing properties ' + to_str(missing)) platform = props['platform'] if platform != 'vmw': raise Exception('Wrong platform %s found, while expecting %s' % (platform, 'vmw')) # if self.config: # self.config external_manager_id = get_prop(props, 'external_manager_id') hostname = get_prop(props, 'hostname') username = get_prop(props, 'username', 'root') password = get_prop(props, 'password') use_keys = get_prop(props, 'use_keys') address = get_prop(props, 'address') is_remote = get_prop(props, 'is_remote', True) ssh_port = get_prop(props, 'ssh_port', 22) migration_port = get_prop(props, 'migration_port', 8002) node = VMWNode(hostname=hostname, username=username, password=password, isRemote=is_remote, ssh_port=ssh_port, migration_port=migration_port, helper=None, use_keys=use_keys, address=address, external_manager_id=external_manager_id) return node
def update_node(self, node, **props): platform = props['platform'] if platform != 'vmw': raise Exception('Wrong platform %s found, while expecting %s' % (platform, 'vmw')) hostname = get_prop(props, 'hostname') username = get_prop(props, 'username', 'root') password = get_prop(props, 'password') use_keys = get_prop(props, 'use_keys') address = get_prop(props, 'address') is_remote = get_prop(props, 'is_remote', True) ssh_port = get_prop(props, 'ssh_port', 22) migration_port = get_prop(props, 'migration_port', 8002) node.platform = platform node.username = username node.password = password node.use_keys = use_keys node.address = address node.is_remote = is_remote node.ssh_port = ssh_port node.migration_port = migration_port node.set_node_credentials('', ssh_port=ssh_port, username=username, password=password, use_keys=use_keys) return node