You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Kishan Kavala (JIRA)" <ji...@apache.org> on 2013/07/17 09:04:48 UTC

[jira] [Resolved] (CLOUDSTACK-643) KVM snapshots deleted on UI/API do not physically delete from secondary storage

     [ https://issues.apache.org/jira/browse/CLOUDSTACK-643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kishan Kavala resolved CLOUDSTACK-643.
--------------------------------------

    Resolution: Fixed

KVM snapshot creation and deletion is working fine with latest 4.2.

2013-07-17 06:26:53,049 DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:) Request:Seq 4-307953677:  { Cmd , MgmtId: 101318455136477, via: 4, Ver: v1, Flags: 100011, [{"org.apache.cloudstack.storage.command.DeleteCommand":{"data":{"org.apache.cloudstack.storage.to.SnapshotObjectTO":{"path":"snapshots/2/33/521e6773-7e1e-40e2-9d6b-c4f08ac14430","volume":{"uuid":"a91559b9-e64a-47fa-83a1-79b5b64ebe56","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"c81a7053-7722-3341-bdaf-9bc53062b75d","id":3,"poolType":"NetworkFilesystem","host":"10.147.28.7","path":"/export/home/kishan/primary30","port":2049}},"name":"ROOT-34","size":143360,"path":"68cd2d1a-d071-4804-9d05-22f38401c55e","volumeId":33,"vmName":"i-2-34-VM","accountId":2,"format":"QCOW2","id":33},"dataStore":{"com.cloud.agent.api.to.NfsTO":{"_url":"nfs://10.147.28.7/export/home/kishan/secondary","_role":"Image"}},"vmName":"i-2-34-VM","name":"2431b8ef-d9c6-4225-b5f4-621e80a2bbf0_ROOT-34_20130717053811","hypervisorType":"KVM","id":8}},"wait":0}}] }
2013-07-17 06:26:53,057 DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:) Processing command: org.apache.cloudstack.storage.command.DeleteCommand
2013-07-17 06:26:53,505 DEBUG [cloud.agent.Agent] (agentRequest-Handler-1:) Seq 4-307953677:  { Ans: , MgmtId: 101318455136477, via: 4, Ver: v1, Flags: 10, [{"com.cloud.agent.api.Answer":{"result":true,"wait":0}}] }


                
> KVM snapshots deleted on UI/API do not physically delete from secondary storage
> -------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-643
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-643
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: KVM, Snapshot
>    Affects Versions: 4.0.0, 4.1.0, 4.2.0
>            Reporter: Prasanna Santhanam
>            Assignee: Kishan Kavala
>            Priority: Blocker
>             Fix For: 4.2.0
>
>
> Snapshots taken on KVM do not delete on secondary storage even after deleting them on the API/UI. 
> The cmd.getSnapshotUuid() in case of KVM is the complete path to the qcow2 image on secondary storage.  But the following concatenation evaluates to an invalid path and subsequent "rm -f" fails quietly returning Answer(success) back to management server.
> ""
> String lPath = parent + "/snapshots/" + String.valueOf(accountId) + "/" + String.valueOf(volumeId) + "/" + filename;
> ""
> On NfsSecondaryStorageResource.java:
> protected Answer execute(final DeleteSnapshotBackupCommand cmd) {
>         String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
>         Long accountId = cmd.getAccountId();
>         Long volumeId = cmd.getVolumeId();
>         String name = cmd.getSnapshotUuid();
>         try {
>             if (swift == null) {
>                 String parent = getRootDir(secondaryStorageUrl);
>                 String filename;
>                 if (cmd.isAll()) {
>                     filename = "*";
>                 } else {
>                     filename = "*" + name + "*";
>                 }
>                 String lPath = parent + "/snapshots/" + String.valueOf(accountId) + "/" + String.valueOf(volumeId) + "/" + filename;
>                 String result = deleteLocalFile(lPath);
>                 if (result != null) {
>                     String errMsg = "failed to delete snapshot " + lPath + " , err=" + result;
>                     s_logger.warn(errMsg);
>                     return new Answer(cmd, false, errMsg);
>                 }
>             } else {
>                     #### SNIP ####
>              }
>             return new Answer(cmd, true, "success");
>         } catch (Exception e) {
>         }
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira