]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/CLI/pveceph.pm
pveceph: change status from long JSON to ceph -s
[pve-manager.git] / PVE / CLI / pveceph.pm
index e2c89be25fd54499fd9ee705472c0d8f91ac9658..de046dd045b3f2fe42743690b88f63e1eae46ddc 100755 (executable)
@@ -144,10 +144,7 @@ __PACKAGE__->register_method ({
            die "Not allowed to select version '$cephver'\n" if !$param->{'allow-experimental'};
            $repolist = "deb http://download.proxmox.com/debian/ceph-luminous buster main\n";
        } elsif ($cephver eq 'octopus') {
-           die "Not allowed to select version '$cephver'\n" if !$param->{'allow-experimental'};
-           $repolist = "deb http://download.proxmox.com/debian/ceph-octopus buster test\n";
-           # FIXME: use production component once available
-           #$repolist = "deb http://download.proxmox.com/debian/ceph-octopus buster main\n";
+           $repolist = "deb http://download.proxmox.com/debian/ceph-octopus buster main\n";
        } else {
            die "not implemented ceph version: $cephver";
        }
@@ -157,9 +154,9 @@ __PACKAGE__->register_method ({
 
        local $ENV{DEBIAN_FRONTEND} = 'noninteractive';
        print "update available package list\n";
-       eval { run_command(['apt', '-q', 'update'], outfunc => sub {}, errfunc => sub { print STDERR "$_[0]\n" }) };
+       eval { run_command(['apt-get', '-q', 'update'], outfunc => sub {}, errfunc => sub { print STDERR "$_[0]\n" }) };
 
-       my @apt_install = qw(apt --no-install-recommends -o Dpkg::Options::=--force-confnew install --);
+       my @apt_install = qw(apt-get --no-install-recommends -o Dpkg::Options::=--force-confnew install --);
        my @ceph_packages = qw(
            ceph
            ceph-common
@@ -178,6 +175,26 @@ __PACKAGE__->register_method ({
        return undef;
     }});
 
+__PACKAGE__->register_method ({
+    name => 'status',
+    path => 'status',
+    method => 'GET',
+    description => "Get Ceph Status.",
+    parameters => {
+       additionalProperties => 0,
+    },
+    returns => { type => 'null' },
+    code => sub {
+       PVE::Ceph::Tools::check_ceph_inited();
+
+       run_command(
+           ['ceph', '-s'],
+           outfunc => sub { print "$_[0]\n" },
+           errfunc => sub { print STDERR "$_[0]\n" }
+       );
+       return undef;
+    }});
+
 our $cmddef = {
     init => [ 'PVE::API2::Ceph', 'init', [], { node => $nodename } ],
     pool => {
@@ -198,6 +215,7 @@ our $cmddef = {
        }, $PVE::RESTHandler::standard_output_options],
        create => [ 'PVE::API2::Ceph', 'createpool', ['name'], { node => $nodename }],
        destroy => [ 'PVE::API2::Ceph', 'destroypool', ['name'], { node => $nodename } ],
+       set => [ 'PVE::API2::Ceph', 'setpool', ['name'], { node => $nodename } ],
     },
     lspools => { alias => 'pool ls' },
     createpool => { alias => 'pool create' },
@@ -231,11 +249,7 @@ our $cmddef = {
     stop => [ 'PVE::API2::Ceph', 'stop', [], { node => $nodename }, $upid_exit],
     install => [ __PACKAGE__, 'install', [] ],
     purge => [  __PACKAGE__, 'purge', [] ],
-    status => [ 'PVE::API2::Ceph', 'status', [], { node => $nodename }, sub {
-       my $res = shift;
-       my $json = JSON->new->allow_nonref;
-       print $json->pretty->encode($res) . "\n";
-    }],
+    status => [ __PACKAGE__, 'status', []],
 };
 
 1;