Skip to content

Commit 475e0b2

Browse files
feat: improve upload a same image to another cluster (#718)
Signed-off-by: PoAn Yang <[email protected]> Co-authored-by: Jillian Maroket <[email protected]>
1 parent fca7709 commit 475e0b2

File tree

4 files changed

+153
-81
lines changed

4 files changed

+153
-81
lines changed

docs/vm/backup-restore.md

+53-29
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,54 @@ Users can now restore a new VM on another cluster by leveraging the VM metadata
9696

9797
#### Upload the same VM images to a new cluster
9898

99+
1. Download the virtual machine image from the existing cluster.
100+
101+
![vm-snapshot.png](/img/v1.5/vm/download-vm-image.png)
102+
103+
1. Decompress the downloaded image.
104+
```
105+
$ gzip -d <image.gz>
106+
```
107+
108+
1. Host the image on a server that is accessible to the new cluster.
109+
110+
Example (simple HTTP server):
111+
```
112+
$ python -m http.server
113+
```
114+
99115
1. Check the existing image name (normally starts with `image-`) and create the same one on the new cluster.
100-
```
101-
$ kubectl get vmimages -A
102-
NAMESPACE NAME DISPLAY-NAME SIZE AGE
103-
default image-79hdq focal-server-cloudimg-amd64.img 566886400 5h36m
104-
default image-l7924 harvester-v1.0.0-rc2-amd64.iso 3964551168 137m
105-
default image-lvqxn opensuse-leap-15.3.x86_64-nocloud.qcow2 568524800 5h35m
106-
```
107-
2. Apply a VM image YAML with the same name and content in the new cluster.
108-
```
109-
$ cat <<EOF | kubectl apply -f -
110-
apiVersion: harvesterhci.io/v1beta1
111-
kind: VirtualMachineImage
112-
metadata:
113-
name: image-lvqxn
114-
namespace: default
115-
spec:
116-
displayName: opensuse-leap-15.3.x86_64-nocloud.qcow2
117-
pvcName: ""
118-
pvcNamespace: ""
119-
sourceType: download
120-
url: http://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.3/images/openSUSE-Leap-15.3.x86_64-NoCloud.qcow2
121-
EOF
122-
```
116+
```
117+
$ kubectl get vmimages -A
118+
NAMESPACE NAME DISPLAY-NAME SIZE AGE
119+
default image-79hdq focal-server-cloudimg-amd64.img 566886400 5h36m
120+
default image-l7924 harvester-v1.0.0-rc2-amd64.iso 3964551168 137m
121+
default image-lvqxn opensuse-leap-15.3.x86_64-nocloud.qcow2 568524800 5h35m
122+
```
123+
124+
1. Apply a `VirtualMachineImage` YAML with the same name and configuration in the new cluster.
125+
126+
Example:
127+
```
128+
$ cat <<EOF | kubectl apply -f -
129+
apiVersion: harvesterhci.io/v1beta1
130+
kind: VirtualMachineImage
131+
metadata:
132+
name: image-79hdq
133+
namespace: default
134+
spec:
135+
displayName: focal-server-cloudimg-amd64.img
136+
pvcName: ""
137+
pvcNamespace: ""
138+
sourceType: download
139+
url: https://<server-ip-to-host-image>:8000/<image-name>
140+
EOF
141+
```
142+
:::info important
143+
144+
Harvester can restore virtual machines only if the image name and configuration on both old and new clusters are identical.
145+
146+
:::
123147

124148
#### Restore a new VM in a new cluster
125149

@@ -233,23 +257,23 @@ Harvester supports the creation of virtual machine backups and snapshots on a sc
233257
- **Type**: Select either **Backup** or **Snapshot**.
234258

235259
- **Namespace** and **Virtual Machine Name**: Specify the namespace and name of the source virtual machine.
236-
260+
237261
- **Cron Schedule**: Specify the cron expression (a string consisting of fields separated by whitespace characters) that defines the schedule properties.
238262

239263
:::info important
240264

241265
The backup or snapshot creation interval must be **at least one hour**. Frequent backup or snapshot deletion results in heavy I/O load.
242266

243267
If two schedules have the same granularity level, each iteration's timing offset must be **at least 10 minutes**.
244-
268+
245269
:::
246270

247271
- **Retain**: Specify the number of up-to-date backups or snapshots to be retained.
248-
272+
249273
When this value is exceeded, the Harvester controller deletes the oldest backups or snapshots, and Longhorn starts the snapshot purge.
250-
274+
251275
- **Max Failure**: Specify the maximum number of consecutive failed backup or snapshot creation attempts to be allowed.
252-
276+
253277
When this value is exceeded, the Harvester controller suspends the schedule.
254278

255279
3. Click **Create**.
@@ -297,7 +321,7 @@ You can suspend active schedules and resume suspended schedules.
297321
![suspend-resume-schedule.png](/img/v1.4/vm/suspend-resume-schedule.png)
298322

299323
The schedule is automatically suspended when the number of consecutive failed backup or snapshot creation attempts exceeds the **Max Failure** value.
300-
324+
301325
Harvester does not allow you to resume a suspended schedule for backup creation if the backup target is not reachable.
302326

303327
:::note
144 KB
Loading

versioned_docs/version-v1.3/vm/backup-restore.md

+47-23
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,54 @@ You must manually configure the virtual machine images with the same name on the
9696

9797
#### Upload the same VM images to a new cluster
9898

99+
1. Download the virtual machine image from the existing cluster.
100+
101+
![vm-snapshot.png](/img/v1.5/vm/download-vm-image.png)
102+
103+
1. Decompress the downloaded image.
104+
```
105+
$ gzip -d <image.gz>
106+
```
107+
108+
1. Host the image on a server that is accessible to the new cluster.
109+
110+
Example (simple HTTP server):
111+
```
112+
$ python -m http.server
113+
```
114+
99115
1. Check the existing image name (normally starts with `image-`) and create the same one on the new cluster.
100-
```
101-
$ kubectl get vmimages -A
102-
NAMESPACE NAME DISPLAY-NAME SIZE AGE
103-
default image-79hdq focal-server-cloudimg-amd64.img 566886400 5h36m
104-
default image-l7924 harvester-v1.0.0-rc2-amd64.iso 3964551168 137m
105-
default image-lvqxn opensuse-leap-15.3.x86_64-nocloud.qcow2 568524800 5h35m
106-
```
107-
2. Apply a VM image YAML with the same name and content in the new cluster.
108-
```
109-
$ cat <<EOF | kubectl apply -f -
110-
apiVersion: harvesterhci.io/v1beta1
111-
kind: VirtualMachineImage
112-
metadata:
113-
name: image-lvqxn
114-
namespace: default
115-
spec:
116-
displayName: opensuse-leap-15.3.x86_64-nocloud.qcow2
117-
pvcName: ""
118-
pvcNamespace: ""
119-
sourceType: download
120-
url: http://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.3/images/openSUSE-Leap-15.3.x86_64-NoCloud.qcow2
121-
EOF
122-
```
116+
```
117+
$ kubectl get vmimages -A
118+
NAMESPACE NAME DISPLAY-NAME SIZE AGE
119+
default image-79hdq focal-server-cloudimg-amd64.img 566886400 5h36m
120+
default image-l7924 harvester-v1.0.0-rc2-amd64.iso 3964551168 137m
121+
default image-lvqxn opensuse-leap-15.3.x86_64-nocloud.qcow2 568524800 5h35m
122+
```
123+
124+
1. Apply a `VirtualMachineImage` YAML with the same name and configuration in the new cluster.
125+
126+
Example:
127+
```
128+
$ cat <<EOF | kubectl apply -f -
129+
apiVersion: harvesterhci.io/v1beta1
130+
kind: VirtualMachineImage
131+
metadata:
132+
name: image-79hdq
133+
namespace: default
134+
spec:
135+
displayName: focal-server-cloudimg-amd64.img
136+
pvcName: ""
137+
pvcNamespace: ""
138+
sourceType: download
139+
url: https://<server-ip-to-host-image>:8000/<image-name>
140+
EOF
141+
```
142+
:::info important
143+
144+
Harvester can restore virtual machines only if the image name and configuration on both old and new clusters are identical.
145+
146+
:::
123147

124148
#### Restore a new VM in a new cluster
125149

versioned_docs/version-v1.4/vm/backup-restore.md

+53-29
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,54 @@ Users can now restore a new VM on another cluster by leveraging the VM metadata
9696

9797
#### Upload the same VM images to a new cluster
9898

99+
1. Download the virtual machine image from the existing cluster.
100+
101+
![vm-snapshot.png](/img/v1.5/vm/download-vm-image.png)
102+
103+
1. Decompress the downloaded image.
104+
```
105+
$ gzip -d <image.gz>
106+
```
107+
108+
1. Host the image on a server that is accessible to the new cluster.
109+
110+
Example (simple HTTP server):
111+
```
112+
$ python -m http.server
113+
```
114+
99115
1. Check the existing image name (normally starts with `image-`) and create the same one on the new cluster.
100-
```
101-
$ kubectl get vmimages -A
102-
NAMESPACE NAME DISPLAY-NAME SIZE AGE
103-
default image-79hdq focal-server-cloudimg-amd64.img 566886400 5h36m
104-
default image-l7924 harvester-v1.0.0-rc2-amd64.iso 3964551168 137m
105-
default image-lvqxn opensuse-leap-15.3.x86_64-nocloud.qcow2 568524800 5h35m
106-
```
107-
2. Apply a VM image YAML with the same name and content in the new cluster.
108-
```
109-
$ cat <<EOF | kubectl apply -f -
110-
apiVersion: harvesterhci.io/v1beta1
111-
kind: VirtualMachineImage
112-
metadata:
113-
name: image-lvqxn
114-
namespace: default
115-
spec:
116-
displayName: opensuse-leap-15.3.x86_64-nocloud.qcow2
117-
pvcName: ""
118-
pvcNamespace: ""
119-
sourceType: download
120-
url: http://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.3/images/openSUSE-Leap-15.3.x86_64-NoCloud.qcow2
121-
EOF
122-
```
116+
```
117+
$ kubectl get vmimages -A
118+
NAMESPACE NAME DISPLAY-NAME SIZE AGE
119+
default image-79hdq focal-server-cloudimg-amd64.img 566886400 5h36m
120+
default image-l7924 harvester-v1.0.0-rc2-amd64.iso 3964551168 137m
121+
default image-lvqxn opensuse-leap-15.3.x86_64-nocloud.qcow2 568524800 5h35m
122+
```
123+
124+
1. Apply a `VirtualMachineImage` YAML with the same name and configuration in the new cluster.
125+
126+
Example:
127+
```
128+
$ cat <<EOF | kubectl apply -f -
129+
apiVersion: harvesterhci.io/v1beta1
130+
kind: VirtualMachineImage
131+
metadata:
132+
name: image-79hdq
133+
namespace: default
134+
spec:
135+
displayName: focal-server-cloudimg-amd64.img
136+
pvcName: ""
137+
pvcNamespace: ""
138+
sourceType: download
139+
url: https://<server-ip-to-host-image>:8000/<image-name>
140+
EOF
141+
```
142+
:::info important
143+
144+
Harvester can restore virtual machines only if the image name and configuration on both old and new clusters are identical.
145+
146+
:::
123147

124148
#### Restore a new VM in a new cluster
125149

@@ -233,23 +257,23 @@ Harvester supports the creation of virtual machine backups and snapshots on a sc
233257
- **Type**: Select either **Backup** or **Snapshot**.
234258

235259
- **Namespace** and **Virtual Machine Name**: Specify the namespace and name of the source virtual machine.
236-
260+
237261
- **Cron Schedule**: Specify the cron expression (a string consisting of fields separated by whitespace characters) that defines the schedule properties.
238262

239263
:::info important
240264

241265
The backup or snapshot creation interval must be **at least one hour**. Frequent backup or snapshot deletion results in heavy I/O load.
242266

243267
If two schedules have the same granularity level, each iteration's timing offset must be **at least 10 minutes**.
244-
268+
245269
:::
246270

247271
- **Retain**: Specify the number of up-to-date backups or snapshots to be retained.
248-
272+
249273
When this value is exceeded, the Harvester controller deletes the oldest backups or snapshots, and Longhorn starts the snapshot purge.
250-
274+
251275
- **Max Failure**: Specify the maximum number of consecutive failed backup or snapshot creation attempts to be allowed.
252-
276+
253277
When this value is exceeded, the Harvester controller suspends the schedule.
254278

255279
3. Click **Create**.
@@ -297,7 +321,7 @@ You can suspend active schedules and resume suspended schedules.
297321
![suspend-resume-schedule.png](/img/v1.4/vm/suspend-resume-schedule.png)
298322

299323
The schedule is automatically suspended when the number of consecutive failed backup or snapshot creation attempts exceeds the **Max Failure** value.
300-
324+
301325
Harvester does not allow you to resume a suspended schedule for backup creation if the backup target is not reachable.
302326

303327
:::note

0 commit comments

Comments
 (0)