public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH container] lxc: resize: fix #2790 return message in case of disk already at size
@ 2020-08-10 14:57 Aaron Lauterer
  2020-08-11  7:51 ` Fabian Ebner
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lauterer @ 2020-08-10 14:57 UTC (permalink / raw)
  To: pve-devel

Otherwise the API would return an error message because the schema
defines a return of type string which wasn't provided.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

We should probably align the resize endpoint on the qemu side
accordingly.

 src/PVE/API2/LXC.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 21899d0..bcac8e2 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1674,7 +1674,7 @@ __PACKAGE__->register_method({
 
 	    die "unable to shrink disk size\n" if $newsize < $size;
 
-	    return if $size == $newsize;
+	    return 'disk is already at specified size' if $size == $newsize;
 
 	    PVE::Cluster::log_msg('info', $authuser, "update CT $vmid: resize --disk $disk --size $sizestr");
 	    my $realcmd = sub {
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH container] lxc: resize: fix #2790 return message in case of disk already at size
  2020-08-10 14:57 [pve-devel] [PATCH container] lxc: resize: fix #2790 return message in case of disk already at size Aaron Lauterer
@ 2020-08-11  7:51 ` Fabian Ebner
  2020-08-11  8:15   ` Aaron Lauterer
  0 siblings, 1 reply; 3+ messages in thread
From: Fabian Ebner @ 2020-08-11  7:51 UTC (permalink / raw)
  To: pve-devel

The returned string is supposed to be a task ID. If some other kind of 
string is returned, could this cause any problems?

Am 10.08.20 um 16:57 schrieb Aaron Lauterer:
> Otherwise the API would return an error message because the schema
> defines a return of type string which wasn't provided.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> 
> We should probably align the resize endpoint on the qemu side
> accordingly.
> 
>   src/PVE/API2/LXC.pm | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 21899d0..bcac8e2 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -1674,7 +1674,7 @@ __PACKAGE__->register_method({
>   
>   	    die "unable to shrink disk size\n" if $newsize < $size;
>   
> -	    return if $size == $newsize;
> +	    return 'disk is already at specified size' if $size == $newsize;
>   
>   	    PVE::Cluster::log_msg('info', $authuser, "update CT $vmid: resize --disk $disk --size $sizestr");
>   	    my $realcmd = sub {
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH container] lxc: resize: fix #2790 return message in case of disk already at size
  2020-08-11  7:51 ` Fabian Ebner
@ 2020-08-11  8:15   ` Aaron Lauterer
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Lauterer @ 2020-08-11  8:15 UTC (permalink / raw)
  To: Fabian Ebner, pve-devel

On 8/11/20 9:51 AM, Fabian Ebner wrote:
> The returned string is supposed to be a task ID. If some other kind of string is returned, could this cause any problems?

Good point. Maybe it is better then to die instead of returning so the returned values will not contain a "success".

Return message on a successfull resize is
{"success":1,"data":"UPID:nola:00000B3B:0425A0CD:5F3251DC:resize:300:root@pam:"}

When setting the size to a smaller value, where we die:
{"message":"unable to shrink disk size\n","data":null,"success":0,"status":500}

> 
> Am 10.08.20 um 16:57 schrieb Aaron Lauterer:
>> Otherwise the API would return an error message because the schema
>> defines a return of type string which wasn't provided.
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
>> ---
>>
>> We should probably align the resize endpoint on the qemu side
>> accordingly.
>>
>>   src/PVE/API2/LXC.pm | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
>> index 21899d0..bcac8e2 100644
>> --- a/src/PVE/API2/LXC.pm
>> +++ b/src/PVE/API2/LXC.pm
>> @@ -1674,7 +1674,7 @@ __PACKAGE__->register_method({
>>           die "unable to shrink disk size\n" if $newsize < $size;
>> -        return if $size == $newsize;
>> +        return 'disk is already at specified size' if $size == $newsize;
>>           PVE::Cluster::log_msg('info', $authuser, "update CT $vmid: resize --disk $disk --size $sizestr");
>>           my $realcmd = sub {
>>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-11  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 14:57 [pve-devel] [PATCH container] lxc: resize: fix #2790 return message in case of disk already at size Aaron Lauterer
2020-08-11  7:51 ` Fabian Ebner
2020-08-11  8:15   ` Aaron Lauterer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal