From commits-return-78855-archive-asf-public=cust-asf.ponee.io@cloudstack.apache.org Fri Jul 20 14:12:26 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id AD171180663 for ; Fri, 20 Jul 2018 14:12:25 +0200 (CEST) Received: (qmail 68340 invoked by uid 500); 20 Jul 2018 12:12:24 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 68331 invoked by uid 99); 20 Jul 2018 12:12:24 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jul 2018 12:12:24 +0000 From: GitBox To: commits@cloudstack.apache.org Subject: [GitHub] rafaelweingartner commented on a change in pull request #2636: Fix limitation on tag matching in 'migrateVolume' with disk offering replacement Message-ID: <153208874423.29969.14835124234587362376.gitbox@gitbox.apache.org> Date: Fri, 20 Jul 2018 12:12:24 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit rafaelweingartner commented on a change in pull request #2636: Fix limitation on tag matching in 'migrateVolume' with disk offering replacement URL: https://github.com/apache/cloudstack/pull/2636#discussion_r204023925 ########## File path: server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java ########## @@ -2189,6 +2189,58 @@ protected void validateConditionsToReplaceDiskOfferingOfVolume(VolumeVO volume, s_logger.info(String.format("Changing disk offering to [uuid=%s] while migrating volume [uuid=%s, name=%s].", newDiskOffering.getUuid(), volume.getUuid(), volume.getName())); } + /** + * Checks if the target storage supports the new disk offering. + * This validation is consistent with the mechanism used to select a storage pool to deploy a volume when a virtual machine is deployed or when a new data disk is allocated. + * + * The scenarios when this method returns true or false is presented in the following table. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
#Disk offering tagsStorage tagsDoes the storage support the disk offering?
1A,BANO
2A,B,CA,B,C,D,XYES
3A,B,CX,Y,ZNO
4nullA,S,DYES
5AnullNO
6nullnullYES
+ */ + protected boolean doesTargetStorageSupportNewDiskOffering(StoragePool destPool, DiskOfferingVO newDiskOffering) { + String newDiskOfferingTags = newDiskOffering.getTags(); + return doesTargetStorageSupportDiskOffering(destPool, newDiskOfferingTags); + } + + @Override + public boolean doesTargetStorageSupportDiskOffering(StoragePool destPool, String diskOfferingTags) { + if (org.apache.commons.lang.StringUtils.isBlank(diskOfferingTags)) { + return true; + } + String storagePoolTags = getStoragePoolTags(destPool); + if (org.apache.commons.lang.StringUtils.isBlank(storagePoolTags)) { + return false; + } + String[] storageTagsAsStringArray = org.apache.commons.lang.StringUtils.split(storagePoolTags, ","); Review comment: Well, but those "gurus"/plugins/drivers and so on are different "things". I mean, they are not library, they are part of our code base to deliver our business. On the other hand, creating a layer over third party utils libraries such as StringUtils, NumberUtils, Hibernate, Spring and so on sound like an overkill. We should discuss that we beers in Montreal :) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services