You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "slavkap (via GitHub)" <gi...@apache.org> on 2023/12/19 10:41:23 UTC

[PR] remove StorPool tags from detached volumes [cloudstack]

slavkap opened a new pull request, #8377:
URL: https://github.com/apache/cloudstack/pull/8377

   ### Description
   
   This PR removes the VolumeCare policy and the VM's UUID tags when a VM has attached data disks and during the destruction of the VM those volumes remain active
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [X] Minor
   - [ ] Trivial
   
   
   ### How Has This Been Tested?
   
   manual and smoke tests
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431355700


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   ```suggestion
       public static SpApiResponse volumeRemoveTags(String name, SpConnectionDesc conn) {
               Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
   ```
   
   seems this method is used to remove tags



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432836221


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   :shrug: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "slavkap (via GitHub)" <gi...@apache.org>.
slavkap commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432774853


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   @DaanHoogland, I will rename it as you both suggested. Still, I prefer to leave it with a common name like the used StorPool API call even though now it is used only to remove



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1870262234

   Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8150


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432812725


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   that seems ok, but the spello is still strange: volumeUpadateTags instead of volumeUpdateTags?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431357772


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -190,6 +190,16 @@ public boolean grantAccess(DataObject data, Host host, DataStore dataStore) {
 
     @Override
     public void revokeAccess(DataObject data, Host host, DataStore dataStore) {
+        if (DataObjectType.VOLUME == data.getType()) {
+            final VolumeVO volume = volumeDao.findById(data.getId());
+            if (volume.getInstanceId() == null) {
+                StorPoolUtil.spLog("Removing tags from detached volume=%s", volume.toString());
+                Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
+                SpConnectionDesc conn = StorPoolUtil.getSpConnection(dataStore.getUuid(), dataStore.getId(), storagePoolDetailsDao, primaryStoreDao);
+                StorPoolUtil.volumeUpadateTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), tags, conn);

Review Comment:
   ```suggestion
                   StorPoolUtil.volumeRemoveTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), conn);
   ```
   
   update this if method is updated to _volumeRemoveTags_ as suggested



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1870199783

   @sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431361004


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {
+        Map<String, Object> json = new HashMap<>();
+        json.put("tags", tags);
+        return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
+    }
+
     public static SpApiResponse volumeUpdateTags(final String name, final String uuid, Long iops,

Review Comment:
   ```suggestion
       public static SpApiResponse volumeUpdateIopsAndTags(final String name, final String uuid, Long iops,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432649252


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   in the future `this method could be used to set tags also` but the name is `volumeRemoveTags`, @slavkap ? Remove and set seem in contradiction to me. Can we add/rename whatever we need in the future later?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1870198269

   @blueorangutan package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431356901


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -190,6 +190,16 @@ public boolean grantAccess(DataObject data, Host host, DataStore dataStore) {
 
     @Override
     public void revokeAccess(DataObject data, Host host, DataStore dataStore) {
+        if (DataObjectType.VOLUME == data.getType()) {
+            final VolumeVO volume = volumeDao.findById(data.getId());
+            if (volume.getInstanceId() == null) {
+                StorPoolUtil.spLog("Removing tags from detached volume=%s", volume.toString());
+                Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
+                SpConnectionDesc conn = StorPoolUtil.getSpConnection(dataStore.getUuid(), dataStore.getId(), storagePoolDetailsDao, primaryStoreDao);
+                StorPoolUtil.volumeUpadateTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), tags, conn);

Review Comment:
   update this if method is updated to _volumeRemoveTags_ as suggested



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "slavkap (via GitHub)" <gi...@apache.org>.
slavkap commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432495101


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   Thanks @sureshanaparti! I prefer it to stay with this name. In future, this method could be used to set tags also



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1862534552

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/8377?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Comparison is base [(`33e2a4d`)](https://app.codecov.io/gh/apache/cloudstack/commit/33e2a4dd6635798f98d4726406ed1af4c00a4cc5?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 30.77% compared to head [(`dbc242d`)](https://app.codecov.io/gh/apache/cloudstack/pull/8377?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 4.39%.
   
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main   #8377       +/-   ##
   ============================================
   - Coverage     30.77%   4.39%   -26.39%     
   ============================================
     Files          5341     361     -4980     
     Lines        374855   28622   -346233     
     Branches      54517    4992    -49525     
   ============================================
   - Hits         115379    1258   -114121     
   + Misses       244219   27225   -216994     
   + Partials      15257     139    -15118     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/8377/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [simulator-marvin-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8377/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/8377/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.39% <ø> (ø)` | |
   | [unit-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8377/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/8377?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431357772


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -190,6 +190,16 @@ public boolean grantAccess(DataObject data, Host host, DataStore dataStore) {
 
     @Override
     public void revokeAccess(DataObject data, Host host, DataStore dataStore) {
+        if (DataObjectType.VOLUME == data.getType()) {
+            final VolumeVO volume = volumeDao.findById(data.getId());
+            if (volume.getInstanceId() == null) {
+                StorPoolUtil.spLog("Removing tags from detached volume=%s", volume.toString());
+                Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
+                SpConnectionDesc conn = StorPoolUtil.getSpConnection(dataStore.getUuid(), dataStore.getId(), storagePoolDetailsDao, primaryStoreDao);
+                StorPoolUtil.volumeUpadateTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), tags, conn);

Review Comment:
   
   ```suggestion
                   StorPoolUtil.volumeRemoveTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), conn);
   ```
   
   update this if method is updated to _volumeRemoveTags_ as suggested



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1870761283

   <b>[SF] Trillian test result (tid-8686)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 47552 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8377-t8686-kvm-centos7.zip
   Smoke tests completed. 120 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_08_migrate_vm | `Error` | 0.05 | test_vm_life_cycle.py
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432649252


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   in the future `this method could be used to set tags also` but the name is `volumeRemoveTags`, @slavkap ? Remove and set seem in contradiction to me. Can we add/rename whatever we need in the future later?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431357772


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -190,6 +190,16 @@ public boolean grantAccess(DataObject data, Host host, DataStore dataStore) {
 
     @Override
     public void revokeAccess(DataObject data, Host host, DataStore dataStore) {
+        if (DataObjectType.VOLUME == data.getType()) {
+            final VolumeVO volume = volumeDao.findById(data.getId());
+            if (volume.getInstanceId() == null) {
+                StorPoolUtil.spLog("Removing tags from detached volume=%s", volume.toString());
+                Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
+                SpConnectionDesc conn = StorPoolUtil.getSpConnection(dataStore.getUuid(), dataStore.getId(), storagePoolDetailsDao, primaryStoreDao);
+                StorPoolUtil.volumeUpadateTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), tags, conn);

Review Comment:
   StorPoolUtil.volumeRemoveTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), conn);
   
   
   update this if method is updated to _volumeRemoveTags_ as suggested



##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -190,6 +190,16 @@ public boolean grantAccess(DataObject data, Host host, DataStore dataStore) {
 
     @Override
     public void revokeAccess(DataObject data, Host host, DataStore dataStore) {
+        if (DataObjectType.VOLUME == data.getType()) {
+            final VolumeVO volume = volumeDao.findById(data.getId());
+            if (volume.getInstanceId() == null) {
+                StorPoolUtil.spLog("Removing tags from detached volume=%s", volume.toString());
+                Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
+                SpConnectionDesc conn = StorPoolUtil.getSpConnection(dataStore.getUuid(), dataStore.getId(), storagePoolDetailsDao, primaryStoreDao);
+                StorPoolUtil.volumeUpadateTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), tags, conn);

Review Comment:
   update this if method is updated to _volumeRemoveTags_ as suggested



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431355700


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   ```suggestion
       public static SpApiResponse volumeRemoveTags(final String name, SpConnectionDesc conn) {
               Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
   ```
   
   seems this method is used to remove tags



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1433478710


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,7 +517,13 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
-    public static SpApiResponse volumeUpdateTags(final String name, final String uuid, Long iops,
+    public static SpApiResponse volumeRemoveTags(String name, Map<String, String> tags, SpConnectionDesc conn) {
+        Map<String, Object> json = new HashMap<>();

Review Comment:
   @slavkap Better to create empty tags map here, instead of passing it to indicate removal of tags in the method, otherwise it's like an update tags.
   
   _Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432652852


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   @slavkap `volumeUpadateTags` has a spello.
   also
   When we need a thing in the future we can implement it then, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "slavkap (via GitHub)" <gi...@apache.org>.
slavkap commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1432822793


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/util/StorPoolUtil.java:
##########
@@ -517,6 +517,12 @@ public static SpApiResponse volumeUpdate(final String name, final Long newSize,
         return POST("MultiCluster/VolumeUpdate/" + name, json, conn);
     }
 
+    public static SpApiResponse volumeUpadateTags(String name, Map<String, String> tags, SpConnectionDesc conn) {

Review Comment:
   I renamed the method with the latest commit as Suresh suggested to volumeRemoveTags



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on code in PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#discussion_r1431357772


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -190,6 +190,16 @@ public boolean grantAccess(DataObject data, Host host, DataStore dataStore) {
 
     @Override
     public void revokeAccess(DataObject data, Host host, DataStore dataStore) {
+        if (DataObjectType.VOLUME == data.getType()) {
+            final VolumeVO volume = volumeDao.findById(data.getId());
+            if (volume.getInstanceId() == null) {
+                StorPoolUtil.spLog("Removing tags from detached volume=%s", volume.toString());
+                Map<String, String> tags = StorPoolHelper.addStorPoolTags(null, "", null, "");
+                SpConnectionDesc conn = StorPoolUtil.getSpConnection(dataStore.getUuid(), dataStore.getId(), storagePoolDetailsDao, primaryStoreDao);
+                StorPoolUtil.volumeUpadateTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), tags, conn);

Review Comment:
   ```suggestion                StorPoolUtil.volumeRemoveTags(StorPoolStorageAdaptor.getVolumeNameFromPath(volume.getPath(), true), conn);
   ```
   
   update this if method is updated to _volumeRemoveTags_ as suggested



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1870271246

   @sureshanaparti a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377#issuecomment-1870266049

   @blueorangutan test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] remove StorPool tags from detached volumes [cloudstack]

Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud merged PR #8377:
URL: https://github.com/apache/cloudstack/pull/8377


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org