Blame SOURCES/0008-RHEL-Disable-o-glance.patch

696189
From 14507902a675fd2e0356c0faf67524eb04e974d2 Mon Sep 17 00:00:00 2001
c232e6
From: "Richard W.M. Jones" <rjones@redhat.com>
c232e6
Date: Wed, 30 Jun 2021 11:15:52 +0100
3156cb
Subject: [PATCH] RHEL: Disable -o glance
c232e6
c232e6
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1977539
c232e6
---
c232e6
 docs/virt-v2v-output-openstack.pod | 56 ++----------------------------
3156cb
 docs/virt-v2v.pod                  | 20 -----------
3156cb
 output/output_glance.mli           |  2 +-
c232e6
 tests/test-v2v-o-glance.sh         |  3 ++
3156cb
 v2v/v2v.ml                         |  7 +---
3156cb
 5 files changed, 7 insertions(+), 81 deletions(-)
c232e6
c232e6
diff --git a/docs/virt-v2v-output-openstack.pod b/docs/virt-v2v-output-openstack.pod
c232e6
index f5a3abad..1ab356e8 100644
c232e6
--- a/docs/virt-v2v-output-openstack.pod
c232e6
+++ b/docs/virt-v2v-output-openstack.pod
c232e6
@@ -10,13 +10,10 @@ virt-v2v-output-openstack - Using virt-v2v to convert guests to OpenStack
c232e6
                         [-oo verify-server-certificate=false]
c232e6
                         [-oo os-username=admin] [-oo os-*=*]
c232e6
 
c232e6
- virt-v2v [-i* options] -o glance
c232e6
-
c232e6
 =head1 DESCRIPTION
c232e6
 
c232e6
 This page documents how to use L<virt-v2v(1)> to convert guests to run
c232e6
-on OpenStack.  There are two output modes you can select, but only
c232e6
-I<-o openstack> should be used normally.
c232e6
+on OpenStack.
c232e6
 
c232e6
 =over 4
c232e6
 
c232e6
@@ -27,15 +24,6 @@ Full description: L</OUTPUT TO OPENSTACK>
c232e6
 This is the modern method for uploading to OpenStack via the REST API.
c232e6
 Guests can be directly converted into Cinder volumes.
c232e6
 
c232e6
-=item B<-o glance>
c232e6
-
c232e6
-Full description: L</OUTPUT TO GLANCE>
c232e6
-
c232e6
-This is the old method for uploading to Glance.  Unfortunately Glance
c232e6
-is not well suited to storing converted guests (since virt-v2v deals
c232e6
-with "pets" not templated "cattle"), so this method is not recommended
c232e6
-unless you really know what you are doing.
c232e6
-
c232e6
 =back
c232e6
 
c232e6
 =head1 OUTPUT TO OPENSTACK
c232e6
@@ -170,50 +158,10 @@ no Cinder volume type is used.
c232e6
 The following options are B<not> supported with OpenStack: I<-oa>,
c232e6
 I<-of>.
c232e6
 
c232e6
-=head1 OUTPUT TO GLANCE
c232e6
-
c232e6
-Note this is a legacy option.  In most cases you should use
c232e6
-L</OUTPUT TO OPENSTACK> instead.
c232e6
-
c232e6
-To output to OpenStack Glance, use the I<-o glance> option.
c232e6
-
c232e6
-This runs the L<glance(1)> CLI program which must be installed on the
c232e6
-virt-v2v conversion host.  For authentication to work, you will need
c232e6
-to set C<OS_*> environment variables.
c232e6
-
c232e6
-Normally there is a file called C<overcloudrc> or C<keystonerc_admin>
c232e6
-which you can simply C<source> to set everything up.
c232e6
-
c232e6
-Virt-v2v adds metadata for the guest to Glance, describing such things
c232e6
-as the guest operating system and what drivers it requires.  The
c232e6
-command C<glance image-show> will display the metadata as "Property"
c232e6
-fields such as C<os_type> and C<hw_disk_bus>.
c232e6
-
c232e6
-=head2 Glance and sparseness
c232e6
-
c232e6
-Glance image upload doesn't appear to correctly handle sparseness.
c232e6
-For this reason, using qcow2 will be faster and use less space on the
c232e6
-Glance server.  Use the virt-v2v S<I<-of qcow2>> option.
c232e6
-
c232e6
-=head2 Glance and multiple disks
c232e6
-
c232e6
-If the guest has a single disk, then the name of the disk in Glance
c232e6
-will be the name of the guest.  You can control this using the I<-on>
c232e6
-option.
c232e6
-
c232e6
-Glance doesn't have a concept of associating multiple disks with a
c232e6
-single guest, and Nova doesn't allow you to boot a guest from multiple
c232e6
-Glance disks either.  If the guest has multiple disks, then the first
c232e6
-(assumed to be the system disk) will have the name of the guest, and
c232e6
-the second and subsequent data disks will be called
c232e6
-C<I<guestname>-disk2>, C<I<guestname>-disk3> etc.  It may be best to
c232e6
-leave the system disk in Glance, and import the data disks to Cinder.
c232e6
-
c232e6
 =head1 SEE ALSO
c232e6
 
c232e6
 L<virt-v2v(1)>,
c232e6
-L<https://docs.openstack.org/python-openstackclient/latest/cli/man/openstack.html>,
c232e6
-L<glance(1)>.
c232e6
+L<https://docs.openstack.org/python-openstackclient/latest/cli/man/openstack.html>.
c232e6
 
c232e6
 =head1 AUTHOR
c232e6
 
c232e6
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
696189
index 7d0bafff..84e049cc 100644
c232e6
--- a/docs/virt-v2v.pod
c232e6
+++ b/docs/virt-v2v.pod
696189
@@ -416,14 +416,6 @@ See L</Networks and bridges> below.
c232e6
 
c232e6
 This is the same as I<-o local>.
c232e6
 
c232e6
-=item B<-o> B<glance>
c232e6
-
c232e6
-This is a legacy option.  You should probably use I<-o openstack>
c232e6
-instead.
c232e6
-
c232e6
-Set the output method to OpenStack Glance.  In this mode the converted
c232e6
-guest is uploaded to Glance.  See L<virt-v2v-output-openstack(1)>.
c232e6
-
c232e6
 =item B<-o> B<json>
c232e6
 
696189
 This option is deprecated and will be removed in S<virt-v2v 2.2>.
696189
@@ -1148,11 +1140,6 @@ and output methods may use disk space, as outlined in the table below.
c232e6
 This temporarily places a full copy of the uncompressed source disks
c232e6
 in C<$VIRT_V2V_TMPDIR> (or F).
c232e6
 
c232e6
-=item I<-o glance>
c232e6
-
c232e6
-This temporarily places a full copy of the output disks in
c232e6
-C<$VIRT_V2V_TMPDIR> (or F).
c232e6
-
c232e6
 =item I<-o local>
c232e6
 
c232e6
 =item I<-o qemu>
696189
@@ -1336,13 +1323,6 @@ instance.
c232e6
 Because of how Cinder volumes are presented as F</dev> block devices,
c232e6
 using I<-o openstack> normally requires that virt-v2v is run as root.
c232e6
 
c232e6
-=item Writing to Glance
c232e6
-
c232e6
-This does I<not> need root (in fact it probably won’t work), but may
c232e6
-require either a special user and/or for you to source a script that
c232e6
-sets authentication environment variables.  Consult the Glance
c232e6
-documentation.
c232e6
-
c232e6
 =item Writing to block devices
c232e6
 
c232e6
 This normally requires root.  See the next section.
3156cb
diff --git a/output/output_glance.mli b/output/output_glance.mli
3156cb
index 972320a2..9befc461 100644
3156cb
--- a/output/output_glance.mli
3156cb
+++ b/output/output_glance.mli
3156cb
@@ -18,4 +18,4 @@
3156cb
 
3156cb
 (** [-o glance] output mode. *)
3156cb
 
3156cb
-module Glance : Output.OUTPUT
3156cb
+(*module Glance : Output.OUTPUT*)
c232e6
diff --git a/tests/test-v2v-o-glance.sh b/tests/test-v2v-o-glance.sh
c232e6
index c0db9115..074b5e16 100755
c232e6
--- a/tests/test-v2v-o-glance.sh
c232e6
+++ b/tests/test-v2v-o-glance.sh
c232e6
@@ -20,6 +20,9 @@
c232e6
 
c232e6
 set -e
c232e6
 
c232e6
+# Feature is disabled in RHEL 9.
c232e6
+exit 77
c232e6
+
c232e6
 source ./functions.sh
c232e6
 set -e
c232e6
 set -x
3156cb
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
696189
index 97b4e4ec..41e020cb 100644
3156cb
--- a/v2v/v2v.ml
3156cb
+++ b/v2v/v2v.ml
696189
@@ -192,7 +192,6 @@ let rec main () =
c232e6
     if !output_mode <> `Not_set then
c232e6
       error (f_"%s option used more than once on the command line") "-o";
c232e6
     match mode with
c232e6
-    | "glance" -> output_mode := `Glance
c232e6
     | "libvirt" -> output_mode := `Libvirt
3156cb
     | "disk" | "local" -> output_mode := `Disk
c232e6
     | "json" -> output_mode := `JSON
696189
@@ -250,7 +249,7 @@ let rec main () =
3156cb
       s_"Map network ‘in’ to ‘out’";
3156cb
     [ L"no-trim" ],  Getopt.String ("-", no_trim_warning),
3156cb
       s_"Ignored for backwards compatibility";
3156cb
-    [ S 'o' ],       Getopt.String ("glance|json|libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode),
3156cb
+    [ S 'o' ],       Getopt.String ("json|libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode),
3156cb
       s_"Set output mode (default: libvirt)";
3156cb
     [ M"oa" ],       Getopt.String ("sparse|preallocated", set_output_alloc),
3156cb
                                     s_"Set output allocation mode";
696189
@@ -318,8 +317,6 @@ virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
c232e6
 
3156cb
 virt-v2v -i disk disk.img -o local -os /var/tmp
c232e6
 
3156cb
-virt-v2v -i disk disk.img -o glance
c232e6
-
c232e6
 There is a companion front-end called \"virt-p2v\" which comes as an
c232e6
 ISO or CD image that can be booted on physical machines.
c232e6
 
696189
@@ -387,7 +384,6 @@ read the man page virt-v2v(1).
3156cb
       pr "input:libvirtxml\n";
3156cb
       pr "input:ova\n";
3156cb
       pr "input:vmx\n";
3156cb
-      pr "output:glance\n";
3156cb
       pr "output:json\n";
3156cb
       pr "output:libvirt\n";
3156cb
       pr "output:local\n";
696189
@@ -481,7 +477,6 @@ read the man page virt-v2v(1).
3156cb
     | `Disk -> (module Output_disk.Disk)
3156cb
     | `Null -> (module Output_null.Null)
3156cb
     | `QEmu -> (module Output_qemu.QEMU)
3156cb
-    | `Glance -> (module Output_glance.Glance)
3156cb
     | `Openstack -> (module Output_openstack.Openstack)
3156cb
     | `RHV_Upload -> (module Output_rhv_upload.RHVUpload)
3156cb
     | `RHV -> (module Output_rhv.RHV)