Backup in Openstack VM

Execute the backup of the volume(s) for a specific instance, or a set of instances, by running the /opt/bacula/bin/openstack-vm-execute-backup procedure with relevant parameters.

Parameters

  • -b <instance-name> - If this parameter is set, the procedure will try to backup all volume of an instance named <instance-name>.

  • -c <tenant/project-openrc.rc> - Path to the <tenant/project>-openrc.sh file. Default value is /opt/bacula/etc/admin-openrc.sh.

  • -i - If this parameter is set, the backup will be incremental.

  • -t <tools> - Path to Openstack procedures. Default value is /opt/bacula/bin/.

  • -v <instance-id> - ID of the instance to backup.

  • -w <waiting-time> - Waiting time between two poll operations. Default value is 5.

  • -h - Display help.

Note

Option -v has precedence over option -b.

Example

Backup of all the volumes attached to a specific instance, using the instance ID:

Note

To get either the ID or the name of a specific instance, the query procedure can be used with /opt/bacula/bin/openstack-vm-query -l. The ID can be found under the ID column.

First get the relevant instance id:

root@stackdev:/opt/bacula# bin/openstack-vm-query -l
+--------------------------------------+----------------+--------+--------------------------------------------------------------------------------+--------------------------+----------+
| ID                                   | Name           | Status | Networks                                                                       | Image                    | Flavor   |
+--------------------------------------+----------------+--------+--------------------------------------------------------------------------------+--------------------------+----------+
| instance_ID                          | instance_name  | ACTIVE | private=00.0.0.0, 1111:1111:1111:0:1111:1111:1111:1111; shared=111.111.111.111 | N/A (booted from volume) | m1.micro |
+--------------------------------------+-------+--------+--------------------------------------------------------------------------------+--------------------------+----------+

Then issue backup creation operation:

root@openstack-bck:~# /opt/bacula/bin/openstack-vm-execute-backup -v instance_ID
Backup of VM=<instance_ID>  INCREMENTAL=False       ADMIN_OPENRC=/opt/bacula/etc/admin-openrc.sh    SCRIPTS=/opt/bacula/bin/
I: Found 2 volumes to backup for <instance_ID>
I: Backing up <volume_ID>
D: Issue snapshot
I: Snapshot done
I: Backup status=creating
[...]
I: Backup status=creating
I: Backup status=creating
I: Backup status=available
I: Done proceeds to next
I: Issue delete command for snapshot=<snapshot_ID>
I: Backing up <volume_ID>
D: Issue snapshot
D: Snapshot creating ...
I: Snapshot done
I: Backup status=creating
[...]
I: Backup status=creating
I: Backup status=creating
I: Backup status=available
I: Done proceeds to next
I: Issue delete command for snapshot=<snapshot_ID>
I: No more volumes to process END OF BACKUP

Backup of all the volumes attached to a specific instance, using the instance name:

root@host:/opt/bacula# /opt/bacula/bin/openstack-vm-execute-backup -b instance_name
Backup of VM=<instance_ID>  INCREMENTAL=False       ADMIN_OPENRC=/opt/bacula/etc/admin-openrc.sh    SCRIPTS=/opt/bacula/bin/
I: Found 2 volumes to backup for <instance_ID>
I: Backing up <volume_ID>
D: Issue snapshot
I: Snapshot done
I: Backup status=creating
[...]
I: Backup status=creating
I: Backup status=creating
I: Backup status=available
I: Done proceeds to next
I: Issue delete command for snapshot=<snapshot_ID>
I: Backing up <volume_ID>
D: Issue snapshot
D: Snapshot creating ...
I: Snapshot done
I: Backup status=creating
[...]
I: Backup status=creating
I: Backup status=creating
I: Backup status=available
I: Done proceeds to next
I: Issue delete command for snapshot=<snapshot_ID>
I: No more volumes to process END OF BACKUP

When using the -b or -v options, to backup an OpenStack instance, there will be one backup jobid in Bacula for each volume attached to the instance. Also, there will be one backup in the OpenStack server for each volume.

root@host:/opt/bacula# /opt/bacula/bin/openstack-vm-query -b
+---------------+----------------------+------------------------------------------+-----------+------+-------------+
| ID            | Name                 | Description                              | Status    | Size | Incremental |
+---------------+----------------------+------------------------------------------+-----------+------+-------------+
| <backup1_ID>> | <backup1_name>       | Backup done by Bacula Enterprise         | available |   10 | False       |
|                                      | INSTANCE=<instance_name> DATE=<datetime> |           |      |             |
|                                      |                                          |           |      |             |
| <backup2_ID>> | <backup2_name>       | Backup done by Bacula Enterprise         | available |    5 | False       |
|                                      | INSTANCE=<instance_name> DATE=<datetime> |           |      |             |
+---------------+----------------------+------------------------------------------+-----------+------+-------------+

Also, in the Catalog, two jobids are created:

|    xx | job.openstack-bck-fd.openstack-vm | 2024-01-01 12:00:00 | B    | I     |        6 | 12,345,678 | T         |
|    XX | job.openstack-bck-fd.openstack-vm | 2024-01-01 12:00:05 | B    | I     |        9 | 90,123,456 | T         |

Backup Job Example with a RunScript Block

As mentioned earlier, it is possible to define a backup job to trigger the openstack-vm-execute-backup program to execute the backup in the OpenStack server.

The RunScript block below triggers the openstack-vm-execute-backup program to backup all the volumes attached to the MyInstance instance in the OpenStack server, having the openstack-bck-fd bacula client installed:

Job {
  Name = OpenStack-test-job
  JobDefs = BackupsToDisk
  FileSet = None
  Client = openstack-bck-fd
  RunScript {
    Command = "/opt/bacula/bin/openstack-vm-execute-backup -b MyInstance"
    RunsOnClient = yes
    RunsWhen = Before
  }
}

FileSet {
  Name = None
  EnableVSS = no
}

The RunScript block below triggers the openstack-vm-execute-backup program to backup all the volumes attached to any instance whose name begins with MyInstance in the OpenStack server, having the openstack-bck-fd bacula client installed:

Job {
  Name = OpenStack-test-job
  JobDefs = BackupsToDisk
  FileSet = None
  Client = openstack-bck-fd
  RunScript {
    Command = "/opt/bacula/bin/openstack-vm-execute-backup -b MyInstance*"
    RunsOnClient = yes
    RunsWhen = Before
  }
}

FileSet {
  Name = None
  EnableVSS = no
}

By default, the plugin will use the /opt/bacula/etc/admin-openrc.sh tenant OpenStack RC file. To trigger the backup of instance(s) volume(s) in a different tenant/project, it is required to use the -c <tenant/project-openrc.rc> option. For example, to backup all the instances whose names begin with MyInstance in the demo tenant/project:

Job {
  Name = OpenStack-test-job
  JobDefs = BackupsToDisk
  FileSet = None
  Client = openstack-bck-fd
  RunScript {
    Command = "/opt/bacula/bin/openstack-vm-execute-backup -c /opt/bacula/etc/demo-openrc.sh -b MyInstance*"
    RunsOnClient = yes
    RunsWhen = Before
  }
}

FileSet {
  Name = None
  EnableVSS = no
}

Go back to the main Openstack VM page.