]> git.proxmox.com Git - qemu-server.git/commitdiff
vzdump: tpmstate: escape drive string
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 14 Sep 2022 13:07:27 +0000 (15:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 16 Sep 2022 10:52:30 +0000 (12:52 +0200)
the volume path could contain escaped ":" or ",", which means their '\'
needs to be escaped another time for passing to HMP.

the same approach is used for hotplugging regular drives in
PVE::QemuServer, and is needed (at least) for RBD storages with IPv6
monhosts or an explicit monhost port.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/VZDump/QemuServer.pm

index 202e53ddebfbdc7857674a47c9e08acc46b8e12b..0d58e03b417f191885bead769c89ee0789affd9f 100644 (file)
@@ -442,6 +442,7 @@ my $attach_tpmstate_drive = sub {
     $self->loginfo('attaching TPM drive to QEMU for backup');
 
     my $drive = "file=$task->{tpmpath},if=none,read-only=on,id=drive-tpmstate0-backup";
+    $drive =~ s/\\/\\\\/g;
     my $ret = PVE::QemuServer::Monitor::hmp_cmd($vmid, "drive_add auto \"$drive\"");
     die "attaching TPM drive failed\n" if $ret !~ m/OK/s;
 };