On 05.02.2016 19:23, Olga Krishtal wrote:
In order to support ploop in storage pools we need separate
volume type: VIR_STORAGE_VOL_PLOOP
Signed-off-by: Olga Krishtal <okrishtal(a)virtuozzo.com>
---
include/libvirt/libvirt-storage.h | 2 +-
src/conf/storage_conf.c | 2 +-
src/storage/storage_backend_fs.c | 3 +++
tools/virsh-volume.c | 3 ++-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h
index 1a868cc..b1e6ba5 100644
--- a/include/libvirt/libvirt-storage.h
+++ b/include/libvirt/libvirt-storage.h
@@ -122,7 +122,7 @@ typedef enum {
VIR_STORAGE_VOL_NETWORK = 3, /* Network volumes like RBD (RADOS Block Device) */
VIR_STORAGE_VOL_NETDIR = 4, /* Network accessible directory that can
* contain other network volumes */
-
+ VIR_STORAGE_VOL_PLOOP = 5, /* Ploop based volumes */
# ifdef VIR_ENUM_SENTINELS
VIR_STORAGE_VOL_LAST
# endif
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3657dfd..01b52a4 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -52,7 +52,7 @@ VIR_LOG_INIT("conf.storage_conf");
VIR_ENUM_IMPL(virStorageVol,
VIR_STORAGE_VOL_LAST,
- "file", "block", "dir", "network",
"netdir")
+ "file", "block", "dir", "network",
"netdir", "ploop")
VIR_ENUM_IMPL(virStoragePool,
VIR_STORAGE_POOL_LAST,
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 692c9ff..525e45c 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1085,6 +1085,8 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn
ATTRIBUTE_UNUSED,
if (vol->target.format == VIR_STORAGE_FILE_DIR)
vol->type = VIR_STORAGE_VOL_DIR;
+ if (vol->target.format == VIR_STORAGE_FILE_PLOOP)
+ vol->type = VIR_STORAGE_VOL_PLOOP;
else
vol->type = VIR_STORAGE_VOL_FILE;
change your "if" to
"else if"
Under first "if" we set vol->type = VIR_STORAGE_VOL_DIR;
and the last "else" rewrites vol->type to VIR_STORAGE_VOL_PLOOP
@@ -1243,6 +1245,7 @@ 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 */
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 35f0cbd..1f4b6b6 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -956,7 +956,8 @@ VIR_ENUM_IMPL(virshStorageVol,
N_("block"),
N_("dir"),
N_("network"),
- N_("netdir"))
+ N_("netdir"),
+ N_("ploop"))
static const char *
virshVolumeTypeToString(int type)