use of com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorSupport in project cloudstack by apache.
the class Ovm3HypervisorSupportTest method ReportedVmStatesTest.
@Test
public void ReportedVmStatesTest() throws ConfigurationException, Ovm3ResourceException {
Ovm3Configuration config = new Ovm3Configuration(configTest.getParams());
con.setResult(xen.getMultipleVmsListXML());
Ovm3HypervisorSupport hypervisor = new Ovm3HypervisorSupport(con, config);
hypervisor.vmStateMapClear();
State vmState = hypervisor.getVmState(vmName);
results.basicStringTest(vmState.toString(), State.Running.toString());
hypervisor.setVmStateStarting(vmName);
results.basicStringTest(hypervisor.getVmState(vmName).toString(), State.Starting.toString());
hypervisor.setVmState(vmName, State.Running);
results.basicStringTest(hypervisor.getVmState(vmName).toString(), State.Running.toString());
hypervisor.revmoveVmState(vmName);
assertNull(hypervisor.getVmState(vmName));
}
use of com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorSupport in project cloudstack by apache.
the class Ovm3HypervisorResource method configure.
/**
* Base configuration of the plugins components.
*/
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
LOGGER.debug("configure " + name + " with params: " + params);
/* check if we're primary or not and if we can connect */
try {
configuration = new Ovm3Configuration(params);
if (!configuration.getIsTest()) {
c = new Connection(configuration.getAgentIp(), configuration.getAgentOvsAgentPort(), configuration.getAgentOvsAgentUser(), configuration.getAgentOvsAgentPassword());
c.setHostName(configuration.getAgentHostname());
}
hypervisorsupport = new Ovm3HypervisorSupport(c, configuration);
if (!configuration.getIsTest()) {
hypervisorsupport.setupServer(configuration.getAgentSshKeyFileName());
}
hypervisorsupport.primaryCheck();
} catch (Exception e) {
throw new CloudRuntimeException("Base checks failed for " + configuration.getAgentHostname(), e);
}
hypervisornetwork = new Ovm3HypervisorNetwork(c, configuration);
hypervisornetwork.configureNetworking();
virtualroutingresource = new Ovm3VirtualRoutingResource(c);
storagepool = new Ovm3StoragePool(c, configuration);
storagepool.prepareForPool();
storageprocessor = new Ovm3StorageProcessor(c, configuration, storagepool);
vmsupport = new Ovm3VmSupport(c, configuration, hypervisorsupport, storageprocessor, storagepool, hypervisornetwork);
vrResource = new VirtualRoutingResource(virtualroutingresource);
if (!vrResource.configure(name, params)) {
throw new ConfigurationException("Unable to configure VirtualRoutingResource");
}
guesttypes = new Ovm3VmGuestTypes();
storageHandler = new StorageSubsystemCommandHandlerBase(storageprocessor);
virtualroutingsupport = new Ovm3VirtualRoutingSupport(c, configuration, virtualroutingresource);
setConfigParams(params);
return true;
}
use of com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorSupport in project cloudstack by apache.
the class Ovm3HypervisorSupportTest method fillHostinfoTest.
@Test
public void fillHostinfoTest() throws ConfigurationException {
Ovm3Configuration config = new Ovm3Configuration(configTest.getParams());
ConnectionTest con = new ConnectionTest();
con.setIp(config.getAgentIp());
Ovm3HypervisorSupport hypervisor = new Ovm3HypervisorSupport(con, config);
LinuxTest linuxTest = new LinuxTest();
NetworkTest networkTest = new NetworkTest();
StartupRoutingCommand srCmd = new StartupRoutingCommand();
con.setResult(results.simpleResponseWrapWrapper(linuxTest.getDiscoverHw()));
con.addResult(results.simpleResponseWrapWrapper(linuxTest.getDiscoverserver()));
con.addResult(results.simpleResponseWrapWrapper(networkTest.getDiscoverNetwork()));
hypervisor.fillHostInfo(srCmd);
}
Aggregations