39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
|
From bb804081e9b5fc959b14d2e254d320cf5a658441 Mon Sep 17 00:00:00 2001
|
|||
|
From: Pino Toscano <ptoscano@redhat.com>
|
|||
|
Date: Thu, 9 Aug 2018 15:01:37 +0200
|
|||
|
Subject: [PATCH] v2v: parse_libvirt_xml: handle srN CDROM devices
|
|||
|
(RHBZ#1612785)
|
|||
|
|
|||
|
This device naming is mostly written by virt-p2v, so get the slot from
|
|||
|
it directly without using the drive_index "decoding" function.
|
|||
|
|
|||
|
(cherry picked from commit c9abaa3e96e7209595f0982c1f2f97e37f3369a6)
|
|||
|
---
|
|||
|
v2v/parse_libvirt_xml.ml | 10 ++++++++++
|
|||
|
1 file changed, 10 insertions(+)
|
|||
|
|
|||
|
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
|
|||
|
index 03a201e77..44723014c 100644
|
|||
|
--- a/v2v/parse_libvirt_xml.ml
|
|||
|
+++ b/v2v/parse_libvirt_xml.ml
|
|||
|
@@ -379,6 +379,16 @@ let parse_libvirt_xml ?conn xml =
|
|||
|
let target_dev = xpath_string "target/@dev" in
|
|||
|
match target_dev with
|
|||
|
| None -> None
|
|||
|
+ | Some dev when String.is_prefix dev "sr" ->
|
|||
|
+ (* "srN" devices are found mostly in the physical XML written by
|
|||
|
+ * virt-p2v.
|
|||
|
+ *)
|
|||
|
+ let name = String.sub dev 2 (String.length dev - 2) in
|
|||
|
+ (try Some (int_of_string name)
|
|||
|
+ with Failure _ ->
|
|||
|
+ warning (f_"could not parse device name ‘%s’ from the source libvirt XML") dev;
|
|||
|
+ None
|
|||
|
+ )
|
|||
|
| Some dev ->
|
|||
|
let rec loop = function
|
|||
|
| [] ->
|
|||
|
--
|
|||
|
2.21.0
|
|||
|
|