Restore to KubeVirt Virtual Machine Examples

CommunityEnterprise

Restore a Virtual Machine using a Different Name

To restore KubeVirt VM to a Kubernetes cluster, the administrator should execute the restore command and specify the where parameter as in this example:

* restore where=/

and then set any other required restore plugin parameters for the restore.

*restore jobid=1 where=/
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
You have selected the following JobId: 1

Building directory tree for JobId(s) 1 ...  +++++++++++++++++++++++++++++++++++++++++++++++++
443 files inserted into the tree.

You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.

cwd is: /
$ mark *
109 files marked.
$ done
Bootstrap records written to /opt/bacula/working/bacula-devel-dir.restore.1.bsr
The Job will require the following (*=>InChanger):
Volume(s)                 Storage(s)                SD Device(s)
===========================================================================

    Vol-0001                  File1                     FileStorage1

Volumes marked with "*" are in the Autochanger.


109 files selected to be restored.

Automatically selected Client: bacula-devel-fd
Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /opt/bacula/working/bacula-devel-dir.restore.1.bsr
Where:           /
Replace:         Always
FileSet:         Full Set
Backup Client:   bacula-devel-fd
Restore Client:  bacula-devel-fd
Storage:         File1
When:            2025-04-01 13:34:48
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (Yes/mod/no): mod
Parameters to modify:
    1: Level
    2: Storage
    3: Job
    4: FileSet
    5: Restore Client
    6: When
    7: Priority
    8: Bootstrap
    9: Where
    10: File Relocation
    11: Replace
    12: JobId
    13: Plugin Options
Select parameter to modify (1-13): 13
Automatically selected : kubernetes: debug=2 config='/home/fmgb/.kube/config'  fdkeyfile=/tmp/snakeoil.key
fdcertfile=/tmp/snakeoil.pem  pluginhost=192.168.1.84  crconfig=0 crbconfig=0 scconfig=0 pvconfig=0
namespace=testing-ns-0015-1 baculaimage=bacula-backup:25Mar25 imagepullpolicy=Always
virtual_machine=test-n1-vm-from-instance-0015-1 security_context=yes compression_in_container=gzip
Plugin Restore Options
Option                         Current Value        Default Value
config:                        *None*               (*None*)
host:                          *None*               (*None*)
token:                         *None*               (*None*)
verify_ssl:                    *None*               (True)
ssl_ca_cert:                   *None*               (*None*)
outputformat:                  *None*               (RAW)
fdaddress:                     *None*               (*FDAddress*)
fdport:                        *None*               (9104)
pluginhost:                    *None*               (*FDAddress*)
pluginport:                    *None*               (9104)
new_namespace:                 *None*               (*None*)
new_name:                      *None*               (*None*)
new_storageclass:              *None*               (*None*)
debug:                         *None*               (*None*)
mac_address:                   *None*               (keep)
run_after_restore:             *None*               (False)
Use above plugin configuration? (Yes/mod/no): mod
You have the following choices:
    1: config (K8S config file)
    2: host (K8S API server URL/Host)
    3: token (K8S Bearertoken)
    4: verify_ssl (K8S API server cert verification)
    5: ssl_ca_cert (Custom CA Certs file to use)
    6: outputformat (Output format when saving to file (JSON, YAML))
    7: fdaddress (The address for listen to incoming backup pod data)
    8: fdport (The port for opening socket for listen)
    9: pluginhost (The endpoint address for backup pod to connect)
    10: pluginport (The endpoint port to connect)
    11: new_namespace (The namespace where the resources will be restored)
    12: new_name (The new name of restored resource)
    13: new_storageclass (The storageclass that will be applied in pvc restores)
    14: debug (Set debug (0,1,2,3) in restore)
    15: mac_address (Set MAC address in restored vm (new, keep, MAC))
    16: run_after_restore (Run restored vm after restore(yes,no))
Select parameter to modify (1-16): 15
Please enter a value for mac_address: new
Plugin Restore Options
Option                         Current Value        Default Value
config:                        *None*               (*None*)
host:                          *None*               (*None*)
token:                         *None*               (*None*)
verify_ssl:                    *None*               (True)
ssl_ca_cert:                   *None*               (*None*)
outputformat:                  *None*               (RAW)
fdaddress:                     *None*               (*FDAddress*)
fdport:                        *None*               (9104)
pluginhost:                    *None*               (*FDAddress*)
pluginport:                    *None*               (9104)
new_namespace:                 *None*               (*None*)
new_name:                      *None*               (*None*)
new_storageclass:              *None*               (*None*)
debug:                         *None*               (*None*)
mac_address:                   new                  (keep)
run_after_restore:             *None*               (False)
Use above plugin configuration? (Yes/mod/no): mod
You have the following choices:
 1: config (K8S config file)
 2: host (K8S API server URL/Host)
 3: token (K8S Bearertoken)
 4: verify_ssl (K8S API server cert verification)
 5: ssl_ca_cert (Custom CA Certs file to use)
 6: outputformat (Output format when saving to file (JSON, YAML))
 7: fdaddress (The address for listen to incoming backup pod data)
 8: fdport (The port for opening socket for listen)
 9: pluginhost (The endpoint address for backup pod to connect)
10: pluginport (The endpoint port to connect)
11: new_namespace (The namespace where the resources will be restored)
12: new_name (The new name of restored resource)
13: new_storageclass (The storageclass that will be applied in pvc restores)
14: debug (Set debug (0,1,2,3) in restore)
15: mac_address (Set MAC address in restored vm (new, keep, MAC))
16: run_after_restore (Run restored vm after restore(yes,no))
Select parameter to modify (1-16): 12
Please enter a value for new_namespace: restored-vm
Plugin Restore Options
Option                         Current Value        Default Value
config:                        *None*               (*None*)
host:                          *None*               (*None*)
token:                         *None*               (*None*)
verify_ssl:                    *None*               (True)
ssl_ca_cert:                   *None*               (*None*)
outputformat:                  *None*               (RAW)
fdaddress:                     *None*               (*FDAddress*)
fdport:                        *None*               (9104)
pluginhost:                    *None*               (*FDAddress*)
pluginport:                    *None*               (9104)
new_namespace:                 *None*               (*None*)
new_name:                      restored-vm          (*None*)
new_storageclass:              *None*               (*None*)
debug:                         *None*               (*None*)
mac_address:                   new                  (keep)
run_after_restore:             yes                  (False)
Use above plugin configuration? (Yes/mod/no): yes
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /opt/bacula/working/bacula-devel-dir.restore.1.bsr
Where:           /
Replace:         Always
FileSet:         Full Set
Backup Client:   bacula-devel-fd
Restore Client:  bacula-devel-fd
Storage:         File1
When:            2025-04-01 13:34:48
Catalog:         MyCatalog
Priority:        10
Plugin Options:  User specified
OK to run? (Yes/mod/no): yes
Job queued. JobId=2

The plugin does not wait for Kubernetes objects to become ready and online in the same way as the kubectl or the oc commands.

Go back to: Restore Examples.