]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Disks/Directory.pm
refactor diskmanagement lock_file calls
[pve-storage.git] / PVE / API2 / Disks / Directory.pm
index f554d6c9a2e0ef5130f8a0765e0a751302d27052..8e6118abc091b937cea4d1f60cd0762869107d49 100644 (file)
@@ -110,7 +110,7 @@ __PACKAGE__->register_method ({
            properties => {
                unitfile => {
                    type => 'string',
-                   description => 'The path of the mount unit'.,
+                   description => 'The path of the mount unit.',
                },
                path => {
                    type => 'string',
@@ -171,7 +171,7 @@ __PACKAGE__->register_method ({
            name => get_standard_option('pve-storage-id'),
            device => {
                type => 'string',
-               description => 'The block device you want to create the thinpool on.',
+               description => 'The block device you want to create the filesystem on.',
            },
            add_storage => {
                description => "Configure storage using the directory.",
@@ -214,7 +214,7 @@ __PACKAGE__->register_method ({
            my $mountunitname = "mnt-pve-$name.mount";
            my $mountunitpath = "/etc/systemd/system/$mountunitname";
 
-           lock_file('/run/lock/pve-diskmanage.lck', undef, sub {
+           PVE::Diskmanage::locked_disk_action(sub {
                # create partition
                my $cmd = [$SGDISK, '-n1', '-t1:8300', $dev];
                print "# ", join(' ', @$cmd), "\n";
@@ -279,11 +279,8 @@ __PACKAGE__->register_method ({
                    PVE::API2::Storage::Config->create($storage_params);
                }
            });
-
-           die $@ if $@;
        };
 
-
        return $rpcenv->fork_worker('dircreate', $name, $user, $worker);
     }});