}
next if !$path;
- my ($size, $format) = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) };
- die "no such volume '$volid'\n" if $@;
+ my ($size, $format);
+ if ($storeid) {
+ # The call in list context can be expensive for certain plugins like RBD, just get size
+ $size = eval { PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5) };
+ die "cannot determine size of volume '$volid' - $@\n" if $@;
+
+ my $scfg = PVE::Storage::storage_config($self->{storecfg}, $storeid);
+ $format = PVE::QemuServer::qemu_img_format($scfg, $volname);
+ } else {
+ ($size, $format) = eval {
+ PVE::Storage::volume_size_info($self->{storecfg}, $volid, 5);
+ };
+ die "cannot determine size and format of volume '$volid' - $@\n" if $@;
+ }
my $diskinfo = {
path => $path,
# proxmox-backup-client can only handle raw files and block devs
# only use it (directly) for disk-less VMs
if (!$diskcount) {
- my @pathlist;
$self->loginfo("backup contains no disks");
local $ENV{PBS_PASSWORD} = $password;
if (defined(my $ns = $scfg->{namespace})) {
push @$cmd, '--ns', $ns;
}
+ if (-e $keyfile) {
+ $self->loginfo("enabling encryption");
+ push @$cmd, '--keyfile', $keyfile;
+ if (defined($master_keyfile)) {
+ if (-e $master_keyfile) {
+ $self->loginfo("enabling master key feature");
+ push @$cmd, '--master-pubkey-file', $master_keyfile;
+ } elsif ($scfg->{'master-pubkey'}) {
+ die "master public key configured but no key file found\n";
+ }
+ }
+ } else {
+ my $encryption_fp = $scfg->{'encryption-key'};
+ die "encryption configured ('$encryption_fp') but no encryption key file found!\n"
+ if $encryption_fp;
+ $self->loginfo("WARNING: backup target is configured with master key, but this backup is not encrypted - master key settings will be ignored!")
+ if defined($master_keyfile) && -e $master_keyfile;
+ }
push @$cmd, "qemu-server.conf:$conffile";
push @$cmd, "fw.conf:$firewall" if -e $firewall;
}
}
- if (!defined($qemu_support->{"pbs-masterkey"}) && -e $master_keyfile) {
- $self->loginfo("WARNING: backup target is configured with master key, but running QEMU version does not support master keys.");
- $self->loginfo("Please make sure you've installed the latest version and the VM has been restarted to use master key feature.");
- $master_keyfile = undef; # skip rest of master key handling below
- }
+ # pve-qemu supports it since 5.2.0-1 (PVE 6.4), so safe to die since PVE 8
+ die "master key configured but running QEMU version does not support master keys\n"
+ if !defined($qemu_support->{'pbs-masterkey'}) && -e $master_keyfile;
$attach_tpmstate_drive->($self, $task, $vmid);
return;
}
+ my $freeze = PVE::QemuServer::get_qga_key($self->{vmlist}->{$vmid}, 'freeze-fs-on-backup') // 1;
+ if (!$freeze) {
+ $self->loginfo("skipping guest-agent 'fs-freeze', disabled in VM options");
+ return;
+ }
+
$self->loginfo("issuing guest-agent 'fs-freeze' command");
eval { mon_cmd($vmid, "guest-fsfreeze-freeze") };
$self->logerr($@) if $@;