* [pve-devel] [PATCH 0/3] Add PBS lib version to VM 'status' call @ 2020-11-05 11:17 Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file Stefan Reiter ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Stefan Reiter @ 2020-11-05 11:17 UTC (permalink / raw) To: pve-devel Include both debian and git version in libproxmox-backup-qemu0.so, so that a running QEMU can query it and return it via QMP. Print data returned by 'query-proxmox-support' for 'full=1' vmstatus calls. proxmox-backup-qemu: Stefan Reiter (1): include debian version and git rev in header file Makefile | 4 ++-- build.rs | 26 ++++++++++++++++++++++++++ current-api.h | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) pve-qemu: Stefan Reiter (1): update patches with squashed in 'include library version' ...dd-query_proxmox_support-QMP-command.patch | 22 +++++++++------ ...issing-crypt-and-compress-parameters.patch | 2 +- ...rite-callback-with-big-blocks-correc.patch | 2 +- ...-block-handling-to-PBS-dump-callback.patch | 2 +- ...E-add-query-pbs-bitmap-info-QMP-call.patch | 23 ++++++++------- ...-transaction-to-synchronize-job-stat.patch | 2 +- ...ore-coroutines-and-don-t-block-on-fi.patch | 4 +-- ...n-up-error-handling-for-create_backu.patch | 2 +- ...igrate-dirty-bitmap-state-via-savevm.patch | 28 ++++++++++--------- 9 files changed, 49 insertions(+), 38 deletions(-) qemu-server: Stefan Reiter (1): print query-proxmox-support result in 'full' status PVE/CLI/qm.pm | 2 +- PVE/QemuServer.pm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file 2020-11-05 11:17 [pve-devel] [PATCH 0/3] Add PBS lib version to VM 'status' call Stefan Reiter @ 2020-11-05 11:17 ` Stefan Reiter 2020-11-11 14:26 ` [pve-devel] applied: " Fabian Grünbichler 2020-11-05 11:17 ` [pve-devel] [PATCH pve-qemu 2/3] update patches with squashed in 'include library version' Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH qemu-server 3/3] print query-proxmox-support result in 'full' status Stefan Reiter 2 siblings, 1 reply; 6+ messages in thread From: Stefan Reiter @ 2020-11-05 11:17 UTC (permalink / raw) To: pve-devel ...so we can get the library version a binary is currently running with. Details are retrieved in build.rs by calling dpkg-parsechangelog and git, then appended using 'with_after_include' to appear within the include guard. The version string in current-api.h is inconsequential, so ignore it in diff. This way we only have to re-commit that file whenever the *actual* API changes, not the version. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- Makefile | 4 ++-- build.rs | 26 ++++++++++++++++++++++++++ current-api.h | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8761298..bc5f1f0 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ endif all: ifneq ($(BUILD_MODE), skip) cargo build $(CARGO_BUILD_ARGS) - diff -up current-api.h proxmox-backup-qemu.h + diff -I 'PROXMOX_BACKUP_QEMU_VERSION' -up current-api.h proxmox-backup-qemu.h endif # always re-create this dir @@ -29,7 +29,7 @@ endif build: rm -rf build cargo build --release - diff -up current-api.h proxmox-backup-qemu.h + diff -I 'PROXMOX_BACKUP_QEMU_VERSION' -up current-api.h proxmox-backup-qemu.h rsync -a debian Makefile Cargo.toml Cargo.lock build.rs proxmox-backup-qemu.h src target current-api.h build/ .PHONY: install diff --git a/build.rs b/build.rs index 46dbb7a..c49b2ab 100644 --- a/build.rs +++ b/build.rs @@ -2,16 +2,42 @@ extern crate cbindgen; use std::env; +use std::process::Command; + +fn capture_stdout(cmd: &str) -> String { + let args: Vec<&str> = cmd.split(' ').collect(); + let (exe, args) = (args[0], &args[1..]); + + let stdout = Command::new(exe) + .args(args) + .output() + .expect(&format!("failed to run program: {}", exe)) + .stdout; + + String::from_utf8(stdout) + .expect(&format!("program {} produced invalid UTF-8 output", exe)) + .trim() + .to_owned() +} fn main() { let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let header = std::fs::read_to_string("header-preamble.c").unwrap(); + let debver = capture_stdout("dpkg-parsechangelog -l debian/changelog -SVersion"); + let gitver = capture_stdout("git rev-parse --short=8 HEAD"); + let version_define = format!( + "\n#define PROXMOX_BACKUP_QEMU_VERSION \"{} ({})\"", + debver, + gitver, + ); + cbindgen::Builder::new() .with_language(cbindgen::Language::C) .with_crate(&crate_dir) .with_header(header) .with_include_guard("PROXMOX_BACKUP_QEMU_H") + .with_after_include(version_define) .generate() .unwrap() .write_to_file("proxmox-backup-qemu.h"); diff --git a/current-api.h b/current-api.h index 77e8c4b..97c185f 100644 --- a/current-api.h +++ b/current-api.h @@ -32,6 +32,8 @@ #include <stdint.h> #include <stdlib.h> +#define PROXMOX_BACKUP_QEMU_VERSION "0.7.1-1 (296da586)" + #define PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE ((1024 * 1024) * 4) /** -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] applied: [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file 2020-11-05 11:17 ` [pve-devel] [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file Stefan Reiter @ 2020-11-11 14:26 ` Fabian Grünbichler 0 siblings, 0 replies; 6+ messages in thread From: Fabian Grünbichler @ 2020-11-11 14:26 UTC (permalink / raw) To: Proxmox VE development discussion a slightly simplified version On November 5, 2020 12:17 pm, Stefan Reiter wrote: > ...so we can get the library version a binary is currently running with. > > Details are retrieved in build.rs by calling dpkg-parsechangelog and > git, then appended using 'with_after_include' to appear within the > include guard. > > The version string in current-api.h is inconsequential, so ignore it in > diff. This way we only have to re-commit that file whenever the *actual* > API changes, not the version. > > Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> > --- > Makefile | 4 ++-- > build.rs | 26 ++++++++++++++++++++++++++ > current-api.h | 2 ++ > 3 files changed, 30 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index 8761298..bc5f1f0 100644 > --- a/Makefile > +++ b/Makefile > @@ -20,7 +20,7 @@ endif > all: > ifneq ($(BUILD_MODE), skip) > cargo build $(CARGO_BUILD_ARGS) > - diff -up current-api.h proxmox-backup-qemu.h > + diff -I 'PROXMOX_BACKUP_QEMU_VERSION' -up current-api.h proxmox-backup-qemu.h > endif > > # always re-create this dir > @@ -29,7 +29,7 @@ endif > build: > rm -rf build > cargo build --release > - diff -up current-api.h proxmox-backup-qemu.h > + diff -I 'PROXMOX_BACKUP_QEMU_VERSION' -up current-api.h proxmox-backup-qemu.h > rsync -a debian Makefile Cargo.toml Cargo.lock build.rs proxmox-backup-qemu.h src target current-api.h build/ > > .PHONY: install > diff --git a/build.rs b/build.rs > index 46dbb7a..c49b2ab 100644 > --- a/build.rs > +++ b/build.rs > @@ -2,16 +2,42 @@ > extern crate cbindgen; > > use std::env; > +use std::process::Command; > + > +fn capture_stdout(cmd: &str) -> String { > + let args: Vec<&str> = cmd.split(' ').collect(); > + let (exe, args) = (args[0], &args[1..]); > + > + let stdout = Command::new(exe) > + .args(args) > + .output() > + .expect(&format!("failed to run program: {}", exe)) > + .stdout; > + > + String::from_utf8(stdout) > + .expect(&format!("program {} produced invalid UTF-8 output", exe)) > + .trim() > + .to_owned() > +} > > fn main() { > let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); > let header = std::fs::read_to_string("header-preamble.c").unwrap(); > > + let debver = capture_stdout("dpkg-parsechangelog -l debian/changelog -SVersion"); > + let gitver = capture_stdout("git rev-parse --short=8 HEAD"); > + let version_define = format!( > + "\n#define PROXMOX_BACKUP_QEMU_VERSION \"{} ({})\"", > + debver, > + gitver, > + ); > + > cbindgen::Builder::new() > .with_language(cbindgen::Language::C) > .with_crate(&crate_dir) > .with_header(header) > .with_include_guard("PROXMOX_BACKUP_QEMU_H") > + .with_after_include(version_define) > .generate() > .unwrap() > .write_to_file("proxmox-backup-qemu.h"); > diff --git a/current-api.h b/current-api.h > index 77e8c4b..97c185f 100644 > --- a/current-api.h > +++ b/current-api.h > @@ -32,6 +32,8 @@ > #include <stdint.h> > #include <stdlib.h> > > +#define PROXMOX_BACKUP_QEMU_VERSION "0.7.1-1 (296da586)" > + > #define PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE ((1024 * 1024) * 4) > > /** > -- > 2.20.1 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH pve-qemu 2/3] update patches with squashed in 'include library version' 2020-11-05 11:17 [pve-devel] [PATCH 0/3] Add PBS lib version to VM 'status' call Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file Stefan Reiter @ 2020-11-05 11:17 ` Stefan Reiter 2020-11-10 16:12 ` [pve-devel] [PATCH v2 " Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH qemu-server 3/3] print query-proxmox-support result in 'full' status Stefan Reiter 2 siblings, 1 reply; 6+ messages in thread From: Stefan Reiter @ 2020-11-05 11:17 UTC (permalink / raw) To: pve-devel Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- requires version bump for updated libproxmox-backup-qemu0 of course ...dd-query_proxmox_support-QMP-command.patch | 22 +++++++++------ ...issing-crypt-and-compress-parameters.patch | 2 +- ...rite-callback-with-big-blocks-correc.patch | 2 +- ...-block-handling-to-PBS-dump-callback.patch | 2 +- ...E-add-query-pbs-bitmap-info-QMP-call.patch | 23 ++++++++------- ...-transaction-to-synchronize-job-stat.patch | 2 +- ...ore-coroutines-and-don-t-block-on-fi.patch | 4 +-- ...n-up-error-handling-for-create_backu.patch | 2 +- ...igrate-dirty-bitmap-state-via-savevm.patch | 28 ++++++++++--------- 9 files changed, 49 insertions(+), 38 deletions(-) diff --git a/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch b/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch index 1549af3..fe34e31 100644 --- a/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch +++ b/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch @@ -8,16 +8,18 @@ backup support. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> +[PVE: query-proxmox-support: include library version] +Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- - pve-backup.c | 7 +++++++ - qapi/block-core.json | 22 ++++++++++++++++++++++ - 2 files changed, 29 insertions(+) + pve-backup.c | 8 ++++++++ + qapi/block-core.json | 25 +++++++++++++++++++++++++ + 2 files changed, 33 insertions(+) diff --git a/pve-backup.c b/pve-backup.c -index bfb648d6b5..2539ae1520 100644 +index bfb648d6b5..cf33d973c6 100644 --- a/pve-backup.c +++ b/pve-backup.c -@@ -1051,3 +1051,10 @@ BackupStatus *qmp_query_backup(Error **errp) +@@ -1051,3 +1051,11 @@ BackupStatus *qmp_query_backup(Error **errp) return info; } @@ -26,13 +28,14 @@ index bfb648d6b5..2539ae1520 100644 +{ + ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret)); + ret->pbs_dirty_bitmap = true; ++ ret->pbs_library_version = g_strdup(PROXMOX_BACKUP_QEMU_VERSION); + return ret; +} diff --git a/qapi/block-core.json b/qapi/block-core.json -index f782c2cf96..6dd5e35473 100644 +index f782c2cf96..1ed5987c88 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -877,6 +877,28 @@ +@@ -877,6 +877,31 @@ ## { 'command': 'backup-cancel' } @@ -44,9 +47,12 @@ index f782c2cf96..6dd5e35473 100644 +# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are +# supported. +# ++# @pbs-library-version: Running version of libproxmox-backup-qemu0 library. ++# +## +{ 'struct': 'ProxmoxSupportStatus', -+ 'data': { 'pbs-dirty-bitmap': 'bool' } } ++ 'data': { 'pbs-dirty-bitmap': 'bool', ++ 'pbs-library-version': 'str' } } + +## +# @query-proxmox-support: diff --git a/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch b/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch index f0ff58a..0a04b58 100644 --- a/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch +++ b/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch @@ -9,7 +9,7 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 2539ae1520..0e293a4f5e 100644 +index cf33d973c6..0f194f5b5c 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -958,6 +958,8 @@ UuidInfo *qmp_backup( diff --git a/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch b/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch index 5f73a01..e3aa251 100644 --- a/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch +++ b/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch @@ -17,7 +17,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 0e293a4f5e..8999692418 100644 +index 0f194f5b5c..4f652cdf44 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -67,6 +67,7 @@ opts_init(pvebackup_init); diff --git a/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch b/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch index d09b817..b1afd22 100644 --- a/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch +++ b/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch @@ -20,7 +20,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 8999692418..562fcc20f7 100644 +index 4f652cdf44..0e212e777f 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -8,6 +8,7 @@ diff --git a/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch b/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch index c8581c8..4970977 100644 --- a/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch +++ b/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch @@ -10,8 +10,8 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- monitor/hmp-cmds.c | 28 ++++++----- pve-backup.c | 117 ++++++++++++++++++++++++++++++++----------- - qapi/block-core.json | 57 ++++++++++++++++++++- - 3 files changed, 159 insertions(+), 43 deletions(-) + qapi/block-core.json | 56 +++++++++++++++++++++ + 3 files changed, 159 insertions(+), 42 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 3ff014d32a..c3227a1498 100644 @@ -68,7 +68,7 @@ index 3ff014d32a..c3227a1498 100644 info->zero_bytes, zero_per); diff --git a/pve-backup.c b/pve-backup.c -index 562fcc20f7..04c21c80aa 100644 +index 0e212e777f..34d3349483 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -46,6 +46,7 @@ static struct PVEBackupState { @@ -314,7 +314,7 @@ index 562fcc20f7..04c21c80aa 100644 err: l = di_list; -@@ -1074,9 +1100,40 @@ BackupStatus *qmp_query_backup(Error **errp) +@@ -1074,10 +1100,41 @@ BackupStatus *qmp_query_backup(Error **errp) return info; } @@ -353,26 +353,29 @@ index 562fcc20f7..04c21c80aa 100644 ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret)); ret->pbs_dirty_bitmap = true; + ret->query_bitmap_info = true; + ret->pbs_library_version = g_strdup(PROXMOX_BACKUP_QEMU_VERSION); return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index 6dd5e35473..5fc42e87f3 100644 +index 1ed5987c88..03fc0af99b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -885,9 +885,11 @@ +@@ -885,11 +885,14 @@ # @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are # supported. # +# @query-bitmap-info: True if the 'query-pbs-bitmap-info' QMP call is supported. +# + # @pbs-library-version: Running version of libproxmox-backup-qemu0 library. + # ## { 'struct': 'ProxmoxSupportStatus', -- 'data': { 'pbs-dirty-bitmap': 'bool' } } -+ 'data': { 'pbs-dirty-bitmap': 'bool', 'query-bitmap-info': 'bool' } } + 'data': { 'pbs-dirty-bitmap': 'bool', ++ 'query-bitmap-info': 'bool', + 'pbs-library-version': 'str' } } ## - # @query-proxmox-support: -@@ -899,6 +901,59 @@ +@@ -902,6 +905,59 @@ ## { 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' } diff --git a/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch b/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch index a9489a8..9299266 100644 --- a/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch +++ b/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch @@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 49 insertions(+), 118 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 04c21c80aa..9562e9c98d 100644 +index 34d3349483..4dcaa27cb9 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -52,6 +52,7 @@ static struct PVEBackupState { diff --git a/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch b/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch index 695c0fd..5c3055c 100644 --- a/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch +++ b/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch @@ -38,7 +38,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 2 files changed, 95 insertions(+), 58 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 9562e9c98d..0466145bec 100644 +index 4dcaa27cb9..167f24ed46 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap"; @@ -359,7 +359,7 @@ index 9562e9c98d..0466145bec 100644 qemu_mutex_unlock(&backup_state.stat.lock); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 5fc42e87f3..b31ad8d989 100644 +index 03fc0af99b..29650896e2 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -784,12 +784,15 @@ diff --git a/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch b/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch index 45dabc4..f8837db 100644 --- a/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch +++ b/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch @@ -22,7 +22,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 0466145bec..1a2647e7a5 100644 +index 167f24ed46..bc780a6fac 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -50,6 +50,7 @@ static struct PVEBackupState { diff --git a/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch b/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch index 5a2e29e..1256289 100644 --- a/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch +++ b/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch @@ -17,9 +17,9 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> migration/Makefile.objs | 1 + migration/pbs-state.c | 92 ++++++++++++++++++++++++++++++++++++++++ pve-backup.c | 1 + - qapi/block-core.json | 9 +++- + qapi/block-core.json | 6 +++ softmmu/vl.c | 1 + - 6 files changed, 106 insertions(+), 1 deletion(-) + 6 files changed, 104 insertions(+) create mode 100644 migration/pbs-state.c diff --git a/include/migration/misc.h b/include/migration/misc.h @@ -145,21 +145,22 @@ index 0000000000..165895b488 + NULL); +} diff --git a/pve-backup.c b/pve-backup.c -index 1a2647e7a5..c12ff8bb61 100644 +index bc780a6fac..6670ef0fbe 100644 --- a/pve-backup.c +++ b/pve-backup.c -@@ -1129,5 +1129,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) +@@ -1128,6 +1128,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) + { ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret)); ret->pbs_dirty_bitmap = true; - ret->query_bitmap_info = true; + ret->pbs_dirty_bitmap_migration = true; + ret->query_bitmap_info = true; + ret->pbs_library_version = g_strdup(PROXMOX_BACKUP_QEMU_VERSION); return ret; - } diff --git a/qapi/block-core.json b/qapi/block-core.json -index b31ad8d989..00c9e12fcc 100644 +index 29650896e2..0da4b35028 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -890,9 +890,16 @@ +@@ -890,12 +890,18 @@ # # @query-bitmap-info: True if the 'query-pbs-bitmap-info' QMP call is supported. # @@ -168,15 +169,16 @@ index b31ad8d989..00c9e12fcc 100644 +# migration cap if this is false/unset may lead +# to crashes on migration! +# + # @pbs-library-version: Running version of libproxmox-backup-qemu0 library. + # ## { 'struct': 'ProxmoxSupportStatus', -- 'data': { 'pbs-dirty-bitmap': 'bool', 'query-bitmap-info': 'bool' } } -+ 'data': { 'pbs-dirty-bitmap': 'bool', -+ 'query-bitmap-info': 'bool', -+ 'pbs-dirty-bitmap-migration': 'bool' } } + 'data': { 'pbs-dirty-bitmap': 'bool', + 'query-bitmap-info': 'bool', ++ 'pbs-dirty-bitmap-migration': 'bool', + 'pbs-library-version': 'str' } } ## - # @query-proxmox-support: diff --git a/softmmu/vl.c b/softmmu/vl.c index 16aa2186b0..88b13871fd 100644 --- a/softmmu/vl.c -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH v2 pve-qemu 2/3] update patches with squashed in 'include library version' 2020-11-05 11:17 ` [pve-devel] [PATCH pve-qemu 2/3] update patches with squashed in 'include library version' Stefan Reiter @ 2020-11-10 16:12 ` Stefan Reiter 0 siblings, 0 replies; 6+ messages in thread From: Stefan Reiter @ 2020-11-10 16:12 UTC (permalink / raw) To: pve-devel Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- v2: Rebased for your convenience :) (was working on something else and this popped out as a side-effect) requires version bump for updated libproxmox-backup-qemu0 ...dd-query_proxmox_support-QMP-command.patch | 22 ++++++++++------ ...issing-crypt-and-compress-parameters.patch | 2 +- ...rite-callback-with-big-blocks-correc.patch | 2 +- ...-block-handling-to-PBS-dump-callback.patch | 2 +- ...E-add-query-pbs-bitmap-info-QMP-call.patch | 23 +++++++++-------- ...-transaction-to-synchronize-job-stat.patch | 2 +- ...ore-coroutines-and-don-t-block-on-fi.patch | 4 +-- ...n-up-error-handling-for-create_backu.patch | 2 +- ...igrate-dirty-bitmap-state-via-savevm.patch | 25 ++++++++++--------- 9 files changed, 47 insertions(+), 37 deletions(-) diff --git a/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch b/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch index 1549af3..aee85fa 100644 --- a/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch +++ b/debian/patches/pve/0044-PVE-add-query_proxmox_support-QMP-command.patch @@ -8,16 +8,18 @@ backup support. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> +[PVE: query-proxmox-support: include library version] +Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- - pve-backup.c | 7 +++++++ - qapi/block-core.json | 22 ++++++++++++++++++++++ - 2 files changed, 29 insertions(+) + pve-backup.c | 8 ++++++++ + qapi/block-core.json | 25 +++++++++++++++++++++++++ + 2 files changed, 33 insertions(+) diff --git a/pve-backup.c b/pve-backup.c -index bfb648d6b5..2539ae1520 100644 +index bfb648d6b5..6bf138cfc6 100644 --- a/pve-backup.c +++ b/pve-backup.c -@@ -1051,3 +1051,10 @@ BackupStatus *qmp_query_backup(Error **errp) +@@ -1051,3 +1051,11 @@ BackupStatus *qmp_query_backup(Error **errp) return info; } @@ -25,14 +27,15 @@ index bfb648d6b5..2539ae1520 100644 +ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) +{ + ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret)); ++ ret->pbs_library_version = g_strdup(PROXMOX_BACKUP_QEMU_VERSION); + ret->pbs_dirty_bitmap = true; + return ret; +} diff --git a/qapi/block-core.json b/qapi/block-core.json -index f782c2cf96..6dd5e35473 100644 +index f782c2cf96..1ed5987c88 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -877,6 +877,28 @@ +@@ -877,6 +877,31 @@ ## { 'command': 'backup-cancel' } @@ -44,9 +47,12 @@ index f782c2cf96..6dd5e35473 100644 +# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are +# supported. +# ++# @pbs-library-version: Running version of libproxmox-backup-qemu0 library. ++# +## +{ 'struct': 'ProxmoxSupportStatus', -+ 'data': { 'pbs-dirty-bitmap': 'bool' } } ++ 'data': { 'pbs-dirty-bitmap': 'bool', ++ 'pbs-library-version': 'str' } } + +## +# @query-proxmox-support: diff --git a/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch b/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch index f0ff58a..34b0f51 100644 --- a/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch +++ b/debian/patches/pve/0045-pbs-fix-missing-crypt-and-compress-parameters.patch @@ -9,7 +9,7 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 2539ae1520..0e293a4f5e 100644 +index 6bf138cfc6..cd3a132d8b 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -958,6 +958,8 @@ UuidInfo *qmp_backup( diff --git a/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch b/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch index 5f73a01..d45a455 100644 --- a/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch +++ b/debian/patches/pve/0046-PVE-handle-PBS-write-callback-with-big-blocks-correc.patch @@ -17,7 +17,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 0e293a4f5e..8999692418 100644 +index cd3a132d8b..f14273645a 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -67,6 +67,7 @@ opts_init(pvebackup_init); diff --git a/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch b/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch index d09b817..930ec8f 100644 --- a/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch +++ b/debian/patches/pve/0047-PVE-add-zero-block-handling-to-PBS-dump-callback.patch @@ -20,7 +20,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 8999692418..562fcc20f7 100644 +index f14273645a..bd802c6205 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -8,6 +8,7 @@ diff --git a/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch b/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch index c8581c8..cba7ed9 100644 --- a/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch +++ b/debian/patches/pve/0048-PVE-add-query-pbs-bitmap-info-QMP-call.patch @@ -10,8 +10,8 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- monitor/hmp-cmds.c | 28 ++++++----- pve-backup.c | 117 ++++++++++++++++++++++++++++++++----------- - qapi/block-core.json | 57 ++++++++++++++++++++- - 3 files changed, 159 insertions(+), 43 deletions(-) + qapi/block-core.json | 56 +++++++++++++++++++++ + 3 files changed, 159 insertions(+), 42 deletions(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 3ff014d32a..c3227a1498 100644 @@ -68,7 +68,7 @@ index 3ff014d32a..c3227a1498 100644 info->zero_bytes, zero_per); diff --git a/pve-backup.c b/pve-backup.c -index 562fcc20f7..04c21c80aa 100644 +index bd802c6205..2db4a62580 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -46,6 +46,7 @@ static struct PVEBackupState { @@ -314,7 +314,7 @@ index 562fcc20f7..04c21c80aa 100644 err: l = di_list; -@@ -1074,9 +1100,40 @@ BackupStatus *qmp_query_backup(Error **errp) +@@ -1074,10 +1100,41 @@ BackupStatus *qmp_query_backup(Error **errp) return info; } @@ -351,28 +351,31 @@ index 562fcc20f7..04c21c80aa 100644 ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) { ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret)); + ret->pbs_library_version = g_strdup(PROXMOX_BACKUP_QEMU_VERSION); ret->pbs_dirty_bitmap = true; + ret->query_bitmap_info = true; return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index 6dd5e35473..5fc42e87f3 100644 +index 1ed5987c88..03fc0af99b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -885,9 +885,11 @@ +@@ -885,11 +885,14 @@ # @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are # supported. # +# @query-bitmap-info: True if the 'query-pbs-bitmap-info' QMP call is supported. +# + # @pbs-library-version: Running version of libproxmox-backup-qemu0 library. + # ## { 'struct': 'ProxmoxSupportStatus', -- 'data': { 'pbs-dirty-bitmap': 'bool' } } -+ 'data': { 'pbs-dirty-bitmap': 'bool', 'query-bitmap-info': 'bool' } } + 'data': { 'pbs-dirty-bitmap': 'bool', ++ 'query-bitmap-info': 'bool', + 'pbs-library-version': 'str' } } ## - # @query-proxmox-support: -@@ -899,6 +901,59 @@ +@@ -902,6 +905,59 @@ ## { 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' } diff --git a/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch b/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch index a9489a8..daa2498 100644 --- a/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch +++ b/debian/patches/pve/0051-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch @@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 49 insertions(+), 118 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 04c21c80aa..9562e9c98d 100644 +index 2db4a62580..b52f4a9364 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -52,6 +52,7 @@ static struct PVEBackupState { diff --git a/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch b/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch index 695c0fd..49213d9 100644 --- a/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch +++ b/debian/patches/pve/0052-PVE-Backup-Use-more-coroutines-and-don-t-block-on-fi.patch @@ -38,7 +38,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 2 files changed, 95 insertions(+), 58 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 9562e9c98d..0466145bec 100644 +index b52f4a9364..4402c0cb17 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap"; @@ -359,7 +359,7 @@ index 9562e9c98d..0466145bec 100644 qemu_mutex_unlock(&backup_state.stat.lock); diff --git a/qapi/block-core.json b/qapi/block-core.json -index 5fc42e87f3..b31ad8d989 100644 +index 03fc0af99b..29650896e2 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -784,12 +784,15 @@ diff --git a/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch b/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch index 45dabc4..873fd37 100644 --- a/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch +++ b/debian/patches/pve/0053-PVE-fix-and-clean-up-error-handling-for-create_backu.patch @@ -22,7 +22,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/pve-backup.c b/pve-backup.c -index 0466145bec..1a2647e7a5 100644 +index 4402c0cb17..c7cde0fb0e 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -50,6 +50,7 @@ static struct PVEBackupState { diff --git a/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch b/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch index b1eca48..77c0c76 100644 --- a/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch +++ b/debian/patches/pve/0055-PVE-Migrate-dirty-bitmap-state-via-savevm.patch @@ -17,9 +17,9 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> migration/Makefile.objs | 1 + migration/pbs-state.c | 97 ++++++++++++++++++++++++++++++++++++++++ pve-backup.c | 1 + - qapi/block-core.json | 9 +++- + qapi/block-core.json | 6 +++ softmmu/vl.c | 1 + - 6 files changed, 111 insertions(+), 1 deletion(-) + 6 files changed, 109 insertions(+) create mode 100644 migration/pbs-state.c diff --git a/include/migration/misc.h b/include/migration/misc.h @@ -150,21 +150,21 @@ index 0000000000..c711498c3e + &pbs_state); +} diff --git a/pve-backup.c b/pve-backup.c -index 1a2647e7a5..c12ff8bb61 100644 +index c7cde0fb0e..f65f1dda26 100644 --- a/pve-backup.c +++ b/pve-backup.c -@@ -1129,5 +1129,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) - ProxmoxSupportStatus *ret = g_malloc0(sizeof(*ret)); +@@ -1130,5 +1130,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp) + ret->pbs_library_version = g_strdup(PROXMOX_BACKUP_QEMU_VERSION); ret->pbs_dirty_bitmap = true; ret->query_bitmap_info = true; + ret->pbs_dirty_bitmap_migration = true; return ret; } diff --git a/qapi/block-core.json b/qapi/block-core.json -index b31ad8d989..00c9e12fcc 100644 +index 29650896e2..0da4b35028 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -890,9 +890,16 @@ +@@ -890,12 +890,18 @@ # # @query-bitmap-info: True if the 'query-pbs-bitmap-info' QMP call is supported. # @@ -173,15 +173,16 @@ index b31ad8d989..00c9e12fcc 100644 +# migration cap if this is false/unset may lead +# to crashes on migration! +# + # @pbs-library-version: Running version of libproxmox-backup-qemu0 library. + # ## { 'struct': 'ProxmoxSupportStatus', -- 'data': { 'pbs-dirty-bitmap': 'bool', 'query-bitmap-info': 'bool' } } -+ 'data': { 'pbs-dirty-bitmap': 'bool', -+ 'query-bitmap-info': 'bool', -+ 'pbs-dirty-bitmap-migration': 'bool' } } + 'data': { 'pbs-dirty-bitmap': 'bool', + 'query-bitmap-info': 'bool', ++ 'pbs-dirty-bitmap-migration': 'bool', + 'pbs-library-version': 'str' } } ## - # @query-proxmox-support: diff --git a/softmmu/vl.c b/softmmu/vl.c index 16aa2186b0..88b13871fd 100644 --- a/softmmu/vl.c -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH qemu-server 3/3] print query-proxmox-support result in 'full' status 2020-11-05 11:17 [pve-devel] [PATCH 0/3] Add PBS lib version to VM 'status' call Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH pve-qemu 2/3] update patches with squashed in 'include library version' Stefan Reiter @ 2020-11-05 11:17 ` Stefan Reiter 2 siblings, 0 replies; 6+ messages in thread From: Stefan Reiter @ 2020-11-05 11:17 UTC (permalink / raw) To: pve-devel Extends print_recursive_hash for the CLI to handle JSON booleans so the result will actually show up in 'qm status --verbose'. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com> --- PVE/CLI/qm.pm | 2 +- PVE/QemuServer.pm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index b3b9251..b9b6051 100755 --- a/PVE/CLI/qm.pm +++ b/PVE/CLI/qm.pm @@ -110,7 +110,7 @@ sub print_recursive_hash { foreach my $item (@$hash) { print_recursive_hash("\t$prefix", $item); } - } elsif (!ref($hash) && defined($hash)) { + } elsif ((!ref($hash) && defined($hash)) || ref($hash) eq 'JSON::PP::Boolean') { if (defined($key)) { print "$prefix$key: $hash\n"; } else { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index fb68ce5..8b94ab0 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2754,6 +2754,14 @@ sub vmstatus { $qmpclient->queue_execute(undef, 2); + foreach my $vmid (keys %$list) { + next if $opt_vmid && ($vmid ne $opt_vmid); + # we can't use the $qmpclient since it might have already aborted on + # 'query-balloon', but this might also fail for older versions... + my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") }; + $res->{$vmid}->{'proxmox-support'} = $qemu_support // {}; + } + foreach my $vmid (keys %$list) { next if $opt_vmid && ($vmid ne $opt_vmid); $res->{$vmid}->{qmpstatus} = $res->{$vmid}->{status} if !$res->{$vmid}->{qmpstatus}; -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-11 14:27 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-11-05 11:17 [pve-devel] [PATCH 0/3] Add PBS lib version to VM 'status' call Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH proxmox-backup-qemu 1/3] include debian version and git rev in header file Stefan Reiter 2020-11-11 14:26 ` [pve-devel] applied: " Fabian Grünbichler 2020-11-05 11:17 ` [pve-devel] [PATCH pve-qemu 2/3] update patches with squashed in 'include library version' Stefan Reiter 2020-11-10 16:12 ` [pve-devel] [PATCH v2 " Stefan Reiter 2020-11-05 11:17 ` [pve-devel] [PATCH qemu-server 3/3] print query-proxmox-support result in 'full' status Stefan Reiter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox