|
|
c232e6 |
From 4d5509a98823cc0b8930678716b862adbd2c0b81 Mon Sep 17 00:00:00 2001
|
|
|
c232e6 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
c232e6 |
Date: Fri, 6 Aug 2021 13:01:28 +0100
|
|
|
c232e6 |
Subject: [PATCH 01/12] Revert "v2v: Remove -o rhv-upload -oa preallocated"
|
|
|
c232e6 |
|
|
|
c232e6 |
This reverts commit 18084f90d9dd9092831cb3487039328981796291.
|
|
|
c232e6 |
---
|
|
|
c232e6 |
v2v/cmdline.ml | 2 +-
|
|
|
c232e6 |
v2v/output_rhv_upload.ml | 22 ++++++++++++++++++++--
|
|
|
c232e6 |
v2v/output_rhv_upload.mli | 7 ++++---
|
|
|
c232e6 |
v2v/rhv-upload-transfer.py | 1 +
|
|
|
c232e6 |
4 files changed, 26 insertions(+), 6 deletions(-)
|
|
|
c232e6 |
|
|
|
c232e6 |
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
|
|
|
c232e6 |
index 79d943df..5e7c01f8 100644
|
|
|
c232e6 |
--- a/v2v/cmdline.ml
|
|
|
c232e6 |
+++ b/v2v/cmdline.ml
|
|
|
c232e6 |
@@ -699,7 +699,7 @@ read the man page virt-v2v(1).
|
|
|
c232e6 |
| Some os -> os in
|
|
|
c232e6 |
if qemu_boot then
|
|
|
c232e6 |
error_option_cannot_be_used_in_output_mode "rhv-upload" "--qemu-boot";
|
|
|
c232e6 |
- Output_rhv_upload.output_rhv_upload output_conn
|
|
|
c232e6 |
+ Output_rhv_upload.output_rhv_upload output_alloc output_conn
|
|
|
c232e6 |
output_password os
|
|
|
c232e6 |
rhv_options,
|
|
|
c232e6 |
output_format, output_alloc
|
|
|
c232e6 |
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
|
|
|
c232e6 |
index 6a632eaa..50baa595 100644
|
|
|
c232e6 |
--- a/v2v/output_rhv_upload.ml
|
|
|
c232e6 |
+++ b/v2v/output_rhv_upload.ml
|
|
|
c232e6 |
@@ -146,11 +146,22 @@ let error_unless_nbdkit_compiled_with_selinux config =
|
|
|
c232e6 |
error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.")
|
|
|
c232e6 |
)
|
|
|
c232e6 |
|
|
|
c232e6 |
+(* Output sparse must be sparse. We may be able to
|
|
|
c232e6 |
+ * lift this limitation in future, but it requires changes on the
|
|
|
c232e6 |
+ * RHV side. See TODO file for details. XXX
|
|
|
c232e6 |
+ *)
|
|
|
c232e6 |
+let error_current_limitation required_param =
|
|
|
c232e6 |
+ error (f_"rhv-upload: currently you must use ā%sā. This restriction will be loosened in a future version.") required_param
|
|
|
c232e6 |
+
|
|
|
c232e6 |
+let error_unless_output_alloc_sparse output_alloc =
|
|
|
c232e6 |
+ if output_alloc <> Sparse then
|
|
|
c232e6 |
+ error_current_limitation "-oa sparse"
|
|
|
c232e6 |
+
|
|
|
c232e6 |
let json_optstring = function
|
|
|
c232e6 |
| Some s -> JSON.String s
|
|
|
c232e6 |
| None -> JSON.Null
|
|
|
c232e6 |
|
|
|
c232e6 |
-class output_rhv_upload output_conn
|
|
|
c232e6 |
+class output_rhv_upload output_alloc output_conn
|
|
|
c232e6 |
output_password output_storage
|
|
|
c232e6 |
rhv_options =
|
|
|
c232e6 |
(* Create a temporary directory which will be deleted on exit. *)
|
|
|
c232e6 |
@@ -189,6 +200,9 @@ class output_rhv_upload output_conn
|
|
|
c232e6 |
"output_conn", JSON.String output_conn;
|
|
|
c232e6 |
"output_password", JSON.String output_password;
|
|
|
c232e6 |
"output_storage", JSON.String output_storage;
|
|
|
c232e6 |
+ "output_sparse", JSON.Bool (match output_alloc with
|
|
|
c232e6 |
+ | Sparse -> true
|
|
|
c232e6 |
+ | Preallocated -> false);
|
|
|
c232e6 |
"rhv_cafile", json_optstring rhv_options.rhv_cafile;
|
|
|
c232e6 |
"rhv_cluster",
|
|
|
c232e6 |
JSON.String (Option.default "Default" rhv_options.rhv_cluster);
|
|
|
c232e6 |
@@ -257,6 +271,7 @@ object
|
|
|
c232e6 |
error_unless_nbdkit_min_version config;
|
|
|
c232e6 |
error_unless_nbdkit_python_plugin_working plugin_script;
|
|
|
c232e6 |
error_unless_nbdkit_compiled_with_selinux config;
|
|
|
c232e6 |
+ error_unless_output_alloc_sparse output_alloc;
|
|
|
c232e6 |
|
|
|
c232e6 |
(* Python code prechecks. *)
|
|
|
c232e6 |
let json_params = match rhv_options.rhv_disk_uuids with
|
|
|
c232e6 |
@@ -282,6 +297,9 @@ object
|
|
|
c232e6 |
|
|
|
c232e6 |
method as_options =
|
|
|
c232e6 |
"-o rhv-upload" ^
|
|
|
c232e6 |
+ (match output_alloc with
|
|
|
c232e6 |
+ | Sparse -> "" (* default, don't need to print it *)
|
|
|
c232e6 |
+ | Preallocated -> " -oa preallocated") ^
|
|
|
c232e6 |
sprintf " -oc %s -op %s -os %s"
|
|
|
c232e6 |
output_conn output_password output_storage
|
|
|
c232e6 |
|
|
|
c232e6 |
@@ -449,7 +467,7 @@ object
|
|
|
c232e6 |
(* Create the metadata. *)
|
|
|
c232e6 |
let ovf =
|
|
|
c232e6 |
Create_ovf.create_ovf source inspect target_meta targets
|
|
|
c232e6 |
- Sparse sd_uuid disk_uuids vol_uuids vm_uuid
|
|
|
c232e6 |
+ output_alloc sd_uuid disk_uuids vol_uuids vm_uuid
|
|
|
c232e6 |
OVirt in
|
|
|
c232e6 |
let ovf = DOM.doc_to_string ovf in
|
|
|
c232e6 |
|
|
|
c232e6 |
diff --git a/v2v/output_rhv_upload.mli b/v2v/output_rhv_upload.mli
|
|
|
c232e6 |
index 01507dff..eb85a57d 100644
|
|
|
c232e6 |
--- a/v2v/output_rhv_upload.mli
|
|
|
c232e6 |
+++ b/v2v/output_rhv_upload.mli
|
|
|
c232e6 |
@@ -25,8 +25,9 @@ val print_output_options : unit -> unit
|
|
|
c232e6 |
val parse_output_options : (string * string) list -> rhv_options
|
|
|
c232e6 |
(** Print and parse rhv-upload -oo options. *)
|
|
|
c232e6 |
|
|
|
c232e6 |
-val output_rhv_upload : string -> string -> string -> rhv_options ->
|
|
|
c232e6 |
- Types.output
|
|
|
c232e6 |
-(** [output_rhv_upload output_conn output_password output_storage rhv_options]
|
|
|
c232e6 |
+val output_rhv_upload : Types.output_allocation -> string -> string ->
|
|
|
c232e6 |
+ string -> rhv_options -> Types.output
|
|
|
c232e6 |
+(** [output_rhv_upload output_alloc output_conn output_password output_storage
|
|
|
c232e6 |
+ rhv_options]
|
|
|
c232e6 |
creates and returns a new {!Types.output} object specialized for writing
|
|
|
c232e6 |
output to oVirt or RHV directly via RHV APIs. *)
|
|
|
c232e6 |
diff --git a/v2v/rhv-upload-transfer.py b/v2v/rhv-upload-transfer.py
|
|
|
c232e6 |
index cf4f8807..5aebcd1d 100644
|
|
|
c232e6 |
--- a/v2v/rhv-upload-transfer.py
|
|
|
c232e6 |
+++ b/v2v/rhv-upload-transfer.py
|
|
|
c232e6 |
@@ -111,6 +111,7 @@ def create_disk(connection):
|
|
|
c232e6 |
# size, based on qemu-img measure of the overlay.
|
|
|
c232e6 |
initial_size=params['disk_size'],
|
|
|
c232e6 |
provisioned_size=params['disk_size'],
|
|
|
c232e6 |
+ # XXX Ignores params['output_sparse'].
|
|
|
c232e6 |
# Handling this properly will be complex, see:
|
|
|
c232e6 |
# https://www.redhat.com/archives/libguestfs/2018-March/msg00177.html
|
|
|
c232e6 |
sparse=True,
|
|
|
c232e6 |
--
|
|
|
c232e6 |
2.31.1
|
|
|
c232e6 |
|