bug 7498: fixed search by keyword in listUserVm/listSystemVms/listRouters commands

status 7498: resolved fixed
This commit is contained in:
alena 2010-12-13 14:40:27 -08:00
parent 24b92b2c56
commit d077b127aa
33 changed files with 292 additions and 297 deletions

View File

@ -61,7 +61,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity {
/**
* @return the name of the virtual machine.
*/
public String getHostName();
public String getName();
/**
* @return the ip address of the virtual machine.

View File

@ -67,7 +67,7 @@ public class StartCommand extends AbstractStartCommand {
this.guestNetworkId = guestNetworkId;
guestMacAddress = vm.getGuestMacAddress();
vncPassword = vm.getVncPassword();
hostName = vm.getHostName();
hostName = vm.getName();
networkRateMbps = networkRate;
networkRateMulticastMbps = multicastRate;
if (bits == 32) {

View File

@ -107,7 +107,7 @@ public class StartConsoleProxyCommand extends AbstractStartCommand {
String basic = " eth0ip=" + proxy.getGuestIpAddress() + " eth0mask=" + proxy.getGuestNetmask() + " eth1ip="
+ eth1Ip + " eth1mask=" + eth1NetMask + " eth2ip="
+ eth2Ip + " eth2mask=" + eth2NetMask + " gateway=" + gateWay
+ " dns1=" + proxy.getDns1() + " type=consoleproxy"+ " name=" + proxy.getHostName() + " template=domP";
+ " dns1=" + proxy.getDns1() + " type=consoleproxy"+ " name=" + proxy.getName() + " template=domP";
if (proxy.getDns2() != null) {
basic = basic + " dns2=" + proxy.getDns2();
}

View File

@ -78,7 +78,7 @@ public class StartRouterCommand extends AbstractStartCommand {
String eth2Ip = router.getPublicIpAddress()==null?"0.0.0.0":router.getPublicIpAddress();
String basic = " eth0ip=" + router.getGuestIpAddress() + " eth0mask=" + router.getGuestNetmask() + " eth1ip="
+ router.getPrivateIpAddress() + " eth1mask=" + router.getPrivateNetmask() + " gateway=" + router.getGateway()
+ " dns1=" + router.getDns1() + " name=" + router.getHostName() + " mgmtcidr=" + mgmt_host;
+ " dns1=" + router.getDns1() + " name=" + router.getName() + " mgmtcidr=" + mgmt_host;
if (!router.getPublicMacAddress().equalsIgnoreCase("FE:FF:FF:FF:FF:FF")) {
basic = basic + " eth2ip=" + eth2Ip + " eth2mask=" + router.getPublicNetmask();
}

View File

@ -98,7 +98,7 @@ public class StartSecStorageVmCommand extends AbstractStartCommand {
String basic = " eth0ip=" + secStorageVm.getGuestIpAddress() + " eth0mask=" + secStorageVm.getGuestNetmask() + " eth1ip="
+ eth1Ip + " eth1mask=" + eth1NetMask + " eth2ip="
+ eth2Ip + " eth2mask=" + eth2NetMask + " gateway=" + gateWay
+ " dns1=" + secStorageVm.getDns1() + " type=secstorage" + " name=" + secStorageVm.getHostName() + " template=domP";
+ " dns1=" + secStorageVm.getDns1() + " type=secstorage" + " name=" + secStorageVm.getName() + " template=domP";
if (secStorageVm.getDns2() != null) {
basic = basic + " dns2=" + secStorageVm.getDns2();
}

View File

@ -51,7 +51,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
protected long id;
@Column(name="name", updatable=false, nullable=false, length=255)
protected String hostName = null;
protected String name = null;
@Column(name="vnc_password", updatable=true, nullable=false, length=255)
protected String vncPassword;
@ -149,7 +149,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
long accountId,
boolean haEnabled) {
this.id = id;
this.hostName = name;
this.name = name;
if (vmTemplateId != null) {
this.templateId = vmTemplateId;
}
@ -184,7 +184,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
Long hostId) {
super();
this.id = id;
this.hostName = name;
this.name = name;
if (vmTemplateId > -1)
this.templateId = vmTemplateId;
else
@ -267,8 +267,8 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
}
@Override
public String getHostName() {
return hostName;
public String getName() {
return name;
}
@Override

View File

@ -682,8 +682,8 @@ public class ApiResponseHelper implements ResponseGenerator {
if (instanceId != null) {
VMInstanceVO vm = ApiDBUtils.findVMInstanceById(instanceId);
volResponse.setVirtualMachineId(vm.getId());
volResponse.setVirtualMachineName(vm.getHostName());
volResponse.setVirtualMachineDisplayName(vm.getHostName());
volResponse.setVirtualMachineName(vm.getName());
volResponse.setVirtualMachineDisplayName(vm.getName());
volResponse.setVirtualMachineState(vm.getState().toString());
}
@ -851,7 +851,7 @@ public class ApiResponseHelper implements ResponseGenerator {
UserVm vm = ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
if(vm != null){
response.setVirtualMachineId(vm.getId());
response.setVirtualMachineName(vm.getHostName());
response.setVirtualMachineName(vm.getName());
response.setVirtualMachineDisplayName(vm.getDisplayName());
}
}
@ -875,7 +875,7 @@ public class ApiResponseHelper implements ResponseGenerator {
UserVm vm = ApiDBUtils.findUserVmById(fwRule.getVirtualMachineId());
if(vm != null){//vm might be destroyed
response.setVirtualMachineId(vm.getId());
response.setVirtualMachineName(vm.getHostName());
response.setVirtualMachineName(vm.getName());
response.setVirtualMachineDisplayName(vm.getDisplayName());
}
}
@ -907,7 +907,7 @@ public class ApiResponseHelper implements ResponseGenerator {
}
userVmResponse.setId(userVm.getId());
userVmResponse.setName(userVm.getHostName());
userVmResponse.setName(userVm.getName());
userVmResponse.setCreated(userVm.getCreated());
if (userVm.getState() != null) {
@ -919,7 +919,7 @@ public class ApiResponseHelper implements ResponseGenerator {
if (userVm.getDisplayName() != null) {
userVmResponse.setDisplayName(userVm.getDisplayName());
} else {
userVmResponse.setDisplayName(userVm.getHostName());
userVmResponse.setDisplayName(userVm.getName());
}
InstanceGroupVO group = ApiDBUtils.findInstanceGroupForVM(userVm.getId());
@ -1046,7 +1046,7 @@ public class ApiResponseHelper implements ResponseGenerator {
DomainRouterResponse routerResponse = new DomainRouterResponse();
routerResponse.setId(router.getId());
routerResponse.setZoneId(router.getDataCenterId());
routerResponse.setName(router.getHostName());
routerResponse.setName(router.getName());
routerResponse.setPodId(router.getPodId());
routerResponse.setTemplateId(router.getTemplateId());
routerResponse.setCreated(router.getCreated());
@ -1106,7 +1106,7 @@ public class ApiResponseHelper implements ResponseGenerator {
vmResponse.setZoneId(vm.getDataCenterId());
vmResponse.setNetworkDomain(vm.getDomain());
vmResponse.setName(vm.getHostName());
vmResponse.setName(vm.getName());
vmResponse.setPodId(vm.getPodId());
vmResponse.setTemplateId(vm.getTemplateId());
vmResponse.setCreated(vm.getCreated());

View File

@ -26,7 +26,7 @@ public class ConsoleProxyExecutorHelper {
public static ConsoleProxyOperationResultObject composeResultObject(ManagementServer managementServer, ConsoleProxyVO proxy) {
ConsoleProxyOperationResultObject result = new ConsoleProxyOperationResultObject();
result.setId(proxy.getId());
result.setName(proxy.getHostName());
result.setName(proxy.getName());
result.setZoneId(proxy.getDataCenterId());
result.setZoneName(managementServer.findDataCenterById(proxy.getDataCenterId()).getName());
result.setDns1(proxy.getDns1());

View File

@ -145,7 +145,7 @@ public class DeployVMExecutor extends VMOperationExecutor {
return resultObject;
resultObject.setId(vm.getId());
resultObject.setName(vm.getHostName());
resultObject.setName(vm.getName());
resultObject.setCreated(vm.getCreated());
resultObject.setZoneId(vm.getDataCenterId());
resultObject.setZoneName(getAsyncJobMgr().getExecutorContext().getManagementServer().findDataCenterById(vm.getDataCenterId()).getName());
@ -153,7 +153,7 @@ public class DeployVMExecutor extends VMOperationExecutor {
resultObject.setServiceOfferingId(vm.getServiceOfferingId());
resultObject.setHaEnabled(vm.isHaEnabled());
if (vm.getDisplayName() == null || vm.getDisplayName().length() == 0) {
resultObject.setDisplayName(vm.getHostName());
resultObject.setDisplayName(vm.getName());
}
else {
resultObject.setDisplayName(vm.getDisplayName());

View File

@ -84,7 +84,7 @@ public class DestroyVMExecutor extends VMOperationExecutor {
VMOperationParam param = listener.getParam();
AsyncJobManager asyncMgr = getAsyncJobMgr();
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
String params = "id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
String params = "id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
if(s_logger.isDebugEnabled())
s_logger.debug("Execute asynchronize destroy VM command: received stop-VM answer, " + vm.getHostId() + "-" + seq);
@ -132,7 +132,7 @@ public class DestroyVMExecutor extends VMOperationExecutor {
} else {
asyncMgr.getExecutorContext().getItMgr().stateTransitTo(vm, Event.OperationFailed, vm.getHostId());
asyncMgr.completeAsyncJob(getJob().getId(),
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent failed to stop VM: " + vm.getHostName());
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent failed to stop VM: " + vm.getName());
// managementServer.saveEvent(param.getUserId(), vm.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
// "failed to stop VM instance : " + vm.getName(), params, param.getChildEventId());
// managementServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_DESTROY,
@ -171,8 +171,8 @@ public class DestroyVMExecutor extends VMOperationExecutor {
event.setUserId(param.getUserId());
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_DESTROY);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("failed to stop VM instance : " + vm.getHostName() + " due to " + resultMessage);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("failed to stop VM instance : " + vm.getName() + " due to " + resultMessage);
event.setLevel(EventVO.LEVEL_ERROR);
boolean jobStatusUpdated = false;

View File

@ -78,7 +78,7 @@ public class RebootVMExecutor extends VMOperationExecutor {
VMOperationParam param = listener.getParam();
AsyncJobManager asyncMgr = getAsyncJobMgr();
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
String params = "id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
String params = "id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
boolean jobStatusUpdated = false;
try {
@ -90,14 +90,14 @@ public class RebootVMExecutor extends VMOperationExecutor {
AsyncJobResult.STATUS_SUCCEEDED, 0, VMExecutorHelper.composeResultObject(asyncMgr.getExecutorContext().getManagementServer(), vm, null));
jobStatusUpdated = true;
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_REBOOT,
"Successfully rebooted VM instance : " + vm.getHostName(), params, param.getEventId());
"Successfully rebooted VM instance : " + vm.getName(), params, param.getEventId());
} else {
asyncMgr.completeAsyncJob(getJob().getId(),
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent is unable to execute the command");
jobStatusUpdated = true;
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_REBOOT,
"Failed to reboot VM instance : " + vm.getHostName(), params, param.getEventId());
"Failed to reboot VM instance : " + vm.getName(), params, param.getEventId());
}
@ -142,8 +142,8 @@ public class RebootVMExecutor extends VMOperationExecutor {
event.setUserId(param.getUserId());
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_REBOOT);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("failed to reboot VM instance : " + vm.getHostName() + " due to " + resultMessage);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("failed to reboot VM instance : " + vm.getName() + " due to " + resultMessage);
event.setLevel(EventVO.LEVEL_ERROR);
boolean jobStatusUpdated = false;

View File

@ -32,7 +32,7 @@ public class RouterExecutorHelper {
resultObject.setDns2(router.getDns2());
resultObject.setNetworkDomain(router.getDomain());
resultObject.setGateway(router.getGateway());
resultObject.setName(router.getHostName());
resultObject.setName(router.getName());
resultObject.setPodId(router.getPodId());
resultObject.setPrivateIp(router.getPrivateIpAddress());
resultObject.setPrivateMacAddress(router.getPrivateMacAddress());

View File

@ -75,7 +75,7 @@ public class StopVMExecutor extends VMOperationExecutor {
VMOperationParam param = listener.getParam();
AsyncJobManager asyncMgr = getAsyncJobMgr();
ManagementServer managementServer = asyncMgr.getExecutorContext().getManagementServer();
String params = "id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
String params = "id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
if(s_logger.isDebugEnabled())
s_logger.debug("Execute asynchronize stop VM command: received answer, " + vm.getHostId() + "-" + seq);
@ -98,7 +98,7 @@ public class StopVMExecutor extends VMOperationExecutor {
jobStatusUpdated = true;
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
"Failed to stop VM instance : " + vm.getHostName(), params, param.getEventId());
"Failed to stop VM instance : " + vm.getName(), params, param.getEventId());
}
} catch(Exception e) {
s_logger.error("Unexpected exception " + e.getMessage(), e);
@ -110,7 +110,7 @@ public class StopVMExecutor extends VMOperationExecutor {
asyncMgr.completeAsyncJob(getJob().getId(),
AsyncJobResult.STATUS_FAILED, BaseCmd.INTERNAL_ERROR, "Agent failed to stop VM");
EventUtils.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_STOP,
"Failed to stop VM instance : " + vm.getHostName(), params, param.getEventId());
"Failed to stop VM instance : " + vm.getName(), params, param.getEventId());
}
}
} finally {
@ -141,8 +141,8 @@ public class StopVMExecutor extends VMOperationExecutor {
event.setUserId(param.getUserId());
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_STOP);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("failed to stop VM instance : " + vm.getHostName() + " due to " + resultMessage);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("failed to stop VM instance : " + vm.getName() + " due to " + resultMessage);
event.setLevel(EventVO.LEVEL_ERROR);
asyncMgr.completeAsyncJob(getJob().getId(),

View File

@ -110,7 +110,7 @@ public class SystemVmCmdExecutor extends VMOperationExecutor {
if (vm instanceof SecondaryStorageVmVO) {
SecondaryStorageVmVO ssVm = (SecondaryStorageVmVO)vm;
result.setId(ssVm.getId());
result.setName(vm.getHostName());
result.setName(vm.getName());
result.setZoneId(ssVm.getDataCenterId());
result.setZoneName(managementServer.findDataCenterById(ssVm.getDataCenterId()).getName());
result.setDns1(ssVm.getDns1());

View File

@ -30,7 +30,7 @@ public class VMExecutorHelper {
VMOperationResultObject resultObject = new VMOperationResultObject();
resultObject.setId(vm.getId());
resultObject.setName(vm.getHostName());
resultObject.setName(vm.getName());
resultObject.setCreated(vm.getCreated());
resultObject.setZoneId(vm.getDataCenterId());
resultObject.setZoneName(managementServer.findDataCenterById(vm.getDataCenterId()).getName());
@ -38,7 +38,7 @@ public class VMExecutorHelper {
resultObject.setServiceOfferingId(vm.getServiceOfferingId());
resultObject.setHaEnabled(vm.isHaEnabled());
if (vm.getDisplayName() == null || vm.getDisplayName().length() == 0) {
resultObject.setDisplayName(vm.getHostName());
resultObject.setDisplayName(vm.getName());
}
else {
resultObject.setDisplayName(vm.getDisplayName());

View File

@ -151,7 +151,7 @@ public class VolumeOperationExecutor extends BaseAsyncJobExecutor {
private AttachVolumeOperationResultObject composeAttachResultObject(UserVm instance, VolumeVO vol) {
AttachVolumeOperationResultObject resultObject = new AttachVolumeOperationResultObject();
resultObject.setVmName(instance.getHostName());
resultObject.setVmName(instance.getName());
resultObject.setVmDisplayName(instance.getDisplayName());
resultObject.setVirtualMachineId(instance.getId());
resultObject.setVmState(instance.getState().toString());

View File

@ -89,7 +89,7 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
if (vm.getHostId() == null) {
return -1;
}
GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getHostName()));
GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getName()));
return answer == null ? -1 : answer.getPort();
}

View File

@ -392,7 +392,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
return null;
} else {
if (s_logger.isTraceEnabled()) {
s_logger.trace("Console proxy " + proxy.getHostName() + " is started");
s_logger.trace("Console proxy " + proxy.getName() + " is started");
}
// if it is a new assignment or a changed assignment,
@ -636,7 +636,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
if (state == State.Running) {
if (s_logger.isTraceEnabled()) {
s_logger.trace("Console proxy is already started: " + proxy.getHostName());
s_logger.trace("Console proxy is already started: " + proxy.getName());
}
return proxy;
}
@ -659,7 +659,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
if (!_itMgr.stateTransitTo(proxy, com.cloud.vm.VirtualMachine.Event.StartRequested, routingHost.getId())) {
if (s_logger.isDebugEnabled()) {
ConsoleProxyVO temp = _consoleProxyDao.findById(proxyId);
s_logger.debug("Unable to start console proxy " + proxy.getHostName() + " because it is not in a startable state : "
s_logger.debug("Unable to start console proxy " + proxy.getName() + " because it is not in a startable state : "
+ ((temp != null) ? temp.getState().toString() : "null"));
}
continue;
@ -679,7 +679,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
String privateIpAddress = allocPrivateIpAddress(proxy.getDataCenterId(), routingHost.getPodId(), proxy.getId(),
proxy.getPrivateMacAddress());
if (privateIpAddress == null && (_IpAllocator != null && !_IpAllocator.exteralIpAddressAllocatorEnabled())) {
String msg = "Unable to allocate private ip addresses for " + proxy.getHostName() + " in pod " + pod.getId();
String msg = "Unable to allocate private ip addresses for " + proxy.getName() + " in pod " + pod.getId();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
}
@ -693,7 +693,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
List<VolumeVO> vols = _storageMgr.prepare(proxy, routingHost);
if (vols == null || vols.size() == 0) {
String msg = "Unable to prepare storage for " + proxy.getHostName() + " in pod " + pod.getId();
String msg = "Unable to prepare storage for " + proxy.getName() + " in pod " + pod.getId();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
}
@ -703,7 +703,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
GuestOSVO guestOS = _guestOSDao.findById(proxy.getGuestOSId());
if (guestOS == null) {
String msg = "Could not find guest OS description for OSId "
+ proxy.getGuestOSId() + " for vm: " + proxy.getHostName();
+ proxy.getGuestOSId() + " for vm: " + proxy.getName();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
} else {
@ -714,10 +714,10 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
// carry the console proxy port info over so that we don't
// need to configure agent on this
StartConsoleProxyCommand cmdStart = new StartConsoleProxyCommand(_networkRate, _multicastRate,
_proxyCmdPort, proxy, proxy.getHostName(), "", vols, Integer.toString(_consoleProxyPort),
_proxyCmdPort, proxy, proxy.getName(), "", vols, Integer.toString(_consoleProxyPort),
Integer.toString(_consoleProxyUrlPort), _mgmt_host, _mgmt_port, _sslEnabled, guestOSDescription);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Sending start command for console proxy " + proxy.getHostName() + " to " + routingHost.getName());
s_logger.debug("Sending start command for console proxy " + proxy.getName() + " to " + routingHost.getName());
}
try {
answer = _agentMgr.send(routingHost.getId(), cmdStart);
@ -725,12 +725,12 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
s_logger.debug("StartConsoleProxy Answer: " + (answer != null ? answer : "null"));
if (s_logger.isDebugEnabled()) {
s_logger.debug("Received answer on starting console proxy " + proxy.getHostName() + " on " + routingHost.getName());
s_logger.debug("Received answer on starting console proxy " + proxy.getName() + " on " + routingHost.getName());
}
if (answer != null && answer.getResult()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Console proxy " + proxy.getHostName() + " started on " + routingHost.getName());
s_logger.debug("Console proxy " + proxy.getName() + " started on " + routingHost.getName());
}
if (answer instanceof StartConsoleProxyAnswer) {
@ -749,7 +749,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_START);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Console proxy started - " + proxy.getHostName());
event.setDescription("Console proxy started - " + proxy.getName());
_eventDao.persist(event);
break;
}
@ -757,13 +757,13 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
+ answer.getDetails());
} catch (OperationTimedoutException e) {
if (e.isActive()) {
s_logger.debug("Unable to start vm " + proxy.getHostName()
s_logger.debug("Unable to start vm " + proxy.getName()
+ " due to operation timed out and it is active so scheduling a restart.");
_haMgr.scheduleRestart(proxy, true);
return null;
}
} catch (AgentUnavailableException e) {
s_logger.debug("Agent " + routingHost.toString() + " was unavailable to start VM " + proxy.getHostName());
s_logger.debug("Agent " + routingHost.toString() + " was unavailable to start VM " + proxy.getName());
}
avoid.add(routingHost);
@ -789,7 +789,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_START);
event.setLevel(EventVO.LEVEL_ERROR);
event.setStartId(startEventId);
event.setDescription("Starting console proxy failed due to unable to find a host - " + proxy.getHostName());
event.setDescription("Starting console proxy failed due to unable to find a host - " + proxy.getName());
_eventDao.persist(event);
throw new ExecutionException("Couldn't find a routingHost to run console proxy");
}
@ -877,7 +877,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
if (s_logger.isTraceEnabled()) {
s_logger.trace("Running proxy pool size : " + runningList.size());
for (ConsoleProxyVO proxy : runningList) {
s_logger.trace("Running proxy instance : " + proxy.getHostName());
s_logger.trace("Running proxy instance : " + proxy.getName());
}
}
@ -1078,7 +1078,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setAccountId(Account.ACCOUNT_ID_SYSTEM);
event.setType(EventTypes.EVENT_PROXY_CREATE);
event.setLevel(EventVO.LEVEL_INFO);
event.setDescription("New console proxy created - " + proxy.getHostName());
event.setDescription("New console proxy created - " + proxy.getName());
_eventDao.persist(event);
txn.commit();
@ -1532,7 +1532,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
}
} else {
if (s_logger.isInfoEnabled()) {
s_logger.info("Unable to acquire synchronization lock to start console proxy : " + readyProxy.getHostName());
s_logger.info("Unable to acquire synchronization lock to start console proxy : " + readyProxy.getName());
}
}
} finally {
@ -1753,7 +1753,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
}
} else {
if (s_logger.isInfoEnabled()) {
s_logger.info("Console proxy " + proxy.getHostName() + " is started");
s_logger.info("Console proxy " + proxy.getName() + " is started");
}
}
}
@ -1952,7 +1952,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
return stop(proxy, startEventId);
} catch (AgentUnavailableException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Stopping console proxy " + proxy.getHostName() + " failed : exception " + e.toString());
s_logger.debug("Stopping console proxy " + proxy.getName() + " failed : exception " + e.toString());
}
return false;
}
@ -1987,7 +1987,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
if (answer != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully reboot console proxy " + proxy.getHostName());
s_logger.debug("Successfully reboot console proxy " + proxy.getName());
}
SubscriptionMgr.getInstance()
@ -2003,12 +2003,12 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_REBOOT);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Console proxy rebooted - " + proxy.getHostName());
event.setDescription("Console proxy rebooted - " + proxy.getName());
_eventDao.persist(event);
return true;
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("failed to reboot console proxy : " + proxy.getHostName());
s_logger.debug("failed to reboot console proxy : " + proxy.getName());
}
final EventVO event = new EventVO();
@ -2017,7 +2017,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_REBOOT);
event.setLevel(EventVO.LEVEL_ERROR);
event.setStartId(startEventId);
event.setDescription("Rebooting console proxy failed - " + proxy.getHostName());
event.setDescription("Rebooting console proxy failed - " + proxy.getName());
_eventDao.persist(event);
return false;
}
@ -2092,7 +2092,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_DESTROY);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Console proxy destroyed - " + vm.getHostName());
event.setDescription("Console proxy destroyed - " + vm.getName());
_eventDao.persist(event);
txn.commit();
@ -2101,7 +2101,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
txn.rollback();
return false;
} finally {
s_logger.debug("console proxy vm is destroyed : " + vm.getHostName());
s_logger.debug("console proxy vm is destroyed : " + vm.getName());
}
}
}
@ -2126,7 +2126,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setAccountId(Account.ACCOUNT_ID_SYSTEM);
event.setType(EventTypes.EVENT_PROXY_DESTROY);
event.setLevel(EventVO.LEVEL_INFO);
event.setDescription("Console proxy destroyed - " + proxy.getHostName());
event.setDescription("Console proxy destroyed - " + proxy.getName());
_eventDao.persist(event);
}
@ -2174,7 +2174,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_STOP);
event.setLevel(EventVO.LEVEL_ERROR);
event.setStartId(startEventId);
event.setDescription("Stopping console proxy failed due to negative answer from agent - " + proxy.getHostName());
event.setDescription("Stopping console proxy failed due to negative answer from agent - " + proxy.getName());
_eventDao.persist(event);
return false;
}
@ -2192,7 +2192,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_STOP);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Console proxy stopped - " + proxy.getHostName());
event.setDescription("Console proxy stopped - " + proxy.getName());
_eventDao.persist(event);
return true;
} catch (OperationTimedoutException e) {
@ -2202,7 +2202,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
event.setType(EventTypes.EVENT_PROXY_STOP);
event.setLevel(EventVO.LEVEL_ERROR);
event.setStartId(startEventId);
event.setDescription("Stopping console proxy failed due to operation time out - " + proxy.getHostName());
event.setDescription("Stopping console proxy failed due to operation time out - " + proxy.getName());
_eventDao.persist(event);
throw new AgentUnavailableException(proxy.getHostId());
}
@ -2279,7 +2279,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
storageIps[1] = vols.get(1).getHostIp();
}
PrepareForMigrationCommand cmd = new PrepareForMigrationCommand(proxy.getHostName(), null, storageIps, vols, mirroredVols);
PrepareForMigrationCommand cmd = new PrepareForMigrationCommand(proxy.getName(), null, storageIps, vols, mirroredVols);
HostVO routingHost = null;
HashSet<Host> avoid = new HashSet<Host>();
@ -2299,8 +2299,8 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
}
if (!_storageMgr.share(proxy, vols, routingHost, false)) {
s_logger.warn("Can not share " + proxy.getHostName());
throw new StorageUnavailableException("Can not share " + proxy.getHostName(), vol.getPoolId());
s_logger.warn("Can not share " + proxy.getName());
throw new StorageUnavailableException("Can not share " + proxy.getName(), vol.getPoolId());
}
Answer answer = _agentMgr.easySend(routingHost.getId(), cmd);
@ -2499,7 +2499,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
buf.append(" template=domP type=consoleproxy");
buf.append(" host=").append(_mgmt_host);
buf.append(" port=").append(_mgmt_port);
buf.append(" name=").append(profile.getVirtualMachine().getHostName());
buf.append(" name=").append(profile.getVirtualMachine().getName());
if (_sslEnabled) {
buf.append(" premium=true");
}
@ -2618,7 +2618,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
ConsoleProxyVO consoleProxy = _consoleProxyDao.findById(proxyVmId);
//find corresponding host
if(consoleProxy!=null){
HostVO consoleProxyHost = _hostDao.findConsoleProxyHost(consoleProxy.getHostName(), Type.ConsoleProxy);
HostVO consoleProxyHost = _hostDao.findConsoleProxyHost(consoleProxy.getName(), Type.ConsoleProxy);
//now send a command to console proxy host
UpdateCertificateCommand certCmd = new UpdateCertificateCommand(certStr, true);
try {

View File

@ -199,12 +199,12 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
// collect list of vm names for the alert email
VMInstanceVO vm = vms.get(0);
if (vm.isHaEnabled()) {
sb.append(" " + vm.getHostName());
sb.append(" " + vm.getName());
}
for (int i = 1; i < vms.size(); i++) {
vm = vms.get(i);
if (vm.isHaEnabled()) {
sb.append(" " + vm.getHostName());
sb.append(" " + vm.getName());
}
}
}
@ -217,7 +217,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
for (final VMInstanceVO vm : vms) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Notifying HA Mgr of to investigate vm " + vm.getId() + "-" + vm.getHostName());
s_logger.debug("Notifying HA Mgr of to investigate vm " + vm.getId() + "-" + vm.getName());
}
scheduleRestart(vm, true);
}
@ -284,8 +284,8 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
if (!(_forceHA || vm.isHaEnabled())) {
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "VM (name: "
+ vm.getHostName() + ", id: " + vm.getId() + ") stopped unexpectedly on host "
+ vm.getHostId(), "Virtual Machine " + vm.getHostName() + " (id: "
+ vm.getName() + ", id: " + vm.getId() + ") stopped unexpectedly on host "
+ vm.getHostId(), "Virtual Machine " + vm.getName() + " (id: "
+ vm.getId() + ") running on host [" + vm.getHostId()
+ "] stopped unexpectedly.");
@ -371,12 +371,12 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
investigator = en.nextElement();
alive = investigator.isVmAlive(vm, host);
if (alive != null) {
s_logger.debug(investigator.getName() + " found VM " + vm.getHostName() + "to be alive? " + alive);
s_logger.debug(investigator.getName() + " found VM " + vm.getName() + "to be alive? " + alive);
break;
}
}
if (alive != null && alive) {
s_logger.debug("VM " + vm.getHostName() + " is found to be alive by " + investigator.getName());
s_logger.debug("VM " + vm.getName() + " is found to be alive by " + investigator.getName());
if (host.getStatus() == Status.Up) {
compareState(vm, new AgentVmInfo(vm.getInstanceName(), mgr, State.Running), false);
return null;
@ -402,7 +402,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
if (alive== null && !fenced) {
s_logger.debug("We were unable to fence off the VM " + vm.toString());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc);
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return (System.currentTimeMillis() >> 10) + _restartRetryInterval;
}
@ -414,8 +414,8 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
// send an alert for VMs that stop unexpectedly
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(),
"VM (name: " + vm.getHostName() + ", id: " + vmId + ") stopped unexpectedly on host "
+ hostDesc, "Virtual Machine " + vm.getHostName() + " (id: "
"VM (name: " + vm.getName() + ", id: " + vmId + ") stopped unexpectedly on host "
+ hostDesc, "Virtual Machine " + vm.getName() + " (id: "
+ vm.getId() + ") running on host [" + hostDesc + "] stopped unexpectedly.");
vm = mgr.get(vm.getId());
@ -455,19 +455,19 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
return (System.currentTimeMillis() >> 10) + _restartRetryInterval;
} catch (final InsufficientCapacityException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc);
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
} catch (final StorageUnavailableException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc);
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
} catch (ConcurrentOperationException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc);
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
} catch (ExecutionException e) {
s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc);
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to restart " + vm.getName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getName() + ", id: " + vmId + " which was running on host " + hostDesc);
return null;
}
}
@ -483,7 +483,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
State agentState = info.state;
final String agentName = info.name;
final State serverState = vm.getState();
final String serverName = vm.getHostName();
final String serverName = vm.getName();
Command command = null;
@ -507,7 +507,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
HostVO hostVO = _hostDao.findById(vm.getHostId());
String hostDesc = "name: " + hostVO.getName() + " (id:" + hostVO.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName();
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "VM (name: " + vm.getHostName() + ", id: " + vm.getId() + ") stopped on host " + hostDesc + " due to storage failure", "Virtual Machine " + vm.getHostName() + " (id: " + vm.getId() + ") running on host [" + vm.getHostId() + "] stopped due to storage failure.");
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "VM (name: " + vm.getName() + ", id: " + vm.getId() + ") stopped on host " + hostDesc + " due to storage failure", "Virtual Machine " + vm.getName() + " (id: " + vm.getId() + ") running on host [" + vm.getHostId() + "] stopped due to storage failure.");
}
if (serverState == State.Migrating) {
@ -545,10 +545,10 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
info.mgr.completeStopCommand(vm);
command = info.mgr.cleanup(vm, agentName);
} else {
s_logger.debug("Ignoring VM in stopping mode: " + vm.getHostName());
s_logger.debug("Ignoring VM in stopping mode: " + vm.getName());
}
} else if (serverState == State.Starting) {
s_logger.debug("Ignoring VM in starting mode: " + vm.getHostName());
s_logger.debug("Ignoring VM in starting mode: " + vm.getName());
} else {
s_logger.debug("Sending cleanup to a stopped vm: " + agentName);
_itMgr.stateTransitTo(vm, VirtualMachine.Event.AgentReportStopped, null);
@ -721,14 +721,14 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to find a host for migrating vm " + vmId);
}
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to migrate vm " + vm.getHostName() + " from host " + fromHostName + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Unable to find a suitable host");
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to migrate vm " + vm.getName() + " from host " + fromHostName + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Unable to find a suitable host");
}
} catch(final InsufficientCapacityException e) {
s_logger.warn("Unable to mgirate due to insufficient capacity " + vm.toString());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to migrate vm " + vm.getHostName() + " from host " + fromHostName + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Insufficient capacity");
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to migrate vm " + vm.getName() + " from host " + fromHostName + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Insufficient capacity");
} catch(final StorageUnavailableException e) {
s_logger.warn("Storage is unavailable: " + vm.toString());
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to migrate vm " + vm.getHostName() + " from host " + fromHostName + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Storage is gone.");
_alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodId(), "Unable to migrate vm " + vm.getName() + " from host " + fromHostName + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Storage is gone.");
}
if (toHost == null) {
@ -775,7 +775,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
DataCenterVO dcVO = _dcDao.findById(vm.getDataCenterId());
HostPodVO podVO = _podDao.findById(vm.getPodId());
_alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), "Unable to migrate vm " + vm.getHostName() + " from host " + fromHost.getName() + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Migrate Command failed. Please check logs.");
_alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), "Unable to migrate vm " + vm.getName() + " from host " + fromHost.getName() + " in zone " + dcVO.getName() + " and pod " + podVO.getName(), "Migrate Command failed. Please check logs.");
_itMgr.stateTransitTo(vm, Event.MigrationFailedOnSource, toHost.getId());
_agentMgr.maintenanceFailed(vm.getHostId());

View File

@ -197,7 +197,7 @@ public class InvestigatorImpl implements Investigator {
Answer pingTestAnswer = _agentMgr.send(otherHost.getId(), new PingTestCommand(routerPrivateIp, privateIp), 30 * 1000);
if (pingTestAnswer.getResult()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("user vm " + vm.getHostName() + " has been successfully pinged, returning that it is alive");
s_logger.debug("user vm " + vm.getName() + " has been successfully pinged, returning that it is alive");
}
return Boolean.TRUE;
}
@ -214,7 +214,7 @@ public class InvestigatorImpl implements Investigator {
}
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("user vm " + vm.getHostName() + " could not be pinged, returning that it is unknown");
s_logger.debug("user vm " + vm.getName() + " could not be pinged, returning that it is unknown");
}
return null;

View File

@ -564,7 +564,7 @@ public class Db20to21MigrationUtil {
proxy.setGuestMacAddress(guestMacAddress);
if(proxy.getState() == State.Running || proxy.getState() == State.Starting) {
System.out.println("System VM " + proxy.getHostName() + " is in active state, mark it to Stopping state for migration");
System.out.println("System VM " + proxy.getName() + " is in active state, mark it to Stopping state for migration");
proxy.setState(State.Stopping);
}
@ -572,7 +572,7 @@ public class Db20to21MigrationUtil {
proxy.setGuestIpAddress(guestIpAddress);
proxy.setGuestNetmask("255.255.0.0");
System.out.println("Assign link loal address to proxy " + proxy.getHostName() + ", link local address: " + guestIpAddress);
System.out.println("Assign link loal address to proxy " + proxy.getName() + ", link local address: " + guestIpAddress);
_consoleProxyDao.update(proxy.getId(), proxy);
}
@ -591,7 +591,7 @@ public class Db20to21MigrationUtil {
secStorageVm.setGuestMacAddress(guestMacAddress);
if(secStorageVm.getState() == State.Running || secStorageVm.getState() == State.Starting) {
System.out.println("System VM " + secStorageVm.getHostName() + " is in active state, mark it to Stopping state for migration");
System.out.println("System VM " + secStorageVm.getName() + " is in active state, mark it to Stopping state for migration");
secStorageVm.setState(State.Stopping);
}
@ -599,7 +599,7 @@ public class Db20to21MigrationUtil {
secStorageVm.setGuestIpAddress(guestIpAddress);
secStorageVm.setGuestNetmask("255.255.0.0");
System.out.println("Assign link loal address to secondary storage VM " + secStorageVm.getHostName() + ", link local address: " + guestIpAddress);
System.out.println("Assign link loal address to secondary storage VM " + secStorageVm.getName() + ", link local address: " + guestIpAddress);
_secStorageVmDao.update(secStorageVm.getId(), secStorageVm);
}
@ -616,7 +616,7 @@ public class Db20to21MigrationUtil {
if(router.getState() == State.Running || router.getState() == State.Starting) {
router.setState(State.Stopping);
System.out.println("System VM " + router.getHostName() + " is in active state, mark it to Stopping state for migration");
System.out.println("System VM " + router.getName() + " is in active state, mark it to Stopping state for migration");
_routerDao.update(router.getId(), router);
}
}
@ -680,11 +680,11 @@ public class Db20to21MigrationUtil {
deviceId = 1; // reset for each VM iteration
for(VolumeVO vol : volumes) {
if(vol.getVolumeType() == VolumeType.ROOT) {
System.out.println("Setting root volume device id to zero, vol: " + vol.getName() + ", instance: " + vm.getHostName());
System.out.println("Setting root volume device id to zero, vol: " + vol.getName() + ", instance: " + vm.getName());
vol.setDeviceId(0L);
} else if(vol.getVolumeType() == VolumeType.DATADISK) {
System.out.println("Setting data volume device id, vol: " + vol.getName() + ", instance: " + vm.getHostName() + ", device id: " + deviceId);
System.out.println("Setting data volume device id, vol: " + vol.getName() + ", instance: " + vm.getName() + ", device id: " + deviceId);
vol.setDeviceId(deviceId);

View File

@ -388,16 +388,16 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
event.setType(EventTypes.EVENT_ROUTER_CREATE);
if (vols == null) {
event.setDescription("failed to create DHCP Server : " + router.getHostName());
event.setDescription("failed to create DHCP Server : " + router.getName());
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
throw new ExecutionException("Unable to create DHCP Server");
}
_itMgr.stateTransitTo(router, VirtualMachine.Event.OperationSucceeded, null);
s_logger.info("DHCP server created: id=" + router.getId() + "; name=" + router.getHostName() + "; vlan=" + guestVlan.getVlanId() + "; pod=" + pod.getName());
s_logger.info("DHCP server created: id=" + router.getId() + "; name=" + router.getName() + "; vlan=" + guestVlan.getVlanId() + "; pod=" + pod.getName());
event.setDescription("successfully created DHCP Server : " + router.getHostName() + " with ip : " + router.getGuestIpAddress());
event.setDescription("successfully created DHCP Server : " + router.getName() + " with ip : " + router.getGuestIpAddress());
_eventDao.persist(event);
return router;
@ -565,14 +565,14 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
_itMgr.stateTransitTo(router, VirtualMachine.Event.OperationSucceeded, null);
s_logger.debug("Router created: id=" + router.getId() + "; name=" + router.getHostName());
s_logger.debug("Router created: id=" + router.getId() + "; name=" + router.getName());
event = new EventVO();
event.setUserId(1L); // system user performed the action
event.setAccountId(accountId);
event.setType(EventTypes.EVENT_ROUTER_CREATE);
event.setStartId(startEventId);
event.setDescription("successfully created Domain Router : " + router.getHostName() + " with ip : " + publicIpAddress);
event.setDescription("successfully created Domain Router : " + router.getName() + " with ip : " + publicIpAddress);
_eventDao.persist(event);
success = true;
return router;
@ -628,7 +628,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
event.setType(EventTypes.EVENT_ROUTER_DESTROY);
event.setState(Event.State.Started);
event.setParameters("id=" + routerId);
event.setDescription("Starting to destroy router : " + router.getHostName());
event.setDescription("Starting to destroy router : " + router.getName());
event = _eventDao.persist(event);
try {
@ -673,7 +673,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
completedEvent.setType(EventTypes.EVENT_ROUTER_DESTROY);
completedEvent.setStartId(event.getId());
completedEvent.setParameters("id=" + routerId);
completedEvent.setDescription("successfully destroyed router : " + router.getHostName());
completedEvent.setDescription("successfully destroyed router : " + router.getName());
_eventDao.persist(completedEvent);
return true;
@ -748,7 +748,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
final DomainRouterVO router = _routerDao.findById(routerId);
final String routerPrivateIpAddress = router.getPrivateIpAddress();
final String vmName = router.getHostName();
final String vmName = router.getName();
final String encodedPassword = rot13(password);
final SavePasswordCommand cmdSavePassword = new SavePasswordCommand(encodedPassword, vmIpAddress, routerPrivateIpAddress, vmName);
@ -891,9 +891,9 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
if (vnet != null) {
s_logger.debug("Router: " + router.getHostName() + " discovered vnet: " + vnet + " from existing VMs.");
s_logger.debug("Router: " + router.getName() + " discovered vnet: " + vnet + " from existing VMs.");
} else {
s_logger.debug("Router: " + router.getHostName() + " was unable to discover vnet from existing VMs. Acquiring new vnet.");
s_logger.debug("Router: " + router.getName() + " was unable to discover vnet from existing VMs. Acquiring new vnet.");
}
String routerMacAddress = null;
@ -919,10 +919,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
if (vnet == null) {
s_logger.error("Unable to get another vnet while starting router " + router.getHostName());
s_logger.error("Unable to get another vnet while starting router " + router.getName());
return null;
} else {
s_logger.debug("Router: " + router.getHostName() + " is using vnet: " + vnet);
s_logger.debug("Router: " + router.getName() + " is using vnet: " + vnet);
}
Answer answer = null;
@ -961,7 +961,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
/*Ram size can be changed by upgradeRouterCmd*/
router.setRamSize(offering.getRamSize());
final String name = VirtualMachineName.attachVnet(router.getHostName(), vnet);
final String name = VirtualMachineName.attachVnet(router.getName(), vnet);
router.setInstanceName(name);
long accountId = router.getAccountId();
// Use account level network domain if available
@ -998,7 +998,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
GuestOSVO guestOS = _guestOSDao.findById(router.getGuestOSId());
if (guestOS == null) {
String msg = "Could not find guest OS description for OSId "
+ router.getGuestOSId() + " for vm: " + router.getHostName();
+ router.getGuestOSId() + " for vm: " + router.getName();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
} else {
@ -1020,13 +1020,13 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
if (resendRouterState(router)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Router " + router.getHostName() + " started on " + routingHost.getName());
s_logger.debug("Router " + router.getName() + " started on " + routingHost.getName());
}
started = true;
break;
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Router " + router.getHostName() + " started on " + routingHost.getName() + " but failed to program rules");
s_logger.debug("Router " + router.getName() + " started on " + routingHost.getName() + " but failed to program rules");
}
sendStopCommand(router);
}
@ -1034,12 +1034,12 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
s_logger.debug("Unable to start " + router.toString() + " on host " + routingHost.toString() + " due to " + answer.getDetails());
} catch (OperationTimedoutException e) {
if (e.isActive()) {
s_logger.debug("Unable to start vm " + router.getHostName() + " due to operation timed out and it is active so scheduling a restart.");
s_logger.debug("Unable to start vm " + router.getName() + " due to operation timed out and it is active so scheduling a restart.");
_haMgr.scheduleRestart(router, true);
return null;
}
} catch (AgentUnavailableException e) {
s_logger.debug("Agent " + routingHost.toString() + " was unavailable to start VM " + router.getHostName());
s_logger.debug("Agent " + routingHost.toString() + " was unavailable to start VM " + router.getName());
}
avoid.add(routingHost);
@ -1064,7 +1064,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
s_logger.debug("Router " + router.toString() + " is now started on " + routingHost.toString());
}
event.setDescription("successfully started Domain Router: " + router.getHostName());
event.setDescription("successfully started Domain Router: " + router.getName());
_eventDao.persist(event);
return _routerDao.findById(routerId);
@ -1181,10 +1181,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
final List<UserVmVO> vms = _vmDao.listBy(router.getId(), State.Creating, State.Starting, State.Running, State.Stopping, State.Stopped, State.Migrating);
Commands cmds = new Commands(OnError.Continue);
for (UserVmVO vm: vms) {
if (vm.getGuestIpAddress() == null || vm.getGuestMacAddress() == null || vm.getHostName() == null) {
if (vm.getGuestIpAddress() == null || vm.getGuestMacAddress() == null || vm.getName() == null) {
continue;
}
DhcpEntryCommand decmd = new DhcpEntryCommand(vm.getGuestMacAddress(), vm.getGuestIpAddress(), router.getPrivateIpAddress(), vm.getHostName());
DhcpEntryCommand decmd = new DhcpEntryCommand(vm.getGuestMacAddress(), vm.getGuestIpAddress(), router.getPrivateIpAddress(), vm.getName());
cmds.addCommand(decmd);
}
if (cmds.size() > 0) {
@ -1424,11 +1424,11 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
if (answer != null && resendRouterState(router)) {
processStopOrRebootAnswer(router, answer);
event.setDescription("successfully rebooted Domain Router : " + router.getHostName());
event.setDescription("successfully rebooted Domain Router : " + router.getName());
_eventDao.persist(event);
return true;
} else {
event.setDescription("failed to reboot Domain Router : " + router.getHostName());
event.setDescription("failed to reboot Domain Router : " + router.getName());
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
return false;
@ -1729,7 +1729,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
answer = _agentMgr.send(hostId, stop);
if (!answer.getResult()) {
s_logger.error("Unable to stop router");
event.setDescription("failed to stop Domain Router : " + router.getHostName());
event.setDescription("failed to stop Domain Router : " + router.getName());
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
} else {
@ -1743,7 +1743,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
if (!stopped) {
event.setDescription("failed to stop Domain Router : " + router.getHostName());
event.setDescription("failed to stop Domain Router : " + router.getName());
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
_itMgr.stateTransitTo(router, VirtualMachine.Event.OperationFailed, router.getHostId());
@ -1751,7 +1751,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
completeStopCommand(router, VirtualMachine.Event.OperationSucceeded);
event.setDescription("successfully stopped Domain Router : " + router.getHostName());
event.setDescription("successfully stopped Domain Router : " + router.getName());
_eventDao.persist(event);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Router " + router.toString() + " is stopped");
@ -1804,8 +1804,8 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
if( ! _storageMgr.share(router, vols, routingHost, false) ) {
s_logger.warn("Can not share " + vol.getPath() + " to " + router.getHostName() );
throw new StorageUnavailableException("Can not share " + vol.getPath() + " to " + router.getHostName(), sp.getId());
s_logger.warn("Can not share " + vol.getPath() + " to " + router.getName() );
throw new StorageUnavailableException("Can not share " + vol.getPath() + " to " + router.getName(), sp.getId());
}
final Answer answer = _agentMgr.easySend(routingHost.getId(), cmd);
@ -1901,7 +1901,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
try {
DomainRouterVO router = start(vm.getDomainRouterId(), 0);
if (router == null) {
s_logger.error("Can't find a domain router to start VM: " + vm.getHostName());
s_logger.error("Can't find a domain router to start VM: " + vm.getName());
return null;
}
@ -1927,10 +1927,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
int cmdIndex = 0;
int passwordIndex = -1;
int vmDataIndex = -1;
cmds.addCommand(new DhcpEntryCommand(vm.getGuestMacAddress(), vm.getGuestIpAddress(), router.getPrivateIpAddress(), vm.getHostName()));
cmds.addCommand(new DhcpEntryCommand(vm.getGuestMacAddress(), vm.getGuestIpAddress(), router.getPrivateIpAddress(), vm.getName()));
if (password != null) {
final String encodedPassword = rot13(password);
cmds.addCommand(new SavePasswordCommand(encodedPassword, vm.getPrivateIpAddress(), router.getPrivateIpAddress(), vm.getHostName()));
cmds.addCommand(new SavePasswordCommand(encodedPassword, vm.getPrivateIpAddress(), router.getPrivateIpAddress(), vm.getName()));
passwordIndex = cmdIndex;
}
@ -1939,22 +1939,22 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
String zoneName = _dcDao.findById(vm.getDataCenterId()).getName();
String routerPublicIpAddress = (router.getPublicIpAddress() != null) ? router.getPublicIpAddress() : vm.getGuestIpAddress();
cmds.addCommand(generateVmDataCommand(router.getPrivateIpAddress(), routerPublicIpAddress, vm.getPrivateIpAddress(), userData, serviceOffering, zoneName, vm.getGuestIpAddress(), vm.getHostName(), vm.getInstanceName(), vm.getId()));
cmds.addCommand(generateVmDataCommand(router.getPrivateIpAddress(), routerPublicIpAddress, vm.getPrivateIpAddress(), userData, serviceOffering, zoneName, vm.getGuestIpAddress(), vm.getName(), vm.getInstanceName(), vm.getId()));
vmDataIndex = cmdIndex;
Answer[] answers = _agentMgr.send(router.getHostId(), cmds);
if (!answers[0].getResult()) {
s_logger.error("Unable to set dhcp entry for " + vm.getId() + " - " + vm.getHostName() +" on domR: " + router.getHostName() + " due to " + answers[0].getDetails());
s_logger.error("Unable to set dhcp entry for " + vm.getId() + " - " + vm.getName() +" on domR: " + router.getName() + " due to " + answers[0].getDetails());
return null;
}
if (password != null && !answers[passwordIndex].getResult()) {
s_logger.error("Unable to set password for " + vm.getId() + " - " + vm.getHostName() + " due to " + answers[passwordIndex].getDetails());
s_logger.error("Unable to set password for " + vm.getId() + " - " + vm.getName() + " due to " + answers[passwordIndex].getDetails());
return null;
}
if (vmDataIndex > 0 && !answers[vmDataIndex].getResult()) {
s_logger.error("Unable to set VM data for " + vm.getId() + " - " + vm.getHostName() + " due to " + answers[vmDataIndex].getDetails());
s_logger.error("Unable to set VM data for " + vm.getId() + " - " + vm.getName() + " due to " + answers[vmDataIndex].getDetails());
return null;
}
return router;
@ -1962,10 +1962,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
s_logger.error("Unable to start router " + vm.getDomainRouterId() + " because storage is unavailable.");
return null;
} catch (AgentUnavailableException e) {
s_logger.error("Unable to setup the router " + vm.getDomainRouterId() + " for vm " + vm.getId() + " - " + vm.getHostName() + " because agent is unavailable");
s_logger.error("Unable to setup the router " + vm.getDomainRouterId() + " for vm " + vm.getId() + " - " + vm.getName() + " because agent is unavailable");
return null;
} catch (OperationTimedoutException e) {
s_logger.error("Unable to setup the router " + vm.getDomainRouterId() + " for vm " + vm.getId() + " - " + vm.getHostName() + " because agent is too busy");
s_logger.error("Unable to setup the router " + vm.getDomainRouterId() + " for vm " + vm.getId() + " - " + vm.getName() + " because agent is too busy");
return null;
}
}
@ -2001,7 +2001,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
final CreateZoneVlanCommand cmdCreateZoneVlan = new CreateZoneVlanCommand(router);
CreateZoneVlanAnswer answer = (CreateZoneVlanAnswer) _agentMgr.easySend(router.getHostId(), cmdCreateZoneVlan);
if(!answer.getResult()){
s_logger.error("Unable to create zone vlan for router: "+router.getHostName()+ " zoneVlan: "+zoneVlan);
s_logger.error("Unable to create zone vlan for router: "+router.getName()+ " zoneVlan: "+zoneVlan);
return null;
}
return zoneVlan;
@ -2020,7 +2020,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
for (DomainRouterVO router : routers) {
String privateIP = router.getPrivateIpAddress();
if(privateIP != null){
final NetworkUsageCommand usageCmd = new NetworkUsageCommand(privateIP, router.getHostName());
final NetworkUsageCommand usageCmd = new NetworkUsageCommand(privateIP, router.getName());
final NetworkUsageAnswer answer = (NetworkUsageAnswer)_agentMgr.easySend(router.getHostId(), usageCmd);
if(answer != null){
Transaction txn = Transaction.open(Transaction.CLOUD_DB);
@ -2416,17 +2416,17 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
}
}
cmds.addCommand("dhcp", new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), routerControlIpAddress, profile.getVirtualMachine().getHostName()));
cmds.addCommand("dhcp", new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), routerControlIpAddress, profile.getVirtualMachine().getName()));
if (password != null) {
final String encodedPassword = rot13(password);
cmds.addCommand("password", new SavePasswordCommand(encodedPassword, nic.getIp4Address(), routerControlIpAddress, profile.getVirtualMachine().getHostName()));
cmds.addCommand("password", new SavePasswordCommand(encodedPassword, nic.getIp4Address(), routerControlIpAddress, profile.getVirtualMachine().getName()));
}
String serviceOffering = _serviceOfferingDao.findById(profile.getServiceOfferingId()).getDisplayText();
String zoneName = _dcDao.findById(config.getDataCenterId()).getName();
cmds.addCommand("vmdata", generateVmDataCommand(routerControlIpAddress, routerPublicIpAddress, nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), profile.getVirtualMachine().getHostName(), profile.getVirtualMachine().getHostName(), profile.getId()));
cmds.addCommand("vmdata", generateVmDataCommand(routerControlIpAddress, routerPublicIpAddress, nic.getIp4Address(), userData, serviceOffering, zoneName, nic.getIp4Address(), profile.getVirtualMachine().getName(), profile.getVirtualMachine().getName(), profile.getId()));
try {
_agentMgr.send(router.getHostId(), cmds);
@ -2438,7 +2438,7 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
Answer answer = cmds.getAnswer("dhcp");
if (!answer.getResult()) {
s_logger.error("Unable to set dhcp entry for " + profile +" on domR: " + router.getHostName() + " due to " + answer.getDetails());
s_logger.error("Unable to set dhcp entry for " + profile +" on domR: " + router.getName() + " due to " + answer.getDetails());
throw new ResourceUnavailableException("Unable to set dhcp entry for " + profile + " due to " + answer.getDetails());
}
@ -2687,10 +2687,10 @@ public class DomainRouterManagerImpl implements DomainRouterManager, DomainRoute
final List<UserVmVO> vms = _vmDao.listBy(router.getId(), State.Creating, State.Starting, State.Running, State.Stopping, State.Stopped, State.Migrating);
Commands cmds = new Commands(OnError.Continue);
for (UserVmVO vm: vms) {
if (vm.getGuestIpAddress() == null || vm.getGuestMacAddress() == null || vm.getHostName() == null) {
if (vm.getGuestIpAddress() == null || vm.getGuestMacAddress() == null || vm.getName() == null) {
continue;
}
DhcpEntryCommand decmd = new DhcpEntryCommand(vm.getGuestMacAddress(), vm.getGuestIpAddress(), router.getPrivateIpAddress(), vm.getHostName());
DhcpEntryCommand decmd = new DhcpEntryCommand(vm.getGuestMacAddress(), vm.getGuestIpAddress(), router.getPrivateIpAddress(), vm.getName());
cmds.addCommand(decmd);
}
if (cmds.size() > 0) {

View File

@ -2141,7 +2141,7 @@ public class ManagementServerImpl implements ManagementServer {
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("accountIdEQ", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
sb.and("accountIdIN", sb.entity().getAccountId(), SearchCriteria.Op.IN);
sb.and("name", sb.entity().getHostName(), SearchCriteria.Op.LIKE);
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
sb.and("stateEQ", sb.entity().getState(), SearchCriteria.Op.EQ);
sb.and("stateNEQ", sb.entity().getState(), SearchCriteria.Op.NEQ);
sb.and("stateNIN", sb.entity().getState(), SearchCriteria.Op.NIN);
@ -2452,7 +2452,7 @@ public class ManagementServerImpl implements ManagementServer {
Object keyword = cmd.getKeyword();
SearchBuilder<DomainRouterVO> sb = _routerDao.createSearchBuilder();
sb.and("name", sb.entity().getHostName(), SearchCriteria.Op.LIKE);
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.IN);
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
@ -2518,10 +2518,7 @@ public class ManagementServerImpl implements ManagementServer {
if (keyword != null) {
SearchCriteria<ConsoleProxyVO> ssc = _consoleProxyDao.createSearchCriteria();
ssc.addOr("displayName", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("group", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("instanceName", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("state", SearchCriteria.Op.LIKE, "%" + keyword + "%");
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
@ -3017,12 +3014,12 @@ public class ManagementServerImpl implements ManagementServer {
@Override
public Pair<String, Integer> getVncPort(VirtualMachine vm) {
if (vm.getHostId() == null) {
s_logger.warn("VM " + vm.getHostName() + " does not have host, return -1 for its VNC port");
s_logger.warn("VM " + vm.getName() + " does not have host, return -1 for its VNC port");
return new Pair<String, Integer>(null, -1);
}
if(s_logger.isTraceEnabled()) {
s_logger.trace("Trying to retrieve VNC port from agent about VM " + vm.getHostName());
s_logger.trace("Trying to retrieve VNC port from agent about VM " + vm.getName());
}
GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getInstanceName()));
@ -4142,8 +4139,6 @@ public class ManagementServerImpl implements ManagementServer {
if (keyword != null) {
SearchCriteria<SecondaryStorageVmVO> ssc = _secStorageVmDao.createSearchCriteria();
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("displayName", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("instanceName", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("state", SearchCriteria.Op.LIKE, "%" + keyword + "%");
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
@ -4884,7 +4879,7 @@ public class ManagementServerImpl implements ManagementServer {
}
for(ConsoleProxyVO cp : cpList)
{
Long cpHostId = hostNameToHostIdMap.get(cp.getHostName());
Long cpHostId = hostNameToHostIdMap.get(cp.getName());
//now send a command to each console proxy host
UpdateCertificateCommand certCmd = new UpdateCertificateCommand(_certDao.findById(certVOId).getCertificate(), false);
try {

View File

@ -221,7 +221,7 @@ public class ConsoleProxyServlet extends HttpServlet {
return;
}
String vmName = vm.getHostName();
String vmName = vm.getName();
if(vmName == null)
vmName = vm.getInstanceName();

View File

@ -929,7 +929,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
List<StoragePoolVO> avoids, long size) {
List<VolumeVO> volumes = create(account, vm, template, dc, pod, offering, diskOffering, avoids, size);
if( volumes == null || volumes.size() == 0) {
throw new CloudRuntimeException("Unable to create volume for " + vm.getHostName());
throw new CloudRuntimeException("Unable to create volume for " + vm.getName());
}
for (VolumeVO v : volumes) {

View File

@ -343,7 +343,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
if (state == State.Running) {
if (s_logger.isTraceEnabled()) {
s_logger.trace("Secondary storage vm is already started: "
+ secStorageVm.getHostName());
+ secStorageVm.getName());
}
saveFailedEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_SSVM_START, "Secondary storage vm is already started", startEventId);
return secStorageVm;
@ -368,7 +368,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
if (s_logger.isDebugEnabled()) {
SecondaryStorageVmVO temp = _secStorageVmDao.findById(secStorageVmId);
s_logger.debug("Unable to start secondary storage vm "
+ secStorageVm.getHostName()
+ secStorageVm.getName()
+ " because it is not in a startable state : "
+ ((temp != null) ? temp.getState().toString() : "null"));
}
@ -391,7 +391,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
secStorageVm.getDataCenterId(), routingHost.getPodId(),
secStorageVm.getId(), secStorageVm.getPrivateMacAddress());
if (privateIpAddress == null && (_IpAllocator != null && !_IpAllocator.exteralIpAddressAllocatorEnabled())) {
String msg = "Unable to allocate private ip addresses for " + secStorageVm.getHostName() + " in pod " + pod.getId();
String msg = "Unable to allocate private ip addresses for " + secStorageVm.getName() + " in pod " + pod.getId();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
}
@ -404,7 +404,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
List<VolumeVO> vols = _storageMgr.prepare(secStorageVm, routingHost);
if (vols == null || vols.size() == 0) {
String msg = "Unable to prepare storage for " + secStorageVm.getHostName() + " in pod " + pod.getId();
String msg = "Unable to prepare storage for " + secStorageVm.getName() + " in pod " + pod.getId();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
}
@ -415,7 +415,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
GuestOSVO guestOS = _guestOSDao.findById(secStorageVm.getGuestOSId());
if (guestOS == null) {
String msg = "Could not find guest OS description for OSId "
+ secStorageVm.getGuestOSId() + " for vm: " + secStorageVm.getHostName();
+ secStorageVm.getGuestOSId() + " for vm: " + secStorageVm.getName();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
} else {
@ -426,11 +426,11 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
// need to configure agent on this
StartSecStorageVmCommand cmdStart = new StartSecStorageVmCommand(_networkRate,
_multicastRate, _secStorageVmCmdPort, secStorageVm,
secStorageVm.getHostName(), "", vols, _mgmt_host, _mgmt_port, _useSSlCopy, guestOSDescription);
secStorageVm.getName(), "", vols, _mgmt_host, _mgmt_port, _useSSlCopy, guestOSDescription);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Sending start command for secondary storage vm "
+ secStorageVm.getHostName()
+ secStorageVm.getName()
+ " to "
+ routingHost.getName());
}
@ -441,14 +441,14 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
if (s_logger.isDebugEnabled()) {
s_logger.debug("Received answer on starting secondary storage vm "
+ secStorageVm.getHostName()
+ secStorageVm.getName()
+ " on "
+ routingHost.getName());
}
if ( answer != null && answer.getResult() ) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Secondary storage vm " + secStorageVm.getHostName()
s_logger.debug("Secondary storage vm " + secStorageVm.getName()
+ " started on " + routingHost.getName());
}
@ -466,7 +466,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_START);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Secondary Storage VM started - " + secStorageVm.getHostName());
event.setDescription("Secondary Storage VM started - " + secStorageVm.getName());
_eventDao.persist(event);
}
break;
@ -474,13 +474,13 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
s_logger.debug("Unable to start " + secStorageVm.toString() + " on host " + routingHost.toString() + " due to " + answer.getDetails());
} catch (OperationTimedoutException e) {
if (e.isActive()) {
s_logger.debug("Unable to start vm " + secStorageVm.getHostName() + " due to operation timed out and it is active so scheduling a restart.");
s_logger.debug("Unable to start vm " + secStorageVm.getName() + " due to operation timed out and it is active so scheduling a restart.");
saveFailedEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_SSVM_START, "Unable to start vm due to operation timed out", startEventId);
_haMgr.scheduleRestart(secStorageVm, true);
return null;
}
} catch (AgentUnavailableException e) {
s_logger.debug("Agent " + routingHost.toString() + " was unavailable to start VM " + secStorageVm.getHostName());
s_logger.debug("Agent " + routingHost.toString() + " was unavailable to start VM " + secStorageVm.getName());
}
avoid.add(routingHost);
@ -508,7 +508,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_START);
event.setLevel(EventVO.LEVEL_ERROR);
event.setStartId(startEventId);
event.setDescription("Starting secondary storage vm failed due to unable to find a host - " + secStorageVm.getHostName());
event.setDescription("Starting secondary storage vm failed due to unable to find a host - " + secStorageVm.getName());
_eventDao.persist(event);
throw new ExecutionException(
"Couldn't find a routingHost to run secondary storage vm");
@ -543,7 +543,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_START);
event.setLevel(EventVO.LEVEL_ERROR);
event.setStartId(startEventId);
event.setDescription("Starting secondary storage vm failed due to unhandled exception - " + secStorageVm.getHostName());
event.setDescription("Starting secondary storage vm failed due to unhandled exception - " + secStorageVm.getName());
_eventDao.persist(event);
Transaction txn = Transaction.currentTxn();
@ -629,12 +629,12 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
Answer answer = _agentMgr.easySend(storageHost.getId(), setupCmd);
if (answer != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully programmed http auth into " + secStorageVm.getHostName());
s_logger.debug("Successfully programmed http auth into " + secStorageVm.getName());
}
return true;
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("failed to program http auth into secondary storage vm : " + secStorageVm.getHostName());
s_logger.debug("failed to program http auth into secondary storage vm : " + secStorageVm.getName());
}
return false;
}
@ -673,12 +673,12 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
Answer answer = _agentMgr.easySend(storageHost.getId(), cpc);
if (answer != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully programmed firewall rules into " + secStorageVm.getHostName());
s_logger.debug("Successfully programmed firewall rules into " + secStorageVm.getName());
}
return true;
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("failed to program firewall rules into secondary storage vm : " + secStorageVm.getHostName());
s_logger.debug("failed to program firewall rules into secondary storage vm : " + secStorageVm.getName());
}
return false;
}
@ -874,7 +874,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_CREATE);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("New Secondary Storage VM created - " + secStorageVm.getHostName());
event.setDescription("New Secondary Storage VM created - " + secStorageVm.getName());
_eventDao.persist(event);
txn.commit();
success = true;
@ -1014,7 +1014,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
}
} else {
if (s_logger.isInfoEnabled()) {
s_logger.info("Unable to acquire synchronization lock to start secondary storage vm : " + readysecStorageVm.getHostName());
s_logger.info("Unable to acquire synchronization lock to start secondary storage vm : " + readysecStorageVm.getName());
}
}
} finally {
@ -1138,7 +1138,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
if (s_logger.isTraceEnabled()) {
s_logger.trace("Running secondary storage vm pool size : " + runningList.size());
for (SecondaryStorageVmVO secStorageVm : runningList) {
s_logger.trace("Running secStorageVm instance : " + secStorageVm.getHostName());
s_logger.trace("Running secStorageVm instance : " + secStorageVm.getName());
}
}
@ -1227,7 +1227,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
}
} else {
if (s_logger.isInfoEnabled()) {
s_logger.info("Secondary storage vm " + secStorageVm.getHostName() + " is started");
s_logger.info("Secondary storage vm " + secStorageVm.getName() + " is started");
}
}
}
@ -1645,7 +1645,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
return stop(secStorageVm, startEventId);
} catch (AgentUnavailableException e) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Stopping secondary storage vm " + secStorageVm.getHostName() + " faled : exception " + e.toString());
s_logger.debug("Stopping secondary storage vm " + secStorageVm.getName() + " faled : exception " + e.toString());
}
return false;
}
@ -1681,7 +1681,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
if (answer != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Successfully reboot secondary storage vm " + secStorageVm.getHostName());
s_logger.debug("Successfully reboot secondary storage vm " + secStorageVm.getName());
}
SubscriptionMgr.getInstance().notifySubscribers(
@ -1697,11 +1697,11 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_REBOOT);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Secondary Storage Vm rebooted - " + secStorageVm.getHostName());
event.setDescription("Secondary Storage Vm rebooted - " + secStorageVm.getName());
_eventDao.persist(event);
return true;
} else {
String msg = "Rebooting Secondary Storage VM failed - " + secStorageVm.getHostName();
String msg = "Rebooting Secondary Storage VM failed - " + secStorageVm.getName();
saveFailedEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_SSVM_REBOOT, msg, startEventId);
if (s_logger.isDebugEnabled()) {
s_logger.debug(msg);
@ -1786,7 +1786,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_DESTROY);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Secondary Storage Vm destroyed - " + vm.getHostName());
event.setDescription("Secondary Storage Vm destroyed - " + vm.getName());
_eventDao.persist(event);
txn.commit();
} catch (Exception e) {
@ -1795,7 +1795,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
return false;
} finally {
s_logger.debug("secondary storage vm vm is destroyed : "
+ vm.getHostName());
+ vm.getName());
}
}
}
@ -1819,7 +1819,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setAccountId(Account.ACCOUNT_ID_SYSTEM);
event.setType(EventTypes.EVENT_SSVM_DESTROY);
event.setLevel(EventVO.LEVEL_INFO);
event.setDescription("Secondary Storage Vm destroyed - " + secStorageVm.getHostName());
event.setDescription("Secondary Storage Vm destroyed - " + secStorageVm.getName());
_eventDao.persist(event);
}
txn.commit();
@ -1876,12 +1876,12 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
event.setType(EventTypes.EVENT_SSVM_STOP);
event.setLevel(EventVO.LEVEL_INFO);
event.setStartId(startEventId);
event.setDescription("Secondary Storage Vm stopped - " + secStorageVm.getHostName());
event.setDescription("Secondary Storage Vm stopped - " + secStorageVm.getName());
_eventDao.persist(event);
return true;
} catch (OperationTimedoutException e) {
saveFailedEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_SSVM_STOP,
"Stopping secondary storage vm failed due to operation time out - " + secStorageVm.getHostName(), startEventId);
"Stopping secondary storage vm failed due to operation time out - " + secStorageVm.getName(), startEventId);
throw new AgentUnavailableException(secStorageVm.getHostId());
}
} finally {
@ -1964,7 +1964,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
storageIps[1] = vols.get(1).getHostIp();
}
PrepareForMigrationCommand cmd = new PrepareForMigrationCommand(secStorageVm.getHostName(), null, storageIps, vols, mirroredVols);
PrepareForMigrationCommand cmd = new PrepareForMigrationCommand(secStorageVm.getName(), null, storageIps, vols, mirroredVols);
HostVO routingHost = null;
HashSet<Host> avoid = new HashSet<Host>();
@ -1984,8 +1984,8 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
}
if( !_storageMgr.share(secStorageVm, vols, routingHost, false) ) {
s_logger.warn("Can not share " + vol.getPath() + " to " + secStorageVm.getHostName());
throw new StorageUnavailableException("Can not share " + vol.getPath() + " to " + secStorageVm.getHostName(), vol.getPoolId());
s_logger.warn("Can not share " + vol.getPath() + " to " + secStorageVm.getName());
throw new StorageUnavailableException("Can not share " + vol.getPath() + " to " + secStorageVm.getName(), vol.getPoolId());
}
Answer answer = _agentMgr.easySend(routingHost.getId(), cmd);
@ -2088,7 +2088,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
buf.append(" template=domP type=secstorage");
buf.append(" host=").append(_mgmt_host);
buf.append(" port=").append(_mgmt_port);
buf.append(" name=").append(profile.getVirtualMachine().getHostName());
buf.append(" name=").append(profile.getVirtualMachine().getName());
buf.append(" zone=").append(dest.getDataCenter().getId());
buf.append(" pod=").append(dest.getPod().getId());

View File

@ -225,7 +225,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
VMInstanceVO vmInstance = _vmDao.findById(volume.getInstanceId());
String vmDisplayName = "detached";
if (vmInstance != null) {
vmDisplayName = vmInstance.getHostName();
vmDisplayName = vmInstance.getName();
}
String snapshotName = vmDisplayName + "_" + volume.getName() + "_" + timeString;

View File

@ -978,7 +978,7 @@ public class AccountManagerImpl implements AccountManager, AccountService {
try {
success = (success && _vmMgr.stop(vm, 0));
} catch (AgentUnavailableException aue) {
s_logger.warn("Agent running on host " + vm.getHostId() + " is unavailable, unable to stop vm " + vm.getHostName());
s_logger.warn("Agent running on host " + vm.getHostId() + " is unavailable, unable to stop vm " + vm.getName());
success = false;
}
}

View File

@ -315,9 +315,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (result) {
userVm.setPassword(password);
EventUtils.saveEvent(userId, userVm.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_RESETPASSWORD, "successfully reset password for VM : " + userVm.getHostName(), null);
EventUtils.saveEvent(userId, userVm.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_VM_RESETPASSWORD, "successfully reset password for VM : " + userVm.getName(), null);
} else {
EventUtils.saveEvent(userId, userVm.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_RESETPASSWORD, "unable to reset password for VM : " + userVm.getHostName(), null);
EventUtils.saveEvent(userId, userVm.getAccountId(), EventVO.LEVEL_ERROR, EventTypes.EVENT_VM_RESETPASSWORD, "unable to reset password for VM : " + userVm.getName(), null);
}
return userVm;
@ -454,7 +454,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
VolumeVO rootVolumeOfVm = null;
List<VolumeVO> rootVolumesOfVm = _volsDao.findByInstanceAndType(vmId, VolumeType.ROOT);
if (rootVolumesOfVm.size() != 1) {
throw new CloudRuntimeException("The VM " + vm.getHostName() + " has more than one ROOT volume and is in an invalid state. Please contact Cloud Support.");
throw new CloudRuntimeException("The VM " + vm.getName() + " has more than one ROOT volume and is in an invalid state. Please contact Cloud Support.");
} else {
rootVolumeOfVm = rootVolumesOfVm.get(0);
}
@ -473,7 +473,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
volume = _storageMgr.createVolume(volume, vm, rootDiskTmplt, dcVO, pod, rootDiskPool.getClusterId(), svo, diskVO, new ArrayList<StoragePoolVO>(), volume.getSize(), rootDiskHyperType);
if (volume == null) {
throw new CloudRuntimeException("Failed to create volume when attaching it to VM: " + vm.getHostName());
throw new CloudRuntimeException("Failed to create volume when attaching it to VM: " + vm.getName());
}
}
@ -489,7 +489,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
for (VolumeVO vol : vols) {
if (vol.getDeviceId().equals(deviceId)) {
throw new RuntimeException("deviceId " + deviceId + " is used by VM " + vm.getHostName());
throw new RuntimeException("deviceId " + deviceId + " is used by VM " + vm.getName());
}
}
} else {
@ -555,7 +555,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_asyncMgr.updateAsyncJobStatus(job.getId(), BaseCmd.PROGRESS_INSTANCE_CREATED, volumeId);
}
String errorMsg = "Failed to attach volume: " + volume.getName() + " to VM: " + vm.getHostName();
String errorMsg = "Failed to attach volume: " + volume.getName() + " to VM: " + vm.getName();
boolean sendCommand = (vm.getState() == State.Running);
AttachVolumeAnswer answer = null;
Long hostId = vm.getHostId();
@ -592,10 +592,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
} else {
_volsDao.attachVolume(volume.getId(), vmId, deviceId);
}
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Volume: " +volume.getName()+ " successfully attached to VM: "+vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Volume: " +volume.getName()+ " successfully attached to VM: "+vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("Volume: " +volume.getName()+ " successfully attached to VM: "+vm.getHostName());
event.setDescription("Volume: " +volume.getName()+ " successfully attached to VM: "+vm.getName());
}
event.setLevel(EventVO.LEVEL_INFO);
_eventDao.persist(event);
@ -697,7 +697,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_asyncMgr.updateAsyncJobStatus(job.getId(), BaseCmd.PROGRESS_INSTANCE_CREATED, volumeId);
}
String errorMsg = "Failed to detach volume: " + volume.getName() + " from VM: " + vm.getHostName();
String errorMsg = "Failed to detach volume: " + volume.getName() + " from VM: " + vm.getName();
boolean sendCommand = (vm.getState() == State.Running);
Answer answer = null;
@ -729,10 +729,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_volsDao.update(volume.getId(), volume);
}
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Volume: " +volume.getName()+ " successfully detached from VM: "+vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Volume: " +volume.getName()+ " successfully detached from VM: "+vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("Volume: " +volume.getName()+ " successfully detached from VM: "+vm.getHostName());
event.setDescription("Volume: " +volume.getName()+ " successfully detached from VM: "+vm.getName());
}
event.setLevel(EventVO.LEVEL_INFO);
_eventDao.persist(event);
@ -881,11 +881,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
State state = vm.getState();
if (state == State.Running) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Starting an already started VM: " + vm.getId() + " - " + vm.getHostName() + "; state = " + vm.getState().toString());
s_logger.debug("Starting an already started VM: " + vm.getId() + " - " + vm.getName() + "; state = " + vm.getState().toString());
}
return vm;
}
String eventParams = "id=" + vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
String eventParams = "id=" + vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
event = new EventVO();
event.setType(EventTypes.EVENT_VM_START);
event.setUserId(userId);
@ -894,7 +894,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setState(Event.State.Completed);
event.setStartId(startEventId);
if (state.isTransitional()) {
String description = "Concurrent operations on the vm " + vm.getId() + " - " + vm.getHostName() + "; state = " + state.toString();
String description = "Concurrent operations on the vm " + vm.getId() + " - " + vm.getName() + "; state = " + state.toString();
event.setDescription(description);
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
@ -925,7 +925,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
if (guestOS == null) {
String msg = "Could not find guest OS description for OSId "
+ vm.getGuestOSId() + " for vm: " + vm.getHostName();
+ vm.getGuestOSId() + " for vm: " + vm.getName();
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
} else {
@ -974,12 +974,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (vm.getDomainRouterId() != null) {
router = _routerMgr.addVirtualMachineToGuestNetwork(vm, password, startEventId);
if (router == null) {
s_logger.error("Unable to add vm " + vm.getId() + " - " + vm.getHostName());
s_logger.error("Unable to add vm " + vm.getId() + " - " + vm.getName());
_itMgr.stateTransitTo(vm, VirtualMachine.Event.OperationFailed, null);
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Unable to start VM: " + vm.getHostName()+"("+vm.getDisplayName()+")" + "; Unable to add VM to guest network");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Unable to start VM: " + vm.getName()+"("+vm.getDisplayName()+")" + "; Unable to add VM to guest network");
} else {
event.setDescription("Unable to start VM: " + vm.getHostName() + "; Unable to add VM to guest network");
event.setDescription("Unable to start VM: " + vm.getName() + "; Unable to add VM to guest network");
}
event.setLevel(EventVO.LEVEL_ERROR);
@ -988,7 +988,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
vnet = router.getVnet();
s_logger.debug("VM: " + vm.getHostName() + " discovered vnet: " + vnet + " from router: " + router.getHostName());
s_logger.debug("VM: " + vm.getName() + " discovered vnet: " + vnet + " from router: " + router.getName());
if(NetworkManager.USE_POD_VLAN){
if(vm.getPodId() != router.getPodId()){
@ -997,7 +997,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
//Create Zone Vlan if not created already
vnet = _routerMgr.createZoneVlan(router);
if (vnet == null) {
s_logger.error("Vlan creation failed. Unable to add vm " + vm.getId() + " - " + vm.getHostName());
s_logger.error("Vlan creation failed. Unable to add vm " + vm.getId() + " - " + vm.getName());
return null;
}
} else {
@ -1029,7 +1029,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
do {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Trying to start vm " + vm.getHostName() + " on host " + host.toString());
s_logger.debug("Trying to start vm " + vm.getName() + " on host " + host.toString());
}
txn.start();
@ -1096,7 +1096,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
answer = _agentMgr.send(host.getId(), cmdStart);
if (answer.getResult()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Started vm " + vm.getHostName() + " on host " + host.toString());
s_logger.debug("Started vm " + vm.getName() + " on host " + host.toString());
}
started = true;
break;
@ -1105,7 +1105,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
s_logger.debug("Unable to start " + vm.toString() + " on host " + host.toString() + " due to " + answer.getDetails());
} catch (OperationTimedoutException e) {
if (e.isActive()) {
String description = "Unable to start vm " + vm.getHostName() + " due to operation timed out and it is active so scheduling a restart.";
String description = "Unable to start vm " + vm.getName() + " due to operation timed out and it is active so scheduling a restart.";
_haMgr.scheduleRestart(vm, true);
host = null;
s_logger.debug(description);
@ -1115,7 +1115,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
return null;
}
} catch (AgentUnavailableException e) {
s_logger.debug("Agent " + host.toString() + " was unavailable to start VM " + vm.getHostName());
s_logger.debug("Agent " + host.toString() + " was unavailable to start VM " + vm.getName());
}
avoid.add(host);
@ -1124,36 +1124,36 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
} while (--retry > 0 && (host = (HostVO)_agentMgr.findHost(Host.Type.Routing, dc, pod, sp, offering, template, vm, null, avoid)) != null);
if (host == null || retry <= 0) {
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Unable to start VM: " + vm.getHostName()+"("+vm.getDisplayName()+")"+ " Reason: "+answer.getDetails());
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Unable to start VM: " + vm.getName()+"("+vm.getDisplayName()+")"+ " Reason: "+answer.getDetails());
} else {
event.setDescription("Unable to start VM: " + vm.getHostName()+ " Reason: "+answer.getDetails());
event.setDescription("Unable to start VM: " + vm.getName()+ " Reason: "+answer.getDetails());
}
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
throw new ExecutionException("Unable to start VM: " + vm.getHostName()+ " Reason: "+answer.getDetails());
throw new ExecutionException("Unable to start VM: " + vm.getName()+ " Reason: "+answer.getDetails());
}
if (!_itMgr.stateTransitTo(vm, VirtualMachine.Event.OperationSucceeded, host.getId())) {
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("unable to start VM: " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("unable to start VM: " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("unable to start VM: " + vm.getHostName());
event.setDescription("unable to start VM: " + vm.getName());
}
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
throw new ConcurrentOperationException("Starting vm " + vm.getHostName() + " didn't work.");
throw new ConcurrentOperationException("Starting vm " + vm.getName() + " didn't work.");
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("Started vm " + vm.getHostName());
s_logger.debug("Started vm " + vm.getName());
}
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("successfully started VM: " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("successfully started VM: " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("successfully started VM: " + vm.getHostName());
event.setDescription("successfully started VM: " + vm.getName());
}
_eventDao.persist(event);
@ -1162,7 +1162,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
return _vmDao.findById(vm.getId());
} catch (Throwable th) {
txn.rollback();
s_logger.error("While starting vm " + vm.getHostName() + ", caught throwable: ", th);
s_logger.error("While starting vm " + vm.getName() + ", caught throwable: ", th);
if (!started) {
vm.setVnet(null);
@ -1183,7 +1183,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
s_logger.warn(th.getMessage());
throw (ExecutionException)th;
}
String description = "Unable to start VM " + vm.getHostName() + " because of an unknown exception";
String description = "Unable to start VM " + vm.getName() + " because of an unknown exception";
event.setDescription(description);
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
@ -1344,25 +1344,25 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setUserId(userId);
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_REBOOT);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
if (vm.getState() == State.Running && vm.getHostId() != null) {
RebootCommand cmd = new RebootCommand(vm.getInstanceName());
RebootAnswer answer = (RebootAnswer)_agentMgr.easySend(vm.getHostId(), cmd);
if (answer != null) {
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Successfully rebooted VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Successfully rebooted VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("Successfully rebooted VM instance : " + vm.getHostName());
event.setDescription("Successfully rebooted VM instance : " + vm.getName());
}
_eventDao.persist(event);
return true;
} else {
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("failed to reboot VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("failed to reboot VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("failed to reboot VM instance : " + vm.getHostName());
event.setDescription("failed to reboot VM instance : " + vm.getName());
}
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
@ -1563,13 +1563,13 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
IPAddressVO guestIP = (userVm.getGuestIpAddress() == null) ? null : _ipAddressDao.findById(userVm.getGuestIpAddress());
if (guestIP != null && guestIP.getAllocatedTime() != null) {
_ipAddressDao.unassignIpAddress(userVm.getGuestIpAddress());
s_logger.debug("Released guest IP address=" + userVm.getGuestIpAddress() + " vmName=" + userVm.getHostName() + " dcId=" + userVm.getDataCenterId());
s_logger.debug("Released guest IP address=" + userVm.getGuestIpAddress() + " vmName=" + userVm.getName() + " dcId=" + userVm.getDataCenterId());
EventVO event = new EventVO();
event.setUserId(User.UID_SYSTEM);
event.setAccountId(userVm.getAccountId());
event.setType(EventTypes.EVENT_NET_IP_RELEASE);
event.setParameters("guestIPaddress=" + userVm.getGuestIpAddress() + "\nvmName=" + userVm.getHostName() + "\ndcId=" + userVm.getDataCenterId());
event.setParameters("guestIPaddress=" + userVm.getGuestIpAddress() + "\nvmName=" + userVm.getName() + "\ndcId=" + userVm.getDataCenterId());
event.setDescription("released a public ip: " + userVm.getGuestIpAddress());
_eventDao.persist(event);
} else {
@ -1710,12 +1710,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
txn.start();
if(vm != null && vm.getHostName() != null && vm.getDisplayName() != null)
if(vm != null && vm.getName() != null && vm.getDisplayName() != null)
{
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("successfully created VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("successfully created VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("successfully created VM instance : " + vm.getHostName());
event.setDescription("successfully created VM instance : " + vm.getName());
}
}
else
@ -1744,8 +1744,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (vm == null) {
eventDescription += "new instance";
} else {
eventDescription += vm.getHostName();
if (!vm.getHostName().equals(vm.getDisplayName())) {
eventDescription += vm.getName();
if (!vm.getName().equals(vm.getDisplayName())) {
eventDescription += " (" + vm.getDisplayName() + ")";
}
}
@ -1785,11 +1785,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setUserId(userId);
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_DESTROY);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Successfully destroyed VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Successfully destroyed VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("Successfully destroyed VM instance : " + vm.getHostName());
event.setDescription("Successfully destroyed VM instance : " + vm.getName());
}
_eventDao.persist(event);
@ -1856,7 +1856,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setUserId(1L);
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_CREATE);
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setParameters("id="+vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
Transaction txn = Transaction.currentTxn();
AccountVO account = null;
@ -1874,10 +1874,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
ResourceAllocationException rae = new ResourceAllocationException("Maximum number of virtual machines for account: " + account.getAccountName() + " has been exceeded.");
rae.setResourceType("vm");
event.setLevel(EventVO.LEVEL_ERROR);
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Failed to recover VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")" + "; the resource limit for account: " + account.getAccountName() + " has been exceeded.");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Failed to recover VM instance : " + vm.getName()+"("+vm.getDisplayName()+")" + "; the resource limit for account: " + account.getAccountName() + " has been exceeded.");
} else {
event.setDescription("Failed to recover VM instance : " + vm.getHostName() + "; the resource limit for account: " + account.getAccountName() + " has been exceeded.");
event.setDescription("Failed to recover VM instance : " + vm.getName() + "; the resource limit for account: " + account.getAccountName() + " has been exceeded.");
}
_eventDao.persist(event);
txn.commit();
@ -1919,10 +1919,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_accountMgr.incrementResourceCount(account.getId(), ResourceType.volume, new Long(volumes.size()));
event.setLevel(EventVO.LEVEL_INFO);
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("successfully recovered VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("successfully recovered VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("successfully recovered VM instance : " + vm.getHostName());
event.setDescription("successfully recovered VM instance : " + vm.getName());
}
_eventDao.persist(event);
@ -2069,11 +2069,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setType(EventTypes.EVENT_VM_STOP);
event.setState(Event.State.Completed);
event.setStartId(startEventId);
event.setParameters("id="+vm.getId() + "\n" + "vmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("Successfully stopped VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
event.setParameters("id="+vm.getId() + "\n" + "vmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("Successfully stopped VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("Successfully stopped VM instance : " + vm.getHostName());
event.setDescription("Successfully stopped VM instance : " + vm.getName());
}
_eventDao.persist(event);
@ -2138,7 +2138,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_STOP);
event.setStartId(startEventId);
event.setParameters("id="+vm.getId() + "\n" + "vmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setParameters("id="+vm.getId() + "\n" + "vmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
StopCommand stop = new StopCommand(vm, vm.getInstanceName(), vm.getVnet());
@ -2146,7 +2146,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
try {
Answer answer = _agentMgr.send(vm.getHostId(), stop);
if (!answer.getResult()) {
s_logger.warn("Unable to stop vm " + vm.getHostName() + " due to " + answer.getDetails());
s_logger.warn("Unable to stop vm " + vm.getName() + " due to " + answer.getDetails());
} else {
stopped = true;
}
@ -2160,15 +2160,15 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
completeStopCommand(userId, vm, VirtualMachine.Event.OperationSucceeded, 0);
} else
{
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("failed to stop VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("failed to stop VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("failed to stop VM instance : " + vm.getHostName());
event.setDescription("failed to stop VM instance : " + vm.getName());
}
event.setLevel(EventVO.LEVEL_ERROR);
_eventDao.persist(event);
_itMgr.stateTransitTo(vm, VirtualMachine.Event.OperationFailed, vm.getHostId());
s_logger.error("Unable to stop vm " + vm.getHostName());
s_logger.error("Unable to stop vm " + vm.getName());
}
return stopped;
@ -2283,7 +2283,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
continue;
}
if(VirtualMachineName.isValidRouterName(vm.getHostName()) && !vm.getState().equals(State.Running)){
if(VirtualMachineName.isValidRouterName(vm.getName()) && !vm.getState().equals(State.Running)){
deleteRules = false;
}
@ -2632,7 +2632,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
VMInstanceVO vm = _vmDao.findById(instanceId);
State vmState = vm.getState();
if( !vmState.equals(State.Stopped) && !vmState.equals(State.Destroyed)) {
throw new CloudRuntimeException("Please put VM " + vm.getHostName() + " into Stopped state first");
throw new CloudRuntimeException("Please put VM " + vm.getName() + " into Stopped state first");
}
}
cmd = new CreatePrivateTemplateFromVolumeCommand(secondaryStorageURL, templateId, volume.getAccountId(),
@ -2904,7 +2904,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setUserId(userId);
event.setAccountId(accountId);
event.setType(EventTypes.EVENT_NET_IP_ASSIGN);
event.setParameters("guestIPaddress=" + guestIp + "\nvmName=" + vm.getHostName() + "\ndcId=" + vm.getDataCenterId());
event.setParameters("guestIPaddress=" + guestIp + "\nvmName=" + vm.getName() + "\ndcId=" + vm.getDataCenterId());
event.setDescription("acquired a public ip: " + guestIp);
_eventDao.persist(event);
@ -2912,9 +2912,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
if (poolId == 0) {
if(vm != null && vm.getHostName()!=null && vm.getDisplayName() != null)
if(vm != null && vm.getName()!=null && vm.getDisplayName() != null)
{
if(!vm.getHostName().equals(vm.getDisplayName())) {
if(!vm.getName().equals(vm.getDisplayName())) {
s_logger.debug("failed to create VM instance : " + name+"("+vm.getInstanceName()+")");
} else {
s_logger.debug("failed to create VM instance : " + name);
@ -2939,12 +2939,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setStartId(startEventId);
event.setState(Event.State.Completed);
String diskOfferingIdentifier = (diskOffering != null) ? String.valueOf(diskOffering.getId()) : "-1";
String eventParams = "id=" + vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ndoId=" + diskOfferingIdentifier + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
String eventParams = "id=" + vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ndoId=" + diskOfferingIdentifier + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
event.setParameters(eventParams);
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("successfully created VM instance : " + vm.getHostName()+"("+vm.getInstanceName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("successfully created VM instance : " + vm.getName()+"("+vm.getInstanceName()+")");
} else {
event.setDescription("successfully created VM instance : " + vm.getHostName());
event.setDescription("successfully created VM instance : " + vm.getName());
}
_eventDao.persist(event);
@ -3081,9 +3081,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
if (poolId == 0) {
if(vm != null && vm.getHostName()!=null && vm.getDisplayName() != null)
if(vm != null && vm.getName()!=null && vm.getDisplayName() != null)
{
if(!vm.getHostName().equals(vm.getDisplayName())) {
if(!vm.getName().equals(vm.getDisplayName())) {
s_logger.debug("failed to create VM instance : " + name+"("+vm.getDisplayName()+")");
} else {
s_logger.debug("failed to create VM instance : " + name);
@ -3108,12 +3108,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
event.setStartId(startEventId);
event.setState(Event.State.Completed);
String diskOfferingIdentifier = (diskOffering != null) ? String.valueOf(diskOffering.getId()) : "-1";
String eventParams = "id=" + vm.getId() + "\nvmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ndoId=" + diskOfferingIdentifier + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
String eventParams = "id=" + vm.getId() + "\nvmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ndoId=" + diskOfferingIdentifier + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId();
event.setParameters(eventParams);
if(!vm.getHostName().equals(vm.getDisplayName())) {
event.setDescription("successfully created VM instance : " + vm.getHostName()+"("+vm.getDisplayName()+")");
if(!vm.getName().equals(vm.getDisplayName())) {
event.setDescription("successfully created VM instance : " + vm.getName()+"("+vm.getDisplayName()+")");
} else {
event.setDescription("successfully created VM instance : " + vm.getHostName());
event.setDescription("successfully created VM instance : " + vm.getName());
}
_eventDao.persist(event);
@ -3242,7 +3242,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_vmDao.updateVM(id, displayName, ha);
// create a event for the change in HA Enabled flag
EventUtils.saveEvent(userId, accountId, EventVO.LEVEL_INFO, EventTypes.EVENT_VM_UPDATE, "Successfully updated virtual machine: "+vm.getHostName()+". "+description, null);
EventUtils.saveEvent(userId, accountId, EventVO.LEVEL_INFO, EventTypes.EVENT_VM_UPDATE, "Successfully updated virtual machine: "+vm.getName()+". "+description, null);
return _vmDao.findById(id);
}

View File

@ -495,7 +495,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
event.setAccountId(vm.getAccountId());
event.setType(EventTypes.EVENT_VM_STOP);
event.setStartId(1); // FIXME:
event.setParameters("id="+vm.getId() + "\n" + "vmName=" + vm.getHostName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
event.setParameters("id="+vm.getId() + "\n" + "vmName=" + vm.getName() + "\nsoId=" + vm.getServiceOfferingId() + "\ntId=" + vm.getTemplateId() + "\ndcId=" + vm.getDataCenterId());
StopCommand stop = new StopCommand(vm, vm.getInstanceName(), null);

View File

@ -218,7 +218,7 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
@Override
public String getHostName() {
return _vm.getHostName();
return _vm.getName();
}
@Override

View File

@ -80,7 +80,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
HostRunningSearch.done();
NameSearch = createSearchBuilder();
NameSearch.and("name", NameSearch.entity().getHostName(), SearchCriteria.Op.EQ);
NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
NameSearch.done();
RouterStateSearch = createSearchBuilder();

View File

@ -94,7 +94,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
ZoneTemplateNonExpungedSearch.done();
NameLikeSearch = createSearchBuilder();
NameLikeSearch.and("name", NameLikeSearch.entity().getHostName(), SearchCriteria.Op.LIKE);
NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE);
NameLikeSearch.done();
StateChangeSearch = createSearchBuilder();