Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Changes | 1 +
Virt.xs | 44 ++++++++++++++++++++++++++++++++++++++++++++
lib/Sys/Virt/Domain.pm | 4 ++++
t/030-api-coverage.t | 1 +
4 files changed, 50 insertions(+)
diff --git a/Changes b/Changes
index 672b566..e425ad4 100644
--- a/Changes
+++ b/Changes
@@ -10,6 +10,7 @@ Revision history for perl module Sys::Virt
- Add PERF_PARAM_STALLED_CYCLES_BACKEND constant
- Add PERF_PARAM_REF_CPU_CYCLES constant
- Add virStorageVolGetInfoFlags & associated constants
+ - Add domain metdata change event
2.5.0 2016-12-05
diff --git a/Virt.xs b/Virt.xs
index 1eb94a8..9a7ce17 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -1096,6 +1096,46 @@ _domain_event_job_completed_callback(virConnectPtr con,
static int
+_domain_event_metadata_change_callback(virConnectPtr con,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque)
+{
+ AV *data = opaque;
+ SV **self;
+ SV **cb;
+ SV *domref;
+ dSP;
+
+ self = av_fetch(data, 0, 0);
+ cb = av_fetch(data, 1, 0);
+
+ SvREFCNT_inc(*self);
+
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK(SP);
+ XPUSHs(*self);
+ domref = sv_newmortal();
+ sv_setref_pv(domref, "Sys::Virt::Domain", (void*)dom);
+ virDomainRef(dom);
+ XPUSHs(domref);
+ XPUSHs(sv_2mortal(newSViv(type)));
+ XPUSHs(sv_2mortal(newSVpv(nsuri, 0)));
+ PUTBACK;
+
+ call_sv(*cb, G_DISCARD);
+
+ FREETMPS;
+ LEAVE;
+
+ return 0;
+}
+
+
+static int
_network_event_lifecycle_callback(virConnectPtr con,
virNetworkPtr net,
int event,
@@ -3248,6 +3288,9 @@ PREINIT:
case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED:
callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_device_generic_callback);
break;
+ case VIR_DOMAIN_EVENT_ID_METADATA_CHANGE:
+ callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_metadata_change_callback);
+ break;
default:
callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback);
break;
@@ -8197,6 +8240,7 @@ BOOT:
REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION,
EVENT_ID_MIGRATION_ITERATION);
REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_JOB_COMPLETED, EVENT_ID_JOB_COMPLETED);
REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED,
EVENT_ID_DEVICE_REMOVAL_FAILED);
+ REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, EVENT_ID_METADATA_CHANGE);
REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_NONE, EVENT_WATCHDOG_NONE);
REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, EVENT_WATCHDOG_PAUSE);
diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm
index bd59139..aa7b5bd 100644
--- a/lib/Sys/Virt/Domain.pm
+++ b/lib/Sys/Virt/Domain.pm
@@ -3211,6 +3211,10 @@ method.
Guest device removal has failed.
+=item Sys::Virt::Domain::EVENT_ID_METADATA_CHANGE
+
+The domain metadata has changed
+
=back
=head2 IO ERROR EVENT CONSTANTS
diff --git a/t/030-api-coverage.t b/t/030-api-coverage.t
index 2c7d146..7bc33fb 100644
--- a/t/030-api-coverage.t
+++ b/t/030-api-coverage.t
@@ -94,6 +94,7 @@ virConnectDomainEventAgentLifecycleCallback
virConnectDomainEventMigrationIterationCallback
virConnectDomainEventJobCompletedCallback
virConnectDomainEventDeviceRemovalFailedCallback
+virConnectDomainEventMetadataChangeCallback
virConnectNetworkEventLifecycleCallback
--
2.9.3