[libvirt] [PATCH 0/4] Blind rbd driver fixes

Sadly I haven't had the time to get a working RBD setup but I believe these patches should fix some recently introduced bugs https://bugzilla.redhat.com/show_bug.cgi?id=1724065 https://bugzilla.redhat.com/show_bug.cgi?id=1729292 If you can test them, please do. Ján Tomko (4): storage: rbd: use VIR_REALLOC in the loop storage: rbd: actually index the array when iterating over it Revert "conf: Remove volOptions for VIR_STORAGE_POOL_RBD" docs: RBD pool only supports raw volumes docs/storage.html.in | 2 +- src/conf/storage_conf.c | 5 +++++ src/storage/storage_backend_rbd.c | 4 ++-- tests/storagepoolcapsschemadata/poolcaps-fs.xml | 5 +++++ tests/storagepoolcapsschemadata/poolcaps-full.xml | 5 +++++ 5 files changed, 18 insertions(+), 3 deletions(-) -- 2.20.1

If there are more than 16 images, the memory allocated in images might be leaked on subsequent execution(s). Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/storage/storage_backend_rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 315bef2fee..d3056287df 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -620,7 +620,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr) size_t i; while (true) { - if (VIR_ALLOC_N(images, nimages) < 0) + if (VIR_REALLOC_N(images, nimages) < 0) goto error; rc = rbd_list2(ptr->ioctx, images, &nimages); -- 2.20.1

On Fri, Jul 12, 2019 at 04:26:05PM +0200, Ján Tomko wrote:
If there are more than 16 images, the memory allocated in images might be leaked on subsequent execution(s).
Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/storage/storage_backend_rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

https://bugzilla.redhat.com/show_bug.cgi?id=1729292 Fixes: 3aa190f2a43a632b542a6ba751a6c3ab4d51f1dd Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/storage/storage_backend_rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index d3056287df..1cb447c55a 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -637,7 +637,7 @@ virStorageBackendRBDGetVolNames(virStorageBackendRBDStatePtr ptr) nnames = nimages; for (i = 0; i < nimages; i++) - VIR_STEAL_PTR(names[i], images->name); + VIR_STEAL_PTR(names[i], images[i]->name); return names; -- 2.20.1

On Fri, Jul 12, 2019 at 04:26:06PM +0200, Ján Tomko wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1729292
Fixes: 3aa190f2a43a632b542a6ba751a6c3ab4d51f1dd Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/storage/storage_backend_rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

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> --- 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 397bd66870..05055cdc29 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 6513ea621a..182fa398f5 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 32003dd608..980c6d210e 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.20.1

On Fri, Jul 12, 2019 at 04:26:07PM +0200, Ján Tomko wrote:
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> --- src/conf/storage_conf.c | 5 +++++ tests/storagepoolcapsschemadata/poolcaps-fs.xml | 5 +++++ tests/storagepoolcapsschemadata/poolcaps-full.xml | 5 +++++ 3 files changed, 15 insertions(+)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/storage.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/storage.html.in b/docs/storage.html.in index d242de7b93..e0e4edec1e 100644 --- a/docs/storage.html.in +++ b/docs/storage.html.in @@ -608,7 +608,7 @@ <h3>Valid volume format types</h3> <p> - The RBD pool does not use the volume format type element. + Only raw volumes are supported. </p> <h2><a id="StorageBackendSheepdog">Sheepdog pool</a></h2> -- 2.20.1

On Fri, Jul 12, 2019 at 04:26:08PM +0200, Ján Tomko wrote:
Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/storage.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé
-
Ján Tomko