public void execCommand(VMInstance n, String command, String login, String keyPath){ SSHConnector sc=new SSHConnector(keyPath, login, n.getPublicAddress()); sc.execCommandSsh(command); }
/** * Update the runtime metadata of a VM if already deployed * @param a description of a VM */ public void updateVMMetadata(VMInstance a){ ComputeMetadata cm= getVMByName(a.getName()); if(cm != null){ a.setPublicAddress(getVMById(cm.getId()).getPublicAddresses().iterator().next()); a.setId(cm.getId()); runtimeInformation.put("publicAddress", a.getPublicAddress()); } }
try { Thread.sleep(90000); // crappy stuff: wati for windows .... TODO String cmd = "powershell \"" + command + " " + owner.getType().getPrivateKey() + " " + owner.getPublicAddress() + "\""; journal.log(Level.INFO, ">> Executing command: " + cmd); run = new PowerShellConnector(cmd);
/** * To initialise 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(Deployment current) { this.currentModel = current; Connector jc; for (VMInstance vm : currentModel.getComponentInstances().onlyVMs()) { if (vm.getPublicAddress().equals("")) { jc = ConnectorFactory.createIaaSConnector(vm.getType().getProvider()); jc.updateVMMetadata(vm); } } }
public void install(VMInstance vmi){ try { startPuppetAgent(vmi.getType().getPrivateKey(),vmi.getType().getLogin(), vmi.getType().getPasswd(), vmi.getName(), vmi.getPublicAddress()); } catch (Exception e) { e.printStackTrace(); } }
journal.log(Level.INFO, ">> Running VM: " + a.getName() + " id: " + a.getId() + " with public address: " + a.getPublicAddress());
@Override public String toString() { return "VMInstance: " + getName() + " Type:" + getType().getName() + "{\n" + "minRam:" + (getType()).getMinRam() + "\n" + "minCore" + (getType()).getMinCores() + "\n" + "minDisk" + (getType()).getMinStorage() + "\n" + "OS" + (getType()).getOs() + "\n" + "location" + (getType()).getLocation() + "\n" + "publicAdress" + getPublicAddress() + "\n" + "groupName" + (getType()).getGroupName(); }
/** * Install puppet, manage the repo, change the hostname and execute puppet on a VM * @param pr the puppet resource * @param n the vm instance on which puppet will be installed and executed * @param hostname the new hostname of the vm for puppet * @param path the path to the puppet manifest */ private void managePuppet(PuppetResource pr, VMInstance n, String hostname, String path){ PuppetMarionnetteConnector puppet=new PuppetMarionnetteConnector(pr.getMaster(),n); //check if the configuration file is in the repo and manage the repo MercurialConnector mc=new MercurialConnector(pr.getRepo(),pr.getRepositoryKey()); journal.log(Level.INFO, ">> Mercurial connector created"); mc.addFile(path, pr.getUsername()); //Touch the site.pp file puppet.touchSiteFile(); //call the update host command puppet.configureHostname(n.getType().getPrivateKey(), n.getType().getLogin(),n.getType().getPasswd(), n.getPublicAddress(), pr.getMaster(), hostname, pr.getConfigureHostnameCommand()); //start the puppet run puppet.install(n); }
net.cloudml.core.VMInstance kni = factory.createVMInstance(); kni.setName(ni.getName()); kni.setPublicAddress(ni.getPublicAddress()); kni.setHostname(ni.getHostname()); kni.setId(ni.getId());