[pve-devel] [v2 manager 19/27] ceph: rename API placeholder 'name' to 'pool'

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Aug 29 15:37:14 CEST 2017


On 08/29/2017 01:04 PM, Fabian Grünbichler wrote:
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> ---
> new in v2
> 
>   PVE/API2/Ceph.pm   | 26 +++++++++++++-------------
>   PVE/CLI/pveceph.pm |  8 ++++----
>   2 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
> index 45477f4b..06c4bb8b 100644
> --- a/PVE/API2/Ceph.pm
> +++ b/PVE/API2/Ceph.pm
> @@ -1570,7 +1570,7 @@ __PACKAGE__->register_method ({
>   
>   __PACKAGE__->register_method ({
>       name => 'lsstorages',
> -    path => 'pools/{name}/storages',
> +    path => 'pools/{pool}/storages',
>       method => 'GET',
>       description => "List all pveceph-managed storages of a pool.",
>       proxyto => 'node',
> @@ -1582,7 +1582,7 @@ __PACKAGE__->register_method ({
>   	additionalProperties => 0,
>   	properties => {
>   	    node => get_standard_option('pve-node'),
> -	    name => {
> +	    pool => {
>   		description => "The name of the pool.",
>   		type => 'string',
>   	    },
> @@ -1602,7 +1602,7 @@ __PACKAGE__->register_method ({
>       code => sub {
>   	my ($param) = @_;
>   
> -	my $storages = $get_storages->($param->{name});
> +	my $storages = $get_storages->($param->{pool});
>   	return [ map { {
>   	    storage => $_,
>   	    krbd => $storages->{$_}->{krbd} // 0,
> @@ -1611,7 +1611,7 @@ __PACKAGE__->register_method ({
>   
>   __PACKAGE__->register_method ({
>       name => 'addstorage',
> -    path => 'pools/{name}/storages',
> +    path => 'pools/{pool}/storages',
>       method => 'POST',
>       description => "Create storage configuration for pool",
>       proxyto => 'node',
> @@ -1623,7 +1623,7 @@ __PACKAGE__->register_method ({
>   	additionalProperties => 0,
>   	properties => {
>   	    node => get_standard_option('pve-node'),
> -	    name => {
> +	    pool => {
>   		description => "The name of the pool.",
>   		type => 'string',
>   	    },
> @@ -1646,14 +1646,14 @@ __PACKAGE__->register_method ({
>   	die "not fully configured - missing '$pve_ckeyring_path'\n"
>   	    if ! -f $pve_ckeyring_path;
>   
> -	$add_storage->($param->{name}, $param->{storage}, $param->{krbd});
> +	$add_storage->($param->{pool}, $param->{storage}, $param->{krbd});
>   
>   	return undef;
>       }});
>   
>   __PACKAGE__->register_method ({
>       name => 'removestorage',
> -    path => 'pools/{name}/storages/{storage}',
> +    path => 'pools/{pool}/storages/{storage}',
>       method => 'DELETE',
>       description => "Remove storage configuration(s) of a pool",
>       proxyto => 'node',
> @@ -1665,7 +1665,7 @@ __PACKAGE__->register_method ({
>   	additionalProperties => 0,
>   	properties => {
>   	    node => get_standard_option('pve-node'),
> -	    name => {
> +	    pool => {
>   		description => "The name of the pool.",
>   		type => 'string',
>   	    },
> @@ -1684,8 +1684,8 @@ __PACKAGE__->register_method ({
>   	    if ! -f $pve_ckeyring_path;
>   
>   	my $target_storage = $param->{storage};
> -	my $pool_storages = $get_storages->($param->{name});
> -	die "no storage named '$target_storage' for pool $param->{name}"
> +	my $pool_storages = $get_storages->($param->{pool});
> +	die "no storage named '$target_storage' for pool $param->{pool}"
>   	    if $target_storage && !$pool_storages->{$target_storage};
>   
>   	my $err;
> @@ -1970,7 +1970,7 @@ __PACKAGE__->register_method ({
>   
>   __PACKAGE__->register_method ({
>       name => 'destroypool',
> -    path => 'pools/{name}',
> +    path => 'pools/{pool}',
>       method => 'DELETE',
>       description => "Destroy pool",
>       proxyto => 'node',
> @@ -1982,7 +1982,7 @@ __PACKAGE__->register_method ({
>   	additionalProperties => 0,
>   	properties => {
>   	    node => get_standard_option('pve-node'),
> -	    name => {
> +	    pool => {
>   		description => "The name of the pool. It must be unique.",
>   		type => 'string',
>   	    },
> @@ -2011,7 +2011,7 @@ __PACKAGE__->register_method ({
>   	$rpcenv->check($user, '/storage', ['Datastore.Allocate'])
>   	    if $param->{remove_storages};
>   
> -	my $pool = $param->{name};
> +	my $pool = $param->{pool};
>   
>   	# if not forced, destroy ceph pool only when no
>   	# vm disks are on it anymore
> diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
> index 1b6999fe..72a8c4e9 100755
> --- a/PVE/CLI/pveceph.pm
> +++ b/PVE/CLI/pveceph.pm
> @@ -165,9 +165,9 @@ our $cmddef = {
>   	}
>       }],
>       createpool => [ 'PVE::API2::Ceph', 'createpool', ['name'], { node => $nodename }],
> -    destroypool => [ 'PVE::API2::Ceph', 'destroypool', ['name'], { node => $nodename } ],
> -    addstorage => [ 'PVE::API2::Ceph', 'addstorage', ['name', 'storage'], { node => $nodename } ],
> -    lsstorages => [ 'PVE::API2::Ceph', 'lsstorages', ['name'], { node => $nodename }, sub {
> +    destroypool => [ 'PVE::API2::Ceph', 'destroypool', ['pool'], { node => $nodename } ],
> +    addstorage => [ 'PVE::API2::Ceph', 'addstorage', ['pool', 'storage'], { node => $nodename } ],
> +    lsstorages => [ 'PVE::API2::Ceph', 'lsstorages', ['pool'], { node => $nodename }, sub {
>   	my $res = shift;
>   
>   	if (@$res == 0) {
> @@ -187,7 +187,7 @@ our $cmddef = {
>   	    printf "%-${maxlen}s %s\n", $p->{storage}, $p->{krbd} ? 'Yes' : 'No';
>   	}
>       }],
> -    removestorage => [ 'PVE::API2::Ceph', 'removestorage', ['name'], { node => $nodename } ],
> +    removestorage => [ 'PVE::API2::Ceph', 'removestorage', ['pool'], { node => $nodename } ],
>       createosd => [ 'PVE::API2::CephOSD', 'createosd', ['dev'], { node => $nodename }, $upid_exit],
>       destroyosd => [ 'PVE::API2::CephOSD', 'destroyosd', ['osdid'], { node => $nodename }, $upid_exit],
>       createmon => [ 'PVE::API2::Ceph', 'createmon', [], { node => $nodename }, $upid_exit],
> 

This would be nice to do at the start of this series to avoid touching
the new API entry points directly again. But as its new and a little PITA to
rebase to the start, I understand if you do not want to move it there.





More information about the pve-devel mailing list