public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command
@ 2020-07-08  9:57 Stefan Reiter
  2020-07-08  9:57 ` [pve-devel] [PATCH v3 qemu-server 2/2] backup: detect PBS features and use only supported Stefan Reiter
  2020-07-09 11:54 ` [pve-devel] applied: Re: [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Reiter @ 2020-07-08  9:57 UTC (permalink / raw)
  To: pve-devel

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

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

v2:
* include 'pbs' feature

 pve-backup.c         |  8 ++++++++
 qapi/block-core.json | 24 ++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/pve-backup.c b/pve-backup.c
index 46191bb328..d90010a4fe 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -1044,3 +1044,11 @@ BackupStatus *qmp_query_backup(Error **errp)
 
     return info;
 }
+
+ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+{
+    ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret));
+    ret->pbs = true;
+    ret->pbs_dirty_bitmap = true;
+    return ret;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 2c83734b04..d04d5e9f48 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -861,6 +861,30 @@
 ##
 { 'command': 'backup-cancel' }
 
+##
+# @ProxmoxSupportStatus:
+#
+# Contains info about supported features added by Proxmox.
+#
+# @pbs: True if backing up to Proxmox Backup Server is supported.
+#
+# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
+#                    supported.
+#
+##
+{ 'struct': 'ProxmoxSupportStatus',
+  'data': { 'pbs': 'bool', '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] 3+ messages in thread

* [pve-devel] [PATCH v3 qemu-server 2/2] backup: detect PBS features and use only supported
  2020-07-08  9:57 [pve-devel] [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command Stefan Reiter
@ 2020-07-08  9:57 ` Stefan Reiter
  2020-07-09 11:54 ` [pve-devel] applied: Re: [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Reiter @ 2020-07-08  9:57 UTC (permalink / raw)
  To: pve-devel

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

If 'pbs' is not supported at all, error out with a nice message.

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

v2:
* check for 'pbs' feature and error with nice message

v3:
* fix string - sorry, the dot didn't make it into v2

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

diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 567088c..83610ba 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -443,6 +443,12 @@ sub archive_pbs {
 	    die "interrupted by signal\n";
 	};
 
+	my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") } // {};
+	if (!$qemu_support->{pbs}) {
+	    die "PBS backups are not supported by this QEMU version. Please make "
+	      . "sure you've installed the latest version and the VM has been restarted.\n";
+	}
+
 	my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
 
 	my $params = {
@@ -453,11 +459,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] 3+ messages in thread

* [pve-devel] applied: Re: [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command
  2020-07-08  9:57 [pve-devel] [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command Stefan Reiter
  2020-07-08  9:57 ` [pve-devel] [PATCH v3 qemu-server 2/2] backup: detect PBS features and use only supported Stefan Reiter
@ 2020-07-09 11:54 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-07-09 11:54 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 08.07.20 11:57, Stefan Reiter wrote:
> Generic interface for future use, currently used for PBS and
> dirty-bitmap backup support.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
> 
> v2:
> * include 'pbs' feature
> 
>  pve-backup.c         |  8 ++++++++
>  qapi/block-core.json | 24 ++++++++++++++++++++++++
>  2 files changed, 32 insertions(+)
> 
>

applied, thanks! but dropped the "pbs" one, makes no sense... We want to have
a proxmox-backup library version and soname info field here in the future though.




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

end of thread, other threads:[~2020-07-09 11:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-08  9:57 [pve-devel] [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command Stefan Reiter
2020-07-08  9:57 ` [pve-devel] [PATCH v3 qemu-server 2/2] backup: detect PBS features and use only supported Stefan Reiter
2020-07-09 11:54 ` [pve-devel] applied: Re: [PATCH v3 qemu 1/2] PVE: add query_proxmox_support QMP command 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