private void unconfigureWithIP(Resource r, PortInstance<? extends Port> i) { Connector jc; if (r != null) { VMInstance ownerVM = (VMInstance) getDestination(i.getOwner().get()); //TODO: generalize to PaaS VM n = ownerVM.getType(); jc = ConnectorFactory.createIaaSConnector(n.getProvider()); //jc=new JCloudsConnector(n.getProvider().getName(), n.getProvider().getLogin(), n.getProvider().getPasswd()); //jc.execCommand(ownerVM.getId(), r.getStopCommand(), "ubuntu", n.getPrivateKey()); executeCommand(ownerVM, jc, r.getStopCommand()); jc.closeConnection(); } }
private void setResourceProperties(Resource r, net.cloudml.core.Resource kr){ kr.setName(r.getName()); kr.setInstallCommand(r.getInstallCommand()); kr.setDownloadCommand(r.getRetrieveCommand()); kr.setConfigureCommand(r.getConfigureCommand()); kr.setStartCommand(r.getStartCommand()); kr.setStopCommand(r.getStopCommand()); kr.setRequireCredentials(r.getRequireCredentials()); kr.setExecuteLocally(r.getExecuteLocally()); convertProperties(r,kr,factory); String kup = ""; for (Map.Entry<String, String> up: r.getUploadCommand().entrySet()) { kup += up.getKey() + " " + up.getValue() + ";"; } kr.setUploadCommand(kup); }
/** * Stop a specific component instance * * @param a An InternalComponent Instance * @throws MalformedURLException */ private void stopInternalComponent(InternalComponentInstance a) { VMInstance ownerVM = (VMInstance) findDestinationWhenNoRequiredExecutionPlatformSpecified(a); //TODO: to be generalized if (ownerVM != null) { VM n = ownerVM.getType(); Connector jc = ConnectorFactory.createIaaSConnector(n.getProvider()); for (Resource r : a.getType().getResources()) { String stopCommand = r.getStopCommand(); //jc.execCommand(ownerVM.getId(), stopCommand, "ubuntu", n.getPrivateKey()); executeCommand(ownerVM, jc, stopCommand); } jc.closeConnection(); coordinator.updateStatusInternalComponent(a.getName(), State.UNINSTALLED.toString(), CloudAppDeployer.class.getName()); //a.setStatus(State.CONFIGURED); } }
public void run() { VMInstance vmi = deploy.getComponentInstances().onlyVMs().withID(id); if (vmi != null) { Provider provider = vmi.getType().getProvider(); Connector c = ConnectorFactory.createIaaSConnector(provider); for(InternalComponentInstance ici : vmi.hostedComponents()){ InternalComponent ic=ici.getType(); for(Resource r : ic.getResources()){ c.execCommand(vmi.getId(),r.getStopCommand(),"ubuntu",vmi.getType().getPrivateKey()); } } c.stopVM(vmi); coordinator.updateStatus(vmi.getName(), ComponentInstance.State.STOPPED, Facade.class.getName()); c.closeConnection(); } } });
cr.setStartCommand(relationship.getClientResource().getStartCommand()); if (relationship.getClientResource().getStopCommand() != null) { cr.setStopCommand(relationship.getClientResource().getStopCommand()); cr.setStartCommand(relationship.getServerResource().getStartCommand()); if (relationship.getServerResource().getStopCommand() != null) { cr.setStopCommand(relationship.getServerResource().getStopCommand());