cifs plugin cleanups
This commit is contained in:
@ -36,12 +36,16 @@ my $api_storage_config = sub {
|
|||||||
return $scfg;
|
return $scfg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
my $cifs_cred_file_name = sub {
|
||||||
|
my ($storeid) = @_;
|
||||||
|
|
||||||
|
return "/etc/pve/priv/${storeid}.cred";
|
||||||
|
};
|
||||||
|
|
||||||
my $set_cifs_credentials = sub {
|
my $set_cifs_credentials = sub {
|
||||||
my ($password, $storeid) = @_;
|
my ($password, $storeid) = @_;
|
||||||
|
|
||||||
my $cred_path = '/etc/pve/priv/';
|
my $cred_file = $cifs_cred_file_name->($storeid);
|
||||||
|
|
||||||
my $cred_file = $cred_path.$storeid.".cred";
|
|
||||||
|
|
||||||
PVE::Tools::file_set_contents($cred_file, "password=$password\n");
|
PVE::Tools::file_set_contents($cred_file, "password=$password\n");
|
||||||
|
|
||||||
@ -294,13 +298,12 @@ __PACKAGE__->register_method ({
|
|||||||
die "can't remove storage - storage is used as base of another storage\n"
|
die "can't remove storage - storage is used as base of another storage\n"
|
||||||
if PVE::Storage::storage_is_used($cfg, $storeid);
|
if PVE::Storage::storage_is_used($cfg, $storeid);
|
||||||
|
|
||||||
my $cred_file = '/etc/pve/priv/'.$storeid.'.cred';
|
if ($scfg->{type} eq 'cifs') {
|
||||||
|
my $cred_file = $cifs_cred_file_name->($storeid);
|
||||||
unlink $cred_file
|
if (-f $cred_file) {
|
||||||
if ($cfg->{ids}->{$storeid}->{type} eq 'cifs') &&
|
unlink($cred_file) or warn "removing cifs credientials '$cred_file' failed: $!\n";
|
||||||
(-e $cred_file);
|
}
|
||||||
|
} elsif ($scfg->{type} eq 'rbd' && !defined($scfg->{monhost})) {
|
||||||
if ($scfg->{type} eq 'rbd' && !defined($scfg->{monhost})) {
|
|
||||||
my $ceph_storage_keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
|
my $ceph_storage_keyring = "/etc/pve/priv/ceph/${storeid}.keyring";
|
||||||
if (-f $ceph_storage_keyring) {
|
if (-f $ceph_storage_keyring) {
|
||||||
unlink($ceph_storage_keyring) or warn "removing keyring of storage failed: $!\n";
|
unlink($ceph_storage_keyring) or warn "removing keyring of storage failed: $!\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user