api: add import/export format querying

This commit is contained in:
Wolfgang Bumiller
2017-05-12 11:56:10 +02:00
committed by Fabian Grünbichler
parent ac191ec740
commit d390328bfd
3 changed files with 57 additions and 0 deletions

View File

@ -681,6 +681,16 @@ sub volume_export {
return;
}
sub volume_export_formats {
my ($class, $scfg, $storeid, $volname, $snapshot, $base_snapshot, $with_snapshots) = @_;
my @formats = ('zfs');
# TODOs:
# push @formats, 'fies' if $volname !~ /^(?:basevol|subvol)-/;
# push @formats, 'raw' if !$base_snapshot && !$with_snapshots;
return @formats;
}
sub volume_import {
my ($class, $scfg, $storeid, $fh, $volname, $format, $base_snapshot, $with_snapshots) = @_;
@ -714,4 +724,10 @@ sub volume_import {
return;
}
sub volume_import_formats {
my ($class, $scfg, $storeid, $volname, $base_snapshot, $with_snapshots) = @_;
return $class->volume_export_formats($scfg, $storeid, $volname, undef, $base_snapshot, $with_snapshots);
}
1;