Skip to content

Commit 4cb5198

Browse files
committed
fix test and variable name
1 parent 646ccd8 commit 4cb5198

File tree

2 files changed

+47
-32
lines changed

2 files changed

+47
-32
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,7 +3984,7 @@ private NetworkVO getDefaultNetwork(DataCenter zone, Account owner, boolean sele
39843984
return defaultNetwork;
39853985
}
39863986

3987-
private NetworkVO createDefaultNetworkForAccount(DataCenter zone, Account owner, List<NetworkOfferingVO> requiredOfferings)
3987+
protected NetworkVO createDefaultNetworkForAccount(DataCenter zone, Account owner, List<NetworkOfferingVO> requiredOfferings)
39883988
throws InsufficientCapacityException, ResourceAllocationException {
39893989
NetworkVO defaultNetwork = null;
39903990
long physicalNetworkId = _networkModel.findPhysicalNetworkId(zone.getId(), requiredOfferings.get(0).getTags(), requiredOfferings.get(0).getTrafficType());
@@ -7591,12 +7591,12 @@ protected void executeStepsToChangeOwnershipOfVm(AssignVMCmd cmd, Account caller
75917591
updateVmOwner(newAccount, vm, domainId, newAccountId);
75927592

75937593
updateVolumesOwner(volumes, oldAccount, newAccount, newAccountId);
7594-
MutableBoolean isNetworkCreated = new MutableBoolean(false);
7594+
MutableBoolean isNetworkAutoCreated = new MutableBoolean(false);
75957595
try {
7596-
updateVmNetwork(cmd, caller, vm, newAccount, template, isNetworkCreated);
7596+
updateVmNetwork(cmd, caller, vm, newAccount, template, isNetworkAutoCreated);
75977597
} catch (InsufficientCapacityException | ResourceAllocationException e) {
75987598
List<NetworkVO> networkVOS = _networkDao.listByAccountIdNetworkName(newAccountId, newAccount.getAccountName() + "-network");
7599-
if (networkVOS.size() == 1 && isNetworkCreated.get()) {
7599+
if (networkVOS.size() == 1 && isNetworkAutoCreated.get()) {
76007600
_networkDao.remove(networkVOS.get(0).getId());
76017601
}
76027602
throw new CloudRuntimeException(String.format("Unable to update networks when assigning VM [%s] due to [%s].", vm, e.getMessage()), e);
@@ -7662,7 +7662,7 @@ protected void updateVolumesOwner(final List<VolumeVO> volumes, Account oldAccou
76627662
* @throws InsufficientCapacityException
76637663
* @throws ResourceAllocationException
76647664
*/
7665-
protected void updateVmNetwork(AssignVMCmd cmd, Account caller, UserVmVO vm, Account newAccount, VirtualMachineTemplate template, MutableBoolean isNetworkCreated)
7665+
protected void updateVmNetwork(AssignVMCmd cmd, Account caller, UserVmVO vm, Account newAccount, VirtualMachineTemplate template, MutableBoolean isNetworkAutoCreated)
76667666
throws InsufficientCapacityException, ResourceAllocationException {
76677667

76687668
logger.trace("Updating network for VM [{}].", vm);
@@ -7680,7 +7680,7 @@ protected void updateVmNetwork(AssignVMCmd cmd, Account caller, UserVmVO vm, Acc
76807680
return;
76817681
}
76827682

7683-
updateAdvancedTypeNetworkForVm(cmd, caller, vm, newAccount, template, vmOldProfile, zone, networkIdList, securityGroupIdList, isNetworkCreated);
7683+
updateAdvancedTypeNetworkForVm(cmd, caller, vm, newAccount, template, vmOldProfile, zone, networkIdList, securityGroupIdList, isNetworkAutoCreated);
76847684
}
76857685

76867686
/**
@@ -7791,7 +7791,7 @@ protected void updateBasicTypeNetworkForVm(AssignVMCmd cmd, UserVmVO vm, Account
77917791
* @throws InvalidParameterValueException
77927792
*/
77937793
protected void updateAdvancedTypeNetworkForVm(AssignVMCmd cmd, Account caller, UserVmVO vm, Account newAccount, VirtualMachineTemplate template,
7794-
VirtualMachineProfileImpl vmOldProfile, DataCenterVO zone, List<Long> networkIdList, List<Long> securityGroupIdList, MutableBoolean isNetworkCreated)
7794+
VirtualMachineProfileImpl vmOldProfile, DataCenterVO zone, List<Long> networkIdList, List<Long> securityGroupIdList, MutableBoolean isNetworkAutoCreated)
77957795
throws InsufficientCapacityException, ResourceAllocationException, InvalidParameterValueException {
77967796

77977797
LinkedHashSet<NetworkVO> applicableNetworks = new LinkedHashSet<>();
@@ -7824,7 +7824,7 @@ protected void updateAdvancedTypeNetworkForVm(AssignVMCmd cmd, Account caller, U
78247824
addNetworksToNetworkIdList(vm, newAccount, vmOldProfile, networkIdList, applicableNetworks, requestedIPv4ForNics, requestedIPv6ForNics);
78257825

78267826
if (applicableNetworks.isEmpty()) {
7827-
selectApplicableNetworkToCreateVm(caller, newAccount, zone, applicableNetworks, isNetworkCreated);
7827+
selectApplicableNetworkToCreateVm(caller, newAccount, zone, applicableNetworks, isNetworkAutoCreated);
78287828
}
78297829

78307830
addNicsToApplicableNetworksAndReturnDefaultNetwork(applicableNetworks, requestedIPv4ForNics, requestedIPv6ForNics, networks);
@@ -7947,7 +7947,7 @@ protected NetworkVO addNicsToApplicableNetworksAndReturnDefaultNetwork(LinkedHas
79477947
* @throws ResourceAllocationException
79487948
*/
79497949
protected void selectApplicableNetworkToCreateVm(Account caller, Account newAccount, DataCenterVO zone,
7950-
Set<NetworkVO> applicableNetworks, MutableBoolean isNetworkCreated)
7950+
Set<NetworkVO> applicableNetworks, MutableBoolean isNetworkAutoCreated)
79517951
throws InsufficientCapacityException, ResourceAllocationException {
79527952

79537953
logger.trace("Selecting the applicable network to create the VM.");
@@ -7969,7 +7969,7 @@ protected void selectApplicableNetworkToCreateVm(Account caller, Account newAcco
79697969
if (virtualNetworks.isEmpty()) {
79707970
try (TransactionLegacy txn = TransactionLegacy.open("CreateNetworkTxn")) {
79717971
defaultNetwork = createApplicableNetworkToCreateVm(caller, newAccount, zone, firstRequiredOffering);
7972-
isNetworkCreated.set(true);
7972+
isNetworkAutoCreated.set(true);
79737973
txn.commit();
79747974
}
79757975
} else if (virtualNetworks.size() > 1) {

0 commit comments

Comments
 (0)