Skip to content

Commit

Permalink
implement APIVER 2
Browse files Browse the repository at this point in the history
This implements the changes that went into [1]. [1] was eventually
modified to not break plugins hard, but that should be the required
changes.

[1]:
https://git.proxmox.com/?p=pve-storage.git;a=commit;h=40d698932e27ee94b5fa06330dbf07bc

Closes #15
  • Loading branch information
rck committed Jul 15, 2019
1 parent c8e33b5 commit 51f5f7c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions LINSTORPlugin.pm
Expand Up @@ -19,7 +19,7 @@ use base qw(PVE::Storage::Plugin);
my $default_redundancy = 2;
my $default_controller = "localhost";
my $default_controller_vm = "";
my $APIVER = 1;
my $APIVER = 2;

my $LINSTOR = '/usr/bin/linstor';

Expand Down Expand Up @@ -208,7 +208,26 @@ sub wait_connect_resource {
}
}

sub get_dev_path {
return "/dev/drbd/by-res/$_[0]/0";
}

# Storage implementation
#
# For APIVER 2
sub map_volume {
my ($class, $storeid, $scfg, $volname, $snapname) = @_;

die "drbd snapshot is not implemented\n" if defined($snapname);

return get_dev_path "$volname";
}

# For APIVER 2
sub unmap_volume {
return 1;
}

sub parse_volname {
my ( $class, $volname ) = @_;

Expand All @@ -226,7 +245,7 @@ sub filesystem_path {

my ( $vtype, $name, $vmid ) = $class->parse_volname($volname);

my $path = "/dev/drbd/by-res/$volname/0";
my $path = get_dev_path "$volname";

return wantarray ? ( $path, $vmid, $vtype ) : $path;
}
Expand Down

0 comments on commit 51f5f7c

Please sign in to comment.