Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDSTACK-8302: Removing snapshots on RBD #1230

Merged
merged 1 commit into from May 4, 2016
Merged

CLOUDSTACK-8302: Removing snapshots on RBD #1230

merged 1 commit into from May 4, 2016

Conversation

dmytro-shevchenko
Copy link
Contributor

Snapshot removing implemented if primary datastore is RBD
https://issues.apache.org/jira/browse/CLOUDSTACK-8302

@borisroman
Copy link
Contributor

Hi @dmytro-shevchenko

Thanks for implementing the removal code. Could you squash the commits and add a descriptive commit message?

@dmytro-shevchenko
Copy link
Contributor Author

Commits are squashed and message updated.

@borisroman
Copy link
Contributor

@dmytro-shevchenko Thank you, I'll give them a test run!

@voloshanenko
Copy link
Contributor

Guys, i see that build hangs... Can you please re run them?

@andrijapanic-dont-use-this-one

Anyone has any more feedback ? Should we merge?

@wido
Copy link
Contributor

wido commented Dec 18, 2015

I'll see if I can run tests on it today with @borisroman on our dev setup

}
} else {
s_logger.warn("Operation not implemented!");
throw new InternalErrorException("Operation not implemented!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add the type of storage pool in this message? Now this line doesn't say much. snapshotTO and primaryStore should contain all the information you need

Copy link
Contributor

Choose a reason for hiding this comment

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

Wido, what do your mean? Improve s_logger.info messages? And include shared/dedicated message for pool type? Because if you mean RBD pool type - it's already included into message " .. remove RBD sn..."

Copy link
Contributor

Choose a reason for hiding this comment

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

For example:

"Operation not supported for storage pool type of NFS"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Storage pool type added to messages.

@remibergsma
Copy link
Contributor

@andrijapanic Merge without testing and LGTMs? Really?

s_logger.warn("Operation not implemented for storage pool type of " + primaryPool.getType().toString());
throw new InternalErrorException("Operation not implemented for storage pool type of " + primaryPool.getType().toString());
}
return new Answer(cmd, true, "Snapshot removed successfully.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add the path of the snapshot here: pool/image@snap. Logs should be easy to consume

@wido
Copy link
Contributor

wido commented Dec 20, 2015

Last code review is LGTM to me, but didn't have the time to test it yet. I think it works, but need to verify first.

@dmytro-shevchenko
Copy link
Contributor Author

Full snapshot path added into log messages.

@wido
Copy link
Contributor

wido commented Dec 24, 2015

ping @borisroman. I would like to see this one go in. Code-wise it looks good.

@wido
Copy link
Contributor

wido commented Dec 30, 2015

Tests seem good according to @borisroman Just looking into why the XenServer strategy had to be used. That should be all

@wido
Copy link
Contributor

wido commented Jan 5, 2016

Any other LGTMs?

@davidamorimcruz
Copy link

LGTM, but haven't had the chance to test it yet.

@remibergsma
Copy link
Contributor

Really wondering why you need to alter XenserverSnapshotStrategy.java for something to work on KVM, like @wido asked. Please give an answer on that one, thanks!

Also, could someone run the integration tests and post the results?

@rohityadavcloud
Copy link
Member

@dmytro-shevchenko can you rebase against latest master (with 4.9xx as the version) etc.

@dmytro-shevchenko
Copy link
Contributor Author

Done, rebased with 4.9xx master.

<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-storage-volume</artifactId>
<version>4.9.0-SNAPSHOT</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

this should read ${project.version} instead of 4.9.0-SNAPSHOT

Copy link
Contributor

Choose a reason for hiding this comment

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

@dmytro-shevchenko please address this for forward compatibility. Thanks...

@DaanHoogland
Copy link
Contributor

@dmytro-shevchenko you are changing XenserverSnapshotStrategy from the storage engine and KVMStorageProcessor from the kvm hypervisor plugin. It seems that you are solving this for two hypervisors half. Can you explain what you encountered in the code to come up with this solution?

@kiwiflyer
Copy link
Contributor

@DaanHoogland

So I've been digging into this a bit. I could be very wrong here, but it seems that XenserverSnapshotStrategy is a very inaccurate description of what this class is actually doing. It seems to be very general and based on some investigation being used for KVM as well. This might be an old artifact of the original feature being Xen specific, until others re-purposed it for other hypervisors.

Mike @mike-tutkowski mentioned something to this effect very recently in this PR: #1441

@andrijapanic-dont-use-this-one

I believe this is the reason Dmytro edit it, since it handles KVM stuff
also...

On 23 March 2016 at 14:40, Simon Weller notifications@github.com wrote:

@DaanHoogland https://github.com/DaanHoogland

So I've been digging into this a bit. I could be very wrong here, but it
seems that XenserverSnapshotStrategy is a very inaccurate description of
what this class is actually doing. It seems to be very general and based on
some investigation being used for KVM as well. This might be an old
artifact of the original feature being Xen specific, until others
re-purposed it for other hypervisors.

Mike @mike-tutkowski https://github.com/mike-tutkowski mentioned
something to this effect very recently in this PR: #1441
#1441


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1230 (comment)

Andrija Panić

@mike-tutkowski
Copy link
Member

Yes, @kiwiflyer, the naming XenserverSnapshotStrategy appears to be old and no longer accurate. I believe it should be renamed to something like DefaultSnapshotStrategy.

@wido
Copy link
Contributor

wido commented Apr 11, 2016

@mike-tutkowski @kiwiflyer So, it is just the class which has a incorrect name? The code is good?

@kiwiflyer
Copy link
Contributor

Lab testing of feature:

Cloudstack RBD snapshot job:

2016-04-11 11:26:22,955 DEBUG [c.c.a.t.Request](Work-Job-Executor-1:ctx-5ac9d6c8 job-121/job-122 ctx-e3c6a9f8) (logid:af23718c) Seq 1-1541075497490841731: Received: { Ans: , MgmtId: 52239507206, via: 1(njcloudhost.dev.ena.net), Ver: v1, Flags: 10, { CreateObjectAnswer } }
2016-04-11 11:26:23,025 DEBUG [o.a.c.s.m.AncientDataMotionStrategy](Work-Job-Executor-1:ctx-5ac9d6c8 job-121/job-122 ctx-e3c6a9f8) (logid:af23718c) copyAsync inspecting src type SNAPSHOT copyAsync inspecting dest type SNAPSHOT
2016-04-11 11:26:23,056 DEBUG [c.c.h.o.r.Ovm3HypervisorGuru](Work-Job-Executor-1:ctx-5ac9d6c8 job-121/job-122 ctx-e3c6a9f8) (logid:af23718c) getCommandHostDelegation: class org.apache.cloudstack.storage.command.CopyCommand
2016-04-11 11:26:23,056 DEBUG [c.c.h.XenServerGuru](Work-Job-Executor-1:ctx-5ac9d6c8 job-121/job-122 ctx-e3c6a9f8) (logid:af23718c) getCommandHostDelegation: class org.apache.cloudstack.storage.command.CopyCommand
2016-04-11 11:26:23,058 DEBUG [c.c.a.t.Request](Work-Job-Executor-1:ctx-5ac9d6c8 job-121/job-122 ctx-e3c6a9f8) (logid:af23718c) Seq 1-1541075497490841732: Sending { Cmd , MgmtId: 52239507206, via: 1(njcloudhost.dev.ena.net), Ver: v1, Flags: 100111, [{"org.apache.cloudstack.storage.command.CopyCommand":{"srcTO":{"org.apache.cloudstack.storage.to.SnapshotObjectTO":{"path":"rbdnjcloudhost/c656809e-ecec-47a0-875d-af297fb77fe3/938125ff-da6d-4355-b83a-e3aa8d941807","volume":{"uuid":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"f0dbafaa-52a3-3077-bc53-d7ad3a5ac132","id":4,"poolType":"RBD","host":"192.168.100.100","path":"rbdnjcloudhost","port":6789,"url":"RBD://192.168.100.100/rbdnjcloudhost/?ROLE=Primary&STOREUUID=f0dbafaa-52a3-3077-bc53-d7ad3a5ac132"}},"name":"ROOT-8","size":8589934592,"path":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeId":8,"vmName":"i-4-8-VM","accountId":4,"format":"RAW","provisioningType":"THIN","id":8,"deviceId":0,"hypervisorType":"KVM"},"dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"f0dbafaa-52a3-3077-bc53-d7ad3a5ac132","id":4,"poolType":"RBD","host":"192.168.100.100","path":"rbdnjcloudhost","port":6789,"url":"RBD://192.168.100.100/rbdnjcloudhost/?ROLE=Primary&STOREUUID=f0dbafaa-52a3-3077-bc53-d7ad3a5ac132"}},"vmName":"i-4-8-VM","name":"test","hypervisorType":"KVM","id":1,"quiescevm":false,"physicalSize":0}},"destTO":{"org.apache.cloudstack.storage.to.SnapshotObjectTO":{"path":"snapshots/4/8","volume":{"uuid":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"f0dbafaa-52a3-3077-bc53-d7ad3a5ac132","id":4,"poolType":"RBD","host":"192.168.100.100","path":"rbdnjcloudhost","port":6789,"url":"RBD://192.168.100.100/rbdnjcloudhost/?ROLE=Primary&STOREUUID=f0dbafaa-52a3-3077-bc53-d7ad3a5ac132"}},"name":"ROOT-8","size":8589934592,"path":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeId":8,"vmName":"i-4-8-VM","accountId":4,"format":"RAW","provisioningType":"THIN","id":8,"deviceId":0,"hypervisorType":"KVM"},"dataStore":{"com.cloud.agent.api.to.NfsTO":{"_url":"nfs://10.103.0.42/secondary","_role":"Image"}},"vmName":"i-4-8-VM","name":"test","hypervisorType":"KVM","id":1,"quiescevm":false,"physicalSize":0}},"executeInSequence":true,"options":{"fullSnapshot":"true"},"options2":{},"wait":21600}}] }

2016-04-11 11:27:41,178 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-1:ctx-80f166f9 job-121) (logid:af23718c) Done executing org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotCmd for job-121
2016-04-11 11:27:41,178 INFO [o.a.c.f.j.i.AsyncJobMonitor](API-Job-Executor-1:ctx-80f166f9 job-121) (logid:af23718c) Remove job-121 from job monitoring

Ceph Log show snapshot has been created:

rbd snap ls -p rbdnjcloudhost c656809e-ecec-47a0-875d-af297fb77fe3
SNAPID NAME SIZE
12 938125ff-da6d-4355-b83a-e3aa8d941807 8192 MB

Cloudstack delete RBD snashot job:

2016-04-11 11:34:03,679 DEBUG c.c.a.ApiServlet (logid:3f05f35f) ===START=== 10.16.0.38 -- GET command=deleteSnapshot&id=36e2eebe-8268-4c36-b21c-b2e57cb62974&response=json&=1460392443709
2016-04-11 11:34:03,730 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](catalina-exec-5:ctx-954c6978 ctx-02ab09fe) (logid:3f05f35f) submit async job-123, details: AsyncJobVO {id:123, userId: 2, accountId: 2, instanceType: Snapshot, instanceId: 1, cmd: org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd, cmdInfo: {"id":"36e2eebe-8268-4c36-b21c-b2e57cb62974","response":"json","ctxDetails":"{"interface com.cloud.storage.Snapshot":"36e2eebe-8268-4c36-b21c-b2e57cb62974"}","cmdEventType":"SNAPSHOT.DELETE","ctxUserId":"2","httpmethod":"GET","
":"1460392443709","uuid":"36e2eebe-8268-4c36-b21c-b2e57cb62974","ctxAccountId":"2","ctxStartEventId":"284"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 52239507206, completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
2016-04-11 11:34:03,731 DEBUG [c.c.a.ApiServlet](catalina-exec-5:ctx-954c6978 ctx-02ab09fe) (logid:3f05f35f) ===END=== 10.16.0.38 -- GET command=deleteSnapshot&id=36e2eebe-8268-4c36-b21c-b2e57cb62974&response=json&=1460392443709
2016-04-11 11:34:03,732 INFO [o.a.c.f.j.i.AsyncJobMonitor](API-Job-Executor-2:ctx-8c9478b9 job-123) (logid:5f0157a8) Add job-123 into job monitoring
2016-04-11 11:34:03,734 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123) (logid:b6ce6bc3) Executing AsyncJobVO {id:123, userId: 2, accountId: 2, instanceType: Snapshot, instanceId: 1, cmd: org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd, cmdInfo: {"id":"36e2eebe-8268-4c36-b21c-b2e57cb62974","response":"json","ctxDetails":"{"interface com.cloud.storage.Snapshot":"36e2eebe-8268-4c36-b21c-b2e57cb62974"}","cmdEventType":"SNAPSHOT.DELETE","ctxUserId":"2","httpmethod":"GET","
":"1460392443709","uuid":"36e2eebe-8268-4c36-b21c-b2e57cb62974","ctxAccountId":"2","ctxStartEventId":"284"}, cmdVersion: 0, status: IN_PROGRESS, processStatus: 0, resultCode: 0, result: null, initMsid: 52239507206, completeMsid: null, lastUpdated: null, lastPolled: null, created: null}
2016-04-11 11:34:03,758 DEBUG [o.a.c.s.s.XenserverSnapshotStrategy](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) delete snapshot chain for snapshot: 1
2016-04-11 11:34:03,759 DEBUG [o.a.c.s.s.XenserverSnapshotStrategy](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Snapshot: 1 doesn't have children, so it's ok to delete it and its parents
2016-04-11 11:34:03,770 DEBUG [c.c.h.o.r.Ovm3HypervisorGuru](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) getCommandHostDelegation: class org.apache.cloudstack.storage.command.DeleteCommand
2016-04-11 11:34:03,770 DEBUG [c.c.h.XenServerGuru](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) getCommandHostDelegation: class org.apache.cloudstack.storage.command.DeleteCommand
2016-04-11 11:34:03,772 DEBUG [c.c.a.t.Request](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Seq 3-826973481575907354: Sending { Cmd , MgmtId: 52239507206, via: 3(s-1-VM), Ver: v1, Flags: 100011, [{"org.apache.cloudstack.storage.command.DeleteCommand":{"data":{"org.apache.cloudstack.storage.to.SnapshotObjectTO":{"path":"snapshots/4/8/938125ff-da6d-4355-b83a-e3aa8d941807","volume":{"uuid":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"f0dbafaa-52a3-3077-bc53-d7ad3a5ac132","id":4,"poolType":"RBD","host":"192.168.100.100","path":"rbdnjcloudhost","port":6789,"url":"RBD://192.168.100.100/rbdnjcloudhost/?ROLE=Primary&STOREUUID=f0dbafaa-52a3-3077-bc53-d7ad3a5ac132"}},"name":"ROOT-8","size":8589934592,"path":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeId":8,"vmName":"i-4-8-VM","accountId":4,"format":"RAW","provisioningType":"THIN","id":8,"deviceId":0,"hypervisorType":"KVM"},"dataStore":{"com.cloud.agent.api.to.NfsTO":{"_url":"nfs://10.103.0.42/secondary","_role":"Image"}},"vmName":"i-4-8-VM","name":"test","hypervisorType":"KVM","id":1,"quiescevm":false,"physicalSize":0}},"wait":0}}] }
2016-04-11 11:34:04,438 DEBUG c.c.a.t.Request (logid:) Seq 3-826973481575907354: Processing: { Ans: , MgmtId: 52239507206, via: 3, Ver: v1, Flags: 10, [{"com.cloud.agent.api.Answer":{"result":true,"wait":0}}] }
2016-04-11 11:34:04,439 DEBUG [c.c.a.t.Request](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Seq 3-826973481575907354: Received: { Ans: , MgmtId: 52239507206, via: 3(s-1-VM), Ver: v1, Flags: 10, { Answer } }
2016-04-11 11:34:04,489 DEBUG [c.c.h.o.r.Ovm3HypervisorGuru](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) getCommandHostDelegation: class org.apache.cloudstack.storage.command.DeleteCommand
2016-04-11 11:34:04,489 DEBUG [c.c.h.XenServerGuru](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) getCommandHostDelegation: class org.apache.cloudstack.storage.command.DeleteCommand
2016-04-11 11:34:04,490 DEBUG [c.c.a.t.Request](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Seq 1-1541075497490841823: Sending { Cmd , MgmtId: 52239507206, via: 1(njcloudhost.dev.ena.net), Ver: v1, Flags: 100011, [{"org.apache.cloudstack.storage.command.DeleteCommand":{"data":{"org.apache.cloudstack.storage.to.SnapshotObjectTO":{"path":"rbdnjcloudhost/c656809e-ecec-47a0-875d-af297fb77fe3/938125ff-da6d-4355-b83a-e3aa8d941807","volume":{"uuid":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"f0dbafaa-52a3-3077-bc53-d7ad3a5ac132","id":4,"poolType":"RBD","host":"192.168.100.100","path":"rbdnjcloudhost","port":6789,"url":"RBD://192.168.100.100/rbdnjcloudhost/?ROLE=Primary&STOREUUID=f0dbafaa-52a3-3077-bc53-d7ad3a5ac132"}},"name":"ROOT-8","size":8589934592,"path":"c656809e-ecec-47a0-875d-af297fb77fe3","volumeId":8,"vmName":"i-4-8-VM","accountId":4,"format":"RAW","provisioningType":"THIN","id":8,"deviceId":0,"hypervisorType":"KVM"},"dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"f0dbafaa-52a3-3077-bc53-d7ad3a5ac132","id":4,"poolType":"RBD","host":"192.168.100.100","path":"rbdnjcloudhost","port":6789,"url":"RBD://192.168.100.100/rbdnjcloudhost/?ROLE=Primary&STOREUUID=f0dbafaa-52a3-3077-bc53-d7ad3a5ac132"}},"vmName":"i-4-8-VM","name":"test","hypervisorType":"KVM","id":1,"quiescevm":false,"physicalSize":0}},"wait":0}}] }
2016-04-11 11:34:04,853 DEBUG c.c.a.t.Request (logid:) Seq 1-1541075497490841823: Processing: { Ans: , MgmtId: 52239507206, via: 1, Ver: v1, Flags: 10, [{"com.cloud.agent.api.Answer":{"result":true,"details":"Snapshot c656809e-ecec-47a0-875d-af297fb77fe3@938125ff-da6d-4355-b83a-e3aa8d941807 removed successfully.","wait":0}}] }
2016-04-11 11:34:04,853 DEBUG [c.c.a.t.Request](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Seq 1-1541075497490841823: Received: { Ans: , MgmtId: 52239507206, via: 1(njcloudhost.dev.ena.net), Ver: v1, Flags: 10, { Answer } }
2016-04-11 11:34:04,894 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Complete async job-123, jobStatus: SUCCEEDED, resultCode: 0, result: org.apache.cloudstack.api.response.SuccessResponse/null/{"success":true}
2016-04-11 11:34:04,894 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Publish async job-123 complete on message bus
2016-04-11 11:34:04,895 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Wake up jobs related to job-123
2016-04-11 11:34:04,895 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Update db status for job-123
2016-04-11 11:34:04,895 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123 ctx-c230036e) (logid:b6ce6bc3) Wake up jobs joined with job-123 and disjoin all subjobs created from job- 123
2016-04-11 11:34:04,899 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl](API-Job-Executor-2:ctx-8c9478b9 job-123) (logid:b6ce6bc3) Done executing org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotCmd for job-123
2016-04-11 11:34:04,899 INFO [o.a.c.f.j.i.AsyncJobMonitor](API-Job-Executor-2:ctx-8c9478b9 job-123) (logid:b6ce6bc3) Remove job-123 from job monitoring

Ceph Log show snapshot has been deleted:

rbd snap ls -p rbdnjcloudhost c656809e-ecec-47a0-875d-af297fb77fe3

@kiwiflyer
Copy link
Contributor

LGTM based on hardware lab testing of feature on 4.8 branch with PR applied.

Wido,

As far as I can tell, the changes to XenserverSnapshotStrategy look to be valid for KVM.

@mike-tutkowski
Copy link
Member

@wido Yes, the name is no longer valid, but it should work just fine for KVM.

@mike-tutkowski
Copy link
Member

I'm not sure of the history for that particular file, but I believe it would be better named DefaultSnapshotStrategy.

Does anyone else have a better name?

If not, I can submit a PR for that on master.

@wido
Copy link
Contributor

wido commented Apr 11, 2016

Based on the tests I see above LGTM.

A new PR afterwards to rename seems good.

@kiwiflyer
Copy link
Contributor

@dmytro-shevchenko We have 2 LGTMs on this and it just needs a CI run. Could you make the change @DaanHoogland requested above regarding the pom.xml and also rebase as there is a conflict?

Thanks!

Snapshot removing implemented on RBD.
1. On management side: when created new shanpshot we checking if our primary storage is RBD,
then do not remove record from cloud.snapshot_store_ref with link to Ceph
image via 'install_path' field.
2. On management side: when removing snapshot, also send command to agent 'DeleteCommand'.
3. On agent side: method implemented 'public Answer deleteSnapshot(final DeleteCommand cmd)'
@dmytro-shevchenko
Copy link
Contributor Author

Rebase with Master done, pom.xml file updated.
Also I perform a small modification in code, during testing I found one issue: in 'snapshot_store_ref' table all snapshots from one volume was linked between each other as Parent->Child using field 'parent_snapshot_id'. If you removing one of previous snapshot and wait for 'storage.cleanup.interval' period, it lead to NullPointerException when you creating new snapshot, because Cloudstack trying to build all this snapshot relations before. Before this patch this field was always set to '0' (no parent). From Cloudstack point of view all snapshots on Ceph not connected (Ceph care about this on his own level).
So, in file engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java:
I moved this block:
SnapshotDataStoreVO snapshotDataStoreVO = snapshotStoreDao.findByStoreSnapshot(primaryStore.getRole(), primaryStore.getId(), snapshot.getId()); if (snapshotDataStoreVO != null) { snapshotDataStoreVO.setParentSnapshotId(0L); snapshotStoreDao.update(snapshotDataStoreVO.getId(), snapshotDataStoreVO); }
from the condition: ...primaryStore).getPoolType() != StoragePoolType.RBD
and it will be executed in any way, as previously. Please review this part of code, if this is good solution.

@wido
Copy link
Contributor

wido commented Apr 26, 2016

With these changes I think we are good?

@kiwiflyer
Copy link
Contributor

I'm building this now and I'll give it a final manual test. Then we'll do a CI run against a hardware lab.

@swill
Copy link
Contributor

swill commented Apr 27, 2016

@kiwiflyer Thank you sir. :)

@kiwiflyer
Copy link
Contributor

Manual testing against a 4.8 hardware lab with Ceph Primary Storage.

2 volume snapshots triggered:
rbd snap ls -p rbdnjcloudhost cabf9a9e-7ac3-44b5-a3bb-02b820bed376
SNAPID NAME SIZE
70 6efbba74-372c-4bd7-95bb-e539524e7209 5120 MB
71 de6acd1b-ccac-4d3f-80aa-b40b05b86a63 5120 MB

both snapshots are deleted
rbd snap ls -p rbdnjcloudhost cabf9a9e-7ac3-44b5-a3bb-02b820bed376
(no results as expected)

Works as expected. Functional tests are good.

@rohityadavcloud
Copy link
Member

tag:mergeready

@swill
Copy link
Contributor

swill commented May 2, 2016

@kiwiflyer thank you. I will merge this today...

@asfgit asfgit merged commit 10ae2af into apache:master May 4, 2016
asfgit pushed a commit that referenced this pull request May 4, 2016
CLOUDSTACK-8302: Removing snapshots on RBDSnapshot removing implemented if primary datastore is RBD
https://issues.apache.org/jira/browse/CLOUDSTACK-8302

* pr/1230:
  CLOUDSTACK-8302 - Cleanup snapshot on KVM with RBD Snapshot removing implemented on RBD. 1. On management side: when created new shanpshot we checking if our primary storage is RBD, then do not remove record from cloud.snapshot_store_ref with link to Ceph image via 'install_path' field. 2. On management side: when removing snapshot, also send command to agent 'DeleteCommand'. 3. On agent side: method implemented 'public Answer deleteSnapshot(final DeleteCommand cmd)'

Signed-off-by: Will Stevens <williamstevens@gmail.com>
aaronhurt pushed a commit to myENA/cloudstack that referenced this pull request Jun 17, 2016
….mail@gmail.com>

Cleanup snapshot on KVM with RBD Snapshot removing implemented on RBD.

1. On management side: when created new shanpshot we checking if our primary storage is RBD, then do not remove record from cloud.snapshot_store_ref with link to Ceph image via 'install_path' field.
2. On management side: when removing snapshot, also send command to agent 'DeleteCommand'.
3. On agent side: method implemented 'public Answer deleteSnapshot(final DeleteCommand cmd)'
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.

None yet