You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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]>
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.
22
25
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.
24
28
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
Currently, the following source providers are supported:
40
+
32
41
* VMWare
33
42
* OpenStack
34
43
35
44
## API
45
+
36
46
The vm-import-controller introduces two CRDs.
37
47
38
48
### Sources
49
+
39
50
Sources allow users to define valid source clusters.
40
51
41
52
For example:
42
53
54
+
<Tabs>
55
+
<TabItemvalue="vmware"label="VMWare"default>
56
+
43
57
```yaml
44
58
apiVersion: migration.harvesterhci.io/v1beta1
45
59
kind: VmwareSource
@@ -59,24 +73,27 @@ The secret contains the credentials for the vCenter endpoint:
59
73
```yaml
60
74
apiVersion: v1
61
75
kind: Secret
62
-
metadata:
76
+
metadata:
63
77
name: vsphere-credentials
64
78
namespace: default
65
79
stringData:
66
80
"username": "user"
67
81
"password": "password"
68
82
```
69
83
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.
84
+
As part of the reconciliation process, the controller will log into vCenter and
85
+
verify whether the `dc` specified in the source spec is valid.
71
86
72
-
Once this check is passed, the source is marked as ready and can be used for VM migrations.
87
+
Once this check is passed, the source is marked as ready and can be used for VM
88
+
migrations.
73
89
74
90
```shell
75
-
$ kubectl get vmwaresource.migration
91
+
$ kubectl get vmwaresource.migration
76
92
NAME STATUS
77
93
vcsim clusterReady
78
94
```
79
-
95
+
</TabItem>
96
+
<TabItem value="openstack" label="OpenStack">
80
97
For OpenStack-based source clusters, an example definition is as follows:
81
98
82
99
```yaml
@@ -98,7 +115,7 @@ The secret contains the credentials for the OpenStack endpoint:
98
115
```yaml
99
116
apiVersion: v1
100
117
kind: Secret
101
-
metadata:
118
+
metadata:
102
119
name: devstack-credentials
103
120
namespace: default
104
121
stringData:
@@ -109,79 +126,100 @@ stringData:
109
126
"ca_cert": "pem-encoded-ca-cert"
110
127
```
111
128
112
-
The OpenStack source reconciliation process attempts to list VMs in the project and marks the source as ready.
129
+
The OpenStack source reconciliation process attempts to list VMs in the project
130
+
and marks the source as ready.
113
131
114
132
```shell
115
133
$ kubectl get opestacksource.migration
116
134
NAME STATUS
117
135
devstack clusterReady
118
136
```
137
+
</TabItem>
138
+
</Tabs>
119
139
120
140
### 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.
141
+
142
+
The VirtualMachineImport CRD provides a way for users to define a source VM and
143
+
map to the actual source cluster to perform VM export/import.
122
144
123
145
A sample VirtualMachineImport looks like this:
124
146
147
+
<Tabs>
148
+
<TabItem value="vmware" label="VMWare" default>
149
+
125
150
```yaml
126
151
apiVersion: migration.harvesterhci.io/v1beta1
127
152
kind: VirtualMachineImport
128
153
metadata:
129
154
name: alpine-export-test
130
155
namespace: default
131
-
spec:
156
+
spec:
132
157
virtualMachineName: "alpine-export-test"
158
+
folder: "/vm-foler"
133
159
networkMapping:
134
-
- sourceNetwork: "dvSwitch 1"
135
-
destinationNetwork: "default/vlan1"
136
-
- sourceNetwork: "dvSwitch 2"
137
-
destinationNetwork: "default/vlan2"
138
-
sourceCluster:
160
+
- sourceNetwork: "dvSwitch 1"
161
+
destinationNetwork: "default/vlan1"
162
+
- sourceNetwork: "dvSwitch 2"
163
+
destinationNetwork: "default/vlan2"
164
+
sourceCluster:
139
165
name: vcsim
140
166
namespace: default
141
167
kind: VmwareSource
142
168
apiVersion: migration.harvesterhci.io/v1beta1
169
+
storageClass: "harvester-longhorn"
143
170
```
144
171
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:
172
+
This will trigger the controller to export the VM named "alpine-export-test"
173
+
from the folder "/vm-folder" on the VMWare source cluster to be exported,
174
+
processed and recreated into the harvester cluster
175
+
</TabItem>
176
+
<TabItem value="openstack" label="OpenStack">
164
177
165
178
```yaml
166
179
apiVersion: migration.harvesterhci.io/v1beta1
167
180
kind: VirtualMachineImport
168
181
metadata:
169
182
name: openstack-demo
170
183
namespace: default
171
-
spec:
184
+
spec:
172
185
virtualMachineName: "openstack-demo" #Name or UUID for instance
186
+
folder: "/vm-folder"
173
187
networkMapping:
174
-
- sourceNetwork: "shared"
175
-
destinationNetwork: "default/vlan1"
176
-
- sourceNetwork: "public"
177
-
destinationNetwork: "default/vlan2"
178
-
sourceCluster:
188
+
- sourceNetwork: "shared"
189
+
destinationNetwork: "default/vlan1"
190
+
- sourceNetwork: "public"
191
+
destinationNetwork: "default/vlan2"
192
+
sourceCluster:
179
193
name: devstack
180
194
namespace: default
181
195
kind: OpenstackSource
182
196
apiVersion: migration.harvesterhci.io/v1beta1
197
+
storageClass: "harvester-longhorn"
183
198
```
184
199
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
-
:::
200
+
:::note
201
+
OpenStack allows users to have multiple instances with the same name. In such a
202
+
scenario, users are advised to use the Instance ID. The reconciliation logic
203
+
tries to perform a name-to-ID lookup when a name is used.
204
+
:::
205
+
</TabItem>
206
+
</Tabs>
207
+
208
+
This can take a while based on the size of the virtual machine, but users should
209
+
see `VirtualMachineImages` created for each disk in the defined virtual machine.
210
+
211
+
The list of items in `networkMapping` will define how the source network
212
+
interfaces are mapped to the Harvester Networks.
213
+
214
+
If a match is not found, each unmatched network interface is attached to the
215
+
default `managementNetwork`.
216
+
217
+
Once the virtual machine has been imported successfully, the object will reflect
0 commit comments