5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-03 01:18:02 +03:00

file restore: qemu helper: switch to more modern blockdev option for drives

From the QEMU man page:

> The most explicit way to describe disks is to use a combination of
> -device to specify the hardware device and -blockdev to describe the
> backend. The device defines what the guest sees and the backend
> describes how QEMU handles the data. It is the only guaranteed stable
> interface for describing block devices and as such is recommended for
> management tools and scripting.

> The -drive option combines the device and backend into a single
> command line option which is a more human friendly. There is however
> no interface stability guarantee although some older board models
> still need updating to work with the modern blockdev forms.

From the perspective of live restore, there should be no behavioral
change, except that the used driver is now explicitly specified. The
'-device' options are still the same, the fact that 'if=none' is gone
shouldn't matter, because the '-device' option was already used to
define the interface (i.e. virito-blk) and the 'id' option needed to
be replaced with 'node-name'.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2024-12-06 17:25:17 +01:00 committed by Thomas Lamprecht
parent c69d18626a
commit 668b8383a7

View File

@ -279,7 +279,7 @@ pub async fn start_vm(
if !file.ends_with(".img.fidx") {
continue;
}
drives.push("-drive".to_owned());
drives.push("-blockdev".to_owned());
let keyfile = if let Some(ref keyfile) = details.keyfile {
format!(",,keyfile={keyfile}")
} else {
@ -291,7 +291,7 @@ pub async fn start_vm(
format!(",,namespace={}", details.namespace)
};
drives.push(format!(
"file=pbs:repository={}{},,snapshot={},,archive={}{},read-only=on,if=none,id=drive{}",
"driver=pbs,repository={}{},snapshot={},archive={}{},read-only=on,node-name=drive{}",
details.repo, namespace, details.snapshot, file, keyfile, id
));