You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2019/03/14 12:05:33 UTC

[GitHub] [cloudstack] shwstppr opened a new pull request #3228: api: snapshot, snapshotpolicy tag support

shwstppr opened a new pull request #3228: api: snapshot, snapshotpolicy tag support
URL: https://github.com/apache/cloudstack/pull/3228
 
 
   ## Description
   **Problem**: Currently tags cannot be applied to snapshot when it is being created but through separate “create tags” API calls. For snapshot policies tags cannot be set either at creation or through “create tags” API.
   
   **Root Cause**: The “create snapshots” API does not support adding tags during creation and it can only be done through “create tags” API. Snapshot policy as a resource does not support tags and no tags can be set for them through any API.
   
   **Solution**: Tag support for snapshot policy has been added. Snapshot policy with tags when executed will produce snapshots containing the same tags from snapshot policy.
   
   Following APIs have been updated:
   - Both “create snapshotpolicy” and “create snapshot” now accepts “tags” as a new parameter. The expected format for “tags” parameter is similar to parameter “tags” in “create tags“ API.
   - Deletion support for tags associated with snapshots policy has been added to “delete snapshotpolicies” API.
   - Tags set for snapshot policies are added to the Response of “list snapshotpolicies“ API.
   
   UI support for setting tags to snapshots and snapshot policy is provided through the corresponding menus with a new section in each form to set tags.
   
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   
   ## Screenshots (if appropriate):
   ![screenshot from 2019-02-08 13-39-23](https://user-images.githubusercontent.com/43956255/52466072-054d5e00-2ba7-11e9-9190-9d90fbdcd9ce.png)
   ![screenshot from 2019-02-08 13-38-53](https://user-images.githubusercontent.com/43956255/52466074-05e5f480-2ba7-11e9-9b43-08457fd4ff50.png)
   ![screenshot from 2019-02-08 13-25-35](https://user-images.githubusercontent.com/43956255/52466113-3037b200-2ba7-11e9-875d-7bc60399903c.png)
   
   ## How Has This Been Tested?
   UI And Cloudmonkey.
   ```
   (local) 🐵 > create snapshot volumeid=9d4a3e48-2c27-4822-98c0-a79381cf4113 tags[0].key=keyss tags[0].value=valuess
    
   {
     "accountid": "77891a42-1e18-11e9-8d89-34e12d5f623e",
     "cmd": "org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotCmd",
     "created": "2019-02-08T00:01:15+0530",
     "jobid": "f4b82b0d-f256-4c87-a8b4-36bbcb44cdeb",
     "jobinstanceid": "21086b5a-42da-4bd1-aa10-d7e62bed88a9",
     "jobinstancetype": "Snapshot",
     "jobprocstatus": 0,
     "jobresult": {
       "snapshot": {
         "account": "admin",
         "created": "2019-02-08T00:01:15+0530",
         "domain": "ROOT",
         "domainid": "77890928-1e18-11e9-8d89-34e12d5f623e",
         "id": "21086b5a-42da-4bd1-aa10-d7e62bed88a9",
         "intervaltype": "MANUAL",
         "name": "vm1_ROOT-6_20190207183115",
         "osdisplayname": "CentOS 5.5 (64-bit)",
         "ostypeid": "7780d0f5-1e18-11e9-8d89-34e12d5f623e",
         "physicalsize": 1596588032,
         "revertable": true,
         "snapshottype": "MANUAL",
         "state": "BackedUp",
         "tags": [
           {
             "key": "keyss",
             "value": "valuess"
           }
         ],
         "virtualsize": 8589934592,
         "volumeid": "9d4a3e48-2c27-4822-98c0-a79381cf4113",
         "volumename": "ROOT-6",
         "volumetype": "ROOT",
         "zoneid": "df67395c-d21d-4404-adcc-a44c9994763d"
       }
     },
     "jobresultcode": 0,
     "jobresulttype": "object",
     "jobstatus": 1,
     "userid": "77892e56-1e18-11e9-8d89-34e12d5f623e"
   }
   (local) 🐵 > create snapshotpolicy volumeid=9d4a3e48-2c27-4822-98c0-a79381cf4113 schedule=1 maxsnaps=1 intervaltype=HOURLY timezone="Etc/GMT+12" tags[0].key=hello tags[0].value=world
   {
     "snapshotpolicy": {
       "fordisplay": true,
       "id": "c9da9363-cbab-47d8-8d1c-cbc69c140946",
       "intervaltype": 0,
       "maxsnaps": 1,
       "schedule": "1",
       "tags": [
         {
           "account": "system",
           "domain": "ROOT",
           "domainid": "77890928-1e18-11e9-8d89-34e12d5f623e",
           "key": "hello",
           "resourceid": "c9da9363-cbab-47d8-8d1c-cbc69c140946",
           "resourcetype": "SnapshotPolicy",
           "value": "world"
         }
       ],
       "timezone": "Etc/GMT+12",
       "volumeid": "9d4a3e48-2c27-4822-98c0-a79381cf4113"
     }
   }
   (local) 🐵 > list snapshotpolicies id=c9da9363-cbab-47d8-8d1c-cbc69c140946
   {
     "count": 1,
     "snapshotpolicy": [
       {
         "fordisplay": true,
         "id": "c9da9363-cbab-47d8-8d1c-cbc69c140946",
         "intervaltype": 0,
         "maxsnaps": 1,
         "schedule": "1",
         "tags": [
           {
             "account": "system",
             "domain": "ROOT",
             "domainid": "77890928-1e18-11e9-8d89-34e12d5f623e",
             "key": "hello",
             "resourceid": "c9da9363-cbab-47d8-8d1c-cbc69c140946",
             "resourcetype": "SnapshotPolicy",
             "value": "world"
           }
         ],
         "timezone": "Etc/GMT+12",
         "volumeid": "9d4a3e48-2c27-4822-98c0-a79381cf4113"
       }
     ]
   }
   
   
   ```
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services