mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
v2v: vdsm: add --vdsm-fixed-ovf option
Add option for -o vdsm that enables output of the modified OVF. oVirt engine should already be able to consume the OVF, but let's not take any chances and enable it only by command line argument. It can be made default later when it receives proper testing. Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
This commit is contained in:
committed by
Richard W.M. Jones
parent
a52ed4b445
commit
285014b290
@@ -79,6 +79,11 @@ let parse_cmdline () =
|
|||||||
let vdsm_compat = ref "0.10" in
|
let vdsm_compat = ref "0.10" in
|
||||||
let set_vdsm_compat s = vdsm_compat := s in
|
let set_vdsm_compat s = vdsm_compat := s in
|
||||||
|
|
||||||
|
let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in
|
||||||
|
let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours in
|
||||||
|
let set_vdsm_ovf_flavour arg =
|
||||||
|
vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in
|
||||||
|
|
||||||
let set_string_option_once optname optref arg =
|
let set_string_option_once optname optref arg =
|
||||||
match !optref with
|
match !optref with
|
||||||
| Some _ ->
|
| Some _ ->
|
||||||
@@ -251,6 +256,8 @@ let parse_cmdline () =
|
|||||||
s_"Output VM UUID";
|
s_"Output VM UUID";
|
||||||
[ L"vdsm-ovf-output" ], Getopt.String ("-", set_string_option_once "--vdsm-ovf-output" vdsm_ovf_output),
|
[ L"vdsm-ovf-output" ], Getopt.String ("-", set_string_option_once "--vdsm-ovf-output" vdsm_ovf_output),
|
||||||
s_"Output OVF file";
|
s_"Output OVF file";
|
||||||
|
[ L"vdsm-ovf-flavour" ], Getopt.Symbol (ovf_flavours_str, Create_ovf.ovf_flavours, set_vdsm_ovf_flavour),
|
||||||
|
s_"Set the type of generated OVF (default rhvexp)";
|
||||||
[ L"vmtype" ], Getopt.String ("-", vmtype_warning),
|
[ L"vmtype" ], Getopt.String ("-", vmtype_warning),
|
||||||
s_"Ignored for backwards compatibility";
|
s_"Ignored for backwards compatibility";
|
||||||
] in
|
] in
|
||||||
@@ -327,6 +334,7 @@ read the man page virt-v2v(1).
|
|||||||
let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
|
let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
|
||||||
let vdsm_vm_uuid = !vdsm_vm_uuid in
|
let vdsm_vm_uuid = !vdsm_vm_uuid in
|
||||||
let vdsm_ovf_output = Option.default "." !vdsm_ovf_output in
|
let vdsm_ovf_output = Option.default "." !vdsm_ovf_output in
|
||||||
|
let vdsm_ovf_flavour = !vdsm_ovf_flavour in
|
||||||
|
|
||||||
(* No arguments and machine-readable mode? Print out some facts
|
(* No arguments and machine-readable mode? Print out some facts
|
||||||
* about what this binary supports.
|
* about what this binary supports.
|
||||||
@@ -343,6 +351,7 @@ read the man page virt-v2v(1).
|
|||||||
List.iter (printf "input:%s\n") (Modules_list.input_modules ());
|
List.iter (printf "input:%s\n") (Modules_list.input_modules ());
|
||||||
List.iter (printf "output:%s\n") (Modules_list.output_modules ());
|
List.iter (printf "output:%s\n") (Modules_list.output_modules ());
|
||||||
List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
|
List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
|
||||||
|
List.iter (printf "ovf:%s\n") Create_ovf.ovf_flavours;
|
||||||
exit 0
|
exit 0
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -542,6 +551,7 @@ read the man page virt-v2v(1).
|
|||||||
vm_uuid = vdsm_vm_uuid;
|
vm_uuid = vdsm_vm_uuid;
|
||||||
ovf_output = vdsm_ovf_output;
|
ovf_output = vdsm_ovf_output;
|
||||||
compat = vdsm_compat;
|
compat = vdsm_compat;
|
||||||
|
ovf_flavour = vdsm_ovf_flavour;
|
||||||
} in
|
} in
|
||||||
Output_vdsm.output_vdsm os vdsm_params output_alloc,
|
Output_vdsm.output_vdsm os vdsm_params output_alloc,
|
||||||
output_format, output_alloc in
|
output_format, output_alloc in
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ type ovf_flavour =
|
|||||||
| OVirt
|
| OVirt
|
||||||
| RHVExportStorageDomain
|
| RHVExportStorageDomain
|
||||||
|
|
||||||
|
let ovf_flavours = ["ovirt"; "rhvexp"]
|
||||||
|
|
||||||
|
let ovf_flavour_of_string = function
|
||||||
|
| "ovirt" -> OVirt
|
||||||
|
| "rhvexp" -> RHVExportStorageDomain
|
||||||
|
| flav -> invalid_arg flav
|
||||||
|
|
||||||
(* We set the creation time to be the same for all dates in
|
(* We set the creation time to be the same for all dates in
|
||||||
* all metadata files. All dates in OVF are UTC.
|
* all metadata files. All dates in OVF are UTC.
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -20,6 +20,15 @@ type ovf_flavour =
|
|||||||
| OVirt
|
| OVirt
|
||||||
| RHVExportStorageDomain
|
| RHVExportStorageDomain
|
||||||
|
|
||||||
|
(** The string representation of available OVF flavours. *)
|
||||||
|
val ovf_flavours : string list
|
||||||
|
|
||||||
|
(** Convert from a string to the corresponding OVF flavour.
|
||||||
|
|
||||||
|
Throw [Invalid_argument] if the string does not match any
|
||||||
|
valid flavour. *)
|
||||||
|
val ovf_flavour_of_string : string -> ovf_flavour
|
||||||
|
|
||||||
(** Create OVF and related files for RHV.
|
(** Create OVF and related files for RHV.
|
||||||
|
|
||||||
The format for RHV export storage domain is described in:
|
The format for RHV export storage domain is described in:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ type vdsm_params = {
|
|||||||
vm_uuid : string;
|
vm_uuid : string;
|
||||||
ovf_output : string;
|
ovf_output : string;
|
||||||
compat : string;
|
compat : string;
|
||||||
|
ovf_flavour : Create_ovf.ovf_flavour;
|
||||||
}
|
}
|
||||||
|
|
||||||
class output_vdsm os vdsm_params output_alloc =
|
class output_vdsm os vdsm_params output_alloc =
|
||||||
@@ -39,7 +40,7 @@ object
|
|||||||
inherit output
|
inherit output
|
||||||
|
|
||||||
method as_options =
|
method as_options =
|
||||||
sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os
|
sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s%s" os
|
||||||
(String.concat ""
|
(String.concat ""
|
||||||
(List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids))
|
(List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids))
|
||||||
(String.concat ""
|
(String.concat ""
|
||||||
@@ -49,6 +50,10 @@ object
|
|||||||
(match vdsm_params.compat with
|
(match vdsm_params.compat with
|
||||||
| "0.10" -> "" (* currently this is the default, so don't print it *)
|
| "0.10" -> "" (* currently this is the default, so don't print it *)
|
||||||
| s -> sprintf " --vdsm-compat=%s" s)
|
| s -> sprintf " --vdsm-compat=%s" s)
|
||||||
|
(match vdsm_params.ovf_flavour with
|
||||||
|
| Create_ovf.OVirt -> "--vdsm-ovf-flavour=ovf"
|
||||||
|
(* currently this is the default, so don't print it *)
|
||||||
|
| Create_ovf.RHVExportStorageDomain -> "")
|
||||||
|
|
||||||
method supported_firmware = [ TargetBIOS ]
|
method supported_firmware = [ TargetBIOS ]
|
||||||
|
|
||||||
@@ -176,7 +181,7 @@ object
|
|||||||
vdsm_params.image_uuids
|
vdsm_params.image_uuids
|
||||||
vdsm_params.vol_uuids
|
vdsm_params.vol_uuids
|
||||||
vdsm_params.vm_uuid
|
vdsm_params.vm_uuid
|
||||||
Create_ovf.RHVExportStorageDomain in
|
vdsm_params.ovf_flavour in
|
||||||
|
|
||||||
(* Write it to the metadata file. *)
|
(* Write it to the metadata file. *)
|
||||||
let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in
|
let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ type vdsm_params = {
|
|||||||
vm_uuid : string; (* --vdsm-vm-uuid *)
|
vm_uuid : string; (* --vdsm-vm-uuid *)
|
||||||
ovf_output : string; (* --vdsm-ovf-output *)
|
ovf_output : string; (* --vdsm-ovf-output *)
|
||||||
compat : string; (* --vdsm-compat=0.10|1.1 *)
|
compat : string; (* --vdsm-compat=0.10|1.1 *)
|
||||||
|
ovf_flavour : Create_ovf.ovf_flavour;
|
||||||
}
|
}
|
||||||
(** Miscellaneous extra command line parameters used by VDSM. *)
|
(** Miscellaneous extra command line parameters used by VDSM. *)
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
<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/' ovf:version='0.9'>
|
<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/' ovf:version='0.9'>
|
||||||
<!-- generated by virt-v2v -->
|
<!-- generated by virt-v2v -->
|
||||||
<References>
|
<References>
|
||||||
<File ovf:href='IMAGE/VOL' ovf:id='VOL' ovf:size='536870912' ovf:description='generated by virt-v2v'/>
|
<File ovf:href='VOL' ovf:id='VOL' ovf:size='536870912' ovf:description='generated by virt-v2v'/>
|
||||||
</References>
|
</References>
|
||||||
<Section xsi:type='ovf:NetworkSection_Type'>
|
<NetworkSection>
|
||||||
<Info>List of networks</Info>
|
<Info>List of networks</Info>
|
||||||
<Network ovf:name='default'/>
|
<Network ovf:name='default'/>
|
||||||
</Section>
|
</NetworkSection>
|
||||||
<Section xsi:type='ovf:DiskSection_Type'>
|
<DiskSection>
|
||||||
<Info>List of Virtual Disks</Info>
|
<Info>List of Virtual Disks</Info>
|
||||||
<Disk ovf:diskId='VOL' ovf:size='1' ovf:fileRef='IMAGE/VOL' ovf:parentRef='' ovf:vm_snapshot_id='#UUID#' ovf:volume-format='COW' ovf:volume-type='Sparse' ovf:format='http://en.wikipedia.org/wiki/Byte' ovf:disk-interface='IDE' ovf:disk-type='System' ovf:boot='True' ovf:actual_size='1'/>
|
<Disk ovf:diskId='IMAGE' ovf:size='1' ovf:fileRef='VOL' ovf:parentRef='' ovf:vm_snapshot_id='#UUID#' ovf:volume-format='COW' ovf:volume-type='Sparse' ovf:format='http://en.wikipedia.org/wiki/Byte' ovf:disk-interface='IDE' ovf:disk-type='System' ovf:boot='True' ovf:actual_size='1'/>
|
||||||
</Section>
|
</DiskSection>
|
||||||
<Content ovf:id='out' xsi:type='ovf:VirtualSystem_Type'>
|
<VirtualSystem ovf:id='out'>
|
||||||
<Name>windows</Name>
|
<Name>windows</Name>
|
||||||
<TemplateId>00000000-0000-0000-0000-000000000000</TemplateId>
|
<TemplateId>00000000-0000-0000-0000-000000000000</TemplateId>
|
||||||
<TemplateName>Blank</TemplateName>
|
<TemplateName>Blank</TemplateName>
|
||||||
@@ -25,11 +25,11 @@
|
|||||||
<IsStateless>False</IsStateless>
|
<IsStateless>False</IsStateless>
|
||||||
<VmType>0</VmType>
|
<VmType>0</VmType>
|
||||||
<DefaultDisplayType>1</DefaultDisplayType>
|
<DefaultDisplayType>1</DefaultDisplayType>
|
||||||
<Section ovf:id='VM' ovf:required='false' xsi:type='ovf:OperatingSystemSection_Type'>
|
<OperatingSystemSection ovf:id='VM' ovf:required='false'>
|
||||||
<Info>Microsoft Windows 7 Phony Edition</Info>
|
<Info>Microsoft Windows 7 Phony Edition</Info>
|
||||||
<Description>Windows7</Description>
|
<Description>Windows7</Description>
|
||||||
</Section>
|
</OperatingSystemSection>
|
||||||
<Section xsi:type='ovf:VirtualHardwareSection_Type'>
|
<VirtualHardwareSection>
|
||||||
<Info>1 CPU, 1024 Memory</Info>
|
<Info>1 CPU, 1024 Memory</Info>
|
||||||
<Item>
|
<Item>
|
||||||
<rasd:Caption>1 virtual cpu</rasd:Caption>
|
<rasd:Caption>1 virtual cpu</rasd:Caption>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<rasd:InstanceId>VOL</rasd:InstanceId>
|
<rasd:InstanceId>VOL</rasd:InstanceId>
|
||||||
<rasd:ResourceType>17</rasd:ResourceType>
|
<rasd:ResourceType>17</rasd:ResourceType>
|
||||||
<Type>disk</Type>
|
<Type>disk</Type>
|
||||||
<rasd:HostResource>IMAGE/VOL</rasd:HostResource>
|
<rasd:HostResource>VOL</rasd:HostResource>
|
||||||
<rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
|
<rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
|
||||||
<rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
|
<rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
|
||||||
<rasd:ApplicationList/>
|
<rasd:ApplicationList/>
|
||||||
@@ -87,6 +87,6 @@
|
|||||||
<rasd:Name>eth0</rasd:Name>
|
<rasd:Name>eth0</rasd:Name>
|
||||||
<rasd:MACAddress>00:11:22:33:44:55</rasd:MACAddress>
|
<rasd:MACAddress>00:11:22:33:44:55</rasd:MACAddress>
|
||||||
</Item>
|
</Item>
|
||||||
</Section>
|
</VirtualHardwareSection>
|
||||||
</Content>
|
</VirtualSystem>
|
||||||
</ovf:Envelope>
|
</ovf:Envelope>
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ $VG virt-v2v --debug-gc \
|
|||||||
--vdsm-vol-uuid VOL \
|
--vdsm-vol-uuid VOL \
|
||||||
--vdsm-vm-uuid VM \
|
--vdsm-vm-uuid VM \
|
||||||
--vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
|
--vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
|
||||||
--vdsm-compat=1.1
|
--vdsm-compat=1.1 \
|
||||||
|
--vdsm-ovf-flavour=ovirt
|
||||||
|
|
||||||
# Test the OVF metadata was created.
|
# Test the OVF metadata was created.
|
||||||
test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
|
test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
|
||||||
|
|||||||
@@ -759,6 +759,26 @@ hex digit can be C<0-9> or C<a-f>), conforming to S<OSF DCE 1.1>.
|
|||||||
|
|
||||||
These options can only be used with I<-o vdsm>.
|
These options can only be used with I<-o vdsm>.
|
||||||
|
|
||||||
|
=item B<--vdsm-ovf-flavour> flavour
|
||||||
|
|
||||||
|
This option controls the format of the OVF generated at the end of conversion.
|
||||||
|
Currently there are two possible flavours:
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item rhevexp
|
||||||
|
|
||||||
|
The OVF format used in RHV export storage domain.
|
||||||
|
|
||||||
|
=item ovirt
|
||||||
|
|
||||||
|
The OVF format understood by oVirt REST API.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
For backward compatibility the default is I<rhevexp>, but this may change in
|
||||||
|
the future.
|
||||||
|
|
||||||
=item B<-v>
|
=item B<-v>
|
||||||
|
|
||||||
=item B<--verbose>
|
=item B<--verbose>
|
||||||
|
|||||||
Reference in New Issue
Block a user