[pve-devel] [PATCH manager v3 06/20] ceph: add add_storage helper

Fabian Gr├╝nbichler f.gruenbichler at proxmox.com
Thu Aug 31 11:38:09 CEST 2017


Signed-off-by: Fabian Gr├╝nbichler <f.gruenbichler at proxmox.com>
---
changes since v2:
- drop keyring handling

changes since v1:
- drop $monhash parameter
- don't generate and set monhost storage parameter

 PVE/API2/Ceph.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 7f709f55..2fd47207 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -12,6 +12,7 @@ use PVE::INotify;
 use PVE::Cluster qw(cfs_lock_file cfs_read_file cfs_write_file);
 use PVE::AccessControl;
 use PVE::Storage;
+use PVE::API2::Storage::Config;
 use PVE::RESTHandler;
 use PVE::RPCEnvironment;
 use PVE::JSONSchema qw(get_standard_option);
@@ -699,6 +700,21 @@ __PACKAGE__->register_method ({
 
     }});
 
+my $add_storage = sub {
+    my ($pool, $storeid, $krbd) = @_;
+
+    my $storage_params = {
+	type => 'rbd',
+	pool => $pool,
+	storage => $storeid,
+	krbd => $krbd // 0,
+	content => $krbd ? 'rootdir' : 'images',
+	pveceph => 1,
+    };
+
+    PVE::API2::Storage::Config->create($storage_params);
+};
+
 __PACKAGE__->register_method ({
     name => 'listmon',
     path => 'mon',
-- 
2.11.0




More information about the pve-devel mailing list