blockdev: support alloc-track driver for live-{import, restore}

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2025-07-02 18:28:17 +02:00 committed by Fabian Grünbichler
parent 418e5524a1
commit 3f8c946b38

View file

@ -123,10 +123,12 @@ my sub get_node_name {
my $hash = substr(Digest::SHA::sha256_hex($info), 0, 30);
my $prefix = "";
if ($type eq 'fmt') {
$prefix = 'f';
if ($type eq 'alloc-track') {
$prefix = 'a';
} elsif ($type eq 'file') {
$prefix = 'e';
} elsif ($type eq 'fmt') {
$prefix = 'f';
} elsif ($type eq 'zeroinit') {
$prefix = 'z';
} else {
@ -375,6 +377,17 @@ sub generate_drive_blockdev {
$child = { driver => 'zeroinit', file => $child, 'node-name' => "$node_name" };
}
if (my $live_restore = $options->{'live-restore'}) {
my $node_name = get_node_name('alloc-track', $drive_id, $drive->{file}, $options);
$child = {
driver => 'alloc-track',
'auto-remove' => JSON::true,
backing => $live_restore->{blockdev},
file => $child,
'node-name' => "$node_name",
};
}
# for fleecing and TPM backup, this is already the top node
return $child if $options->{fleecing} || $options->{'tpm-backup'} || $options->{'no-throttle'};