implement map_volume and unmap_volume

This allows to request a mapped device/path explicitly, regardles of
the storage option, eg. krbd option in the RBDplugin.

Bump of the storage ABI => 2

Co-authored-by: Alwin Antreich <a.antreich@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer
2018-11-08 14:05:17 +01:00
committed by Thomas Lamprecht
parent 8b6b710265
commit 40d698932e
3 changed files with 86 additions and 33 deletions

View File

@ -37,7 +37,7 @@ use PVE::Storage::ZFSPlugin;
use PVE::Storage::DRBDPlugin;
# Storage API version. Icrement it on changes in storage API interface.
use constant APIVER => 1;
use constant APIVER => 2;
# load standard plugins
PVE::Storage::DirPlugin->register();
@ -671,6 +671,30 @@ sub vdisk_create_base {
});
}
sub map_volume {
my ($cfg, $volid, $snapname) = @_;
my ($storeid, $volname) = parse_volume_id($volid);
my $scfg = storage_config($cfg, $storeid);
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
return $plugin->map_volume($storeid, $scfg, $volname, $snapname);
}
sub unmap_volume {
my ($cfg, $volid, $snapname) = @_;
my ($storeid, $volname) = parse_volume_id($volid);
my $scfg = storage_config($cfg, $storeid);
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
return $plugin->unmap_volume($storeid, $scfg, $volname, $snapname);
}
sub vdisk_alloc {
my ($cfg, $storeid, $vmid, $fmt, $name, $size) = @_;