Skip to content

Commit 4802b5c

Browse files
committed
Merge branch 'ablecloud-team:ablestack-europa' into ablestack-europa
2 parents 78dcb2e + e3074f3 commit 4802b5c

5 files changed

Lines changed: 51 additions & 4 deletions

File tree

client/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,11 @@
617617
<artifactId>cloud-plugin-backup-commvault</artifactId>
618618
<version>${project.version}</version>
619619
</dependency>
620+
<dependency>
621+
<groupId>org.apache.cloudstack</groupId>
622+
<artifactId>cloud-plugin-backup-bx</artifactId>
623+
<version>${project.version}</version>
624+
</dependency>
620625
<dependency>
621626
<groupId>org.apache.cloudstack</groupId>
622627
<artifactId>cloud-plugin-integrations-kubernetes-service</artifactId>

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4702,6 +4702,7 @@ private boolean orchestrateRemoveNicFromVm(final VirtualMachine vm, final Nic ni
47024702

47034703
_networkMgr.removeNic(vmProfile, nic);
47044704
_nicsDao.remove(nic.getId());
4705+
cleanupSecurityGroupMappingsIfNeeded(vmVO);
47054706
return true;
47064707
}
47074708

@@ -4777,13 +4778,26 @@ private boolean orchestrateRemoveVmFromNetwork(final VirtualMachine vm, final Ne
47774778
logger.debug("Successfully released nic {} for vm {}", nic, vm);
47784779

47794780
_networkMgr.removeNic(vmProfile, nic);
4781+
cleanupSecurityGroupMappingsIfNeeded(vmVO);
47804782
return true;
47814783
} finally {
47824784
_nicsDao.releaseFromLockTable(lock.getId());
47834785
logger.debug("Lock is released for nic {} as a part of remove vm {} from network {}", lock, vm, network);
47844786
}
47854787
}
47864788

4789+
private void cleanupSecurityGroupMappingsIfNeeded(final VMInstanceVO vm) {
4790+
if (vm == null || vm.getType() != VirtualMachine.Type.User || _securityGroupManager.isVmSecurityGroupEnabled(vm.getId())) {
4791+
return;
4792+
}
4793+
4794+
final UserVmVO userVm = _userVmDao.findById(vm.getId());
4795+
if (userVm != null) {
4796+
logger.debug("Removing stale security group mappings for VM {} after NIC removal left no security-group-enabled networks.", vm);
4797+
_securityGroupManager.removeInstanceFromGroups(userVm);
4798+
}
4799+
}
4800+
47874801
@Override
47884802
public void findHostAndMigrate(final String vmUuid, final Long newSvcOfferingId, final Map<String, String> customParameters, final ExcludeList excludes) throws InsufficientCapacityException, ConcurrentOperationException,
47894803
ResourceUnavailableException {

server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.apache.cloudstack.framework.async.AsyncRpcContext;
5454
import org.apache.cloudstack.framework.messagebus.MessageBus;
5555
import org.apache.cloudstack.framework.messagebus.PublishScope;
56+
import org.apache.cloudstack.secstorage.heuristics.HeuristicType;
5657
import org.apache.cloudstack.storage.command.TemplateOrVolumePostUploadCommand;
5758
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
5859
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
@@ -300,13 +301,29 @@ protected void createTemplateWithinZones(TemplateProfile profile, VMTemplateVO t
300301
}
301302

302303
protected List<DataStore> getImageStoresThrowsExceptionIfNotFound(long zoneId, TemplateProfile profile) {
303-
List<DataStore> imageStores = storeMgr.getImageStoresByZoneIds(zoneId);
304+
List<DataStore> imageStores = storeMgr.getImageStoresByScopeExcludingReadOnly(new ZoneScope(zoneId));
304305
if (imageStores == null || imageStores.size() == 0) {
305306
throw new CloudRuntimeException(String.format("Unable to find image store to download the template [%s].", profile.getTemplate()));
306307
}
307308
return imageStores;
308309
}
309310

311+
protected DataStore verifyHeuristicRulesForZone(VMTemplateVO template, Long zoneId) {
312+
HeuristicType heuristicType;
313+
if (ImageFormat.ISO.equals(template.getFormat())) {
314+
heuristicType = HeuristicType.ISO;
315+
} else {
316+
heuristicType = HeuristicType.TEMPLATE;
317+
}
318+
DataStore imageStore = heuristicRuleHelper.getImageStoreIfThereIsHeuristicRule(zoneId, heuristicType, template);
319+
if (imageStore == null || isWritableImageStore(imageStore, zoneId)) {
320+
return imageStore;
321+
}
322+
323+
logger.info("Heuristic rule selected readonly image store [{}] in zone [{}]; skipping it for template upload.", imageStore, zoneId);
324+
return null;
325+
}
326+
310327
protected void standardImageStoreAllocation(List<DataStore> imageStores, VMTemplateVO template) {
311328
Set<Long> zoneSet = new HashSet<Long>();
312329
Collections.shuffle(imageStores);

server/src/main/java/com/cloud/template/TemplateAdapterBase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
4646
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
4747
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
48+
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
4849
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
4950
import org.apache.cloudstack.secstorage.heuristics.HeuristicType;
5051
import org.apache.cloudstack.storage.command.TemplateOrVolumePostUploadCommand;
@@ -207,6 +208,16 @@ protected boolean isZoneAndImageStoreAvailable(DataStore imageStore, Long zoneId
207208
return true;
208209
}
209210

211+
protected boolean isWritableImageStore(DataStore imageStore, Long zoneId) {
212+
if (imageStore == null || zoneId == null) {
213+
return false;
214+
}
215+
216+
List<DataStore> writableImageStores = storeMgr.getImageStoresByScopeExcludingReadOnly(new ZoneScope(zoneId));
217+
return CollectionUtils.isNotEmpty(writableImageStores) &&
218+
writableImageStores.stream().anyMatch(store -> store.getId() == imageStore.getId());
219+
}
220+
210221
/**
211222
* If the template/ISO is marked as private, then it is allocated to a random secondary storage; otherwise, allocates to every storage pool in every zone given by the
212223
* {@link TemplateProfile#getZoneIdList()}.

ui/public/locales/ko_KR.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,9 +1791,9 @@
17911791
"label.nfsserver": "NFS \uc11c\ubc84",
17921792
"label.nic": "NIC",
17931793
"label.nicadaptertype": "NIC \uc5b4\ub311\ud130 \uc720\ud615",
1794-
"label.nicmultiqueuenumber": "NIC multiqueue \ubc88\ud638",
1795-
"label.nicmultiqueuenumber.tooltip": "NIC multiqueue \ubc88\ud638\uc785\ub2c8\ub2e4. KVM\ub9cc \uc9c0\uc6d0\ud569\ub2c8\ub2e4. \"-1\" \uac12\uc740 NIC multiqueue \ubc88\ud638\uac00 \uc778\uc2a4\ud134\uc2a4\uc758 vCPU \ubc88\ud638\ub85c \uc124\uc815\ub428\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.",
1796-
"label.nicpackedvirtqueuesenabled": "NIC \uc555\ucd95 virtqueues \ud65c\uc131\ud654\ub428",
1794+
"label.nicmultiqueuenumber": "NIC multiqueue \uc218",
1795+
"label.nicmultiqueuenumber.tooltip": "NIC multiqueue \uc218\uc785\ub2c8\ub2e4. KVM\ub9cc \uc9c0\uc6d0\ud569\ub2c8\ub2e4. \"-1\" \uac12\uc740 NIC multiqueue \uc218\ub294 \uc778\uc2a4\ud134\uc2a4\uc758 vCPU \uc218\ub85c \uc124\uc815\ub428\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4.",
1796+
"label.nicpackedvirtqueuesenabled": "NIC \uc555\ucd95 virtqueues \ud65c\uc131\ud654",
17971797
"label.nicpackedvirtqueuesenabled.tooltip": "NIC \uc555\ucd95 virtqueues \ud65c\uc131\ud654 \uc5ec\ubd80\uc785\ub2c8\ub2e4. QEMU >= 4.2.0 \ubc0f Libvirt >= 6.3.0\uc778 KVM\ub9cc \uc9c0\uc6d0\ud569\ub2c8\ub2e4.",
17981798
"label.nics": "NIC",
17991799
"label.no": "\uc544\ub2c8\uc624",

0 commit comments

Comments
 (0)