Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-643

KVM snapshots deleted on UI/API do not physically delete from secondary storage

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 4.0.0, 4.1.0, 4.2.0
    • 4.2.0
    • KVM, Snapshot
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Description

      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) {
      }
      }

      Attachments

        Activity

          People

            kishan Kishan
            tsp Prasanna
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: