rbd: make activate_volume idempotent

This commit is contained in:
Dietmar Maurer
2015-09-10 11:10:35 +02:00
parent 5dbd11531f
commit 4f6a99d8c7
2 changed files with 6 additions and 0 deletions

View File

@ -494,6 +494,10 @@ sub activate_volume {
return 1 if !$scfg->{krbd};
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
my $pool = $scfg->{pool} ? $scfg->{pool} : 'rbd';
my $path = "/dev/rbd/$pool/$name";
return if -b $path;
my $cmd = &$rbd_cmd($scfg, $storeid, 'map', $name);
run_rbd_command($cmd, errmsg => "can't mount rbd volume $name");