my $rpcenv = PVE::RPCEnvironment::get();
my $authuser = $rpcenv->get_user();
- my $cfg = cfs_read_file("storage.cfg");
+ my $cfg = PVE::Storage::config();
my @sids = PVE::Storage::storage_ids($cfg);
code => sub {
my ($param) = @_;
- my $cfg = cfs_read_file("storage.cfg");
+ my $cfg = PVE::Storage::config();
return &$api_storage_config($cfg, $param->{storage});
}});
PVE::Storage::lock_storage_config(
sub {
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
if (my $scfg = PVE::Storage::storage_config($cfg, $storeid, 1)) {
die "storage ID '$storeid' already defined\n";
PVE::Storage::activate_storage($cfg, $storeid);
}
- cfs_write_file('storage.cfg', $cfg);
+ PVE::Storage::write_config($cfg);
}, "create storage failed");
PVE::Storage::lock_storage_config(
sub {
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
PVE::SectionConfig::assert_if_modified($cfg, $digest);
$scfg->{$k} = $opts->{$k};
}
- cfs_write_file('storage.cfg', $cfg);
+ PVE::Storage::write_config($cfg);
}, "update storage failed");
PVE::Storage::lock_storage_config(
sub {
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
die "storage '$storeid' does not exist\n"
if !($cfg->{ids}->{$storeid});
delete $cfg->{ids}->{$storeid};
- cfs_write_file('storage.cfg', $cfg);
+ PVE::Storage::write_config($cfg);
}, "delete storage failed");
use Data::Dumper;
use PVE::SafeSyslog;
-use PVE::Cluster qw(cfs_read_file);
+use PVE::Cluster;
use PVE::Storage;
use PVE::INotify;
use PVE::Exception qw(raise_param_exc);
my $storeid = $param->{storage};
- my $cfg = cfs_read_file("storage.cfg");
+ my $cfg = PVE::Storage::config();
my $vollist = PVE::Storage::volume_list($cfg, $storeid, $param->{vmid}, $param->{content});
$param->{format} = $fmt;
}
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
my $volid = PVE::Storage::vdisk_alloc ($cfg, $storeid, $param->{vmid},
$param->{format},
my ($volid, $storeid) = &$real_volume_id($param->{storage}, $param->{volume});
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
$rpcenv->check_volume_access($authuser, $cfg, undef, $volid);
my $rpcenv = PVE::RPCEnvironment::get();
my $authuser = $rpcenv->get_user();
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
my ($volid, $storeid) = &$real_volume_id($param->{storage}, $param->{volume});
print "DEBUG: COPY $src_volid TO $dst_volid\n";
- my $cfg = cfs_read_file('storage.cfg');
+ my $cfg = PVE::Storage::config();
# do all parameter checks first
use File::Basename;
use PVE::Tools;
use PVE::INotify;
-use PVE::Cluster qw(cfs_read_file);
+use PVE::Cluster;
use PVE::Storage;
use PVE::API2::Storage::Content;
use PVE::RESTHandler;
undef $target if $target && ($target eq $localnode || $target eq 'localhost');
- my $cfg = cfs_read_file("storage.cfg");
+ my $cfg = PVE::Storage::config();
my $info = PVE::Storage::storage_info($cfg, $param->{content});
code => sub {
my ($param) = @_;
- my $cfg = cfs_read_file("storage.cfg");
+ my $cfg = PVE::Storage::config();
my $info = PVE::Storage::storage_info($cfg, $param->{content});
my $user = $rpcenv->get_user();
- my $cfg = cfs_read_file("storage.cfg");
+ my $cfg = PVE::Storage::config();
my $node = $param->{node};
my $scfg = PVE::Storage::storage_check_enabled($cfg, $param->{storage}, $node);
use Socket;
use PVE::Tools qw(run_command file_read_firstline $IPV6RE);
-use PVE::Cluster qw(cfs_read_file cfs_lock_file);
+use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file);
use PVE::Exception qw(raise_param_exc);
use PVE::JSONSchema;
use PVE::INotify;
return cfs_read_file("storage.cfg");
}
+sub write_config {
+ my ($cfg) = @_;
+
+ cfs_write_file('storage.cfg', $cfg);
+}
+
sub lock_storage_config {
my ($code, $errmsg) = @_;