[pve-devel] [PATCH v2 container] use PVE::Storage::config(), not cfs_read_file()

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Mar 25 13:51:09 CET 2016


---
Changes to v1:
- fix API2/LXC/Config.pm and API2/LXC/Status.pm as well

 src/PVE/API2/LXC.pm        | 8 ++++----
 src/PVE/API2/LXC/Config.pm | 3 +--
 src/PVE/API2/LXC/Status.pm | 4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index ea1e942..ec9ea44 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -7,7 +7,7 @@ use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param run_command);
 use PVE::Exception qw(raise raise_param_exc);
 use PVE::INotify;
-use PVE::Cluster qw(cfs_read_file);
+use PVE::Cluster;
 use PVE::AccessControl;
 use PVE::Firewall;
 use PVE::Storage;
@@ -213,7 +213,7 @@ __PACKAGE__->register_method({
 
 	my $storage = extract_param($param, 'storage') // 'local';
 
-	my $storage_cfg = cfs_read_file("storage.cfg");
+	my $storage_cfg = PVE::Storage::config();
 
 	my $ostemplate = extract_param($param, 'ostemplate');
 
@@ -505,7 +505,7 @@ __PACKAGE__->register_method({
 	# test if container exists
 	my $conf = PVE::LXC::Config->load_config($vmid);
 
-	my $storage_cfg = cfs_read_file("storage.cfg");
+	my $storage_cfg = PVE::Storage::config();
 
 	PVE::LXC::Config->check_protection($conf, "can't remove CT $vmid");
 
@@ -1268,7 +1268,7 @@ __PACKAGE__->register_method({
 
 	PVE::LXC::check_ct_modify_config_perm($rpcenv, $authuser, $vmid, undef, $param, []);
 
-	my $storage_cfg = cfs_read_file("storage.cfg");
+	my $storage_cfg = PVE::Storage::config();
 
 	my $code = sub {
 
diff --git a/src/PVE/API2/LXC/Config.pm b/src/PVE/API2/LXC/Config.pm
index 0d0732e..85466e2 100644
--- a/src/PVE/API2/LXC/Config.pm
+++ b/src/PVE/API2/LXC/Config.pm
@@ -7,7 +7,6 @@ use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param run_command);
 use PVE::Exception qw(raise raise_param_exc);
 use PVE::INotify;
-use PVE::Cluster qw(cfs_read_file);
 use PVE::AccessControl;
 use PVE::Firewall;
 use PVE::Storage;
@@ -126,7 +125,7 @@ __PACKAGE__->register_method({
 
 	PVE::LXC::check_ct_modify_config_perm($rpcenv, $authuser, $vmid, undef, $param, []);
 
-	my $storage_cfg = cfs_read_file("storage.cfg");
+	my $storage_cfg = PVE::Storage::config();
 
 	my $code = sub {
 
diff --git a/src/PVE/API2/LXC/Status.pm b/src/PVE/API2/LXC/Status.pm
index 01dfe12..07e4afe 100644
--- a/src/PVE/API2/LXC/Status.pm
+++ b/src/PVE/API2/LXC/Status.pm
@@ -7,7 +7,7 @@ use PVE::SafeSyslog;
 use PVE::Tools qw(extract_param run_command);
 use PVE::Exception qw(raise raise_param_exc);
 use PVE::INotify;
-use PVE::Cluster qw(cfs_read_file);
+use PVE::Cluster;
 use PVE::AccessControl;
 use PVE::Firewall;
 use PVE::Storage;
@@ -172,7 +172,7 @@ __PACKAGE__->register_method({
 			PVE::LXC::Config->check_lock($conf);
 		    }
 
-		    my $storage_cfg = cfs_read_file("storage.cfg");
+		    my $storage_cfg = PVE::Storage::config();
 
 		    PVE::LXC::update_lxc_config($storage_cfg, $vmid, $conf);
 
-- 
2.1.4





More information about the pve-devel mailing list