Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53A601884F for ; Sun, 20 Dec 2015 09:48:47 +0000 (UTC) Received: (qmail 86082 invoked by uid 500); 20 Dec 2015 09:48:47 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 85967 invoked by uid 500); 20 Dec 2015 09:48:47 -0000 Mailing-List: contact issues-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list issues@cloudstack.apache.org Received: (qmail 85951 invoked by uid 500); 20 Dec 2015 09:48:47 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 85948 invoked by uid 99); 20 Dec 2015 09:48:47 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Dec 2015 09:48:47 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id DE0942C1F68 for ; Sun, 20 Dec 2015 09:48:46 +0000 (UTC) Date: Sun, 20 Dec 2015 09:48:46 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8302) Cleanup snapshot on KVM with RBD MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-8302?page=3Dcom.atla= ssian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId= =3D15065687#comment-15065687 ]=20 ASF GitHub Bot commented on CLOUDSTACK-8302: -------------------------------------------- Github user wido commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1230#discussion_r48101631 =20 --- Diff: plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/= KVMStorageProcessor.java --- @@ -1274,7 +1274,46 @@ public Answer createVolumeFromSnapshot(final Cop= yCommand cmd) { =20 @Override public Answer deleteSnapshot(final DeleteCommand cmd) { - return new Answer(cmd); + try { + SnapshotObjectTO snapshotTO =3D (SnapshotObjectTO) cmd.get= Data(); + PrimaryDataStoreTO primaryStore =3D (PrimaryDataStoreTO) s= napshotTO.getDataStore(); + VolumeObjectTO volume =3D snapshotTO.getVolume(); + String snapshotFullPath =3D snapshotTO.getPath(); + String snapshotName =3D snapshotFullPath.substring(snapsho= tFullPath.lastIndexOf("/") + 1); + KVMStoragePool primaryPool =3D storagePoolMgr.getStoragePo= ol(primaryStore.getPoolType(), primaryStore.getUuid()); + KVMPhysicalDisk disk =3D storagePoolMgr.getPhysicalDisk(pr= imaryStore.getPoolType(), primaryStore.getUuid(), volume.getPath()); + if (primaryPool.getType() =3D=3D StoragePoolType.RBD) { + Rados r =3D 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 =3D r.ioCtxCreate(primaryPool.getSourceDir())= ; + Rbd rbd =3D new Rbd(io); + RbdImage image =3D rbd.open(disk.getName()); + try { + s_logger.info("Attempting to remove RBD snapshot "= + disk.getName() + "@" + snapshotName); + if (image.snapIsProtected(snapshotName)) { + s_logger.debug("Unprotecting RBD snapshot " + = snapshotFullPath); + image.snapUnprotect(snapshotName); + } + image.snapRemove(snapshotName); + s_logger.info("Snapshot " + snapshotFullPath + " s= uccessfully removed from " + + primaryPool.getType().toString() + " pool= ."); + } finally { + rbd.close(image); + r.ioCtxDestroy(io); + } + } else { + s_logger.warn("Operation not implemented for storage p= ool type of " + primaryPool.getType().toString()); + throw new InternalErrorException("Operation not implem= ented for storage pool type of " + primaryPool.getType().toString()); + } + return new Answer(cmd, true, "Snapshot removed successfull= y."); + } catch (Exception e) { + s_logger.error(e.getMessage()); + return new Answer(cmd, false, "Failed to remove snapshot!"= ); --- End diff -- =20 Same here. Tell which snapshot couldn't be removed > Cleanup snapshot on KVM with RBD > -------------------------------- > > Key: CLOUDSTACK-8302 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-830= 2 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the defa= ult.)=20 > Components: KVM, Snapshot, Storage Controller > Affects Versions: 4.4.0, 4.4.1, 4.4.2 > Environment: CloudStack 4.4.2 + KVM on CentOS 6.6 + Ceph/RBD 0.80= .8 > Reporter: Star Guo > Assignee: Wido den Hollander > Priority: Critical > > I just build a lab with CloudStack 4.4.2 + CentOS 6.6 KVM + Ceph/RBD 0.80= .8. > I deploy an instance on RBD and I create the ROOT volume snapshots. When = delete a snapshot the UI show OK, but the snapshot of the volume in the RBD= pool is still exist. > And I find the code in com/cloud/hypervisor/kvm/storage/KVMStorageProcess= or.java:=20 > =E2=80=A6 > @Override > public Answer deleteSnapshot(DeleteCommand cmd) { > return new Answer(cmd); > } > =E2=80=A6 > deleteSnapshot() does not be implememented. And I also find the code: > ... > @Override > public Answer createTemplateFromSnapshot(CopyCommand cmd) { > return null; //To change body of implemented methods use File | = Settings | File Templates. > } > ... > So does createTenokateFromSnapshot(). I just look for it in MASTER branch= but not do that yet. Will CloudStack Dev Team plan to do that ? Thanks . -- This message was sent by Atlassian JIRA (v6.3.4#6332)