Skip to content

Commit 8935377

Browse files
committed
Merge branch '4.22' into 422-fix-cks-node-unmanage-vm
2 parents 47a5e8c + 09ee092 commit 8935377

File tree

6 files changed

+39
-16
lines changed

6 files changed

+39
-16
lines changed

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2326,7 +2326,8 @@ public void prepareAllNicsForMigration(final VirtualMachineProfile vm, final Dep
23262326
for (final NetworkElement element : networkElements) {
23272327
if (providersToImplement.contains(element.getProvider())) {
23282328
if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
2329-
throw new CloudRuntimeException(String.format("Service provider %s either doesn't exist or is not enabled in physical network: %s", element.getProvider().getName(), _physicalNetworkDao.findById(network.getPhysicalNetworkId())));
2329+
throw new CloudRuntimeException(String.format("Service provider %s either doesn't exist or is not enabled in physical network: %s",
2330+
element.getProvider().getName(), _physicalNetworkDao.findById(network.getPhysicalNetworkId())));
23302331
}
23312332
if (element instanceof NetworkMigrationResponder) {
23322333
if (!((NetworkMigrationResponder) element).prepareMigration(profile, network, vm, dest, context)) {
@@ -2633,6 +2634,10 @@ && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) {
26332634

26342635
final NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
26352636
guru.deallocate(network, profile, vm);
2637+
if (nic.getReservationStrategy() == Nic.ReservationStrategy.Create) {
2638+
applyProfileToNicForRelease(nic, profile);
2639+
_nicDao.update(nic.getId(), nic);
2640+
}
26362641
if (BooleanUtils.isNotTrue(preserveNics)) {
26372642
_nicDao.remove(nic.getId());
26382643
}

engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class SnapshotDataStoreDaoImpl extends GenericDaoBase<SnapshotDataStoreVO
6767
private SearchBuilder<SnapshotDataStoreVO> searchFilteringStoreIdEqStoreRoleEqStateNeqRefCntNeq;
6868
protected SearchBuilder<SnapshotDataStoreVO> searchFilteringStoreIdEqStateEqStoreRoleEqIdEqUpdateCountEqSnapshotIdEqVolumeIdEq;
6969
private SearchBuilder<SnapshotDataStoreVO> stateSearch;
70-
private SearchBuilder<SnapshotDataStoreVO> idStateNeqSearch;
70+
private SearchBuilder<SnapshotDataStoreVO> idStateNinSearch;
7171
protected SearchBuilder<SnapshotVO> snapshotVOSearch;
7272
private SearchBuilder<SnapshotDataStoreVO> snapshotCreatedSearch;
7373
private SearchBuilder<SnapshotDataStoreVO> dataStoreAndInstallPathSearch;
@@ -146,10 +146,10 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
146146
stateSearch.done();
147147

148148

149-
idStateNeqSearch = createSearchBuilder();
150-
idStateNeqSearch.and(SNAPSHOT_ID, idStateNeqSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ);
151-
idStateNeqSearch.and(STATE, idStateNeqSearch.entity().getState(), SearchCriteria.Op.NEQ);
152-
idStateNeqSearch.done();
149+
idStateNinSearch = createSearchBuilder();
150+
idStateNinSearch.and(SNAPSHOT_ID, idStateNinSearch.entity().getSnapshotId(), SearchCriteria.Op.EQ);
151+
idStateNinSearch.and(STATE, idStateNinSearch.entity().getState(), SearchCriteria.Op.NOTIN);
152+
idStateNinSearch.done();
153153

154154
snapshotVOSearch = snapshotDao.createSearchBuilder();
155155
snapshotVOSearch.and(VOLUME_ID, snapshotVOSearch.entity().getVolumeId(), SearchCriteria.Op.EQ);
@@ -480,15 +480,15 @@ public List<SnapshotDataStoreVO> findBySnapshotId(long snapshotId) {
480480

481481
@Override
482482
public List<SnapshotDataStoreVO> findBySnapshotIdWithNonDestroyedState(long snapshotId) {
483-
SearchCriteria<SnapshotDataStoreVO> sc = idStateNeqSearch.create();
483+
SearchCriteria<SnapshotDataStoreVO> sc = idStateNinSearch.create();
484484
sc.setParameters(SNAPSHOT_ID, snapshotId);
485485
sc.setParameters(STATE, State.Destroyed.name());
486486
return listBy(sc);
487487
}
488488

489489
@Override
490490
public List<SnapshotDataStoreVO> findBySnapshotIdAndNotInDestroyedHiddenState(long snapshotId) {
491-
SearchCriteria<SnapshotDataStoreVO> sc = idStateNeqSearch.create();
491+
SearchCriteria<SnapshotDataStoreVO> sc = idStateNinSearch.create();
492492
sc.setParameters(SNAPSHOT_ID, snapshotId);
493493
sc.setParameters(STATE, State.Destroyed.name(), State.Hidden.name());
494494
return listBy(sc);

server/src/main/java/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,8 @@ public LoadBalancer createPublicLoadBalancerRule(String xId, String name, String
17381738
throw new NetworkRuleConflictException("Can't do load balance on IP address: " + ipVO.getAddress());
17391739
}
17401740

1741+
verifyLoadBalancerRuleNetwork(name, network, ipVO);
1742+
17411743
String cidrString = generateCidrString(cidrList);
17421744

17431745
boolean performedIpAssoc = false;
@@ -1790,7 +1792,17 @@ public LoadBalancer createPublicLoadBalancerRule(String xId, String name, String
17901792

17911793
return result;
17921794
}
1793-
/**
1795+
1796+
protected void verifyLoadBalancerRuleNetwork(String lbName, Network network, IPAddressVO ipVO) {
1797+
if (ipVO.getAssociatedWithNetworkId() != null && network.getId() != ipVO.getAssociatedWithNetworkId()) {
1798+
String msg = String.format("Cannot create Load Balancer rule %s as the IP address %s is not associated " +
1799+
"with the network %s (ID=%s)", lbName, ipVO.getAddress(), network.getName(), network.getUuid());
1800+
logger.error(msg);
1801+
throw new InvalidParameterValueException(msg);
1802+
}
1803+
}
1804+
1805+
/**
17941806
* Transforms the cidrList from a List of Strings to a String which contains all the CIDRs from cidrList separated by whitespaces. This is used to facilitate both the persistence
17951807
* in the DB and also later when building the configuration String in the getRulesForPool method of the HAProxyConfigurator class.
17961808
*/

test/integration/smoke/test_secondary_storage.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ def test_01_sys_vm_start(self):
136136
'Up',
137137
"Check state of primary storage pools is Up or not"
138138
)
139-
for _ in range(2):
139+
# Poll until all SSVMs are Running, or timeout after 3 minutes
140+
timeout = 180
141+
interval = 15
142+
list_ssvm_response = []
143+
while timeout > 0:
140144
list_ssvm_response = list_ssvms(
141145
self.apiclient,
142146
systemvmtype='secondarystoragevm',
@@ -154,10 +158,12 @@ def test_01_sys_vm_start(self):
154158
"Check list System VMs response"
155159
)
156160

157-
for ssvm in list_ssvm_response:
158-
if ssvm.state != 'Running':
159-
time.sleep(30)
160-
continue
161+
if all(ssvm.state == 'Running' for ssvm in list_ssvm_response):
162+
break
163+
164+
time.sleep(interval)
165+
timeout -= interval
166+
161167
for ssvm in list_ssvm_response:
162168
self.assertEqual(
163169
ssvm.state,

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/BaseMO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private UnmanagedInstanceTO createUnmanagedInstanceTOFromThinListingDynamicPrope
226226
} else if (objProp.getName().equals("config.bootOptions")) {
227227
VirtualMachineBootOptions bootOptions = (VirtualMachineBootOptions) objProp.getVal();
228228
String bootMode = "LEGACY";
229-
if (bootOptions != null && bootOptions.isEfiSecureBootEnabled()) {
229+
if (bootOptions != null && Boolean.TRUE.equals(bootOptions.isEfiSecureBootEnabled())) {
230230
bootMode = "SECURE";
231231
}
232232
vm.setBootMode(bootMode);

vmware-base/src/main/java/com/cloud/hypervisor/vmware/util/VmwareHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ public static UnmanagedInstanceTO getUnmanagedInstance(VmwareHypervisorHost hype
819819
instance.setBootType(firmware.equalsIgnoreCase("efi") ? "UEFI" : "BIOS");
820820
VirtualMachineBootOptions bootOptions = configInfo.getBootOptions();
821821
String bootMode = "LEGACY";
822-
if (bootOptions != null && bootOptions.isEfiSecureBootEnabled()) {
822+
if (bootOptions != null && Boolean.TRUE.equals(bootOptions.isEfiSecureBootEnabled())) {
823823
bootMode = "SECURE";
824824
}
825825
instance.setBootMode(bootMode);

0 commit comments

Comments
 (0)