+
+ my ($vtype, $name, $vmid, undef, undef, $isBase, $format) =
+ $plugin->parse_volname($volname);
+ if ($isBase) {
+ my $vollist = $plugin->list_images($storeid, $scfg);
+ foreach my $info (@$vollist) {
+ my (undef, $tmpvolname) = parse_volume_id($info->{volid});
+ my $basename = undef;
+ my $basevmid = undef;
+
+ eval{
+ (undef, undef, undef, $basename, $basevmid) =
+ $plugin->parse_volname($tmpvolname);
+ };
+
+ if ($basename && defined($basevmid) && $basevmid == $vmid && $basename eq $name) {
+ die "base volume '$volname' is still in use " .
+ "(use by '$tmpvolname')\n";
+ }
+ }
+ }
+ $cleanup_worker = $plugin->free_image($storeid, $scfg, $volname, $isBase, $format);