|
|
0d20ef |
From 0d60372cb2b9f6afa92993cf3d4666e98296bf69 Mon Sep 17 00:00:00 2001
|
|
|
0d20ef |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
0d20ef |
Date: Mon, 20 Oct 2014 18:18:54 +0100
|
|
|
0d20ef |
Subject: [PATCH] v2v: Add a unique number to source disks.
|
|
|
0d20ef |
|
|
|
0d20ef |
Note that it doesn't matter what the number is, as long as it's
|
|
|
0d20ef |
different for each disk.
|
|
|
0d20ef |
|
|
|
0d20ef |
The unique number lets us store extra data in input objects which is
|
|
|
0d20ef |
associated with each disk.
|
|
|
0d20ef |
|
|
|
0d20ef |
(cherry picked from commit 63387fd8d0d77f7fdaaad14e5053b86ae51cbd6e)
|
|
|
0d20ef |
---
|
|
|
0d20ef |
v2v/input_disk.ml | 1 +
|
|
|
0d20ef |
v2v/input_libvirtxml.ml | 6 ++++--
|
|
|
0d20ef |
v2v/input_ova.ml | 1 +
|
|
|
0d20ef |
v2v/types.ml | 1 +
|
|
|
0d20ef |
v2v/types.mli | 1 +
|
|
|
0d20ef |
5 files changed, 8 insertions(+), 2 deletions(-)
|
|
|
0d20ef |
|
|
|
0d20ef |
diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml
|
|
|
0d20ef |
index 0b68ccf..ef28b43 100644
|
|
|
0d20ef |
--- a/v2v/input_disk.ml
|
|
|
0d20ef |
+++ b/v2v/input_disk.ml
|
|
|
0d20ef |
@@ -66,6 +66,7 @@ class input_disk verbose input_format disk = object
|
|
|
0d20ef |
| format -> format in
|
|
|
0d20ef |
|
|
|
0d20ef |
let disk = {
|
|
|
0d20ef |
+ s_disk_id = 0;
|
|
|
0d20ef |
s_qemu_uri = disk_absolute;
|
|
|
0d20ef |
s_format = Some format;
|
|
|
0d20ef |
s_target_dev = None;
|
|
|
0d20ef |
diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml
|
|
|
0d20ef |
index 3b19685..0cfd75c 100644
|
|
|
0d20ef |
--- a/v2v/input_libvirtxml.ml
|
|
|
0d20ef |
+++ b/v2v/input_libvirtxml.ml
|
|
|
0d20ef |
@@ -103,11 +103,13 @@ let parse_libvirt_xml ~verbose xml =
|
|
|
0d20ef |
(* Non-removable disk devices. *)
|
|
|
0d20ef |
let disks =
|
|
|
0d20ef |
let get_disks, add_disk =
|
|
|
0d20ef |
- let disks = ref [] in
|
|
|
0d20ef |
+ let disks = ref [] and i = ref 0 in
|
|
|
0d20ef |
let get_disks () = List.rev !disks in
|
|
|
0d20ef |
let add_disk qemu_uri format target_dev =
|
|
|
0d20ef |
+ incr i;
|
|
|
0d20ef |
disks :=
|
|
|
0d20ef |
- { s_qemu_uri = qemu_uri; s_format = format;
|
|
|
0d20ef |
+ { s_disk_id = !i;
|
|
|
0d20ef |
+ s_qemu_uri = qemu_uri; s_format = format;
|
|
|
0d20ef |
s_target_dev = target_dev } :: !disks
|
|
|
0d20ef |
in
|
|
|
0d20ef |
get_disks, add_disk
|
|
|
0d20ef |
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
|
|
|
0d20ef |
index 001a579..6349c76 100644
|
|
|
0d20ef |
--- a/v2v/input_ova.ml
|
|
|
0d20ef |
+++ b/v2v/input_ova.ml
|
|
|
0d20ef |
@@ -210,6 +210,7 @@ object
|
|
|
0d20ef |
else filename in
|
|
|
0d20ef |
|
|
|
0d20ef |
let disk = {
|
|
|
0d20ef |
+ s_disk_id = i;
|
|
|
0d20ef |
s_qemu_uri = filename;
|
|
|
0d20ef |
s_format = Some "vmdk";
|
|
|
0d20ef |
s_target_dev = Some target_dev;
|
|
|
0d20ef |
diff --git a/v2v/types.ml b/v2v/types.ml
|
|
|
0d20ef |
index ba04161..5124f3c 100644
|
|
|
0d20ef |
--- a/v2v/types.ml
|
|
|
0d20ef |
+++ b/v2v/types.ml
|
|
|
0d20ef |
@@ -33,6 +33,7 @@ type source = {
|
|
|
0d20ef |
s_nics : source_nic list;
|
|
|
0d20ef |
}
|
|
|
0d20ef |
and source_disk = {
|
|
|
0d20ef |
+ s_disk_id : int;
|
|
|
0d20ef |
s_qemu_uri : string;
|
|
|
0d20ef |
s_format : string option;
|
|
|
0d20ef |
s_target_dev : string option;
|
|
|
0d20ef |
diff --git a/v2v/types.mli b/v2v/types.mli
|
|
|
0d20ef |
index 863371c..c077dc2 100644
|
|
|
0d20ef |
--- a/v2v/types.mli
|
|
|
0d20ef |
+++ b/v2v/types.mli
|
|
|
0d20ef |
@@ -35,6 +35,7 @@ type source = {
|
|
|
0d20ef |
(** The source: metadata, disk images. *)
|
|
|
0d20ef |
|
|
|
0d20ef |
and source_disk = {
|
|
|
0d20ef |
+ s_disk_id : int; (** A unique ID for each source disk. *)
|
|
|
0d20ef |
s_qemu_uri : string; (** QEMU URI of source disk. *)
|
|
|
0d20ef |
s_format : string option; (** Format. *)
|
|
|
0d20ef |
s_target_dev : string option; (** Target @dev from libvirt XML. *)
|
|
|
0d20ef |
--
|
|
|
0d20ef |
1.8.3.1
|
|
|
0d20ef |
|