@@ -1146,10 +1146,14 @@ private UserVm rebootVirtualMachine(long vmId, boolean enterSetup, boolean force
11461146 return null;
11471147 }
11481148
1149- if (vm.getState() != State.Running || vm.getHostId() == null ) {
1149+ if (vm.getState() != State.Running) {
11501150 logger.error("Vm {} is not in Running state, failed to reboot", vm);
11511151 return null;
11521152 }
1153+ if ( null == vm.getHostId() ) {
1154+ logger.error("Vm {} , is in state 'Running', but doesn't have a host id, failed to reboot", vm);
1155+ return null;
1156+ }
11531157
11541158 collectVmDiskAndNetworkStatistics(vm, State.Running);
11551159
@@ -2477,10 +2481,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
24772481
24782482 _executor = Executors.newScheduledThreadPool(wrks, new NamedThreadFactory("UserVm-Scavenger"));
24792483
2480- String vmIpWorkers = configs.get(VmIpFetchTaskWorkers.value().toString());
2481- int vmipwrks = NumbersUtil.parseInt(vmIpWorkers, 10);
2482-
2483- _vmIpFetchExecutor = Executors.newScheduledThreadPool(vmipwrks, new NamedThreadFactory("UserVm-ipfetch"));
2484+ _vmIpFetchExecutor = Executors.newScheduledThreadPool(VmIpFetchTaskWorkers.value(), new NamedThreadFactory("UserVm-ipfetch"));
24842485
24852486 String aggregationRange = configs.get("usage.stats.job.aggregation.range");
24862487 int _usageAggregationRange = NumbersUtil.parseInt(aggregationRange, 1440);
@@ -2799,12 +2800,10 @@ protected void runInContext() {
27992800 if (scanLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION)) {
28002801 try {
28012802 List<UserVmVO> vms = _vmDao.findDestroyedVms(new Date(System.currentTimeMillis() - ((long)_expungeDelay << 10)));
2802- if (logger.isInfoEnabled()) {
2803- if (vms.isEmpty()) {
2804- logger.trace("Found no Instances to expunge.");
2805- } else {
2806- logger.info("Found " + vms.size() + " Instances to expunge.");
2807- }
2803+ if (vms.isEmpty()) {
2804+ logger.trace("Found no Instances to expunge.");
2805+ } else {
2806+ logger.info("Found " + vms.size() + " Instances to expunge.");
28082807 }
28092808 for (UserVmVO vm : vms) {
28102809 try {
@@ -3144,9 +3143,8 @@ private void generateNetworkUsageForVm(VirtualMachine vm, boolean isDisplay, Str
31443143 NetworkVO network = _networkDao.findById(nic.getNetworkId());
31453144 long isDefault = (nic.isDefaultNic()) ? 1 : 0;
31463145 UsageEventUtils.publishUsageEvent(eventType, vm.getAccountId(), vm.getDataCenterId(), vm.getId(),
3147- Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, vm.getClass().getName(), vm.getUuid(), true );
3146+ Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, vm.getClass().getName(), vm.getUuid(), isDisplay );
31483147 }
3149-
31503148 }
31513149
31523150 @Override
@@ -3482,7 +3480,7 @@ public UserVm rebootVirtualMachine(RebootVMCmd cmd) throws InsufficientCapacityE
34823480 throw new InvalidParameterValueException("Booting into a hardware setup menu is not implemented on " + vmInstance.getHypervisorType());
34833481 }
34843482
3485- UserVm userVm = rebootVirtualMachine(vmId, cmd.getBootIntoSetup() , cmd.isForced());
3483+ UserVm userVm = rebootVirtualMachine(vmId, enterSetup , cmd.isForced());
34863484 if (userVm != null ) {
34873485 // update the vmIdCountMap if the vm is in advanced shared network with out services
34883486 final List<NicVO> nics = _nicDao.listByVmId(vmId);
@@ -4558,11 +4556,6 @@ private UserVm getUncheckedUserVmResource(DataCenter zone, String hostName, Stri
45584556
45594557 long id = _vmDao.getNextInSequence(Long.class, "id");
45604558
4561- if (hostName != null) {
4562- // Check is hostName is RFC compliant
4563- checkNameForRFCCompliance(hostName);
4564- }
4565-
45664559 String instanceName = null;
45674560 String instanceSuffix = _instance;
45684561 String uuidName = _uuidMgr.generateUuid(UserVm.class, customId);
@@ -5912,7 +5905,8 @@ protected String getCurrentVmPasswordOrDefineNewPassword(String newPassword, Use
59125905 /**
59135906 * Create or overwrite a parameter in the list
59145907 * @param params the list of parameters
5915- * @param parameter the parameter to creat/overwrite
5908+ * @param parameterMap the original map of parameters to take the existing parameters from if params is null
5909+ * @param parameter the parameter to create or overwrite
59165910 * @param parameterValue the value to give to the parameter
59175911 * @return the resulting updated list of parameters
59185912 */
0 commit comments