Created
July 12, 2022 03:11
-
-
Save uncelvel/eaf9925761ee91639134189f508123a0 to your computer and use it in GitHub Desktop.
remove-local-storage-proxmox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub parse_config { | |
my ($class, $filename, $raw) = @_; | |
my $cfg = $class->SUPER::parse_config($filename, $raw); | |
my $ids = $cfg->{ids}; | |
=comment-out | |
# make sure we have a reasonable 'local:' storage | |
# we want 'local' to be always the same 'type' (on all cluster nodes) | |
if (!$ids->{local} || $ids->{local}->{type} ne 'dir' || | |
($ids->{local}->{path} && $ids->{local}->{path} ne '/var/lib/vz')) { | |
$ids->{local} = { | |
type => 'dir', | |
priority => 0, # force first entry | |
path => '/var/lib/vz', | |
'prune-backups' => 'keep-all=1', | |
content => { | |
backup => 1, | |
images => 1, | |
iso => 1, | |
rootdir => 1, | |
snippets => 1, | |
vztmpl => 1, | |
}, | |
}; | |
} | |
# make sure we have a path | |
$ids->{local}->{path} = '/var/lib/vz' if !$ids->{local}->{path}; | |
# remove node restrictions for local storage | |
delete($ids->{local}->{nodes}); | |
=cut | |
foreach my $storeid (keys %$ids) { | |
my $d = $ids->{$storeid}; | |
my $type = $d->{type}; | |
my $def = $defaultData->{plugindata}->{$type}; | |
if ($def->{content}) { | |
$d->{content} = $def->{content}->[1] if !$d->{content}; | |
} | |
if (grep { $_ eq $type } @SHARED_STORAGE) { | |
$d->{shared} = 1; | |
} | |
} | |
return $cfg; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment