private List<ServiceOfferingJoinVO> filterOfferingsOnCurrentTags(List<ServiceOfferingJoinVO> offerings, ServiceOfferingVO currentVmOffering) { if (currentVmOffering == null) { return offerings; } List<String> currentTagsList = StringUtils.csvTagsToList(currentVmOffering.getTags()); // New service offering should have all the tags of the current service offering. List<ServiceOfferingJoinVO> filteredOfferings = new ArrayList<>(); for (ServiceOfferingJoinVO offering : offerings) { List<String> newTagsList = StringUtils.csvTagsToList(offering.getTags()); if (newTagsList.containsAll(currentTagsList)) { filteredOfferings.add(offering); } } return filteredOfferings; }
final List<String> currentTags = StringUtils.csvTagsToList(currentServiceOffering.getTags()); final List<String> newTags = StringUtils.csvTagsToList(newServiceOffering.getTags()); if (!newTags.containsAll(currentTags)) { throw new InvalidParameterValueException("Unable to upgrade virtual machine; the current service offering " + " should have tags as subset of " +
private void checkDestinationForTags(StoragePool destPool, VMInstanceVO vm) { List<VolumeVO> vols = _volsDao.findUsableVolumesForInstance(vm.getId()); // OfflineVmwareMigration: iterate over volumes // OfflineVmwareMigration: get disk offering List<String> storageTags = storageMgr.getStoragePoolTagList(destPool.getId()); for(Volume vol : vols) { DiskOfferingVO diskOffering = _diskOfferingDao.findById(vol.getDiskOfferingId()); List<String> volumeTags = StringUtils.csvTagsToList(diskOffering.getTags()); if(! matches(volumeTags, storageTags)) { String msg = String.format("destination pool '%s' with tags '%s', does not support the volume diskoffering for volume '%s' (tags: '%s') ", destPool.getName(), StringUtils.listToCsvTags(storageTags), vol.getName(), StringUtils.listToCsvTags(volumeTags) ); throw new CloudRuntimeException(msg); } } }