Re: [libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
On Mon, Apr 11, 2016 at 07:16:21PM +0300, Olga Krishtal wrote: > Recursively deletes whole directory of a ploop volume. > To delete ploop image it has to be unmounted. > > Signed-off-by: Olga Krishtal> --- > src/storage/storage_backend_fs.c | 3 +++ > 1 file changed, 3 insertions(+) > ACK Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
On Mon, Apr 11, 2016 at 07:16:21PM +0300, Olga Krishtal wrote: > Recursively deletes whole directory of a ploop volume. > To delete ploop image it has to be unmounted. > > Signed-off-by: Olga Krishtal> --- > src/storage/storage_backend_fs.c | 3 +++ > 1 file changed, 3 insertions(+) > ACK > diff --git a/src/storage/storage_backend_fs.c > b/src/storage/storage_backend_fs.c > index 8517b26..77c94c9 100644 > --- a/src/storage/storage_backend_fs.c > +++ b/src/storage/storage_backend_fs.c > @@ -1264,6 +1264,9 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn > ATTRIBUTE_UNUSED, > } > break; > case VIR_STORAGE_VOL_PLOOP: > +if (virFileDeleteTree(vol->target.path) < 0) > +return -1; The indentation is off here. Jan > +break; > case VIR_STORAGE_VOL_BLOCK: > case VIR_STORAGE_VOL_NETWORK: > case VIR_STORAGE_VOL_NETDIR: > -- > 1.8.3.1 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
Recursively deletes whole directory of a ploop volume. To delete ploop image it has to be unmounted. Signed-off-by: Olga Krishtal--- src/storage/storage_backend_fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 8517b26..77c94c9 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1264,6 +1264,9 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, } break; case VIR_STORAGE_VOL_PLOOP: +if (virFileDeleteTree(vol->target.path) < 0) +return -1; +break; case VIR_STORAGE_VOL_BLOCK: case VIR_STORAGE_VOL_NETWORK: case VIR_STORAGE_VOL_NETDIR: -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
Recursively deletes whole directory of a ploop volume. To delete ploop image it has to be unmounted. Signed-off-by: Olga Krishtal--- src/storage/storage_backend_fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 8517b26..77c94c9 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1264,6 +1264,9 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, } break; case VIR_STORAGE_VOL_PLOOP: +if (virFileDeleteTree(vol->target.path) < 0) +return -1; +break; case VIR_STORAGE_VOL_BLOCK: case VIR_STORAGE_VOL_NETWORK: case VIR_STORAGE_VOL_NETDIR: -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
08.02.2016 16:04, Olga Krishtal пишет: Deletes whole directory of a ploop volume. To delete ploop image it has to be unmounted. Signed-off-by: Olga Krishtal--- src/storage/storage_backend.c| 6 ++ src/storage/storage_backend.h| 2 ++ src/storage/storage_backend_fs.c | 5 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 6bd4618..be57630 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -861,6 +861,12 @@ int virStorageBackendCreatePloop(virConnectPtr conn ATTRIBUTE_UNUSED, return ret; } +int virStorageBackendDeletePloop(virConnectPtr conn ATTRIBUTE_UNUSED, + virStorageVolDefPtr vol) +{ +return virFileDeleteTree(vol->target.path); +} + enum { QEMU_IMG_BACKING_FORMAT_NONE = 0, QEMU_IMG_BACKING_FORMAT_FLAG, diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 852d6ed..7d354c5 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -115,6 +115,8 @@ int virStorageBackendCreatePloop(virConnectPtr conn, virStorageVolDefPtr inputvol, unsigned int flags); +int virStorageBackendDeletePloop(virConnectPtr conn, + virStorageVolDefPtr vol); virStorageBackendBuildVolFrom virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol, diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 56f6ef7..0df1880 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1247,7 +1247,6 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, switch ((virStorageVolType) vol->type) { case VIR_STORAGE_VOL_FILE: case VIR_STORAGE_VOL_DIR: -case VIR_STORAGE_VOL_PLOOP: This chunk is unnecessary if you remove related one from patch #1 if (virFileRemove(vol->target.path, vol->target.perms->uid, vol->target.perms->gid) < 0) { /* Silently ignore failures where the vol has already gone away */ @@ -1264,6 +1263,10 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, } } break; +case VIR_STORAGE_VOL_PLOOP: +if (virStorageBackendDeletePloop(conn, vol) < 0) +return -1; +break; case VIR_STORAGE_VOL_BLOCK: case VIR_STORAGE_VOL_NETWORK: case VIR_STORAGE_VOL_NETDIR: -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
On 05.02.2016 19:23, Olga Krishtal wrote: Deletes whole directory of a ploop volume. To delete ploop image it has to be unmounted. Signed-off-by: Olga Krishtal--- src/storage/storage_backend.c| 6 ++ src/storage/storage_backend.h| 2 ++ src/storage/storage_backend_fs.c | 5 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 96bd3fc..1b4ffbc 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -861,6 +861,12 @@ int virStorageBackendCreatePloop(virConnectPtr conn ATTRIBUTE_UNUSED, return ret; } +int virStorageBackendDeletePloop(virConnectPtr conn ATTRIBUTE_UNUSED, + virStorageVolDefPtr vol) +{ +return virFileDeleteTree(vol->target.path); +} + enum { QEMU_IMG_BACKING_FORMAT_NONE = 0, QEMU_IMG_BACKING_FORMAT_FLAG, diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 852d6ed..7d354c5 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -115,6 +115,8 @@ int virStorageBackendCreatePloop(virConnectPtr conn, virStorageVolDefPtr inputvol, unsigned int flags); +int virStorageBackendDeletePloop(virConnectPtr conn, + virStorageVolDefPtr vol); virStorageBackendBuildVolFrom virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol, diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 3487545..9926a6e 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1247,7 +1247,6 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, switch ((virStorageVolType) vol->type) { case VIR_STORAGE_VOL_FILE: case VIR_STORAGE_VOL_DIR: -case VIR_STORAGE_VOL_PLOOP: if (virFileRemove(vol->target.path, vol->target.perms->uid, vol->target.perms->gid) < 0) { /* Silently ignore failures where the vol has already gone away */ @@ -1264,6 +1263,10 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, } } break; +case VIR_STORAGE_VOL_PLOOP: +if (virStorageBackendDeletePloop(conn, vol) != 0) check ret code like < 0 +return -1; +break; case VIR_STORAGE_VOL_BLOCK: case VIR_STORAGE_VOL_NETWORK: case VIR_STORAGE_VOL_NETDIR: -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
Deletes whole directory of a ploop volume. To delete ploop image it has to be unmounted. Signed-off-by: Olga Krishtal--- src/storage/storage_backend.c| 6 ++ src/storage/storage_backend.h| 2 ++ src/storage/storage_backend_fs.c | 5 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 6bd4618..be57630 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -861,6 +861,12 @@ int virStorageBackendCreatePloop(virConnectPtr conn ATTRIBUTE_UNUSED, return ret; } +int virStorageBackendDeletePloop(virConnectPtr conn ATTRIBUTE_UNUSED, + virStorageVolDefPtr vol) +{ +return virFileDeleteTree(vol->target.path); +} + enum { QEMU_IMG_BACKING_FORMAT_NONE = 0, QEMU_IMG_BACKING_FORMAT_FLAG, diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 852d6ed..7d354c5 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -115,6 +115,8 @@ int virStorageBackendCreatePloop(virConnectPtr conn, virStorageVolDefPtr inputvol, unsigned int flags); +int virStorageBackendDeletePloop(virConnectPtr conn, + virStorageVolDefPtr vol); virStorageBackendBuildVolFrom virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol, diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 56f6ef7..0df1880 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1247,7 +1247,6 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, switch ((virStorageVolType) vol->type) { case VIR_STORAGE_VOL_FILE: case VIR_STORAGE_VOL_DIR: -case VIR_STORAGE_VOL_PLOOP: if (virFileRemove(vol->target.path, vol->target.perms->uid, vol->target.perms->gid) < 0) { /* Silently ignore failures where the vol has already gone away */ @@ -1264,6 +1263,10 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, } } break; +case VIR_STORAGE_VOL_PLOOP: +if (virStorageBackendDeletePloop(conn, vol) < 0) +return -1; +break; case VIR_STORAGE_VOL_BLOCK: case VIR_STORAGE_VOL_NETWORK: case VIR_STORAGE_VOL_NETDIR: -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/7] storage:dir: .deleteVol callback for ploop volume
Deletes whole directory of a ploop volume. To delete ploop image it has to be unmounted. Signed-off-by: Olga Krishtal--- src/storage/storage_backend.c| 6 ++ src/storage/storage_backend.h| 2 ++ src/storage/storage_backend_fs.c | 5 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 96bd3fc..1b4ffbc 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -861,6 +861,12 @@ int virStorageBackendCreatePloop(virConnectPtr conn ATTRIBUTE_UNUSED, return ret; } +int virStorageBackendDeletePloop(virConnectPtr conn ATTRIBUTE_UNUSED, + virStorageVolDefPtr vol) +{ +return virFileDeleteTree(vol->target.path); +} + enum { QEMU_IMG_BACKING_FORMAT_NONE = 0, QEMU_IMG_BACKING_FORMAT_FLAG, diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 852d6ed..7d354c5 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -115,6 +115,8 @@ int virStorageBackendCreatePloop(virConnectPtr conn, virStorageVolDefPtr inputvol, unsigned int flags); +int virStorageBackendDeletePloop(virConnectPtr conn, + virStorageVolDefPtr vol); virStorageBackendBuildVolFrom virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol, diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 3487545..9926a6e 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -1247,7 +1247,6 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, switch ((virStorageVolType) vol->type) { case VIR_STORAGE_VOL_FILE: case VIR_STORAGE_VOL_DIR: -case VIR_STORAGE_VOL_PLOOP: if (virFileRemove(vol->target.path, vol->target.perms->uid, vol->target.perms->gid) < 0) { /* Silently ignore failures where the vol has already gone away */ @@ -1264,6 +1263,10 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED, } } break; +case VIR_STORAGE_VOL_PLOOP: +if (virStorageBackendDeletePloop(conn, vol) != 0) +return -1; +break; case VIR_STORAGE_VOL_BLOCK: case VIR_STORAGE_VOL_NETWORK: case VIR_STORAGE_VOL_NETDIR: -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list