ping
On 25/04/16 14:16, "Dmitry Mishin" <dim(a)virtuozzo.com> wrote:
If one wants to monitor 'drive-backup' command progress and
completion,
he needs a constant to recognize that. Right now, libvirt reports such
block jobs as 'unknown'.
Signed-off-by: Dmitry Mishin <dim(a)virtuozzo.com>
---
examples/object-events/event-test.c | 3 +++
include/libvirt/libvirt-domain.h | 3 +++
src/conf/domain_conf.c | 2 +-
src/qemu/qemu_monitor_json.c | 2 ++
tools/virsh-domain.c | 3 ++-
5 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/examples/object-events/event-test.c
b/examples/object-events/event-test.c
index 2063536..57d3610 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -745,6 +745,9 @@ blockJobTypeToStr(int type)
case VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT:
return "active layer block commit";
+
+ case VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP:
+ return "block backup";
}
return "unknown";
diff --git a/include/libvirt/libvirt-domain.h
b/include/libvirt/libvirt-domain.h
index 160f20f..17ea991 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1941,6 +1941,9 @@ typedef enum {
/* Active Block Commit (virDomainBlockCommit with flags), job
* exists as long as sync is active */
+ VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP = 5,
+ /* Block Backup job */
+
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_BLOCK_JOB_TYPE_LAST
# endif
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 28248c8..30c97e3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -820,7 +820,7 @@ VIR_ENUM_IMPL(virDomainLoader,
* <mirror> XML (remaining types are not two-phase). */
VIR_ENUM_DECL(virDomainBlockJob)
VIR_ENUM_IMPL(virDomainBlockJob, VIR_DOMAIN_BLOCK_JOB_TYPE_LAST,
- "", "", "copy", "",
"active-commit")
+ "", "", "copy", "",
"active-commit", "")
VIR_ENUM_IMPL(virDomainMemoryModel, VIR_DOMAIN_MEMORY_MODEL_LAST,
"", "dimm")
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 7bb9976..61fbdd9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -831,6 +831,8 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
type = VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT;
else if (STREQ(type_str, "mirror"))
type = VIR_DOMAIN_BLOCK_JOB_TYPE_COPY;
+ else if (STREQ(type_str, "backup"))
+ type = VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP;
switch ((virConnectDomainEventBlockJobStatus) event) {
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index a9f70dc..1b8c9b9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2527,7 +2527,8 @@ VIR_ENUM_IMPL(virshDomainBlockJob,
N_("Block Pull"),
N_("Block Copy"),
N_("Block Commit"),
- N_("Active Block Commit"))
+ N_("Active Block Commit"),
+ N_("Block Backup"))
static const char *
virshDomainBlockJobToString(int type)
--
1.8.3.1