Skip to content

Commit 413161f

Browse files
committed
docs: document full VM import spec
- Document the full VM import spec, i.e. all properties of the VirtualMachineImport CRD by giving appropriate examples. - Put examples for OpenStack and VMWare in tabs - Fix whitespaces and long lines Signed-off-by: Moritz Röhrich <[email protected]>
1 parent 19cf378 commit 413161f

File tree

1 file changed

+83
-48
lines changed

1 file changed

+83
-48
lines changed

docs/advanced/addons/vmimport.md

Lines changed: 83 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,49 @@ title: "VM Import"
1010

1111
_Available as of v1.1.0_
1212

13-
Beginning with v1.1.0, users can import their virtual machines from VMWare and OpenStack into Harvester.
13+
Beginning with v1.1.0, users can import their virtual machines from VMWare and
14+
OpenStack into Harvester.
1415

1516
This is accomplished using the vm-import-controller addon.
1617

17-
To use the VM Import feature, users need to enable the vm-import-controller addon.
18+
To use the VM Import feature, users need to enable the vm-import-controller
19+
addon.
1820

1921
![](/img/v1.2/vm-import-controller/EnableAddon.png)
2022

21-
By default, vm-import-controller leverages ephemeral storage, which is mounted from /var/lib/kubelet.
23+
By default, vm-import-controller leverages ephemeral storage, which is mounted
24+
from /var/lib/kubelet.
2225

23-
During the migration, a large VM's node could run out of space on this mount, resulting in subsequent scheduling failures.
26+
During the migration, a large VM's node could run out of space on this mount,
27+
resulting in subsequent scheduling failures.
2428

25-
To avoid this, users are advised to enable PVC-backed storage and customize the amount of storage needed. According to the best practice, the PVC size should be twice the size of the largest VM being migrated. This is essential as the PVC is used as scratch space to download the VM, and convert the disks into raw image files.
29+
To avoid this, users are advised to enable PVC-backed storage and customize the
30+
amount of storage needed. According to the best practice, the PVC size should be
31+
twice the size of the largest VM being migrated. This is essential as the PVC is
32+
used as scratch space to download the VM, and convert the disks into raw image
33+
files.
2634

2735
![](/img/v1.2/vm-import-controller/ConfigureAddon.png)
2836

2937
## vm-import-controller
3038

3139
Currently, the following source providers are supported:
40+
3241
* VMWare
3342
* OpenStack
3443

3544
## API
45+
3646
The vm-import-controller introduces two CRDs.
3747

3848
### Sources
49+
3950
Sources allow users to define valid source clusters.
4051

4152
For example:
4253

54+
<Tabs>
55+
<TabItem value="vmware" label="VMWare" default>
4356
```yaml
4457
apiVersion: migration.harvesterhci.io/v1beta1
4558
kind: VmwareSource
@@ -59,24 +72,27 @@ The secret contains the credentials for the vCenter endpoint:
5972
```yaml
6073
apiVersion: v1
6174
kind: Secret
62-
metadata:
75+
metadata:
6376
name: vsphere-credentials
6477
namespace: default
6578
stringData:
6679
"username": "user"
6780
"password": "password"
6881
```
6982
70-
As part of the reconciliation process, the controller will log into vCenter and verify whether the `dc` specified in the source spec is valid.
83+
As part of the reconciliation process, the controller will log into vCenter and
84+
verify whether the `dc` specified in the source spec is valid.
7185

72-
Once this check is passed, the source is marked as ready and can be used for VM migrations.
86+
Once this check is passed, the source is marked as ready and can be used for VM
87+
migrations.
7388

7489
```shell
75-
$ kubectl get vmwaresource.migration
90+
$ kubectl get vmwaresource.migration
7691
NAME STATUS
7792
vcsim clusterReady
7893
```
79-
94+
</TabItem>
95+
<TabItem value="openstack" label="OpenStack">
8096
For OpenStack-based source clusters, an example definition is as follows:
8197

8298
```yaml
@@ -98,7 +114,7 @@ The secret contains the credentials for the OpenStack endpoint:
98114
```yaml
99115
apiVersion: v1
100116
kind: Secret
101-
metadata:
117+
metadata:
102118
name: devstack-credentials
103119
namespace: default
104120
stringData:
@@ -109,79 +125,98 @@ stringData:
109125
"ca_cert": "pem-encoded-ca-cert"
110126
```
111127

112-
The OpenStack source reconciliation process attempts to list VMs in the project and marks the source as ready.
128+
The OpenStack source reconciliation process attempts to list VMs in the project
129+
and marks the source as ready.
113130

114131
```shell
115132
$ kubectl get opestacksource.migration
116133
NAME STATUS
117134
devstack clusterReady
118135
```
136+
</TabItem>
137+
</Tabs>
119138

120139
### VirtualMachineImport
121-
The VirtualMachineImport CRD provides a way for users to define a source VM and map to the actual source cluster to perform VM export/import.
140+
141+
The VirtualMachineImport CRD provides a way for users to define a source VM and
142+
map to the actual source cluster to perform VM export/import.
122143

123144
A sample VirtualMachineImport looks like this:
124145

146+
<Tabs>
147+
<TabItem value="vmware" label="VMWare" default>
125148
```yaml
126149
apiVersion: migration.harvesterhci.io/v1beta1
127150
kind: VirtualMachineImport
128151
metadata:
129152
name: alpine-export-test
130153
namespace: default
131-
spec:
154+
spec:
132155
virtualMachineName: "alpine-export-test"
156+
folder: "/vm-foler"
133157
networkMapping:
134-
- sourceNetwork: "dvSwitch 1"
135-
destinationNetwork: "default/vlan1"
136-
- sourceNetwork: "dvSwitch 2"
137-
destinationNetwork: "default/vlan2"
138-
sourceCluster:
158+
- sourceNetwork: "dvSwitch 1"
159+
destinationNetwork: "default/vlan1"
160+
- sourceNetwork: "dvSwitch 2"
161+
destinationNetwork: "default/vlan2"
162+
sourceCluster:
139163
name: vcsim
140164
namespace: default
141165
kind: VmwareSource
142166
apiVersion: migration.harvesterhci.io/v1beta1
167+
storageClass: "harvester-longhorn"
143168
```
144169

145-
This will trigger the controller to export the VM named "alpine-export-test" on the VMWare source cluster to be exported, processed and recreated into the harvester cluster
146-
147-
This can take a while based on the size of the virtual machine, but users should see `VirtualMachineImages` created for each disk in the defined virtual machine.
148-
149-
The list of items in `networkMapping` will define how the source network interfaces are mapped to the Harvester Networks.
150-
151-
If a match is not found, each unmatched network interface is attached to the default `managementNetwork`.
152-
153-
Once the virtual machine has been imported successfully, the object will reflect the status:
154-
155-
```shell
156-
$ kubectl get virtualmachineimport.migration
157-
NAME STATUS
158-
alpine-export-test virtualMachineRunning
159-
openstack-cirros-test virtualMachineRunning
160-
161-
```
162-
163-
Similarly, users can define a VirtualMachineImport for an OpenStack source as well:
164-
170+
This will trigger the controller to export the VM named "alpine-export-test"
171+
from the folder "/vm-folder" on the VMWare source cluster to be exported,
172+
processed and recreated into the harvester cluster
173+
</TabItem>
174+
<TabItem value="openstack" label="OpenStack">
165175
```yaml
166176
apiVersion: migration.harvesterhci.io/v1beta1
167177
kind: VirtualMachineImport
168178
metadata:
169179
name: openstack-demo
170180
namespace: default
171-
spec:
181+
spec:
172182
virtualMachineName: "openstack-demo" #Name or UUID for instance
183+
folder: "/vm-folder"
173184
networkMapping:
174-
- sourceNetwork: "shared"
175-
destinationNetwork: "default/vlan1"
176-
- sourceNetwork: "public"
177-
destinationNetwork: "default/vlan2"
178-
sourceCluster:
185+
- sourceNetwork: "shared"
186+
destinationNetwork: "default/vlan1"
187+
- sourceNetwork: "public"
188+
destinationNetwork: "default/vlan2"
189+
sourceCluster:
179190
name: devstack
180191
namespace: default
181192
kind: OpenstackSource
182193
apiVersion: migration.harvesterhci.io/v1beta1
194+
storageClass: "harvester-longhorn"
183195
```
184196

185-
:::note
186-
OpenStack allows users to have multiple instances with the same name. In such a scenario, users are advised to use the Instance ID. The reconciliation logic tries to perform a name-to-ID lookup when a name is used.
187-
:::
197+
:::note
198+
OpenStack allows users to have multiple instances with the same name. In such a
199+
scenario, users are advised to use the Instance ID. The reconciliation logic
200+
tries to perform a name-to-ID lookup when a name is used.
201+
:::
202+
</TabItem>
203+
</Tabs>
204+
205+
This can take a while based on the size of the virtual machine, but users should
206+
see `VirtualMachineImages` created for each disk in the defined virtual machine.
207+
208+
The list of items in `networkMapping` will define how the source network
209+
interfaces are mapped to the Harvester Networks.
210+
211+
If a match is not found, each unmatched network interface is attached to the
212+
default `managementNetwork`.
213+
214+
Once the virtual machine has been imported successfully, the object will reflect
215+
the status:
216+
217+
```shell
218+
$ kubectl get virtualmachineimport.migration
219+
NAME STATUS
220+
alpine-export-test virtualMachineRunning
221+
openstack-cirros-test virtualMachineRunning
222+
```

0 commit comments

Comments
 (0)