Support also a "socket" listen type with no explicitly specified socket
(which will be generated by libvirt).
Updates commit a4adf48915c0e3e7f4e8b7bbdbb5ac622da1ac58.
Related to: RHBZ#1378022
---
v2v/create_libvirt_xml.ml | 4 +++-
v2v/parse_libvirt_xml.ml | 4 ++--
v2v/types.ml | 5 +++--
v2v/types.mli | 2 +-
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/v2v/create_libvirt_xml.ml b/v2v/create_libvirt_xml.ml
index 19e0a52..c276109 100644
--- a/v2v/create_libvirt_xml.ml
+++ b/v2v/create_libvirt_xml.ml
@@ -249,7 +249,9 @@ let create_libvirt_xml ?pool source target_buses guestcaps
let sub = e "listen" [ "type", "network";
"network", n ] [] in
append_child sub graphics
| LSocket s ->
- let sub = e "listen" [ "type", "socket";
"socket", s ] [] in
+ let attrs = [ "type", "socket" ] @
+ (match s with None -> [] | Some s -> [ "socket", s ]) in
+ let sub = e "listen" attrs [] in
append_child sub graphics
| LNone ->
let sub = e "listen" [ "type", "none" ] [] in
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
index 50bdf1c..edffd20 100644
--- a/v2v/parse_libvirt_xml.ml
+++ b/v2v/parse_libvirt_xml.ml
@@ -109,8 +109,8 @@ let parse_libvirt_xml ?conn xml =
)
| Some "socket" ->
(match xpath_string "listen[1]/@socket" with
- | None -> LNoListen
- | Some n -> LSocket n
+ | None -> LSocket None
+ | Some n -> LSocket (Some n)
)
| Some "none" ->
LNone
diff --git a/v2v/types.ml b/v2v/types.ml
index 3c92357..d802e19 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -85,7 +85,7 @@ and s_display_listen =
| LNoListen
| LAddress of string
| LNetwork of string
- | LSocket of string
+ | LSocket of string option
| LNone
and source_video = Source_other_video of string |
@@ -232,7 +232,8 @@ and string_of_source_display { s_display_type = typ;
| LNoListen -> ""
| LAddress a -> sprintf " listening on address %s" a
| LNetwork n -> sprintf " listening on network %s" n
- | LSocket s -> sprintf " listening on Unix domain socket %s" s
+ | LSocket (Some s) -> sprintf " listening on Unix domain socket %s" s
+ | LSocket None -> sprintf " listening on automatically created Unix domain
socket"
| LNone -> " listening on private fd"
)
diff --git a/v2v/types.mli b/v2v/types.mli
index 6cd6190..31a974a 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -142,7 +142,7 @@ and s_display_listen =
| LNoListen (** No parseable <listen/> element. *)
| LAddress of string (** Listen address. *)
| LNetwork of string (** Listen network. *)
- | LSocket of string (** Listen Unix domain socket. *)
+ | LSocket of string option (** Listen Unix domain socket. *)
| LNone (** <listen type='none'> *)
(** Video adapter model. *)
--
2.9.3