Skip to content

api: snapshot, snapshotpolicy tag support#3228

Merged
yadvr merged 7 commits intoapache:masterfrom
shapeblue:snapshot-snapshotpolicy-tag-support
Jun 27, 2019
Merged

api: snapshot, snapshotpolicy tag support#3228
yadvr merged 7 commits intoapache:masterfrom
shapeblue:snapshot-snapshotpolicy-tag-support

Conversation

@shwstppr
Copy link
Contributor

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

  • 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)
  • 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
screenshot from 2019-02-08 13-38-53
screenshot from 2019-02-08 13-25-35

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"
    }
  ]
}


@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✖centos6 ✖centos7 ✔debian. JID-2642

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shwstppr there seems to be some build issues, can you have a look?

@PaulAngus PaulAngus modified the milestones: 4.11.3.0, 4.13.0.0 Mar 25, 2019
@@ -0,0 +1,30 @@
package org.apache.cloudstack.api.command.user.snapshot;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license needed, @shwstppr . Can you add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland added license

@shwstppr shwstppr closed this Mar 27, 2019
@shwstppr shwstppr reopened this Mar 27, 2019
@yadvr yadvr changed the title api: snapshot, snapshotpolicy tag support [WIP DO NOT MERGE] api: snapshot, snapshotpolicy tag support Mar 29, 2019
@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2665

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, now tags look like this:

{
      "account": "user",
      "created": "2019-04-01T12:21:04+0000",
      "domain": "ROOT",
      "domainid": "c1bf87c5-4fb7-11e9-b7a8-1e004901077b",
      "id": "03298bd6-605a-49bf-a599-449e8de4a8d9",
      "intervaltype": "MANUAL",
      "name": "snap1",
      "osdisplayname": "CentOS 5.3 (64-bit)",
      "ostypeid": "c1c83ce2-4fb7-11e9-b7a8-1e004901077b",
      "physicalsize": 419862016,
      "revertable": false,
      "snapshottype": "MANUAL",
      "state": "BackedUp",
      "tags": [
        {
          "key": "random",
          "value": "rand-value"
        }
      ],
      "virtualsize": 2147483648,
      "volumeid": "545f71aa-d92d-4650-ad8b-1032d3a1709a",
      "volumename": "ROOT-5",
      "volumetype": "ROOT",
      "zoneid": "5c3dcefe-7b0e-4c3e-bb92-271a3c01229e"
    }

@blueorangutan
Copy link

Trillian test result (tid-3457)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 28705 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3228-t3457-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 69 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_01_cancel_host_maintenace_with_no_migration_jobs Failure 5.48 test_host_maintenance.py
test_02_cancel_host_maintenace_with_migration_jobs Error 1.50 test_host_maintenance.py

@yadvr
Copy link
Member

yadvr commented May 23, 2019

@shwstppr can you fix the conflicts?

@shwstppr shwstppr force-pushed the snapshot-snapshotpolicy-tag-support branch from 3dcb841 to 26b4073 Compare May 24, 2019 07:18
@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2785

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@anuragaw
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2906

@anuragaw
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2907

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-3711)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 26945 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3228-t3711-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_internal_lb.py
Smoke tests completed. 71 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on latest changes

@anuragaw
Copy link
Contributor

Updated heght of the dilague box -
Screenshot from 2019-06-25 12-31-32
@andrijapanic , @rhtyd , @shwstppr

@anuragaw
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@anuragaw a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@borisstoyanov
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-12

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-13

@yadvr
Copy link
Member

yadvr commented Jun 25, 2019

Packaging race condition, the repo may be inconsistent. Will rekick packaging.
@blueorangutan package

@blueorangutan
Copy link

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-18

@yadvr
Copy link
Member

yadvr commented Jun 25, 2019

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-18)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 30865 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3228-t18-kvm-centos7.zip
Smoke tests completed. 71 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@yadvr yadvr changed the title [WIP DO NOT MERGE] api: snapshot, snapshotpolicy tag support api: snapshot, snapshotpolicy tag support Jun 27, 2019
@yadvr yadvr merged commit 5847453 into apache:master Jun 27, 2019
winterhazel pushed a commit that referenced this pull request Jan 28, 2026
Correção na listagem de _backup schedules_ de projetos

Closes #3228

See merge request scclouds/scclouds!1346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants