mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 10:28:14 +00:00
ceph: make create/destroypool API paths async
in order to get task log entries and easily accessible task/error logs. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
c75f019a55
commit
8c42620460
@ -1591,7 +1591,7 @@ __PACKAGE__->register_method ({
|
||||
},
|
||||
},
|
||||
},
|
||||
returns => { type => 'null' },
|
||||
returns => { type => 'string' },
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
@ -1603,10 +1603,10 @@ __PACKAGE__->register_method ({
|
||||
if ! -f $pve_ckeyring_path;
|
||||
|
||||
my $pool = $param->{name};
|
||||
|
||||
if ($param->{add_storages}) {
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
my $user = $rpcenv->get_user();
|
||||
|
||||
if ($param->{add_storages}) {
|
||||
$rpcenv->check($user, '/storage', ['Datastore.Allocate']);
|
||||
die "pool name contains characters which are illegal for storage naming\n"
|
||||
if !PVE::JSONSchema::parse_storage_id($pool);
|
||||
@ -1615,9 +1615,11 @@ __PACKAGE__->register_method ({
|
||||
my $pg_num = $param->{pg_num} || 64;
|
||||
my $size = $param->{size} || 3;
|
||||
my $min_size = $param->{min_size} || 2;
|
||||
my $rados = PVE::RADOS->new();
|
||||
my $application = $param->{application} // 'rbd';
|
||||
|
||||
my $worker = sub {
|
||||
|
||||
my $rados = PVE::RADOS->new();
|
||||
$rados->mon_command({
|
||||
prefix => "osd pool create",
|
||||
pool => $pool,
|
||||
@ -1672,8 +1674,9 @@ __PACKAGE__->register_method ({
|
||||
die "adding storages for pool '$pool' failed, check log and add manually!\n"
|
||||
if $err;
|
||||
}
|
||||
};
|
||||
|
||||
return undef;
|
||||
return $rpcenv->fork_worker('cephcreatepool', $pool, $user, $worker);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
@ -1828,7 +1831,7 @@ __PACKAGE__->register_method ({
|
||||
},
|
||||
},
|
||||
},
|
||||
returns => { type => 'null' },
|
||||
returns => { type => 'string' },
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
@ -1856,6 +1859,7 @@ __PACKAGE__->register_method ({
|
||||
}
|
||||
}
|
||||
|
||||
my $worker = sub {
|
||||
my $rados = PVE::RADOS->new();
|
||||
# fixme: '--yes-i-really-really-mean-it'
|
||||
$rados->mon_command({
|
||||
@ -1880,8 +1884,8 @@ __PACKAGE__->register_method ({
|
||||
die "failed to remove (some) storages - check log and remove manually!\n"
|
||||
if $err;
|
||||
}
|
||||
|
||||
return undef;
|
||||
};
|
||||
return $rpcenv->fork_worker('cephdestroypool', $pool, $user, $worker);
|
||||
}});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user