mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
v2v: <File ovf:size> changed to the actual size (if known).
Note that this attribute is optional. Thanks: Arik Hadas
This commit is contained in:
@@ -819,12 +819,17 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids
|
||||
|
||||
(* Add disk to <References/> node. *)
|
||||
let disk =
|
||||
e "File" [
|
||||
let attrs = ref [
|
||||
"ovf:href", fileref;
|
||||
"ovf:id", vol_uuid;
|
||||
"ovf:size", Int64.to_string ov.ov_virtual_size; (* NB: in bytes *)
|
||||
"ovf:description", generated_by;
|
||||
] [] in
|
||||
] in
|
||||
(match t.target_actual_size with
|
||||
| None -> ()
|
||||
| Some actual_size ->
|
||||
List.push_back attrs ("ovf:size", Int64.to_string actual_size)
|
||||
);
|
||||
e "File" !attrs [] in
|
||||
append_child disk references;
|
||||
|
||||
(* Add disk to DiskSection. *)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ovf:Envelope xmlns:rasd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData' xmlns:vssd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ovf='http://schemas.dmtf.org/ovf/envelope/1/' xmlns:ovirt='http://www.ovirt.org/ovf' ovf:version='0.9'>
|
||||
<!-- generated by virt-v2v -->
|
||||
<References>
|
||||
<File ovf:href='#DISK_ID#/#VOL_ID#' ovf:id='#VOL_ID#' ovf:size='536870912' ovf:description='generated by virt-v2v'/>
|
||||
<File ovf:href='#DISK_ID#/#VOL_ID#' ovf:id='#VOL_ID#' ovf:description='generated by virt-v2v' ovf:size='#SIZE#'/>
|
||||
</References>
|
||||
<Section xsi:type='ovf:NetworkSection_Type'>
|
||||
<Info>List of networks</Info>
|
||||
|
||||
@@ -74,6 +74,7 @@ sed -i \
|
||||
-e "s/$DISK_ID/#DISK_ID#/g" \
|
||||
-e "s/$VM_ID/#VM_ID#/g" \
|
||||
-e "s/$VOL_ID/#VOL_ID#/g" \
|
||||
-e "s/\(<File.*ovf:size='\)[^']*/\1#SIZE#/g" \
|
||||
-e 's/\(\<generated by virt-v2v\) [^ <'"'\""']*/\1/' \
|
||||
-e 's/<rasd:InstanceId>'"$RE_UUID"'</<rasd:InstanceId>#UUID#</' \
|
||||
-e 's/<\(rasd:\)\?\(CreationDate\|LastModified\|last_modified_date\)>[^<]*</<\1\2>#DATE#</' \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ovf:Envelope xmlns:rasd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData' xmlns:vssd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ovf='http://schemas.dmtf.org/ovf/envelope/1/' xmlns:ovirt='http://www.ovirt.org/ovf' ovf:version='0.9'>
|
||||
<!-- generated by virt-v2v -->
|
||||
<References>
|
||||
<File ovf:href='VOL' ovf:id='VOL' ovf:size='536870912' ovf:description='generated by virt-v2v'/>
|
||||
<File ovf:href='VOL' ovf:id='VOL' ovf:description='generated by virt-v2v' ovf:size='#SIZE#'/>
|
||||
</References>
|
||||
<NetworkSection>
|
||||
<Info>List of networks</Info>
|
||||
|
||||
@@ -82,6 +82,7 @@ RE_UUID='\<[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[
|
||||
|
||||
# Filter variable strings
|
||||
sed -i \
|
||||
-e "s/\(<File.*ovf:size='\)[^']*/\1#SIZE#/g" \
|
||||
-e 's/\(\<generated by virt-v2v\) [^ <'"'\""']*/\1/' \
|
||||
-e 's/<rasd:InstanceId>'"$RE_UUID"'</<rasd:InstanceId>#UUID#</' \
|
||||
-e 's/<\(rasd:\)\?\(CreationDate\|LastModified\|last_modified_date\)>[^<]*</<\1\2>#DATE#</' \
|
||||
|
||||
Reference in New Issue
Block a user