From c27fda8374562a9b6061e18f8c9ba78ae9df2c08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Fri, 12 Jul 2019 16:13:17 +0200
Subject: [PATCH] Revert "conf: Remove volOptions for VIR_STORAGE_POOL_RBD"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 035db37394ad11a39d47f8bd2b6a8a2734283cbf

Even though we only allow using RBD with raw volumes,
removing the options and the default format causes our
parser not to fill out the volume format and the backend code
rejects creating a non-raw volume.

Re-introduce the volume options to fix volume creation while
erroring out on requests to use non-raw formats.

https://bugzilla.redhat.com/show_bug.cgi?id=1724065

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry-picked from commit 5d74619329a2063efc8028536b3f8acc8e949f88)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
 src/conf/storage_conf.c                           | 5 +++++
 tests/storagepoolcapsschemadata/poolcaps-fs.xml   | 5 +++++
 tests/storagepoolcapsschemadata/poolcaps-full.xml | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 397bd66..05055cd 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -241,6 +241,11 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
                    VIR_STORAGE_POOL_SOURCE_NETWORK |
                    VIR_STORAGE_POOL_SOURCE_NAME),
       },
+      .volOptions = {
+          .defaultFormat = VIR_STORAGE_FILE_RAW,
+          .formatFromString = virStorageVolumeFormatFromString,
+          .formatToString = virStorageFileFormatTypeToString,
+      }
     },
     {.poolType = VIR_STORAGE_POOL_SHEEPDOG,
      .poolOptions = {
diff --git a/tests/storagepoolcapsschemadata/poolcaps-fs.xml b/tests/storagepoolcapsschemadata/poolcaps-fs.xml
index 6513ea6..182fa39 100644
--- a/tests/storagepoolcapsschemadata/poolcaps-fs.xml
+++ b/tests/storagepoolcapsschemadata/poolcaps-fs.xml
@@ -145,6 +145,11 @@
   <pool type='mpath' supported='no'>
   </pool>
   <pool type='rbd' supported='no'>
+    <volOptions>
+      <defaultFormat type='raw'/>
+      <enum name='targetFormatType'>
+      </enum>
+    </volOptions>
   </pool>
   <pool type='sheepdog' supported='no'>
   </pool>
diff --git a/tests/storagepoolcapsschemadata/poolcaps-full.xml b/tests/storagepoolcapsschemadata/poolcaps-full.xml
index 32003dd..980c6d2 100644
--- a/tests/storagepoolcapsschemadata/poolcaps-full.xml
+++ b/tests/storagepoolcapsschemadata/poolcaps-full.xml
@@ -145,6 +145,11 @@
   <pool type='mpath' supported='yes'>
   </pool>
   <pool type='rbd' supported='yes'>
+    <volOptions>
+      <defaultFormat type='raw'/>
+      <enum name='targetFormatType'>
+      </enum>
+    </volOptions>
   </pool>
   <pool type='sheepdog' supported='yes'>
   </pool>
-- 
2.19.1

