Displaying 20 results from an estimated 32 matches for "xpathctx_set_current_context".
2014 Nov 24
3
[PATCH] v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
...1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 95af2e5..9a9c10a 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -187,14 +187,17 @@ object
for i = 0 to nr_nodes-1 do
let n = Xml.xpathobj_node doc obj i in
Xml.xpathctx_set_current_context xpathctx n;
- let parent_id = xpath_to_int "rasd:Parent/text()" 0 in
(* XXX We assume the OVF lists these in order.
let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
*)
(* Find the parent controller. *)
- let cont...
2015 Jun 25
0
[PATCH v2] v2v: Free XML objects in the correct order.
...done;
!features in
@@ -89,7 +89,7 @@ let parse_libvirt_xml ?conn xml =
if nr_nodes < 1 then None
else (
(* Ignore everything except the first <graphics> device. *)
- let node = Xml.xpathobj_node doc obj 0 in
+ let node = Xml.xpathobj_node obj 0 in
Xml.xpathctx_set_current_context xpathctx node;
let keymap =
match xpath_to_string "@keymap" "" with "" -> None | k -> Some k in
@@ -150,7 +150,7 @@ let parse_libvirt_xml ?conn xml =
if nr_nodes < 1 then None
else (
(* Ignore everything except the first <so...
2015 Jun 25
0
[PATCH] v2v: Free XML objects in the correct order.
...done;
!features in
@@ -89,7 +89,7 @@ let parse_libvirt_xml ?conn xml =
if nr_nodes < 1 then None
else (
(* Ignore everything except the first <graphics> device. *)
- let node = Xml.xpathobj_node doc obj 0 in
+ let node = Xml.xpathobj_node obj 0 in
Xml.xpathctx_set_current_context xpathctx node;
let keymap =
match xpath_to_string "@keymap" "" with "" -> None | k -> Some k in
@@ -150,7 +150,7 @@ let parse_libvirt_xml ?conn xml =
if nr_nodes < 1 then None
else (
(* Ignore everything except the first <so...
2015 Jun 25
2
[PATCH v2] v2v: Free XML objects in the correct order.
In version 2:
- No substantial change, I just tidied up the code a bit.
- Removed one case where whitespace changes had crept in.
Rich.
2014 Nov 24
0
Re: [PATCH] v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
...s(-)
>
> diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
> index 95af2e5..9a9c10a 100644
> --- a/v2v/input_ova.ml
> +++ b/v2v/input_ova.ml
> @@ -187,14 +187,17 @@ object
> for i = 0 to nr_nodes-1 do
> let n = Xml.xpathobj_node doc obj i in
> Xml.xpathctx_set_current_context xpathctx n;
> - let parent_id = xpath_to_int "rasd:Parent/text()" 0 in
>
> (* XXX We assume the OVF lists these in order.
> let address = xpath_to_int "rasd:AddressOnParent/text()" 0 in
> *)
>
> (* Find the pare...
2015 Aug 28
7
v2v: -i libvirtxml: Map empty network or bridge name to a default (RHBZ#1257895).
When importing from VMware via the libvirt driver, the libvirt driver
can add an empty source bridge name:
<interface type='bridge'>
<mac address='00:01:02:03:04:05:06'/>
<source bridge=''/>
</interface>
Replicate what we do on the -i ova path, and map these to "eth0",
"eth1" etc.
This also includes a bunch
2017 Mar 13
0
[PATCH 2/2] v2v: -i ova: Factor out the OVF parsing into a separate module.
...elope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType/text()=17]" in
- let obj = Xml.xpath_eval_expression xpathctx expr in
- let nr_nodes = Xml.xpathobj_nr_nodes obj in
- for i = 0 to nr_nodes-1 do
- let n = Xml.xpathobj_node obj i in
- Xml.xpathctx_set_current_context xpathctx n;
-
- (* XXX We assume the OVF lists these in order.
- let address = xpath_int "rasd:AddressOnParent/text()" in
- *)
-
- (* Find the parent controller. *)
- let parent_id = xpath_int "rasd:Parent/text()" in
- let controller =
-...
2017 Mar 13
4
[PATCH 0/2] v2v: -i ova: A couple of cleanup patches.
A couple of patches cleaning up the -i ova code. These are
both just refactoring (or should be at any rate).
The second patch is best viewed with 'git show -w' to exclude
whitespace changes.
Rich.
2016 Sep 08
1
[PATCH] virt-v2v: Support for ova exported from AWS [v2]
...uot; ->
- error (f_"could not parse ovf:Name from OVF document")
+ warning (f_"could not parse ovf:Name from OVF document");
+ "default"
| Some name -> name in
(* Search for memory. *)
@@ -245,10 +246,10 @@ object
Xml.xpathctx_set_current_context xpathctx n;
let file_id = xpath_string_default "rasd:HostResource/text()" "" in
- let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in
+ let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in
if Str.string_match rex file_id 0 then (...
2016 Sep 06
2
[PATCH] virt-v2v: Support for ova exported from AWS
...ame/text()" "default" in
(* Search for memory. *)
let memory = xpath_to_int "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType/text()=4]/rasd:VirtualQuantity/text()" (1024 * 1024) in
@@ -263,10 +261,10 @@ object
Xml.xpathctx_set_current_context xpathctx n;
let file_id = xpath_to_string "rasd:HostResource/text()" "" in
- let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in
+ let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in
if Str.string_match rex file_id 0 then (...
2018 Mar 22
1
[PATCH] v2v: Fix parsing of OVA files and documentation for --network and --bridge (RHBZ#1559027).
...a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml
index d8de0cea1..82d7adf8c 100644
--- a/v2v/parse_ovf_from_ova.ml
+++ b/v2v/parse_ovf_from_ova.ml
@@ -230,16 +230,17 @@ let parse_ovf_from_ova ovf_filename =
for i = 0 to nr_nodes-1 do
let n = Xml.xpathobj_node obj i in
Xml.xpathctx_set_current_context xpathctx n;
- let vnet =
- Option.default (sprintf"eth%d" i)
- (xpath_string "rasd:ElementName/text()") in
+ let vnet, vnet_type =
+ match xpath_string "rasd:Connection/text()" with
+ | Some connection -> connecti...
2017 Oct 08
0
[PATCH v2 4/4] common/mltools: xpath_helpers: Get rid of xpath_*_default functions.
...tem/ovf:VirtualHardwareSection/vmw:Config[@vmw:key=\"firmware\"]/@vmw:value") in
let firmware =
match firmware with
| "bios" -> BIOS
@@ -141,7 +139,8 @@ let parse_ovf_from_ova ovf_filename =
| Some id -> parent_controller id in
Xml.xpathctx_set_current_context xpathctx n;
- let file_id = xpath_string_default "rasd:HostResource/text()" "" in
+ let file_id =
+ Option.default "" (xpath_string "rasd:HostResource/text()") in
let rex = PCRE.compile "^(?:ovf:)?/disk/(.*)" in
if PCR...
2016 Sep 06
0
Re: [PATCH] virt-v2v: Support for ova exported from AWS
...lt" in
>
> (* Search for memory. *)
> let memory = xpath_to_int "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType/text()=4]/rasd:VirtualQuantity/text()" (1024 * 1024) in
> @@ -263,10 +261,10 @@ object
>
> Xml.xpathctx_set_current_context xpathctx n;
> let file_id = xpath_to_string "rasd:HostResource/text()" "" in
> - let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in
> + let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in
> if Str.string_match rex file_...
2018 Apr 25
9
[PATCH v2 0/9] v2v: -i ova: Handle OVAs containing snapshots.
https://bugzilla.redhat.com/show_bug.cgi?id=1570407
This turned into quite an in-depth refactoring of how we handle OVAs.
It also fixes a potential security issue.
Rich.
2017 Oct 27
0
[PATCH v11 7/8] mllib: add XPath helper xpath_get_nodes
...XPath expression and return a list with the matching
+ XML nodes. *)
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index 02b4d54ff..729f8b67a 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -55,15 +55,8 @@ let target_features_of_capabilities_doc doc arch =
Xml.xpathctx_set_current_context xpathctx node;
(* Get guest/features/* nodes. *)
- let obj = Xml.xpath_eval_expression xpathctx "features/*" in
-
- let features = ref [] in
- for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
- let feature_node = Xml.xpathobj_node obj i in
- let feature_name = Xml.n...
2014 Oct 31
0
[PATCH] v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
...that seems unfair since the
+ * user has gone through conversion before we reach here.
+ *)
+ warning (f_"the target hypervisor does not support a %s KVM guest") arch;
+ []
+ ) else (
+ let node (* first matching <guest> *) = Xml.xpathobj_node doc obj 0 in
+ Xml.xpathctx_set_current_context xpathctx node;
+
+ (* Get guest/features/* nodes. *)
+ let obj = Xml.xpath_eval_expression xpathctx "features/*" in
+
+ let features = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let feature_node = Xml.xpathobj_node doc obj i in
+ let feature_name = X...
2016 Feb 09
0
[PATCH 1/4] v2v: collect source network and video adapter types
...bj = Xml.xpath_eval_expression xpathctx "/domain/devices/video" in
+ let nr_nodes = Xml.xpathobj_nr_nodes obj in
+ if nr_nodes < 1 then None
+ else (
+ (* Ignore everything except the first <video> device. *)
+ let node = Xml.xpathobj_node obj 0 in
+
+ Xml.xpathctx_set_current_context xpathctx node;
+ match xpath_string "model/@type" with
+ | None -> None
+ | Some "qxl" | Some "virtio" -> Some Source_QXL
+ | Some "cirrus" | Some "vga" -> Some Source_Cirrus
+ | Some model ->
+ warning (...
2016 Mar 18
0
[PATCH v4 1/5] v2v: collect source network and video adapter types
...bj = Xml.xpath_eval_expression xpathctx "/domain/devices/video" in
+ let nr_nodes = Xml.xpathobj_nr_nodes obj in
+ if nr_nodes < 1 then None
+ else (
+ (* Ignore everything except the first <video> device. *)
+ let node = Xml.xpathobj_node obj 0 in
+
+ Xml.xpathctx_set_current_context xpathctx node;
+ match xpath_string "model/@type" with
+ | None -> None
+ | Some "qxl" | Some "virtio" -> Some Source_QXL
+ | Some "cirrus" | Some "vga" -> Some Source_Cirrus
+ | Some model -> Some (Source_other_...
2016 Feb 20
0
[PATCH v2 1/4] v2v: collect source network and video adapter types
...bj = Xml.xpath_eval_expression xpathctx "/domain/devices/video" in
+ let nr_nodes = Xml.xpathobj_nr_nodes obj in
+ if nr_nodes < 1 then None
+ else (
+ (* Ignore everything except the first <video> device. *)
+ let node = Xml.xpathobj_node obj 0 in
+
+ Xml.xpathctx_set_current_context xpathctx node;
+ match xpath_string "model/@type" with
+ | None -> None
+ | Some "qxl" | Some "virtio" -> Some Source_QXL
+ | Some "cirrus" | Some "vga" -> Some Source_Cirrus
+ | Some model -> Some (Source_other_...
2017 Feb 07
0
[PATCH v2 2/7] Move xml and xpath_helpers OCAML code to mllib
...thobjptr_get_nodeptr"
let xpathobj_node ((docptr, _), xpathobjptr) i =
docptr, xpathobjptr_get_nodeptr xpathobjptr i
external xpathctxptr_set_nodeptr : xpathctxptr -> nodeptr -> unit
- = "v2v_xml_xpathctx_set_nodeptr"
+ = "mllib_xml_xpathctx_set_nodeptr"
let xpathctx_set_current_context (_, xpathctxptr) (_, nodeptr) =
xpathctxptr_set_nodeptr xpathctxptr nodeptr
-external nodeptr_name : nodeptr -> string = "v2v_xml_nodeptr_name"
+external nodeptr_name : nodeptr -> string = "mllib_xml_nodeptr_name"
let node_name (_, nodeptr) = nodeptr_name nodeptr...