Github user wido commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1230#discussion_r48005662 --- Diff: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java --- @@ -1274,7 +1274,45 @@ public Answer createVolumeFromSnapshot(final CopyCommand cmd) { @Override public Answer deleteSnapshot(final DeleteCommand cmd) { - return new Answer(cmd); + try { + SnapshotObjectTO snapshotTO = (SnapshotObjectTO) cmd.getData(); + PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO) snapshotTO.getDataStore(); + VolumeObjectTO volume = snapshotTO.getVolume(); + String snapshotFullPath = snapshotTO.getPath(); + String snapshotName = snapshotFullPath.substring(snapshotFullPath.lastIndexOf("/") + 1); + KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(primaryStore.getPoolType(), primaryStore.getUuid()); + KVMPhysicalDisk disk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), volume.getPath()); + if (primaryPool.getType() == StoragePoolType.RBD) { + Rados r = new Rados(primaryPool.getAuthUserName()); + r.confSet("mon_host", primaryPool.getSourceHost() + ":" + primaryPool.getSourcePort()); + r.confSet("key", primaryPool.getAuthSecret()); + r.confSet("client_mount_timeout", "30"); + r.connect(); + s_logger.debug("Succesfully connected to Ceph cluster at " + r.confGet("mon_host")); + IoCTX io = r.ioCtxCreate(primaryPool.getSourceDir()); + Rbd rbd = new Rbd(io); + RbdImage image = rbd.open(disk.getName()); + try { + s_logger.info("Attempting to remove RBD snapshot " + disk.getName() + "@" + snapshotName); + if (image.snapIsProtected(snapshotName)) { + s_logger.debug("Unprotecting snapshot " + snapshotFullPath); + image.snapUnprotect(snapshotName); + } + image.snapRemove(snapshotName); + s_logger.info("Snapshot " + snapshotFullPath + " successfully removed."); + } finally { + rbd.close(image); + r.ioCtxDestroy(io); + } + } else { + s_logger.warn("Operation not implemented!"); + throw new InternalErrorException("Operation not implemented!"); --- End diff -- 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
--- 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. ---