public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu 1/2] PVE: add query_proxmox_support QMP command
@ 2020-07-08  8:42 Stefan Reiter
  2020-07-08  8:42 ` [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU Stefan Reiter
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Reiter @ 2020-07-08  8:42 UTC (permalink / raw)
  To: pve-devel

Generic interface for future use, currently only used for dirty-bitmap
backup support.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 pve-backup.c         |  7 +++++++
 qapi/block-core.json | 22 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/pve-backup.c b/pve-backup.c
index 46191bb328..187a78f38d 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -1044,3 +1044,10 @@ BackupStatus *qmp_query_backup(Error **errp)
 
     return info;
 }
+
+ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+{
+    ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret));
+    ret->pbs_dirty_bitmap = true;
+    return ret;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 2c83734b04..169b89a58e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -861,6 +861,28 @@
 ##
 { 'command': 'backup-cancel' }
 
+##
+# @ProxmoxSupportStatus:
+#
+# Contains info about supported features added by Proxmox.
+#
+# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
+#                    supported.
+#
+##
+{ 'struct': 'ProxmoxSupportStatus',
+  'data': { 'pbs-dirty-bitmap': 'bool' } }
+
+##
+# @query-proxmox-support:
+#
+# Returns information about supported features added by Proxmox.
+#
+# Returns: @ProxmoxSupportStatus
+#
+##
+{ 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' }
+
 ##
 # @BlockDeviceTimedStats:
 #
-- 
2.20.1





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

* [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU
  2020-07-08  8:42 [pve-devel] [PATCH qemu 1/2] PVE: add query_proxmox_support QMP command Stefan Reiter
@ 2020-07-08  8:42 ` Stefan Reiter
  2020-07-08  9:08   ` Thomas Lamprecht
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Reiter @ 2020-07-08  8:42 UTC (permalink / raw)
  To: pve-devel

If 'query-proxmox-support' is not known to QEMU, assume that no other
features are supported either.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

Does not require any version bumps, since it handles failure gracefully.

 PVE/VZDump/QemuServer.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 567088c..3c2a334 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -443,6 +443,8 @@ sub archive_pbs {
 	    die "interrupted by signal\n";
 	};
 
+	my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") } // {};
+
 	my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
 
 	my $params = {
@@ -453,11 +455,13 @@ sub archive_pbs {
 	    password => $password,
 	    devlist => $devlist,
 	    'config-file' => $conffile,
-	    'use-dirty-bitmap' => JSON::true,
 	};
 	$params->{fingerprint} = $fingerprint if defined($fingerprint);
 	$params->{'firewall-file'} = $firewall if -e $firewall;
 
+	$params->{'use-dirty-bitmap'} = JSON::true
+	    if $qemu_support->{'pbs-dirty-bitmap'};
+
 	$params->{timeout} = 60; # give some time to connect to the backup server
 
 	my $res = eval { mon_cmd($vmid, "backup", %$params) };
-- 
2.20.1





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

* Re: [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU
  2020-07-08  8:42 ` [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU Stefan Reiter
@ 2020-07-08  9:08   ` Thomas Lamprecht
  2020-07-08  9:22     ` Stefan Reiter
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Lamprecht @ 2020-07-08  9:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.07.20 10:42, Stefan Reiter wrote:
> If 'query-proxmox-support' is not known to QEMU, assume that no other
> features are supported either.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> Does not require any version bumps, since it handles failure gracefully.
> 
>  PVE/VZDump/QemuServer.pm | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
> index 567088c..3c2a334 100644
> --- a/PVE/VZDump/QemuServer.pm
> +++ b/PVE/VZDump/QemuServer.pm
> @@ -443,6 +443,8 @@ sub archive_pbs {
>  	    die "interrupted by signal\n";
>  	};
>  
> +	my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") } // {};

can we not fall back and instead use undef here to error out with a nice
"does not support PBS at all" message?

> +
>  	my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
>  
>  	my $params = {
> @@ -453,11 +455,13 @@ sub archive_pbs {
>  	    password => $password,
>  	    devlist => $devlist,
>  	    'config-file' => $conffile,
> -	    'use-dirty-bitmap' => JSON::true,
>  	};
>  	$params->{fingerprint} = $fingerprint if defined($fingerprint);
>  	$params->{'firewall-file'} = $firewall if -e $firewall;
>  
> +	$params->{'use-dirty-bitmap'} = JSON::true
> +	    if $qemu_support->{'pbs-dirty-bitmap'};
> +
>  	$params->{timeout} = 60; # give some time to connect to the backup server
>  
>  	my $res = eval { mon_cmd($vmid, "backup", %$params) };
> 





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

* Re: [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU
  2020-07-08  9:08   ` Thomas Lamprecht
@ 2020-07-08  9:22     ` Stefan Reiter
  2020-07-08  9:49       ` Thomas Lamprecht
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Reiter @ 2020-07-08  9:22 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion

On 7/8/20 11:08 AM, Thomas Lamprecht wrote:
> On 08.07.20 10:42, Stefan Reiter wrote:
>> If 'query-proxmox-support' is not known to QEMU, assume that no other
>> features are supported either.
>>
>> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
>> ---
>>
>> Does not require any version bumps, since it handles failure gracefully.
>>
>>   PVE/VZDump/QemuServer.pm | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
>> index 567088c..3c2a334 100644
>> --- a/PVE/VZDump/QemuServer.pm
>> +++ b/PVE/VZDump/QemuServer.pm
>> @@ -443,6 +443,8 @@ sub archive_pbs {
>>   	    die "interrupted by signal\n";
>>   	};
>>   
>> +	my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") } // {};
> 
> can we not fall back and instead use undef here to error out with a nice
> "does not support PBS at all" message?
>

If we want that, sure. Though I think it might be cleaner to also have a 
'pbs' feature as well, I don't like the approach of implicitly detecting 
support just because a QMP command exists.

I'll send a v2.

>> +
>>   	my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
>>   
>>   	my $params = {
>> @@ -453,11 +455,13 @@ sub archive_pbs {
>>   	    password => $password,
>>   	    devlist => $devlist,
>>   	    'config-file' => $conffile,
>> -	    'use-dirty-bitmap' => JSON::true,
>>   	};
>>   	$params->{fingerprint} = $fingerprint if defined($fingerprint);
>>   	$params->{'firewall-file'} = $firewall if -e $firewall;
>>   
>> +	$params->{'use-dirty-bitmap'} = JSON::true
>> +	    if $qemu_support->{'pbs-dirty-bitmap'};
>> +
>>   	$params->{timeout} = 60; # give some time to connect to the backup server
>>   
>>   	my $res = eval { mon_cmd($vmid, "backup", %$params) };
>>
> 




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

* Re: [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU
  2020-07-08  9:22     ` Stefan Reiter
@ 2020-07-08  9:49       ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2020-07-08  9:49 UTC (permalink / raw)
  To: Stefan Reiter, Proxmox VE development discussion

On 08.07.20 11:22, Stefan Reiter wrote:
> On 7/8/20 11:08 AM, Thomas Lamprecht wrote:
>> On 08.07.20 10:42, Stefan Reiter wrote:
>>> If 'query-proxmox-support' is not known to QEMU, assume that no other
>>> features are supported either.
>>>
>>> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
>>> ---
>>>
>>> Does not require any version bumps, since it handles failure gracefully.
>>>
>>>   PVE/VZDump/QemuServer.pm | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
>>> index 567088c..3c2a334 100644
>>> --- a/PVE/VZDump/QemuServer.pm
>>> +++ b/PVE/VZDump/QemuServer.pm
>>> @@ -443,6 +443,8 @@ sub archive_pbs {
>>>           die "interrupted by signal\n";
>>>       };
>>>   +    my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") } // {};
>>
>> can we not fall back and instead use undef here to error out with a nice
>> "does not support PBS at all" message?
>>
> 
> If we want that, sure. Though I think it might be cleaner to also have a 'pbs' feature as well, I don't like the approach of implicitly detecting support just because a QMP command exists.

adding an extra command which plainly returns true doesn't changes anything,
at least when done in the initial version of this as then it only can go:

* qmp command exists -> always true
* qmp command doesn'T exists -> always false

so you do not gain anything by that, but I do not care to much..

> 
> I'll send a v2.
> 
>>> +
>>>       my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
>>>         my $params = {
>>> @@ -453,11 +455,13 @@ sub archive_pbs {
>>>           password => $password,
>>>           devlist => $devlist,
>>>           'config-file' => $conffile,
>>> -        'use-dirty-bitmap' => JSON::true,
>>>       };
>>>       $params->{fingerprint} = $fingerprint if defined($fingerprint);
>>>       $params->{'firewall-file'} = $firewall if -e $firewall;
>>>   +    $params->{'use-dirty-bitmap'} = JSON::true
>>> +        if $qemu_support->{'pbs-dirty-bitmap'};
>>> +
>>>       $params->{timeout} = 60; # give some time to connect to the backup server
>>>         my $res = eval { mon_cmd($vmid, "backup", %$params) };
>>>
>>






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

end of thread, other threads:[~2020-07-08  9:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08  8:42 [pve-devel] [PATCH qemu 1/2] PVE: add query_proxmox_support QMP command Stefan Reiter
2020-07-08  8:42 ` [pve-devel] [PATCH qemu-server 2/2] backup: use dirty-bitmap for PBS only if supported by QEMU Stefan Reiter
2020-07-08  9:08   ` Thomas Lamprecht
2020-07-08  9:22     ` Stefan Reiter
2020-07-08  9:49       ` Thomas Lamprecht

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