[GitHub] cloudstack pull request #1722: CLOUDSTACK-9558 Cleanup the snapshots on the ...

2016-12-08 Thread yvsubhash
Github user yvsubhash commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1722#discussion_r91570095
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -260,11 +260,15 @@ public boolean deleteSnapshot(Long snapshotId) {
 boolean result = deleteSnapshotChain(snapshotOnImage);
 obj.processEvent(Snapshot.Event.OperationSucceeded);
 if (result) {
-//snapshot is deleted on backup storage, need to delete it 
on primary storage
-SnapshotDataStoreVO snapshotOnPrimary = 
snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
-if (snapshotOnPrimary != null) {
-snapshotOnPrimary.setState(State.Destroyed);
-snapshotStoreDao.update(snapshotOnPrimary.getId(), 
snapshotOnPrimary);
+SnapshotInfo snapshotOnPrimary = 
snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+if(snapshotSvr.deleteSnapshot(snapshotOnPrimary)) {
--- End diff --

If the db state is set to 'destroyed', it would no longer visible in the ui 
and entry would be left behind in primary. Leaving it as is keeps the option of 
manual cleanup 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1722: CLOUDSTACK-9558 Cleanup the snapshots on the ...

2016-12-08 Thread yvsubhash
Github user yvsubhash commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1722#discussion_r91569719
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -260,11 +260,15 @@ public boolean deleteSnapshot(Long snapshotId) {
 boolean result = deleteSnapshotChain(snapshotOnImage);
 obj.processEvent(Snapshot.Event.OperationSucceeded);
 if (result) {
-//snapshot is deleted on backup storage, need to delete it 
on primary storage
-SnapshotDataStoreVO snapshotOnPrimary = 
snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
-if (snapshotOnPrimary != null) {
-snapshotOnPrimary.setState(State.Destroyed);
-snapshotStoreDao.update(snapshotOnPrimary.getId(), 
snapshotOnPrimary);
+SnapshotInfo snapshotOnPrimary = 
snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
--- End diff --

Yes it should be updated in this case as well. It is taken care


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1722: CLOUDSTACK-9558 Cleanup the snapshots on the ...

2016-12-07 Thread koushik-das
Github user koushik-das commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1722#discussion_r91251778
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -260,11 +260,15 @@ public boolean deleteSnapshot(Long snapshotId) {
 boolean result = deleteSnapshotChain(snapshotOnImage);
 obj.processEvent(Snapshot.Event.OperationSucceeded);
 if (result) {
-//snapshot is deleted on backup storage, need to delete it 
on primary storage
-SnapshotDataStoreVO snapshotOnPrimary = 
snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
-if (snapshotOnPrimary != null) {
-snapshotOnPrimary.setState(State.Destroyed);
-snapshotStoreDao.update(snapshotOnPrimary.getId(), 
snapshotOnPrimary);
+SnapshotInfo snapshotOnPrimary = 
snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
--- End diff --

Master branch has slightly different code which deals with cleanup for RBD 
type storage pool. So if this is fwd merged there will be conflicts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1722: CLOUDSTACK-9558 Cleanup the snapshots on the ...

2016-12-07 Thread koushik-das
Github user koushik-das commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1722#discussion_r91252165
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -260,11 +260,15 @@ public boolean deleteSnapshot(Long snapshotId) {
 boolean result = deleteSnapshotChain(snapshotOnImage);
 obj.processEvent(Snapshot.Event.OperationSucceeded);
 if (result) {
-//snapshot is deleted on backup storage, need to delete it 
on primary storage
-SnapshotDataStoreVO snapshotOnPrimary = 
snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
-if (snapshotOnPrimary != null) {
-snapshotOnPrimary.setState(State.Destroyed);
-snapshotStoreDao.update(snapshotOnPrimary.getId(), 
snapshotOnPrimary);
+SnapshotInfo snapshotOnPrimary = 
snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+if(snapshotSvr.deleteSnapshot(snapshotOnPrimary)) {
--- End diff --

What happens if deleteSnapshot fails? Will it be retried again? If not 
should the DB be always cleaned up whether snapshot removal from primary is 
successful or not?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1722: CLOUDSTACK-9558 Cleanup the snapshots on the ...

2016-12-07 Thread koushik-das
Github user koushik-das commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1722#discussion_r91252945
  
--- Diff: 
engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
 ---
@@ -260,11 +260,15 @@ public boolean deleteSnapshot(Long snapshotId) {
 boolean result = deleteSnapshotChain(snapshotOnImage);
 obj.processEvent(Snapshot.Event.OperationSucceeded);
 if (result) {
-//snapshot is deleted on backup storage, need to delete it 
on primary storage
-SnapshotDataStoreVO snapshotOnPrimary = 
snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
-if (snapshotOnPrimary != null) {
-snapshotOnPrimary.setState(State.Destroyed);
-snapshotStoreDao.update(snapshotOnPrimary.getId(), 
snapshotOnPrimary);
+SnapshotInfo snapshotOnPrimary = 
snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
--- End diff --

What if snapshotOnPrimary is null (as per getSnapshot() it is possible)? If 
snapshot is not found on primary but DB entry exists, should it just be updated 
as 'Destroyed'?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] cloudstack pull request #1722: CLOUDSTACK-9558 Cleanup the snapshots on the ...

2016-10-21 Thread yvsubhash
GitHub user yvsubhash opened a pull request:

https://github.com/apache/cloudstack/pull/1722

CLOUDSTACK-9558 Cleanup the snapshots on the primary storage of Xense…

Cleanup the snapshots on the primary storage of Xenserver after VM/Volume 
is expunged

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/yvsubhash/cloudstack CLOUDSTACK-9558

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cloudstack/pull/1722.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1722


commit 0ff5a5329ec047fe4872347a26236da75ce5eef7
Author: subhash_y 
Date:   2016-08-29T05:15:03Z

CLOUDSTACK-9558 Cleanup the snapshots on the primary storage of Xenserver 
after VM/Volume is expunged




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---