vzdzump script / enable cifs storage

moemoe

Member
Mar 18, 2022
2
0
6
39
Hey,

as Proxmox checks the CIFS state every 30s and therefore prevents suspending disks in my NAS, I wanted to enable the CIFS storage only when needed.

I took the script from https://git.proxmox.com/?p=pve-manager.git;a=blob;f=vzdump-hook-script.pl;hb=HEAD, and added a disable for the storage:

Perl:
# ...
if ($phase eq 'job-init' ||
    $phase eq 'job-start' ||
    $phase eq 'job-end'  ||
    $phase eq 'job-abort') {
#...
    # wake up remote storage node and enable storage
    if ($phase eq 'job-init') {
        system ("/sbin/pvesm set $storeid --disable 0") == 0 ||
            die "enabling storage $storeid failed";
    }

    # disable storage afterwards
    if ($phase eq 'job-end' || $phase eq 'job-abort') {
        system ("/sbin/pvesm set $storeid --disable 1")
    }
#...

Enabled the script (at least I thought I did)

Code:
root@localfluff:/usr/local/bin# cat /etc/vzdump.conf
# vzdump default settings

#tmpdir: DIR
#dumpdir: DIR
#storage: STORAGE_ID
#mode: snapshot|suspend|stop
#bwlimit: KBPS
#ionice: PRI
#lockwait: MINUTES
#stopwait: MINUTES
#stdexcludes: BOOLEAN
#mailto: ADDRESSLIST
#prune-backups: keep-INTERVAL=N[,...]
#script: FILENAME
#exclude-path: PATHLIST
#pigz: N
script: /usr/local/bin/vzdump-hook-script.pl
root@localfluff:/usr/local/bin# ls -l /usr/local/bin/vzdump-hook-script.pl
-rwxr-xr-x 1 root root 2510 Mar 18 10:03 /usr/local/bin/vzdump-hook-script.pl

And started the backup job in the web interface in "Datacenter -> Backup -> Select Job -> Run Now".

It seems the scipt isn't executed at all:

Code:
Mar 18 09:51:52 localfluff pvedaemon[3489602]: <root@pam> starting task UPID:localfluff:0038E743:0ED97C3D:62345638:vzdump:201:root@pam:
Mar 18 09:51:52 localfluff pvedaemon[3729219]: could not activate storage 'nocloud': storage 'nocloud' is disabled
Mar 18 09:51:52 localfluff pvedaemon[3489602]: <root@pam> end task UPID:localfluff:0038E743:0ED97C3D:62345638:vzdump:201:root@pam: could not activate storage 'nocloud': storage 'nocloud' is disabled

To check, I started the backup job with the storage activated, and the storage gets disabled after the backup, so this works fine.

Any hints what I did oversee? Of course the storage is not available when starting the backup, as the hook needs to be run. As there is a section about enabling storage in the example script, I think this should work...

Thanks
Moritz
 
Last edited:
the job-init hook point is not part of any released version of pve-manager yet..
 
  • Like
Reactions: moemoe