Bug 8208 - bare metal provisioning

make an individual package and move to premium
This commit is contained in:
Frank 2011-03-08 10:45:50 -08:00
parent 5517046a66
commit 20a7d95c06
11 changed files with 61 additions and 1272 deletions

View File

@ -1,131 +0,0 @@
package com.cloud.api;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.PxeServerResponse;
import com.cloud.baremetal.LinMinPxeServerManager;
import com.cloud.baremetal.PxeServerManager;
import com.cloud.baremetal.PxeServerManager.PxeServerType;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.host.Host;
import com.cloud.server.ManagementService;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
@Implementation(description="Adds a PXE server appliance", responseObject = PxeServerResponse.class)
public class AddPxeServerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddPxeServerCmd.class.getName());
private static final String s_name = "addpxeserverresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external firewall appliance.")
private Long zoneId;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external firewall appliance.")
private Long podId;
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the PXE server appliance.")
private String url;
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="Username of PXE server appliance.")
private String username;
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Password of the PXE server appliance.")
private String password;
@Parameter(name=ApiConstants.PXE_SERVER_TYPE, type=CommandType.STRING, required = true, description="Type of PXE server. Current values are LinMin, DMCD")
private String type;
@Parameter(name=ApiConstants.LINMIN_USERNAME, type=CommandType.STRING, required = false, description="Optional, username uses to access LinMin API")
private String linminUsername;
@Parameter(name=ApiConstants.LINMIN_PASSWORD, type=CommandType.STRING, required = false, description="Optional, password uses to access LinMin API")
private String linminPassword;
@Parameter(name=ApiConstants.LINMIN_APID, type=CommandType.STRING, required = false, description="Optional, APID uses to access LinMin API")
private String linminApid;
///////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public Long getZoneId() {
return zoneId;
}
public String getUrl() {
return url;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getType() {
return type;
}
public Long getPod() {
return podId;
}
public String getLinMinUsername() {
return linminUsername;
}
public String getLinMinPassword() {
return linminPassword;
}
public String getLinMinApid() {
return linminApid;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
try {
PxeServerManager pxeServerMgr;
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
if (getType().equalsIgnoreCase(PxeServerType.LinMin.getName())) {
pxeServerMgr = locator.getManager(LinMinPxeServerManager.class);
} else {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unsupport PXE server type " + getType());
}
Host pxeServer = pxeServerMgr.addPxeServer(this);
PxeServerResponse response = pxeServerMgr.getApiResponse(pxeServer);
response.setObjectName("pxeserver");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException ipve) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
} catch (CloudRuntimeException cre) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
}
}
}

View File

@ -1,18 +0,0 @@
package com.cloud.api.response;
import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class PxeServerResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the PXE server")
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@ -1,5 +0,0 @@
package com.cloud.baremetal;
public interface LinMinPxeServerManager extends PxeServerManager {
}

View File

@ -1,142 +0,0 @@
package com.cloud.baremetal;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerAnswer;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerCommand;
import com.cloud.api.AddPxeServerCmd;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.resource.ServerResource;
import com.cloud.utils.component.Inject;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
@Local(value = {LinMinPxeServerManager.class})
public class LinMinPxeServerManagerImpl extends PxeServerManagerImpl implements LinMinPxeServerManager {
private static final org.apache.log4j.Logger s_logger = Logger.getLogger(LinMinPxeServerManagerImpl.class);
@Inject DataCenterDao _dcDao;
@Inject HostDao _hostDao;
@Inject AgentManager _agentMgr;
@Override
public Host addPxeServer(AddPxeServerCmd cmd) throws InvalidParameterValueException, CloudRuntimeException {
long zoneId = cmd.getZoneId();
Long podId = cmd.getPod();
String apiUsername;
String apiPassword;
String apid;
DataCenterVO zone = _dcDao.findById(zoneId);
if (zone == null) {
throw new InvalidParameterValueException("Could not find zone with ID: " + zoneId);
}
List<HostVO> pxeServers = _hostDao.listBy(Host.Type.PxeServer, null, podId, zoneId);
if (pxeServers.size() != 0) {
throw new InvalidParameterValueException("Already had a PXE server in Pod: " + podId + " zone: " + zoneId);
}
URI uri;
try {
uri = new URI(cmd.getUrl());
} catch (Exception e) {
s_logger.debug(e);
throw new InvalidParameterValueException(e.getMessage());
}
apiUsername = cmd.getLinMinUsername();
apiPassword = cmd.getLinMinPassword();
apid = cmd.getLinMinApid();
if (apiUsername == null) {
throw new InvalidParameterValueException("No LinMin username specified, without it I can not use LinMin API");
}
if (apiPassword == null) {
throw new InvalidParameterValueException("No LinMin password specified, without it I can not use LinMin API");
}
if (apid == null) {
throw new InvalidParameterValueException("No LinMin apid specified, without it I can not use LinMin API");
}
String ipAddress = uri.getHost();
String username = cmd.getUsername();
String password = cmd.getPassword();
String guid = getPxeServerGuid(Long.toString(zoneId), PxeServerType.LinMin.getName(), ipAddress);
Map params = new HashMap<String, String>();
params.put("zone", Long.toString(zoneId));
params.put("pod", podId.toString());
params.put("ip", ipAddress);
params.put("username", username);
params.put("password", password);
params.put("guid", guid);
params.put("pod", Long.toString(cmd.getPod()));
params.put("apiUsername", apiUsername);
params.put("apiPassword", apiPassword);
params.put("apid", apid);
ServerResource resource = null;
try {
if (cmd.getType().equalsIgnoreCase(PxeServerType.LinMin.getName())) {
resource = new LinMinPxeServerResource();
resource.configure("LinMin PXE resource", params);
}
} catch (Exception e) {
s_logger.debug(e);
throw new CloudRuntimeException(e.getMessage());
}
Host pxeServer = _agentMgr.addHost(zoneId, resource, Host.Type.PxeServer, params);
if (pxeServer == null) {
throw new CloudRuntimeException("Cannot add PXE server as a host");
}
return pxeServer;
}
@Override
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context, Long pxeServerId) {
List<NicProfile> nics = profile.getNics();
if (nics.size() == 0) {
throw new CloudRuntimeException("Cannot do PXE start without nic");
}
NicProfile pxeNic = nics.get(0);
String mac = pxeNic.getMacAddress();
String ip = pxeNic.getIp4Address();
String gateway = pxeNic.getGateway();
String mask = pxeNic.getNetmask();
String dns = pxeNic.getDns1();
if (dns == null) {
dns = pxeNic.getDns2();
}
try {
String linMinTpl = profile.getTemplate().getUrl();
assert linMinTpl != null : "How can a null template get here!!!";
PrepareLinMinPxeServerCommand cmd = new PrepareLinMinPxeServerCommand(ip, mac, mask, gateway, dns, linMinTpl,
profile.getVirtualMachine().getName(), dest.getHost().getName());
PrepareLinMinPxeServerAnswer ans = (PrepareLinMinPxeServerAnswer) _agentMgr.send(pxeServerId, cmd);
return ans.getResult();
} catch (Exception e) {
s_logger.warn("Cannot prepare PXE server", e);
return false;
}
}
}

View File

@ -1,345 +0,0 @@
package com.cloud.baremetal;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import javax.naming.ConfigurationException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import com.cloud.agent.IAgentControl;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.PingCommand;
import com.cloud.agent.api.PingRoutingCommand;
import com.cloud.agent.api.ReadyAnswer;
import com.cloud.agent.api.ReadyCommand;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupPxeServerCommand;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerAnswer;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerCommand;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host.Type;
import com.cloud.resource.ServerResource;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.ssh.SSHCmdHelper;
import com.cloud.vm.VirtualMachine.State;
public class LinMinPxeServerResource implements ServerResource {
private static final Logger s_logger = Logger.getLogger(LinMinPxeServerResource.class);
String _name;
String _guid;
String _username;
String _password;
String _ip;
String _zoneId;
String _podId;
String _apiUsername;
String _apiPassword;
String _apid;
class XmlReturn {
NodeList nList;
public XmlReturn(InputSource s, String tagName) {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(s);
doc.getDocumentElement().normalize();
nList = doc.getElementsByTagName(tagName);
} catch (Exception e) {
s_logger.debug("The XML file:");
s_logger.debug(s.toString());
s_logger.debug("Cannot parse XMl file", e);
nList = null;
}
}
public String getValue(String tag) {
if (nList == null || nList.getLength() == 0) {
throw new InvalidParameterValueException("invalid XML file");
}
Element e = (Element)nList.item(0);
NodeList nlList= e.getElementsByTagName(tag).item(0).getChildNodes();
Node nValue = (Node)nlList.item(0);
return nValue.getNodeValue();
}
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_name = name;
_guid = (String)params.get("guid");
_ip = (String)params.get("ip");
_username = (String)params.get("username");
_password = (String)params.get("password");
_zoneId = (String)params.get("zone");
_podId = (String)params.get("pod");
_apiUsername = (String)params.get("apiUsername");
_apiPassword = (String)params.get("apiPassword");
_apid = (String)params.get("apid");
if (_guid == null) {
throw new ConfigurationException("No Guid specified");
}
if (_zoneId == null) {
throw new ConfigurationException("No Zone specified");
}
if (_podId == null) {
throw new ConfigurationException("No Pod specified");
}
if (_ip == null) {
throw new ConfigurationException("No IP specified");
}
if (_username == null) {
throw new ConfigurationException("No username specified");
}
if (_password == null) {
throw new ConfigurationException("No password specified");
}
if (_apiUsername == null) {
throw new ConfigurationException("No API username specified");
}
if (_apiPassword == null) {
throw new ConfigurationException("No API password specified");
}
if (_apid == null) {
throw new ConfigurationException("No A specified");
}
com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22);
s_logger.debug(String.format("Trying to connect to LinMin PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
try {
sshConnection.connect(null, 60000, 60000);
if (!sshConnection.authenticateWithPassword(_username, _password)) {
s_logger.debug("SSH Failed to authenticate");
throw new ConfigurationException(String.format("Cannot connect to LinMin PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username,
_password));
}
if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "[ -d '/home/tftpboot' ] && [ -d '/usr/local/linmin' ]")) {
throw new ConfigurationException("Cannot find LinMin directory /home/tftpboot, /usr/local/linmin on PXE server");
}
return true;
} catch (Exception e) {
throw new ConfigurationException(e.getMessage());
} finally {
if (sshConnection != null) {
sshConnection.close();
}
}
}
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
return true;
}
@Override
public String getName() {
return _name;
}
@Override
public Type getType() {
return Type.PxeServer;
}
@Override
public StartupCommand[] initialize() {
StartupPxeServerCommand cmd = new StartupPxeServerCommand();
cmd.setName(_name);
cmd.setDataCenter(_zoneId);
cmd.setPod(_podId);
cmd.setPrivateIpAddress(_ip);
cmd.setStorageIpAddress("");
cmd.setVersion("");
cmd.setGuid(_guid);
return new StartupCommand[]{cmd};
}
@Override
public PingCommand getCurrentStatus(long id) {
//TODO: check server
return new PingRoutingCommand(getType(), id, new HashMap<String, State>());
}
protected ReadyAnswer execute(ReadyCommand cmd) {
s_logger.debug("LinMin resource " + _name + " is ready");
return new ReadyAnswer(cmd);
}
private InputSource httpCall(String urlStr) {
try {
s_logger.debug("Execute http call " + urlStr);
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
conn.setReadTimeout(30000);
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer xmlStuff = new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
xmlStuff.append(line);
}
StringReader statsReader = new StringReader(xmlStuff.toString());
InputSource statsSource = new InputSource(statsReader);
s_logger.debug("Http call retrun:");
s_logger.debug(xmlStuff.toString());
return statsSource;
} catch (MalformedURLException e) {
throw new CloudRuntimeException("URL is malformed " + urlStr, e);
} catch (IOException e) {
s_logger.warn("can not do http call", e);
return null;
}catch (Exception e) {
s_logger.warn("Cannot do http call " + urlStr, e);
throw new CloudRuntimeException(e.getStackTrace().toString());
}
}
protected PrepareLinMinPxeServerAnswer execute(PrepareLinMinPxeServerCommand cmd) {
StringBuffer askApid = new StringBuffer();
askApid.append("http://");
askApid.append(_ip);
askApid.append("/tftpboot/www/lbmp-API.php?actiontype=provision&apid=");
askApid.append(_apid);
askApid.append("&auth_user=");
askApid.append(_apiUsername);
askApid.append("&auth_user_pw=");
askApid.append(_apiPassword);
askApid.append("&rtn_format=XML&action=authorize");
InputSource s = httpCall(askApid.toString());
if (s == null) {
return new PrepareLinMinPxeServerAnswer(cmd, "Http call failed");
}
try {
XmlReturn r = new XmlReturn(s, "LinMinBareMetalAPI");
String res = r.getValue("actionResultsMsg");
s_logger.debug(s.toString());
if (!res.startsWith("Successful")) {
return new PrepareLinMinPxeServerAnswer(cmd, "Acquire APID failed");
}
String apid5 = r.getValue("apid");
if (apid5 == null) {
return new PrepareLinMinPxeServerAnswer(cmd, "Cannot get 5 minutes APID " + apid5);
}
StringBuffer addRole = new StringBuffer();
addRole.append("http://");
addRole.append(_ip);
addRole.append("/tftpboot/www/lbmp-API.php?actiontype=provision&user_supplied_id=");
addRole.append(cmd.getVmName());
addRole.append("&mac_address=");
addRole.append(cmd.getMac().replaceAll(":", "%3A"));
addRole.append("&apid=");
addRole.append(apid5);
addRole.append("&control_file_template=");
addRole.append(cmd.getTemplate().replace(' ', '+'));
addRole.append("&node_name=");
addRole.append(cmd.getHostName());
addRole.append("&node_domain=");
addRole.append(cmd.getHostName());
addRole.append("&node_password=password");
addRole.append("&node_time_zone=Etc%2FGMT-8");
if (cmd.getIp() != null) {
addRole.append("&node_ip_address=");
addRole.append(cmd.getIp());
}
if (cmd.getNetMask() != null) {
addRole.append("&node_subnet_mask=");
addRole.append(cmd.getNetMask());
}
if (cmd.getDns() != null) {
addRole.append("&node_nameserver=");
addRole.append(cmd.getDns());
}
if (cmd.getGateWay() != null) {
addRole.append("&node_default_gateway=");
addRole.append(cmd.getGateWay());
}
addRole.append("&enable_provisioning_flag=nextbootonly&rtn_format=XML&action=add");
s = httpCall(addRole.toString());
if (s == null) {
return new PrepareLinMinPxeServerAnswer(cmd, "Http call failed");
}
r = new XmlReturn(s, "LinMinBareMetalAPI");
res = r.getValue("actionResultsMsg");
s_logger.debug(s.toString());
if (!res.startsWith("Successful")) {
return new PrepareLinMinPxeServerAnswer(cmd, "Add LinMin role failed");
}
} catch (Exception e) {
s_logger.warn("Cannot parse result from Lin Min server", e);
return new PrepareLinMinPxeServerAnswer(cmd, e.getMessage());
}
s_logger.debug("Prepare LinMin PXE server successfully");
return new PrepareLinMinPxeServerAnswer(cmd);
}
@Override
public Answer executeRequest(Command cmd) {
if (cmd instanceof ReadyCommand) {
return execute((ReadyCommand) cmd);
} else if (cmd instanceof PrepareLinMinPxeServerCommand) {
return execute((PrepareLinMinPxeServerCommand)cmd);
} else {
return Answer.createUnsupportedCommandAnswer(cmd);
}
}
@Override
public void disconnected() {
// TODO Auto-generated method stub
}
@Override
public IAgentControl getAgentControl() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setAgentControl(IAgentControl agentControl) {
// TODO Auto-generated method stub
}
}

View File

@ -1,37 +0,0 @@
package com.cloud.baremetal;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerCommand;
import com.cloud.api.AddPxeServerCmd;
import com.cloud.api.response.PxeServerResponse;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
import com.cloud.utils.component.Manager;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
public interface PxeServerManager extends Manager {
public static class PxeServerType {
private String _name;
public static final PxeServerType LinMin = new PxeServerType("LinMin");
public static final PxeServerType DMCD = new PxeServerType("DMCD");
public PxeServerType(String name) {
_name = name;
}
public String getName() {
return _name;
}
}
public Host addPxeServer(AddPxeServerCmd cmd) throws InvalidParameterValueException, CloudRuntimeException;
public PxeServerResponse getApiResponse(Host pxeServer);
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context, Long pxeServerId);
}

View File

@ -1,70 +0,0 @@
package com.cloud.baremetal;
import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerCommand;
import com.cloud.api.AddPxeServerCmd;
import com.cloud.api.response.PxeServerResponse;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
@Local(value = {PxeServerManager.class})
public class PxeServerManagerImpl implements PxeServerManager {
private static final org.apache.log4j.Logger s_logger = Logger.getLogger(PxeServerManagerImpl.class);
protected String _name;
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_name = name;
return true;
}
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
return true;
}
@Override
public String getName() {
return _name;
}
protected String getPxeServerGuid(String zoneId, String name, String ip) {
return zoneId + "-" + name + "-" + ip;
}
@Override
public Host addPxeServer(AddPxeServerCmd cmd) throws InvalidParameterValueException, CloudRuntimeException {
// TODO Auto-generated method stub
return null;
}
@Override
public PxeServerResponse getApiResponse(Host pxeServer) {
PxeServerResponse response = new PxeServerResponse();
response.setId(pxeServer.getId());
return response;
}
@Override
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context, Long pxeServerId) {
return true;
}
}

View File

@ -147,7 +147,6 @@ import com.cloud.vm.dao.SecondaryStorageVmDaoImpl;
import com.cloud.vm.dao.UserVmDaoImpl;
import com.cloud.vm.dao.UserVmDetailsDaoImpl;
import com.cloud.vm.dao.VMInstanceDaoImpl;
import com.cloud.vm.BareMetalVmManagerImpl;;
public class DefaultComponentLibrary implements ComponentLibrary {
@ -325,7 +324,7 @@ public class DefaultComponentLibrary implements ComponentLibrary {
addManager("ClusteredAgentManager", ClusteredAgentManagerImpl.class);
addManager("VirtualMachineManager", ClusteredVirtualMachineManagerImpl.class);
addManager("HypervisorGuruManager", HypervisorGuruManagerImpl.class);
addManager("BareMetalVmManager", BareMetalVmManagerImpl.class);
ComponentInfo<? extends Manager> info = addManager("ConsoleProxyManager", ConsoleProxyManagerImpl.class);
info.addParameter("consoleproxy.sslEnabled", "true");

View File

@ -1,5 +0,0 @@
package com.cloud.vm;
public interface BareMetalVmManager extends UserVmManager {
}

View File

@ -1,457 +0,0 @@
package com.cloud.vm;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.api.StopAnswer;
import com.cloud.agent.api.baremetal.PrepareLinMinPxeServerCommand;
import com.cloud.agent.manager.Commands;
import com.cloud.api.commands.AttachVolumeCmd;
import com.cloud.api.commands.CreateTemplateCmd;
import com.cloud.api.commands.DeployVMCmd;
import com.cloud.api.commands.DetachVolumeCmd;
import com.cloud.api.commands.UpgradeVMCmd;
import com.cloud.baremetal.LinMinPxeServerManager;
import com.cloud.baremetal.PxeServerManager;
import com.cloud.baremetal.PxeServerManager.PxeServerType;
import com.cloud.configuration.ResourceCount.ResourceType;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.deploy.DataCenterDeployment;
import com.cloud.deploy.DeployDestination;
import com.cloud.domain.DomainVO;
import com.cloud.event.EventTypes;
import com.cloud.event.UsageEventVO;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network;
import com.cloud.network.NetworkVO;
import com.cloud.network.IpAddrAllocator.IpAddr;
import com.cloud.network.Networks.TrafficType;
import com.cloud.server.ManagementService;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.Storage;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Volume;
import com.cloud.storage.Storage.TemplateType;
import com.cloud.user.Account;
import com.cloud.user.AccountVO;
import com.cloud.user.SSHKeyPair;
import com.cloud.user.UserContext;
import com.cloud.user.UserVO;
import com.cloud.uservm.UserVm;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.component.Manager;
import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.crypt.RSAHelper;
import com.cloud.utils.db.DB;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.VirtualMachineProfile.Param;
@Local(value={BareMetalVmManager.class, BareMetalVmService.class})
public class BareMetalVmManagerImpl extends UserVmManagerImpl implements BareMetalVmManager, BareMetalVmService, Manager {
private static final Logger s_logger = Logger.getLogger(BareMetalVmManagerImpl.class);
private ConfigurationDao _configDao;
@Override
public boolean attachISOToVM(long vmId, long isoId, boolean attach) {
s_logger.warn("attachISOToVM is not supported by Bare Metal, just fake a true");
return true;
}
@Override
public Volume attachVolumeToVM(AttachVolumeCmd command) {
s_logger.warn("attachVolumeToVM is not supported by Bare Metal, return null");
return null;
}
@Override
public Volume detachVolumeFromVM(DetachVolumeCmd cmd) {
s_logger.warn("detachVolumeFromVM is not supported by Bare Metal, return null");
return null;
}
@Override
public UserVm upgradeVirtualMachine(UpgradeVMCmd cmd) {
s_logger.warn("upgradeVirtualMachine is not supported by Bare Metal, return null");
return null;
}
@Override
public VMTemplateVO createPrivateTemplateRecord(CreateTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException, ResourceAllocationException {
s_logger.warn("createPrivateTemplateRecord is not supported by Bare Metal, return null");
return null;
}
@Override @DB
public VMTemplateVO createPrivateTemplate(CreateTemplateCmd command) throws CloudRuntimeException {
s_logger.warn("createPrivateTemplate is not supported by Bare Metal, return null");
return null;
}
@Override
public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
StorageUnavailableException, ResourceAllocationException {
Account caller = UserContext.current().getCaller();
String accountName = cmd.getAccountName();
Long domainId = cmd.getDomainId();
List<Long> networkList = cmd.getNetworkIds();
String group = cmd.getGroup();
Account owner = _accountDao.findActiveAccount(accountName, domainId);
if (owner == null) {
throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain " + domainId);
}
_accountMgr.checkAccess(caller, owner);
long accountId = owner.getId();
DataCenterVO dc = _dcDao.findById(cmd.getZoneId());
if (dc == null) {
throw new InvalidParameterValueException("Unable to find zone: " + cmd.getZoneId());
}
if (dc.getDomainId() != null) {
DomainVO domain = _domainDao.findById(dc.getDomainId());
if (domain == null) {
throw new CloudRuntimeException("Unable to find the domain " + dc.getDomainId() + " for the zone: " + dc);
}
_accountMgr.checkAccess(caller, domain);
_accountMgr.checkAccess(owner, domain);
}
// check if account/domain is with in resource limits to create a new vm
if (_accountMgr.resourceLimitExceeded(owner, ResourceType.user_vm)) {
ResourceAllocationException rae = new ResourceAllocationException("Maximum number of virtual machines for account: " + owner.getAccountName()
+ " has been exceeded.");
rae.setResourceType("vm");
throw rae;
}
ServiceOfferingVO offering = _serviceOfferingDao.findById(cmd.getServiceOfferingId());
if (offering == null || offering.getRemoved() != null) {
throw new InvalidParameterValueException("Unable to find service offering: " + cmd.getServiceOfferingId());
}
VMTemplateVO template = _templateDao.findById(cmd.getTemplateId());
// Make sure a valid template ID was specified
if (template == null || template.getRemoved() != null) {
throw new InvalidParameterValueException("Unable to use template " + cmd.getTemplateId());
}
if (template.getTemplateType().equals(TemplateType.SYSTEM)) {
throw new InvalidParameterValueException("Unable to use system template " + cmd.getTemplateId()+" to deploy a user vm");
}
if (template.getFormat() != Storage.ImageFormat.BAREMETAL) {
throw new InvalidParameterValueException("Unable to use non Bare Metal template" + cmd.getTemplateId() +" to deploy a bare metal vm");
}
String userData = cmd.getUserData();
byte [] decodedUserData = null;
if (userData != null) {
if (userData.length() >= 2 * MAX_USER_DATA_LENGTH_BYTES) {
throw new InvalidParameterValueException("User data is too long");
}
decodedUserData = org.apache.commons.codec.binary.Base64.decodeBase64(userData.getBytes());
if (decodedUserData.length > MAX_USER_DATA_LENGTH_BYTES){
throw new InvalidParameterValueException("User data is too long");
}
if (decodedUserData.length < 1) {
throw new InvalidParameterValueException("User data is too short");
}
}
// Find an SSH public key corresponding to the key pair name, if one is given
String sshPublicKey = null;
if (cmd.getSSHKeyPairName() != null && !cmd.getSSHKeyPairName().equals("")) {
Account account = UserContext.current().getCaller();
SSHKeyPair pair = _sshKeyPairDao.findByName(account.getAccountId(), account.getDomainId(), cmd.getSSHKeyPairName());
if (pair == null) {
throw new InvalidParameterValueException("A key pair with name '" + cmd.getSSHKeyPairName() + "' was not found.");
}
sshPublicKey = pair.getPublicKey();
}
_accountMgr.checkAccess(caller, template);
DataCenterDeployment plan = new DataCenterDeployment(dc.getId());
s_logger.debug("Allocating in the DB for bare metal vm");
if (dc.getNetworkType() != NetworkType.Basic || networkList != null) {
s_logger.warn("Bare Metal only supports basical network mode now, switch to baisc network automatically");
}
Network defaultNetwork = _networkMgr.getSystemNetworkByZoneAndTrafficType(dc.getId(), TrafficType.Guest);
if (defaultNetwork == null) {
throw new InvalidParameterValueException("Unable to find a default network to start a vm");
}
networkList = new ArrayList<Long>();
networkList.add(defaultNetwork.getId());
List<Pair<NetworkVO, NicProfile>> networks = new ArrayList<Pair<NetworkVO, NicProfile>>();
short defaultNetworkNumber = 0;
for (Long networkId : networkList) {
NetworkVO network = _networkDao.findById(networkId);
if (network == null) {
throw new InvalidParameterValueException("Unable to find network by id " + networkId);
} else {
if (!network.isShared()) {
//Check account permissions
List<NetworkVO> networkMap = _networkDao.listBy(accountId, networkId);
if (networkMap == null || networkMap.isEmpty()) {
throw new PermissionDeniedException("Unable to create a vm using network with id " + networkId + ", permission denied");
}
}
if (network.isDefault()) {
defaultNetworkNumber++;
}
networks.add(new Pair<NetworkVO, NicProfile>(network, null));
}
}
//at least one network default network has to be set
if (defaultNetworkNumber == 0) {
throw new InvalidParameterValueException("At least 1 default network has to be specified for the vm");
} else if (defaultNetworkNumber >1) {
throw new InvalidParameterValueException("Only 1 default network per vm is supported");
}
long id = _vmDao.getNextInSequence(Long.class, "id");
String hostName = cmd.getName();
String instanceName = VirtualMachineName.getVmName(id, owner.getId(), _instance);
if (hostName == null) {
hostName = instanceName;
} else {
//verify hostName (hostname doesn't have to be unique)
if (!NetUtils.verifyDomainNameLabel(hostName, true)) {
throw new InvalidParameterValueException("Invalid name. Vm name can contain ASCII letters 'a' through 'z', the digits '0' through '9', " +
"and the hyphen ('-'), must be between 1 and 63 characters long, and can't start or end with \"-\" and can't start with digit");
}
}
UserVmVO vm = new UserVmVO(id, instanceName, cmd.getDisplayName(), template.getId(), HypervisorType.BareMetal,
template.getGuestOSId(), offering.getOfferHA(), domainId, owner.getId(), offering.getId(), userData, hostName);
if (sshPublicKey != null) {
vm.setDetail("SSH.PublicKey", sshPublicKey);
}
if (_itMgr.allocate(vm, template, offering, null, null, networks, null, plan, cmd.getHypervisor(), owner) == null) {
return null;
}
// startVirtualMachine() will retrieve this property
vm.setDetail("pxeboot", "true");
_vmDao.saveDetails(vm);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully allocated DB entry for " + vm);
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully allocated DB entry for " + vm);
}
UserContext.current().setEventDetails("Vm Id: " + vm.getId());
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_CREATE, accountId, dc.getId(), vm.getId(), vm.getName(), offering.getId(),
template.getId(), null);
_usageEventDao.persist(usageEvent);
_accountMgr.incrementResourceCount(accountId, ResourceType.user_vm);
// Assign instance to the group
try {
if (group != null) {
boolean addToGroup = addInstanceToGroup(Long.valueOf(id), group);
if (!addToGroup) {
throw new CloudRuntimeException("Unable to assign Vm to the group " + group);
}
}
} catch (Exception ex) {
throw new CloudRuntimeException("Unable to assign Vm to the group " + group);
}
return vm;
}
public UserVm startVirtualMachine(DeployVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException {
long vmId = cmd.getEntityId();
UserVmVO vm = _vmDao.findById(vmId);
_vmDao.loadDetails(vm);
List<HostVO> servers = _hostDao.listBy(Host.Type.PxeServer, vm.getDataCenterId());
if (servers.size() == 0) {
throw new CloudRuntimeException("Cannot find PXE server, please make sure there is one PXE server per zone");
}
HostVO pxeServer = servers.get(0);
VMTemplateVO template = _templateDao.findById(vm.getTemplateId());
if (template == null || template.getFormat() != Storage.ImageFormat.BAREMETAL) {
throw new InvalidParameterValueException("Invalid template with id = " + vm.getTemplateId());
}
Map<VirtualMachineProfile.Param, Object> params = new HashMap<VirtualMachineProfile.Param, Object>();
//TODO: have to ugly harding code here
if (pxeServer.getResource().equalsIgnoreCase("com.cloud.baremetal.LinMinPxeServerResource")) {
params.put(Param.PxeSeverType, PxeServerType.LinMin);
} else {
throw new CloudRuntimeException("Unkown PXE server resource " + pxeServer.getResource());
}
return startVirtualMachine(cmd, params);
}
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_name = name;
ComponentLocator locator = ComponentLocator.getCurrentLocator();
_configDao = locator.getDao(ConfigurationDao.class);
if (_configDao == null) {
throw new ConfigurationException("Unable to get the configuration dao.");
}
Map<String, String> configs = _configDao.getConfiguration("AgentManager", params);
_instance = configs.get("instance.name");
if (_instance == null) {
_instance = "DEFAULT";
}
String workers = configs.get("expunge.workers");
int wrks = NumbersUtil.parseInt(workers, 10);
String time = configs.get("expunge.interval");
_expungeInterval = NumbersUtil.parseInt(time, 86400);
time = configs.get("expunge.delay");
_expungeDelay = NumbersUtil.parseInt(time, _expungeInterval);
_executor = Executors.newScheduledThreadPool(wrks, new NamedThreadFactory("UserVm-Scavenger"));
_itMgr.registerGuru(Type.UserBareMetal, this);
s_logger.info("User VM Manager is configured.");
return true;
}
@Override
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context) {
UserVmVO vm = profile.getVirtualMachine();
Account owner = _accountDao.findById(vm.getAccountId());
if (owner == null || owner.getState() == Account.State.disabled) {
throw new PermissionDeniedException("The owner of " + vm + " either does not exist or is disabled: " + vm.getAccountId());
}
PxeServerType pxeType = (PxeServerType) profile.getParameter(Param.PxeSeverType);
if (pxeType == null) {
s_logger.debug("This is a normal IPMI start, skip prepartion of PXE server");
return true;
}
s_logger.debug("This is a PXE start, prepare PXE server first");
PxeServerManager pxeMgr = null;
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
if (pxeType == PxeServerType.LinMin) {
pxeMgr = locator.getManager(LinMinPxeServerManager.class);
} else {
throw new CloudRuntimeException("Unsupport PXE type " + pxeType.toString());
}
if (pxeMgr == null) {
throw new CloudRuntimeException("No PXE manager find for type " + pxeType.toString());
}
List<HostVO> servers = _hostDao.listBy(Host.Type.PxeServer, vm.getDataCenterId());
if (servers.size() == 0) {
throw new CloudRuntimeException("Cannot find PXE server, please make sure there is one PXE server per zone");
}
HostVO pxeServer = servers.get(0);
if (!pxeMgr.prepare(profile, dest, context, pxeServer.getId())) {
throw new CloudRuntimeException("Pepare PXE server failed");
}
profile.addBootArgs("PxeBoot");
return true;
}
@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context) {
UserVmVO userVm = profile.getVirtualMachine();
List<NicVO> nics = _nicDao.listByVmId(userVm.getId());
for (NicVO nic : nics) {
NetworkVO network = _networkDao.findById(nic.getNetworkId());
if (network.getTrafficType() == TrafficType.Guest) {
userVm.setPrivateIpAddress(nic.getIp4Address());
userVm.setPrivateMacAddress(nic.getMacAddress());
}
}
_vmDao.update(userVm.getId(), userVm);
return true;
}
@Override
public boolean finalizeStart(VirtualMachineProfile<UserVmVO> profile, long hostId, Commands cmds, ReservationContext context) {
UserVmVO vm = profile.getVirtualMachine();
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_START, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), vm.getName(),
vm.getServiceOfferingId(), vm.getTemplateId(), null);
_usageEventDao.persist(usageEvent);
List<NicVO> nics = _nicDao.listByVmId(vm.getId());
for (NicVO nic : nics) {
NetworkVO network = _networkDao.findById(nic.getNetworkId());
long isDefault = (nic.isDefaultNic()) ? 1 : 0;
usageEvent = new UsageEventVO(EventTypes.EVENT_NETWORK_OFFERING_CREATE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), vm.getName(),
network.getNetworkOfferingId(), null, isDefault);
_usageEventDao.persist(usageEvent);
}
return true;
}
@Override
public void finalizeStop(VirtualMachineProfile<UserVmVO> profile, StopAnswer answer) {
super.finalizeStop(profile, answer);
}
@Override
public UserVm destroyVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException {
return super.destroyVm(vmId);
}
}

View File

@ -197,68 +197,68 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
private static final Logger s_logger = Logger.getLogger(UserVmManagerImpl.class);
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3; // 3 seconds
@Inject HostDao _hostDao = null;
@Inject DetailsDao _detailsDao = null;
@Inject DomainRouterDao _routerDao = null;
@Inject ServiceOfferingDao _offeringDao = null;
@Inject DiskOfferingDao _diskOfferingDao = null;
@Inject UserStatisticsDao _userStatsDao = null;
@Inject VMTemplateDao _templateDao = null;
@Inject VMTemplateHostDao _templateHostDao = null;
@Inject DomainDao _domainDao = null;
@Inject ResourceLimitDao _limitDao = null;
@Inject UserVmDao _vmDao = null;
@Inject VolumeDao _volsDao = null;
@Inject DataCenterDao _dcDao = null;
@Inject FirewallRulesDao _rulesDao = null;
@Inject LoadBalancerVMMapDao _loadBalancerVMMapDao = null;
@Inject LoadBalancerDao _loadBalancerDao = null;
@Inject IPAddressDao _ipAddressDao = null;
@Inject HostPodDao _podDao = null;
@Inject CapacityDao _capacityDao = null;
@Inject NetworkManager _networkMgr = null;
@Inject StorageManager _storageMgr = null;
@Inject SnapshotManager _snapshotMgr = null;
@Inject AgentManager _agentMgr = null;
@Inject ConfigurationManager _configMgr = null;
@Inject AccountDao _accountDao = null;
@Inject UserDao _userDao = null;
@Inject SnapshotDao _snapshotDao = null;
@Inject GuestOSDao _guestOSDao = null;
@Inject GuestOSCategoryDao _guestOSCategoryDao = null;
@Inject HighAvailabilityManager _haMgr = null;
@Inject AlertManager _alertMgr = null;
@Inject AccountManager _accountMgr;
@Inject AccountService _accountService;
@Inject AsyncJobManager _asyncMgr;
@Inject VlanDao _vlanDao;
@Inject ClusterDao _clusterDao;
@Inject AccountVlanMapDao _accountVlanMapDao;
@Inject StoragePoolDao _storagePoolDao;
@Inject VMTemplateHostDao _vmTemplateHostDao;
@Inject SecurityGroupManager _networkGroupMgr;
@Inject ServiceOfferingDao _serviceOfferingDao;
@Inject NetworkOfferingDao _networkOfferingDao;
@Inject EventDao _eventDao = null;
@Inject InstanceGroupDao _vmGroupDao;
@Inject InstanceGroupVMMapDao _groupVMMapDao;
@Inject VirtualMachineManager _itMgr;
@Inject NetworkDao _networkDao;
@Inject VirtualNetworkApplianceManager _routerMgr;
@Inject NicDao _nicDao;
@Inject RulesManager _rulesMgr;
@Inject LoadBalancingRulesManager _lbMgr;
@Inject UsageEventDao _usageEventDao;
@Inject SSHKeyPairDao _sshKeyPairDao;
@Inject UserVmDetailsDao _vmDetailsDao;
@Inject protected HostDao _hostDao = null;
@Inject protected DetailsDao _detailsDao = null;
@Inject protected DomainRouterDao _routerDao = null;
@Inject protected ServiceOfferingDao _offeringDao = null;
@Inject protected DiskOfferingDao _diskOfferingDao = null;
@Inject protected UserStatisticsDao _userStatsDao = null;
@Inject protected VMTemplateDao _templateDao = null;
@Inject protected VMTemplateHostDao _templateHostDao = null;
@Inject protected DomainDao _domainDao = null;
@Inject protected ResourceLimitDao _limitDao = null;
@Inject protected UserVmDao _vmDao = null;
@Inject protected VolumeDao _volsDao = null;
@Inject protected DataCenterDao _dcDao = null;
@Inject protected FirewallRulesDao _rulesDao = null;
@Inject protected LoadBalancerVMMapDao _loadBalancerVMMapDao = null;
@Inject protected LoadBalancerDao _loadBalancerDao = null;
@Inject protected IPAddressDao _ipAddressDao = null;
@Inject protected HostPodDao _podDao = null;
@Inject protected CapacityDao _capacityDao = null;
@Inject protected NetworkManager _networkMgr = null;
@Inject protected StorageManager _storageMgr = null;
@Inject protected SnapshotManager _snapshotMgr = null;
@Inject protected AgentManager _agentMgr = null;
@Inject protected ConfigurationManager _configMgr = null;
@Inject protected AccountDao _accountDao = null;
@Inject protected UserDao _userDao = null;
@Inject protected SnapshotDao _snapshotDao = null;
@Inject protected GuestOSDao _guestOSDao = null;
@Inject protected GuestOSCategoryDao _guestOSCategoryDao = null;
@Inject protected HighAvailabilityManager _haMgr = null;
@Inject protected AlertManager _alertMgr = null;
@Inject protected AccountManager _accountMgr;
@Inject protected AccountService _accountService;
@Inject protected AsyncJobManager _asyncMgr;
@Inject protected VlanDao _vlanDao;
@Inject protected ClusterDao _clusterDao;
@Inject protected AccountVlanMapDao _accountVlanMapDao;
@Inject protected StoragePoolDao _storagePoolDao;
@Inject protected VMTemplateHostDao _vmTemplateHostDao;
@Inject protected SecurityGroupManager _networkGroupMgr;
@Inject protected ServiceOfferingDao _serviceOfferingDao;
@Inject protected NetworkOfferingDao _networkOfferingDao;
@Inject protected EventDao _eventDao = null;
@Inject protected InstanceGroupDao _vmGroupDao;
@Inject protected InstanceGroupVMMapDao _groupVMMapDao;
@Inject protected VirtualMachineManager _itMgr;
@Inject protected NetworkDao _networkDao;
@Inject protected VirtualNetworkApplianceManager _routerMgr;
@Inject protected NicDao _nicDao;
@Inject protected RulesManager _rulesMgr;
@Inject protected LoadBalancingRulesManager _lbMgr;
@Inject protected UsageEventDao _usageEventDao;
@Inject protected SSHKeyPairDao _sshKeyPairDao;
@Inject protected UserVmDetailsDao _vmDetailsDao;
ScheduledExecutorService _executor = null;
int _expungeInterval;
int _expungeDelay;
protected ScheduledExecutorService _executor = null;
protected int _expungeInterval;
protected int _expungeDelay;
String _name;
String _instance;
String _zone;
protected String _name;
protected String _instance;
protected String _zone;
private ConfigurationDao _configDao;