Skip to content

Commit 395cbcc

Browse files
author
Alex Huang
committed
Move the rest of the generics out of virtualmachinemanager
1 parent db93ebf commit 395cbcc

5 files changed

Lines changed: 169 additions & 183 deletions

File tree

‎server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,12 @@ public boolean destroyProxy(long vmId) {
11531153
try {
11541154
//expunge the vm
11551155
_itMgr.expunge(proxy.getUuid());
1156+
proxy.setPublicIpAddress(null);
1157+
proxy.setPublicMacAddress(null);
1158+
proxy.setPublicNetmask(null);
1159+
proxy.setPrivateMacAddress(null);
1160+
proxy.setPrivateIpAddress(null);
1161+
_consoleProxyDao.update(proxy.getId(), proxy);
11561162
_consoleProxyDao.remove(vmId);
11571163
HostVO host = _hostDao.findByTypeNameAndZoneId(proxy.getDataCenterId(), proxy.getHostName(),
11581164
Host.Type.ConsoleProxy);

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId) throw
12101210

12111211
// #2 migrate the vm if host doesn't have capacity or is in avoid set
12121212
if (!existingHostHasCapacity){
1213-
vmInstance = _itMgr.findHostAndMigrate(vmInstance.getType(), vmInstance, newServiceOfferingId, excludes);
1213+
_itMgr.findHostAndMigrate(vmInstance.getUuid(), newServiceOfferingId, excludes);
12141214
}
12151215

12161216
// #3 scale the vm now
@@ -1225,14 +1225,9 @@ public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId) throw
12251225
s_logger.warn("Received exception while scaling ",e);
12261226
} catch (ConcurrentOperationException e) {
12271227
s_logger.warn("Received exception while scaling ",e);
1228-
} catch (VirtualMachineMigrationException e) {
1229-
s_logger.warn("Received exception while scaling ",e);
1230-
} catch (ManagementServerException e) {
1231-
s_logger.warn("Received exception while scaling ",e);
12321228
} catch (Exception e) {
12331229
s_logger.warn("Received exception while scaling ",e);
1234-
}
1235-
finally{
1230+
} finally {
12361231
if(!success){
12371232
_itMgr.upgradeVmDb(vmId, currentServiceOffering.getId()); // rollback
12381233
// Decrement CPU and Memory count accordingly.
@@ -3752,8 +3747,8 @@ public VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool) {
37523747
+ destHypervisorType.toString() + ", vm: "
37533748
+ vm.getHypervisorType().toString());
37543749
}
3755-
VMInstanceVO migratedVm = _itMgr.storageMigration(vm, destPool);
3756-
return migratedVm;
3750+
_itMgr.storageMigration(vm.getUuid(), destPool);
3751+
return _vmDao.findById(vm.getId());
37573752

37583753
}
37593754

‎server/src/com/cloud/vm/VirtualMachineManager.java‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929
import com.cloud.exception.ConcurrentOperationException;
3030
import com.cloud.exception.InsufficientCapacityException;
3131
import com.cloud.exception.InsufficientServerCapacityException;
32-
import com.cloud.exception.ManagementServerException;
3332
import com.cloud.exception.OperationTimedoutException;
3433
import com.cloud.exception.ResourceUnavailableException;
35-
import com.cloud.exception.VirtualMachineMigrationException;
3634
import com.cloud.hypervisor.Hypervisor.HypervisorType;
3735
import com.cloud.network.Network;
3836
import com.cloud.network.dao.NetworkVO;
@@ -114,7 +112,7 @@ void advanceReboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> param
114112

115113
VirtualMachine findById(long vmId);
116114

117-
<T extends VMInstanceVO> T storageMigration(T vm, StoragePool storagePoolId);
115+
void storageMigration(String vmUuid, StoragePool storagePoolId);
118116

119117
/**
120118
* @param vmInstance
@@ -175,15 +173,11 @@ NicProfile addVmToNetwork(VirtualMachine vm, Network network, NicProfile request
175173
VirtualMachineTO toVmTO(VirtualMachineProfile profile);
176174

177175

178-
VMInstanceVO reConfigureVm(VMInstanceVO vm, ServiceOffering newServiceOffering, boolean sameHost)
179-
throws ResourceUnavailableException, ConcurrentOperationException;
176+
VMInstanceVO reConfigureVm(VMInstanceVO vm, ServiceOffering newServiceOffering, boolean sameHost) throws ResourceUnavailableException, ConcurrentOperationException;
180177

181-
VMInstanceVO findHostAndMigrate(VirtualMachine.Type vmType, VMInstanceVO vm, Long newSvcOfferingId, DeploymentPlanner.ExcludeList excludeHostList) throws InsufficientCapacityException,
182-
ConcurrentOperationException, ResourceUnavailableException,
183-
VirtualMachineMigrationException, ManagementServerException;
178+
void findHostAndMigrate(String vmUuid, Long newSvcOfferingId, DeploymentPlanner.ExcludeList excludeHostList) throws InsufficientCapacityException,
179+
ConcurrentOperationException, ResourceUnavailableException;
184180

185-
<T extends VMInstanceVO> T migrateForScale(T vm, long srcHostId, DeployDestination dest, Long newSvcOfferingId)
186-
throws ResourceUnavailableException, ConcurrentOperationException,
187-
ManagementServerException, VirtualMachineMigrationException;
181+
void migrateForScale(String vmUuid, long srcHostId, DeployDestination dest, Long newSvcOfferingId) throws ResourceUnavailableException, ConcurrentOperationException;
188182

189183
}

0 commit comments

Comments
 (0)