public void execCommand(NodeInstance n, String command, String login, String keyPath){ SSHConnector sc=new SSHConnector(keyPath, login, n.getPublicAddress()); sc.execCommandSsh(command); }
/** * To initialize a deployment Model as the model of the current system if the system is already running * @param current the current Deployment model */ public void setCurrentModel(DeploymentModel current){ this.currentModel=current; Connector jc; for(NodeInstance n: currentModel.getNodeInstances()){ if(n.getPublicAddress().equals("")){ jc=ConnectorFactory.createConnector(n.getType().getProvider()); jc.updateNodeMetadata(n); } } }
@Override public String toString() { return "NodeInstance: "+name+" Type:"+type.getName()+"{\n" + "minRam:" + type.getMinRam()+"\n"+ "minCore" + type.getMinCore()+"\n"+ "minDisk" + type.getMinDisk()+"\n"+ "OS" + type.getOS()+"\n"+ "location" + type.getLocation()+"\n"+ "publicAdress" + getPublicAddress()+"\n"+ "groupName" + type.getGroupName(); }
/** * Configure Artefacts according to the bindings * @param dm a deployment model * @throws MalformedURLException */ private void configureWithBindings(List<BindingInstance> bindings) { //Configure on the basis of the bindings //parameters transmitted to the configuration scripts are "ip ipDestination portDestination" for(BindingInstance bi : bindings){ if(bi.getClient().getType().getIsRemote()){ ClientPortInstance client=bi.getClient(); ServerPortInstance server=bi.getServer(); Resource clientResource=bi.getType().getClientResource(); Resource serverResource=bi.getType().getServerResource(); String destinationIpAddress=server.getOwner().getDestination().getPublicAddress(); int destinationPortNumber=server.getType().getPortNumber(); String ipAddress=client.getOwner().getDestination().getPublicAddress(); //client resources configureWithIP(clientResource,client,destinationIpAddress,ipAddress,destinationPortNumber); //server resources configureWithIP(serverResource,server,destinationIpAddress,ipAddress,destinationPortNumber); } } }
Server temp=(Server)findObjectResourceByName(a.getName(), ResourceType.SERVER); a.setPublicAddress(temp.getNics().get(0).getIpAddresses().get(0).getIpAddress()); journal.log(Level.INFO, ">> Running node: " + a.getName() + " id: " + a.getId() + " with public address: " + a.getPublicAddress()); } catch (ExtilityException e) {
net.cloudml.core.NodeInstance kni = factory.createNodeInstance(); kni.setName(ni.getName()); kni.setPublicAddress(ni.getPublicAddress()); kni.setType(nodes.get(ni.getType().getName())); initProperties(ni, kni, factory);