@Override public String getHostTags(final long hostId) { final List<String> hostTags = _hostTagsDao.gethostTags(hostId); if (hostTags == null) { return null; } else { return StringUtils.listToCsvTags(hostTags); } }
@Override public String getStoragePoolTags(long poolId) { return StringUtils.listToCsvTags(getStoragePoolTagList(poolId)); }
@Test public void listToCsvTags() { assertEquals("a,b,c", StringUtils.listToCsvTags(Arrays.asList("a","b", "c"))); assertEquals("", StringUtils.listToCsvTags(new ArrayList<String>())); }
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); } } }
if (!failedZones.isEmpty()) { s_logger.debug("There were failures when copying template to zones: " + StringUtils.listToCsvTags(failedZones));
@Test public void listToCsvTags() { assertEquals("a,b,c", StringUtils.listToCsvTags(Arrays.asList("a", "b", "c"))); assertEquals("", StringUtils.listToCsvTags(new ArrayList<>())); } }