[Libguestfs] [v2v PATCH] output_openstack: work around non-blocking bug in openstack CLI

Laszlo Ersek lersek at redhat.com
Wed Apr 13 07:05:34 UTC 2022


The openstack output module currently passes the "--non-bootable" and
"--read-write" options to the "openstack volume create" command. There is
a bug in the "openstack" utility however (that is, in the
python-openstackclient project @ dabaec5a7b1b) where it assumes that the
image creation API blocks, and as soon as it completes, the readonly and
bootable flags can be tweaked with the APIs that exist for those purposes.

The image creation API does not block however, and when the "openstack"
command line utility tries to set the readonly & bootable flags, those
APIs fail because image creation is still in progress. This results in an
obscure error message on the virt-v2v standard error:

> [ 322.8] Initializing the target -o openstack
> openstack [...] volume create -f json --size 20 --description virt-v2v
> temporary volume for esx6.7-win2016-x86_64 --non-bootable --read-write
> esx6.7-win2016-x86_64-sda
> Failed to set volume read-only access mode flag: Invalid volume: Volume
> 009dc6bd-2f80-4ac3-b5e7-771863aca237 status must be available to update
> readonly flag, but current status is: creating. (HTTP 400) (Request-ID:
> req-6f56ce4c-249b-4112-9c52-dd91b7f5aae9)

Given that "--non-bootable" and "--read-write" are both defaults for VM
image creation, according to
<https://docs.openstack.org/python-openstackclient/yoga/cli/command-objects/volume.html>,
work the symptom around by simply not passing these options.

(Tested only with "make check"; I don't have an Openstack setup.)

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2074801
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 output/output_openstack.ml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/output/output_openstack.ml b/output/output_openstack.ml
index d0af2ac79e7e..aa01d5a67c50 100644
--- a/output/output_openstack.ml
+++ b/output/output_openstack.ml
@@ -277,9 +277,7 @@ The os-* parameters and environment variables are optional.
       List.push_back_list args [ "volume"; "create";
                                  "-f"; "json";
                                  "--size"; size_gb;
-                                 "--description"; description;
-                                 "--non-bootable";
-                                 "--read-write" ];
+                                 "--description"; description ];
       Option.may (
         fun os -> List.push_back_list args [ "--type"; os ]
       ) output_storage;
-- 
2.19.1.3.g30247aa5d201



More information about the Libguestfs mailing list