1 package PVE
::Storage
::RBDPlugin
;
11 use PVE
::Cluster
qw(cfs_read_file);;
12 use PVE
::JSONSchema
qw(get_standard_option);
15 use PVE
::Storage
::Plugin
;
16 use PVE
::Tools
qw(run_command trim);
18 use base
qw(PVE::Storage::Plugin);
20 my $get_parent_image_name = sub {
22 return undef if !$parent;
23 return $parent->{image
} . "@" . $parent->{snapshot
};
26 my $librados_connect = sub {
27 my ($scfg, $storeid, $options) = @_;
29 my $librados_config = PVE
::CephConfig
::ceph_connect_option
($scfg, $storeid);
31 my $rados = PVE
::RADOS-
>new(%$librados_config);
37 my ($scfg, $volume) = @_;
38 my $path = $scfg->{pool
} ?
$scfg->{pool
} : 'rbd';
39 $path .= "/$scfg->{namespace}" if defined($scfg->{namespace
});
40 $path .= "/$volume" if defined($volume);
44 my sub get_rbd_dev_path
{
45 my ($scfg, $storeid, $volume) = @_;
49 # NOTE: the config doesn't support this currently (but it could!), hack for qemu-server tests
50 $cluster_id = $scfg->{fsid
};
51 } elsif ($scfg->{monhost
}) {
52 my $rados = $librados_connect->($scfg, $storeid);
53 $cluster_id = $rados->mon_command({ prefix
=> 'fsid', format
=> 'json' })->{fsid
};
55 $cluster_id = cfs_read_file
('ceph.conf')->{global
}->{fsid
};
58 my $uuid_pattern = "([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})";
59 if ($cluster_id =~ qr/^${uuid_pattern}$/is) {
60 $cluster_id = $1; # use untained value
62 die "cluster fsid has invalid format\n";
65 my $rbd_path = get_rbd_path
($scfg, $volume);
66 my $pve_path = "/dev/rbd-pve/${cluster_id}/${rbd_path}";
67 my $path = "/dev/rbd/${rbd_path}";
69 return $path if !-e
$pve_path && -e
$path; # mapped before rbd-pve udev rule existed
74 my ($binary, $scfg, $storeid, $op, @options) = @_;
76 my $cmd_option = PVE
::CephConfig
::ceph_connect_option
($scfg, $storeid);
77 my $pool = $scfg->{pool
} ?
$scfg->{pool
} : 'rbd';
79 my $cmd = [$binary, '-p', $pool];
81 if (defined(my $namespace = $scfg->{namespace
})) {
82 # some subcommands will fail if the --namespace parameter is present
83 my $no_namespace_parameter = {
86 push @$cmd, '--namespace', "$namespace" if !$no_namespace_parameter->{$op};
88 push @$cmd, '-c', $cmd_option->{ceph_conf
} if ($cmd_option->{ceph_conf
});
89 push @$cmd, '-m', $cmd_option->{mon_host
} if ($cmd_option->{mon_host
});
90 push @$cmd, '--auth_supported', $cmd_option->{auth_supported
} if ($cmd_option->{auth_supported
});
91 push @$cmd, '-n', "client.$cmd_option->{userid}" if ($cmd_option->{userid
});
92 push @$cmd, '--keyring', $cmd_option->{keyring
} if ($cmd_option->{keyring
});
96 push @$cmd, @options if scalar(@options);
102 my ($scfg, $storeid, $op, @options) = @_;
104 return $build_cmd->('/usr/bin/rbd', $scfg, $storeid, $op, @options);
107 my $rados_cmd = sub {
108 my ($scfg, $storeid, $op, @options) = @_;
110 return $build_cmd->('/usr/bin/rados', $scfg, $storeid, $op, @options);
113 # needed for volumes created using ceph jewel (or higher)
114 my $krbd_feature_update = sub {
115 my ($scfg, $storeid, $name) = @_;
117 my (@disable, @enable);
118 my ($kmajor, $kminor) = PVE
::ProcFSTools
::kernel_version
();
120 if ($kmajor > 5 || $kmajor == 5 && $kminor >= 3) {
121 # 'deep-flatten' can only be disabled, not enabled after image creation
122 push @enable, 'fast-diff', 'object-map';
124 push @disable, 'fast-diff', 'object-map', 'deep-flatten';
128 push @enable, 'exclusive-lock';
130 push @disable, 'exclusive-lock';
133 my $active_features_list = (rbd_volume_info
($scfg, $storeid, $name))[4];
134 my $active_features = { map { $_ => 1 } @$active_features_list };
136 my $to_disable = join(',', grep { $active_features->{$_} } @disable);
137 my $to_enable = join(',', grep { !$active_features->{$_} } @enable );
140 print "disable RBD image features this kernel RBD drivers is not compatible with: $to_disable\n";
141 my $cmd = $rbd_cmd->($scfg, $storeid, 'feature', 'disable', $name, $to_disable);
144 errmsg
=> "could not disable krbd-incompatible image features '$to_disable' for rbd image: $name",
148 print "enable RBD image features this kernel RBD drivers supports: $to_enable\n";
150 my $cmd = $rbd_cmd->($scfg, $storeid, 'feature', 'enable', $name, $to_enable);
153 errmsg
=> "could not enable krbd-compatible image features '$to_enable' for rbd image: $name",
160 sub run_rbd_command
{
161 my ($cmd, %args) = @_;
164 my $errmsg = $args{errmsg
} . ": " || "";
165 if (!exists($args{errfunc
})) {
166 # ' error: 2014-02-06 11:51:59.839135 7f09f94d0760 -1 librbd: snap_unprotect: can't unprotect;
167 # at least 1 child(ren) in pool cephstor1
168 $args{errfunc
} = sub {
170 if ($line =~ m/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ [0-9a-f]+ [\-\d]+ librbd: (.*)$/) {
175 print STDERR
$lasterr;
180 eval { run_command
($cmd, %args); };
182 die $errmsg . $lasterr if length($lasterr);
190 my ($scfg, $storeid) = @_;
192 my $pool = $scfg->{pool
} ?
$scfg->{pool
} : 'rbd';
193 $pool .= "/$scfg->{namespace}" if defined($scfg->{namespace
});
196 my $parser = sub { $raw .= shift };
198 my $cmd = $rbd_cmd->($scfg, $storeid, 'ls', '-l', '--format', 'json');
200 run_rbd_command
($cmd, errmsg
=> "rbd error", errfunc
=> sub {}, outfunc
=> $parser);
204 die $err if $err && $err !~ m/doesn't contain rbd images/ ;
209 } elsif ($raw =~ m/^(\[.*\])$/s) { # untaint
210 $result = JSON
::decode_json
($1);
212 die "got unexpected data from rbd ls: '$raw'\n";
217 foreach my $el (@$result) {
218 next if defined($el->{snapshot
});
220 my $image = $el->{image
};
222 my ($owner) = $image =~ m/^(?:vm|base)-(\d+)-/;
223 next if !defined($owner);
225 $list->{$pool}->{$image} = {
228 parent
=> $get_parent_image_name->($el->{parent
}),
237 my ($scfg, $storeid, $name) = @_;
239 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'ls', $name, '--format', 'json');
242 run_rbd_command
($cmd, errmsg
=> "rbd error", errfunc
=> sub {}, outfunc
=> sub { $raw .= shift; });
245 if ($raw =~ m/^(\[.*\])$/s) { # untaint
246 $list = eval { JSON
::decode_json
($1) };
247 die "invalid JSON output from 'rbd snap ls $name': $@\n" if $@;
249 die "got unexpected data from 'rbd snap ls $name': '$raw'\n";
252 $list = [] if !defined($list);
255 foreach my $el (@$list) {
256 my $snap = $el->{name
};
257 my $protected = defined($el->{protected
}) && $el->{protected
} eq "true" ?
1 : undef;
260 id
=> $el->{id
} // undef,
261 size
=> $el->{size
} // 0,
262 protected
=> $protected,
268 sub rbd_volume_info
{
269 my ($scfg, $storeid, $volname, $snap) = @_;
273 my @options = ('info', $volname, '--format', 'json');
275 push @options, '--snap', $snap;
278 $cmd = $rbd_cmd->($scfg, $storeid, @options);
281 my $parser = sub { $raw .= shift };
283 run_rbd_command
($cmd, errmsg
=> "rbd error", errfunc
=> sub {}, outfunc
=> $parser);
288 } elsif ($raw =~ m/^(\{.*\})$/s) { # untaint
289 $volume = JSON
::decode_json
($1);
291 die "got unexpected data from rbd info: '$raw'\n";
294 $volume->{parent
} = $get_parent_image_name->($volume->{parent
});
295 $volume->{protected
} = defined($volume->{protected
}) && $volume->{protected
} eq "true" ?
1 : undef;
297 return $volume->@{qw(size parent format protected features)};
308 content
=> [ {images
=> 1, rootdir
=> 1}, { images
=> 1 }],
315 description
=> "IP addresses of monitors (for external clusters).",
316 type
=> 'string', format
=> 'pve-storage-portal-dns-list',
319 description
=> "Pool.",
323 description
=> "Data Pool (for erasure coding only)",
327 description
=> "Namespace.",
331 description
=> "RBD Id.",
335 description
=> "Authsupported.",
339 description
=> "Always access rbd through krbd kernel module.",
343 description
=> "Client keyring contents (for external clusters).",
351 nodes
=> { optional
=> 1 },
352 disable
=> { optional
=> 1 },
353 monhost
=> { optional
=> 1},
354 pool
=> { optional
=> 1 },
355 'data-pool' => { optional
=> 1 },
356 namespace
=> { optional
=> 1 },
357 username
=> { optional
=> 1 },
358 content
=> { optional
=> 1 },
359 krbd
=> { optional
=> 1 },
360 keyring
=> { optional
=> 1 },
361 bwlimit
=> { optional
=> 1 },
365 # Storage implementation
368 my ($class, $storeid, $scfg, %param) = @_;
370 my $secret = $param{keyring
} if defined $param{keyring
} // undef;
371 PVE
::CephConfig
::ceph_create_keyfile
($scfg->{type
}, $storeid, $secret);
377 my ($class, $storeid, $scfg, %param) = @_;
379 if (exists($param{keyring
})) {
380 if (defined($param{keyring
})) {
381 PVE
::CephConfig
::ceph_create_keyfile
($scfg->{type
}, $storeid, $param{keyring
});
383 PVE
::CephConfig
::ceph_remove_keyfile
($scfg->{type
}, $storeid);
391 my ($class, $storeid, $scfg) = @_;
392 PVE
::CephConfig
::ceph_remove_keyfile
($scfg->{type
}, $storeid);
397 my ($class, $volname) = @_;
399 if ($volname =~ m/^((base-(\d+)-\S+)\/)?
((base
)?
(vm
)?
-(\d
+)-\S
+)$/) {
400 return ('images', $4, $7, $2, $3, $5, 'raw');
403 die "unable to parse rbd volume name '$volname'\n";
407 my ($class, $scfg, $volname, $storeid, $snapname) = @_;
409 my $cmd_option = PVE
::CephConfig
::ceph_connect_option
($scfg, $storeid);
410 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
411 $name .= '@'.$snapname if $snapname;
413 my $rbd_dev_path = get_rbd_dev_path
($scfg, $storeid, $name);
414 return ($rbd_dev_path, $vmid, $vtype) if $scfg->{krbd
};
416 my $rbd_path = get_rbd_path
($scfg, $name);
417 my $path = "rbd:${rbd_path}";
419 $path .= ":conf=$cmd_option->{ceph_conf}" if $cmd_option->{ceph_conf
};
420 if (defined($scfg->{monhost
})) {
421 my $monhost = PVE
::CephConfig
::hostlist
($scfg->{monhost
}, ';');
422 $monhost =~ s/:/\\:/g;
423 $path .= ":mon_host=$monhost";
424 $path .= ":auth_supported=$cmd_option->{auth_supported}";
427 $path .= ":id=$cmd_option->{userid}:keyring=$cmd_option->{keyring}" if ($cmd_option->{keyring
});
429 return ($path, $vmid, $vtype);
432 sub find_free_diskname
{
433 my ($class, $storeid, $scfg, $vmid, $fmt, $add_fmt_suffix) = @_;
435 my $cmd = $rbd_cmd->($scfg, $storeid, 'ls');
441 if ($line =~ m/^(.*)$/) { # untaint
442 push @$disk_list, $1;
447 run_rbd_command
($cmd, errmsg
=> "rbd error", errfunc
=> sub {}, outfunc
=> $parser);
451 die $err if $err && $err !~ m/doesn't contain rbd images/;
453 return PVE
::Storage
::Plugin
::get_next_vm_diskname
($disk_list, $storeid, $vmid, undef, $scfg);
457 my ($class, $storeid, $scfg, $volname) = @_;
459 my $snap = '__base__';
461 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
462 $class->parse_volname($volname);
464 die "create_base not possible with base image\n" if $isBase;
466 my ($size, $parent, $format, undef) = rbd_volume_info
($scfg, $storeid, $name);
467 die "rbd volume info on '$name' failed\n" if !($size);
469 die "rbd image must be at format V2" if $format ne "2";
471 die "volname '$volname' contains wrong information about parent $parent $basename\n"
472 if $basename && (!$parent || $parent ne $basename."@".$snap);
475 $newname =~ s/^vm-/base-/;
477 my $newvolname = $basename ?
"$basename/$newname" : "$newname";
479 my $cmd = $rbd_cmd->(
483 get_rbd_path
($scfg, $name),
484 get_rbd_path
($scfg, $newname),
486 run_rbd_command
($cmd, errmsg
=> "rbd rename '$name' error");
488 eval { $class->unmap_volume($storeid, $scfg, $volname); };
491 my $running = undef; #fixme : is create_base always offline ?
493 $class->volume_snapshot($scfg, $storeid, $newname, $snap, $running);
495 my (undef, undef, undef, $protected) = rbd_volume_info
($scfg, $storeid, $newname, $snap);
498 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'protect', $newname, '--snap', $snap);
499 run_rbd_command
($cmd, errmsg
=> "rbd protect $newname snap '$snap' error");
507 my ($class, $scfg, $storeid, $volname, $vmid, $snapname) = @_;
509 my $snap = '__base__';
510 $snap = $snapname if length $snapname;
512 my ($vtype, $basename, $basevmid, undef, undef, $isBase) =
513 $class->parse_volname($volname);
515 die "$volname is not a base image and snapname is not provided\n"
516 if !$isBase && !length($snapname);
518 my $name = $class->find_free_diskname($storeid, $scfg, $vmid);
520 warn "clone $volname: $basename snapname $snap to $name\n";
522 if (length($snapname)) {
523 my (undef, undef, undef, $protected) = rbd_volume_info
($scfg, $storeid, $volname, $snapname);
526 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'protect', $volname, '--snap', $snapname);
527 run_rbd_command
($cmd, errmsg
=> "rbd protect $volname snap $snapname error");
531 my $newvol = "$basename/$name";
532 $newvol = $name if length($snapname);
535 get_rbd_path
($scfg, $basename),
538 push @options, ('--data-pool', $scfg->{'data-pool'}) if $scfg->{'data-pool'};
540 my $cmd = $rbd_cmd->($scfg, $storeid, 'clone', @options, get_rbd_path
($scfg, $name));
541 run_rbd_command
($cmd, errmsg
=> "rbd clone '$basename' error");
547 my ($class, $storeid, $scfg, $vmid, $fmt, $name, $size) = @_;
550 die "illegal name '$name' - should be 'vm-$vmid-*'\n"
551 if $name && $name !~ m/^vm-$vmid-/;
553 $name = $class->find_free_diskname($storeid, $scfg, $vmid) if !$name;
556 '--image-format' , 2,
557 '--size', int(($size + 1023) / 1024),
559 push @options, ('--data-pool', $scfg->{'data-pool'}) if $scfg->{'data-pool'};
561 my $cmd = $rbd_cmd->($scfg, $storeid, 'create', @options, $name);
562 run_rbd_command
($cmd, errmsg
=> "rbd create '$name' error");
568 my ($class, $storeid, $scfg, $volname, $isBase) = @_;
570 my ($vtype, $name, $vmid, undef, undef, undef) =
571 $class->parse_volname($volname);
574 my $snaps = rbd_ls_snap
($scfg, $storeid, $name);
575 foreach my $snap (keys %$snaps) {
576 if ($snaps->{$snap}->{protected
}) {
577 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'unprotect', $name, '--snap', $snap);
578 run_rbd_command
($cmd, errmsg
=> "rbd unprotect $name snap '$snap' error");
582 $class->deactivate_volume($storeid, $scfg, $volname);
584 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'purge', $name);
585 run_rbd_command
($cmd, errmsg
=> "rbd snap purge '$name' error");
587 $cmd = $rbd_cmd->($scfg, $storeid, 'rm', $name);
588 run_rbd_command
($cmd, errmsg
=> "rbd rm '$name' error");
594 my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
596 $cache->{rbd
} = rbd_ls
($scfg, $storeid) if !$cache->{rbd
};
598 my $dat = $cache->{rbd
}->{get_rbd_path
($scfg)};
599 return [] if !$dat; # nothing found
602 for my $image (sort keys %$dat) {
603 my $info = $dat->{$image};
604 my ($volname, $parent, $owner) = $info->@{'name', 'parent', 'vmid'};
606 if ($parent && $parent =~ m/^(base-\d+-\S+)\@__base__$/) {
607 $info->{volid
} = "$storeid:$1/$volname";
609 $info->{volid
} = "$storeid:$volname";
613 my $found = grep { $_ eq $info->{volid
} } @$vollist;
616 next if defined ($vmid) && ($owner ne $vmid);
619 $info->{format
} = 'raw';
628 my ($class, $storeid, $scfg, $cache) = @_;
630 my $rados = $librados_connect->($scfg, $storeid);
631 my $df = $rados->mon_command({ prefix
=> 'df', format
=> 'json' });
633 my $pool = $scfg->{'data-pool'} // $scfg->{pool
} // 'rbd';
635 my ($d) = grep { $_->{name
} eq $pool } @{$df->{pools
}};
638 warn "could not get usage stats for pool '$pool'\n";
642 # max_avail -> max available space for data w/o replication in the pool
643 # bytes_used -> data w/o replication in the pool
644 my $free = $d->{stats
}->{max_avail
};
645 my $used = $d->{stats
}->{stored
} // $d->{stats
}->{bytes_used
};
646 my $total = $used + $free;
649 return ($total, $free, $used, $active);
652 sub activate_storage
{
653 my ($class, $storeid, $scfg, $cache) = @_;
657 sub deactivate_storage
{
658 my ($class, $storeid, $scfg, $cache) = @_;
663 my ($class, $storeid, $scfg, $volname, $snapname) = @_;
665 my ($vtype, $img_name, $vmid) = $class->parse_volname($volname);
667 my $name = $img_name;
668 $name .= '@'.$snapname if $snapname;
670 my $kerneldev = get_rbd_dev_path
($scfg, $storeid, $name);
672 return $kerneldev if -b
$kerneldev; # already mapped
674 # features can only be enabled/disabled for image, not for snapshot!
675 $krbd_feature_update->($scfg, $storeid, $img_name);
677 my $cmd = $rbd_cmd->($scfg, $storeid, 'map', $name);
678 run_rbd_command
($cmd, errmsg
=> "can't map rbd volume $name");
684 my ($class, $storeid, $scfg, $volname, $snapname) = @_;
686 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
687 $name .= '@'.$snapname if $snapname;
689 my $kerneldev = get_rbd_dev_path
($scfg, $storeid, $name);
692 my $cmd = $rbd_cmd->($scfg, $storeid, 'unmap', $kerneldev);
693 run_rbd_command
($cmd, errmsg
=> "can't unmap rbd device $kerneldev");
699 sub activate_volume
{
700 my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
702 $class->map_volume($storeid, $scfg, $volname, $snapname) if $scfg->{krbd
};
707 sub deactivate_volume
{
708 my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
710 $class->unmap_volume($storeid, $scfg, $volname, $snapname);
715 sub volume_size_info
{
716 my ($class, $scfg, $storeid, $volname, $timeout) = @_;
718 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
719 my ($size, undef) = rbd_volume_info
($scfg, $storeid, $name);
724 my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
726 return 1 if $running && !$scfg->{krbd
}; # FIXME???
728 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
730 my $cmd = $rbd_cmd->($scfg, $storeid, 'resize', '--allow-shrink', '--size', ($size/1024/1024), $name);
731 run_rbd_command
($cmd, errmsg
=> "rbd resize '$volname' error");
735 sub volume_snapshot
{
736 my ($class, $scfg, $storeid, $volname, $snap) = @_;
738 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
740 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'create', '--snap', $snap, $name);
741 run_rbd_command
($cmd, errmsg
=> "rbd snapshot '$volname' error");
745 sub volume_snapshot_rollback
{
746 my ($class, $scfg, $storeid, $volname, $snap) = @_;
748 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
750 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'rollback', '--snap', $snap, $name);
751 run_rbd_command
($cmd, errmsg
=> "rbd snapshot $volname to '$snap' error");
754 sub volume_snapshot_delete
{
755 my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
757 return 1 if $running && !$scfg->{krbd
}; # FIXME: ????
759 $class->deactivate_volume($storeid, $scfg, $volname, $snap, {});
761 my ($vtype, $name, $vmid) = $class->parse_volname($volname);
763 my (undef, undef, undef, $protected) = rbd_volume_info
($scfg, $storeid, $name, $snap);
765 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'unprotect', $name, '--snap', $snap);
766 run_rbd_command
($cmd, errmsg
=> "rbd unprotect $name snap '$snap' error");
769 my $cmd = $rbd_cmd->($scfg, $storeid, 'snap', 'rm', '--snap', $snap, $name);
771 run_rbd_command
($cmd, errmsg
=> "rbd snapshot '$volname' error");
776 sub volume_snapshot_needs_fsfreeze
{
780 sub volume_has_feature
{
781 my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
784 snapshot
=> { current
=> 1, snap
=> 1},
785 clone
=> { base
=> 1, snap
=> 1},
786 template
=> { current
=> 1},
787 copy
=> { base
=> 1, current
=> 1, snap
=> 1},
788 sparseinit
=> { base
=> 1, current
=> 1},
789 rename => {current
=> 1},
792 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) = $class->parse_volname($volname);
798 $key = $isBase ?
'base' : 'current';
800 return 1 if $features->{$feature}->{$key};
806 my ($class, $scfg, $storeid, $source_volname, $target_vmid, $target_volname) = @_;
816 ) = $class->parse_volname($source_volname);
817 $target_volname = $class->find_free_diskname($storeid, $scfg, $target_vmid, $format)
821 my $cmd = $rbd_cmd->($scfg, $storeid, 'info', $target_volname);
822 run_rbd_command
($cmd, errmsg
=> "exist check", quiet
=> 1);
824 die "target volume '${target_volname}' already exists\n" if !$@;
826 my $cmd = $rbd_cmd->($scfg, $storeid, 'rename', $source_image, $target_volname);
830 errmsg
=> "could not rename image '${source_image}' to '${target_volname}'",
833 eval { $class->unmap_volume($storeid, $scfg, $source_volname); };
836 $base_name = $base_name ?
"${base_name}/" : '';
838 return "${storeid}:${base_name}${target_volname}";