file-restore: add basic VM/block device support
Includes methods to start, stop and list QEMU file-restore VMs, as well as CLI commands do the latter two (start is implicit). The implementation is abstracted behind the concept of a "BlockRestoreDriver", so other methods can be implemented later (e.g. mapping directly to loop devices on the host, using other hypervisors then QEMU, etc...). Starting VMs is currently unused but will be needed for further changes. The design for the QEMU driver uses a locked 'map' file (/run/proxmox-backup/$UID/restore-vm-map.json) containing a JSON encoding of currently running VMs. VMs are addressed by a 'name', which is a systemd-unit encoded combination of repository and snapshot string, thus uniquely identifying it. Note that currently you need to run proxmox-file-restore as root to use this method of restoring. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
a5bdc987dc
commit
58421ec112
@ -10,6 +10,14 @@ macro_rules! PROXMOX_BACKUP_RUN_DIR_M { () => ("/run/proxmox-backup") }
|
||||
#[macro_export]
|
||||
macro_rules! PROXMOX_BACKUP_LOG_DIR_M { () => ("/var/log/proxmox-backup") }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! PROXMOX_BACKUP_CACHE_DIR_M { () => ("/var/cache/proxmox-backup") }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M {
|
||||
() => ("/usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore")
|
||||
}
|
||||
|
||||
/// namespaced directory for in-memory (tmpfs) run state
|
||||
pub const PROXMOX_BACKUP_RUN_DIR: &str = PROXMOX_BACKUP_RUN_DIR_M!();
|
||||
|
||||
@ -30,6 +38,15 @@ pub const PROXMOX_BACKUP_PROXY_PID_FN: &str = concat!(PROXMOX_BACKUP_RUN_DIR_M!(
|
||||
/// the PID filename for the privileged api daemon
|
||||
pub const PROXMOX_BACKUP_API_PID_FN: &str = concat!(PROXMOX_BACKUP_RUN_DIR_M!(), "/api.pid");
|
||||
|
||||
/// filename of the cached initramfs to use for booting single file restore VMs, this file is
|
||||
/// automatically created by APT hooks
|
||||
pub const PROXMOX_BACKUP_INITRAMFS_FN: &str =
|
||||
concat!(PROXMOX_BACKUP_CACHE_DIR_M!(), "/file-restore-initramfs.img");
|
||||
|
||||
/// filename of the kernel to use for booting single file restore VMs
|
||||
pub const PROXMOX_BACKUP_KERNEL_FN: &str =
|
||||
concat!(PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M!(), "/bzImage");
|
||||
|
||||
/// Prepend configuration directory to a file name
|
||||
///
|
||||
/// This is a simply way to get the full path for configuration files.
|
||||
|
Reference in New Issue
Block a user