Skip to content

Commit bb05bce

Browse files
authored
F OpenNebula/one-swap#34: Docs for OVA import
Signed-off-by: Alejandro Mosteiro <[email protected]>
1 parent e53bce9 commit bb05bce

File tree

5 files changed

+208
-0
lines changed

5 files changed

+208
-0
lines changed

source/ext/spellchecking/wordlists/opennebula.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ disksnapshotcreate
323323
disksnapshotdelete
324324
disksnapshotrename
325325
disksnapshotrevert
326+
distro
326327
dns
327328
dockerfile
328329
dockerfiles
@@ -347,6 +348,7 @@ eth
347348
ethernet
348349
etime
349350
ev
351+
exe
350352
externalToken
351353
extraConfig
352354
extraconfig
@@ -535,6 +537,7 @@ onemarketapp
535537
oneprovision
536538
onesecgroup
537539
oneshowback
540+
oneswap
538541
onetemplate
539542
oneuser
540543
onevcenter
@@ -561,6 +564,7 @@ overcommitted
561564
overcommitting
562565
overprovision
563566
overriden
567+
ovf
564568
ovmf
565569
ovswitch
566570
parallelize
@@ -626,6 +630,7 @@ resched
626630
resetserver
627631
restic
628632
resubmission
633+
rhsrvany
629634
rke
630635
rmar
631636
roleadd
@@ -656,6 +661,7 @@ scsi
656661
sd
657662
sdb
658663
sdc
664+
sdX
659665
seSparse
660666
secgroup
661667
secgrouppool
@@ -688,6 +694,7 @@ storages
688694
stunnel
689695
subcommand
690696
subcommands
697+
subdir
691698
subdirectories
692699
subfolder
693700
subfolders
@@ -836,6 +843,7 @@ wr
836843
writeback
837844
writethrough
838845
wss
846+
Xen
839847
xfs
840848
xml
841849
xmlrpc

source/marketplace/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ A Marketplace stores Marketplace Appliances. A MarketPlace Appliance includes on
2121
Private Marketplaces <private_marketplaces/index>
2222
Managing Marketplaces in Sunstone <sunstone_marketplaces/index>
2323
Appliances <appliances/index>
24+
OVA Management <ova_management/index>
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
.. _import_ova:
2+
3+
================
4+
OVA Import
5+
================
6+
7+
Requirements
8+
================================================================================
9+
10+
The import tool will assume that the provided OVA has been exported from a VMware environment, user must make sure that the provided OVA is compatible with VMware environments. Other sources are currently not supported (i.e. Xen or VirtualBox).
11+
12+
When converting an OVA you will need enough space both in the ``/tmp`` folder and in the destination DS where the disk images are going to be imported.
13+
14+
Windows VirtIO drivers
15+
--------------------------------------------------------------------------------
16+
17+
Before converting Windows VMs, download the required VirtIO drivers for the Windows VM distribution. These drivers can be downloaded from the `virtio-win repository <https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md>`__.
18+
19+
.. note:: The converted VM will reboot several times after instantiation in order to install and configure the VirtIO drivers.
20+
21+
Usage
22+
================================================================================
23+
24+
It is possible to specify the target Datastore and VNET for the OVA to be imported. Refer to ``man oneswap`` for the complete documentation of the oneswap command. Available options for the ``oneswap import`` command are:
25+
26+
+--------------------------------------------+-----------------------------------------------------------------------+
27+
| Parameter | Description |
28+
+============================================+=======================================================================+
29+
| ``--ova file.ova | /path/to/ovf/files/`` | Path to the OVA file or folder containing the OVF files. |
30+
+--------------------------------------------+-----------------------------------------------------------------------+
31+
| ``--datastore name | ID`` | Name/ID of the Datastore to store the new Image. Accepts one or more |
32+
| | Datastores (i.e. ``--datastore 101,102``). When more than one |
33+
| | Datastore is provided, each disk will be allocated in a different one.|
34+
+--------------------------------------------+-----------------------------------------------------------------------+
35+
| ``--network name | ID`` | Name/ID of the VNET to assign in the VM Template. Accepts one or more |
36+
| | VNETs (i.e. ``--network 0,1``). When more than one VNET is provided, |
37+
| | each interface from the OVA will be assigned to each VNET. |
38+
+--------------------------------------------+-----------------------------------------------------------------------+
39+
| ``--virtio /path/to/virtio.iso`` | Path to the ISO file with the VirtIO drivers for the Windows version. |
40+
+--------------------------------------------+-----------------------------------------------------------------------+
41+
42+
If multiple network interfaces are detected when importing an OVA and only one VNET ID or not enough VNET IDs are provided for all interfaces, using ``--network ID``, the last one will be used for the rest of the interfaces after the last coincidence. The same will apply to Datastores using the ``--datastore ID`` option.
43+
44+
Example on importing OVF
45+
--------------------------------------------------------------------------------
46+
47+
Example command on how to import an OVF using the Datastore ID 101 and VNET ID 1:
48+
49+
.. prompt:: text $ auto
50+
51+
$ oneswap import --ova /ovas/vm-alma9/ --datastore 101 --network 1
52+
Running: virt-v2v -v --machine-readable -i ova /ovas/vm-alma9/ -o local -os /tmp/vm-alma9/conversions/ -of qcow2 --root=first
53+
54+
Setting up the source: -i ova /home/onepoc/ovas/vm-alma9/
55+
56+
(...)
57+
58+
$ onetemplate list
59+
ID USER GROUP NAME REGTIME
60+
63 onepoc oneadmin vm-alma9 03/24 16:34:34
61+
62+
$ onetemplate instantiate 63
63+
VM ID: 103
64+
65+
Example on importing OVA with multiple DS and VNET
66+
--------------------------------------------------------------------------------
67+
68+
The source OVA has two disks and two NICs, as it can be seen from the .ovf file:
69+
70+
.. prompt:: text $ auto
71+
72+
<DiskSection>
73+
<Info>List of the virtual disks</Info>
74+
<Disk ovf:capacityAllocationUnits="byte" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:diskId="vmdisk1" ovf:capacity="8589934592" ovf:fileRef="file1"/>
75+
<Disk ovf:capacityAllocationUnits="byte" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:diskId="vmdisk2" ovf:capacity="2147483648" ovf:fileRef="file2"/>
76+
</DiskSection>
77+
<NetworkSection>
78+
<Info>The list of logical networks</Info>
79+
<Network ovf:name="VM Network 0">
80+
<Description>The VM Network 0 network</Description>
81+
</Network>
82+
<Network ovf:name="VM Network 1">
83+
<Description>The VM Network 1 network</Description>
84+
</Network>
85+
</NetworkSection>
86+
87+
Example command on how to import an OVA with two disks and two network interfaces, importing each disk to a different Datastore and assigning each NIC to a different VNET:
88+
89+
.. prompt:: text $ auto
90+
91+
$ oneswap import --ova /home/onepoc/ovas/ubuntu2404.ova --datastore 1,101 --network 1,0
92+
Running: virt-v2v -v --machine-readable -i ova /home/onepoc/ovas/ubuntu2404.ova -o local -os /tmp/ubuntu2404/conversions/ -of qcow2 --root=first
93+
94+
Setting up the source: -i ova /home/onepoc/ovas/ubuntu2404.ova
95+
96+
(...)
97+
98+
$ onetemplate list
99+
ID USER GROUP NAME REGTIME
100+
101 onepoc oneadmin ubuntu2404 04/10 12:55:03
101+
102+
The OS Image is imported in Datastore 1 and the Datablock Image is imported in Datastore 101, and the VM Template has one NIC using VNET 1 and a second NIC using VNET 0.
103+
104+
.. prompt:: text $ auto
105+
106+
$ oneimage list
107+
ID USER GROUP NAME DATASTORE SIZE TYPE PER STAT RVMS
108+
151 onepoc oneadmin ubuntu2404_1 NFS image 2G DB No rdy 0
109+
150 onepoc oneadmin ubuntu2404_0 default 8G OS No rdy 0
110+
111+
$ onetemplate show 101 | grep NIC -A 1
112+
NIC=[
113+
NETWORK_ID="1" ]
114+
NIC=[
115+
NETWORK_ID="0" ]
116+
117+
Context injection
118+
================================================================================
119+
120+
OneSwap will detect the guest operating system and try to inject the context packages available from the `one-apps <https://github.com/opennebula/one-apps>`__ repository.
121+
122+
Context injection will be performed following these steps:
123+
124+
1. Install context using package manager for the distro. However, this step may fail and trigger the execution of the fallback context installation command:
125+
126+
.. prompt:: text $ auto
127+
128+
Inspecting disk...Done (3.92s)
129+
Injecting one-context...Running: virt-customize -q -a /tmp/vm-alma9/conversions/vm-alma9-sda --run-command 'subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms' --run-command 'yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' --copy-in /var/lib/one/context//one-context-6.10.0-3.el9.noarch.rpm:/tmp --install /tmp/one-context-6.10.0-3.el9.noarch.rpm --delete /tmp/one-context-6.10.0-3.el9.noarch.rpm --run-command 'systemctl enable NetworkManager.service || exit 0'
130+
Failed (6.31s)
131+
132+
2. Context will be installed using a fallback method of copying the context packages into the guest OS and installing it on the first boot in case the previous step fails. Sometimes it will be necessary to boot twice in order for this method to work.
133+
134+
.. prompt:: text $ auto
135+
136+
Running: virt-customize -q -a /tmp/vm-alma9/conversions/vm-alma9-sda --firstboot-install epel-release --copy-in /var/lib/one/context//one-context-6.10.0-3.el9.noarch.rpm:/tmp --firstboot-install /tmp/one-context-6.10.0-3.el9.noarch.rpm --run-command 'systemctl enable network.service || exit 0'
137+
Success (42.24s)
138+
Context will install on first boot, you may need to boot it twice.
139+
140+
.. note:: If context injection does not work after importing, it is also possible to install one-context **before exporting the OVA** from VMware using the packages available in the one-apps repository and uninstalling VMware Tools. In this case it is important to be aware that the one-context service will get rid of any manual network configurations done to the guest OS and the VM won't be able to get the network configuration from VMware anymore.
141+
142+
Additional virt-v2v options
143+
================================================================================
144+
145+
The following parameters can be tuned for virt-v2v, defaults will be applied if no options are provided.
146+
147+
+--------------------------------------------+-----------------------------------------------------------------------+
148+
| Parameter | Description |
149+
+============================================+=======================================================================+
150+
| ``--v2v-path /path/to/ovf/files/`` | Path to the OVA file or folder containing the OVF files. |
151+
| | Default: virt-v2v |
152+
+--------------------------------------------+-----------------------------------------------------------------------+
153+
| ``--work-dir | -w /path/to/work/dir`` | Directory where disk conversion takes place, will make subdir for each|
154+
| | VM. Default: /tmp |
155+
+--------------------------------------------+-----------------------------------------------------------------------+
156+
| ``--format | -f name [ qcow2 | raw]`` | Disk format [ qcow2 | raw ]. |
157+
| | Default: qcow2 |
158+
+--------------------------------------------+-----------------------------------------------------------------------+
159+
| ``--virtio /path/to/iso`` | Full path of the win-virtio ISO file. Required to inject VirtIO |
160+
| | drivers to Windows Guests. |
161+
+--------------------------------------------+-----------------------------------------------------------------------+
162+
| ``--win-qemu-ga /path/to/iso`` | Install QEMU Guest Agent to a Windows guest. |
163+
+--------------------------------------------+-----------------------------------------------------------------------+
164+
| ``--qemu-ga`` | Install qemu-guest-agent package to a Linux guest, useful with |
165+
| | --custom or --fallback. |
166+
+--------------------------------------------+-----------------------------------------------------------------------+
167+
| ``--delete-after`` | Removes the leftover conversion directory in the working directory |
168+
| | which contains the converted VM disks and descriptor files. |
169+
+--------------------------------------------+-----------------------------------------------------------------------+
170+
| ``--vddk /path/to/vddk/`` | Full path to the VDDK library, required for VDDK based transfer. |
171+
+--------------------------------------------+-----------------------------------------------------------------------+
172+
| ``--virt-tools /path/to/virt-tools`` | Path to the directory containing rhsrvany.exe, defaults to |
173+
| | /usr/local/share/virt-tools. See https://github.com/rwmjones/rhsrvany.|
174+
+--------------------------------------------+-----------------------------------------------------------------------+
175+
| ``--root option`` | Choose the root filesystem to be converted. Can be ask, single, first |
176+
| | or /dev/sdX. |
177+
+--------------------------------------------+-----------------------------------------------------------------------+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. _ova_management:
2+
3+
====================
4+
OVA Management
5+
====================
6+
7+
.. toctree::
8+
:maxdepth: 2
9+
10+
Overview <overview>
11+
OVA Import <import_ova>
12+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _ova_management_overview:
2+
3+
====================
4+
Overview
5+
====================
6+
7+
OpenNebula supports importing OVAs that have been exported from vCenter / ESXi environments, generating the necessary VM Template and Images.
8+
9+
It is possible to import `.ova` files or a folder containing the OVF files (VMDK disk files and manifest file in `.ovf` format). The import tool will inject context packages in the target Images, automatically detecting the guest operating system.
10+

0 commit comments

Comments
 (0)