[pve-devel] Question to ZFSPlugin.pm

Alexandre DERUMIER aderumier at odiso.com
Thu Jan 22 08:17:59 CET 2015


This is strange,

the destroy vm code is

    # only remove disks owned by this VM
    foreach_drive($conf, sub {
        my ($ds, $drive) = @_;

        return if drive_is_cdrom($drive);

        my $volid = $drive->{file};

        return if !$volid || $volid =~ m|^/|;

        my ($path, $owner) = PVE::Storage::path($storecfg, $volid);
        return if !$path || !$owner || ($owner != $vmid);

        PVE::Storage::vdisk_free($storecfg, $volid);
    });

    if ($keep_empty_config) {
        PVE::Tools::file_set_contents($conffile, "memory: 128\n");
    } else {
        unlink $conffile;
    }


So,If PVE::Storage::vdisk_free is hanging (before the disk have clone), the config file shouldn't be delete

the vdisk_free code is

   $plugin->cluster_lock_storage($storeid, $scfg->{shared}, undef, sub {

        my ($vtype, $name, $vmid, undef, undef, $isBase) =
            $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";
                }
            }
        }
        my $cleanup_worker = $plugin->free_image($storeid, $scfg, $volname, $isBase);
    });

if volume isbase (this is the case of templates, the disk volid is base-xxxx), we check if we have clones.
(listing all volumes, and check if the volumes have the base image as parent)



----- Mail original -----
De: "Wolfgang Link" <w.link at proxmox.com>
À: "datanom.net" <mir at datanom.net>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Mercredi 21 Janvier 2015 11:05:30
Objet: [pve-devel] Question to ZFSPlugin.pm

I implemented the ZFSPlugin for local Zfs use. 

When I test my adaption of this Plug-in, 
I recognize that it is possible to erase a template witch has a linked 
clone. 

I mean the Zfs-volume will not destroyed but the config of the template. 

My problem is I can't validate, it on the orginal Plugin, because I have 
no iSCSI Nexenta/OmniOS. 

Has the ZFSPlugin the same behavior on iSCSI? 

regards. 






_______________________________________________ 
pve-devel mailing list 
pve-devel at pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 


More information about the pve-devel mailing list