From 18fc82999871ebdf88ef33a26a113c7e7e030af8 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:23:12 +0000 Subject: import perl-Sys-Virt-1.2.8-6.el7 --- diff --git a/.gitignore b/.gitignore index 49a06d5..45e7e4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/Sys-Virt-1.1.1.tar.gz +SOURCES/Sys-Virt-1.2.8.tar.gz diff --git a/.perl-Sys-Virt.metadata b/.perl-Sys-Virt.metadata index 5c57f00..f008e7c 100644 --- a/.perl-Sys-Virt.metadata +++ b/.perl-Sys-Virt.metadata @@ -1 +1 @@ -4fb0c4248dca1b5b09521bf8651b9a6cff2baea2 SOURCES/Sys-Virt-1.1.1.tar.gz +e52de62759e3bccbb208c249f83fc6a7b9b1d9d0 SOURCES/Sys-Virt-1.2.8.tar.gz diff --git a/SOURCES/0001-Add-VIR_DOMAIN_JOB_STATS_COMPLETED-constant.patch b/SOURCES/0001-Add-VIR_DOMAIN_JOB_STATS_COMPLETED-constant.patch new file mode 100644 index 0000000..8f0d726 --- /dev/null +++ b/SOURCES/0001-Add-VIR_DOMAIN_JOB_STATS_COMPLETED-constant.patch @@ -0,0 +1,56 @@ +From ef80bc61e8d9131c957503dd1607324283fd9a38 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 11 Sep 2014 11:35:48 +0100 +Subject: [PATCH] Add VIR_DOMAIN_JOB_STATS_COMPLETED constant + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 947f0706ddd83f503943f058e34e5244c7435244) +--- + Virt.xs | 2 ++ + lib/Sys/Virt/Domain.pm | 13 ++++++++++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/Virt.xs b/Virt.xs +index ba74519..55d8946 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -7231,6 +7231,8 @@ BOOT: + REGISTER_CONSTANT(VIR_DOMAIN_JOB_FAILED, JOB_FAILED); + REGISTER_CONSTANT(VIR_DOMAIN_JOB_CANCELLED, JOB_CANCELLED); + ++ REGISTER_CONSTANT(VIR_DOMAIN_JOB_STATS_COMPLETED, JOB_STATS_COMPLETED); ++ + REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_BYTES, JOB_COMPRESSION_BYTES); + REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_CACHE, JOB_COMPRESSION_CACHE); + REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES, JOB_COMPRESSION_CACHE_MISSES); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 2264a1c..db9e548 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -1281,7 +1281,7 @@ The expected amount of file remaining to be processed by the job, in bytes. + + =back + +-=item my ($type, $stats) = $dom->get_job_stats() ++=item my ($type, $stats) = $dom->get_job_stats($flags=0) + + Returns an array summarising the execution state of the + background job. The C<$type> value is one of the JOB TYPE +@@ -1296,6 +1296,17 @@ following constants. + The type of job, one of the JOB TYPE constants listed later in + this document. + ++The C<$flags> parameter defaults to zero and can take one of ++the following constants. ++ ++=over 4 ++ ++=item Sys::Virt::Domain::JOB_STATS_COMPLETED ++ ++Return the stats of the most recently completed job. ++ ++=back ++ + =item Sys::Virt::Domain::JOB_TIME_ELAPSED + + The elapsed time in milliseconds diff --git a/SOURCES/0001-Fix-error-handling-for-virNodeDeviceGetParent.patch b/SOURCES/0001-Fix-error-handling-for-virNodeDeviceGetParent.patch deleted file mode 100644 index e1b2f6d..0000000 --- a/SOURCES/0001-Fix-error-handling-for-virNodeDeviceGetParent.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 4eaf7009f1346e11a7d8903025d07ecee84ccf36 Mon Sep 17 00:00:00 2001 -From: "Daniel P. Berrange" -Date: Tue, 6 Aug 2013 14:23:55 +0100 -Subject: [PATCH] Fix error handling for virNodeDeviceGetParent() - - https://bugzilla.redhat.com/show_bug.cgi?id=994141 - -It is valid for virNodeDeviceGetParent() to return NULL in the -case where there is no parent device present. - -Signed-off-by: Daniel P. Berrange -(cherry picked from commit 43666d996feed10d72a1eb03415901d7b3d5332a) ---- - Virt.xs | 6 ++++-- - examples/node-devlist.pl | 11 +++++++++++ - 2 files changed, 15 insertions(+), 2 deletions(-) - create mode 100644 examples/node-devlist.pl - -diff --git a/Virt.xs b/Virt.xs -index aa4a795..f8ebce7 100644 ---- a/Virt.xs -+++ b/Virt.xs -@@ -5390,8 +5390,10 @@ const char * - get_parent(dev) - virNodeDevicePtr dev; - CODE: -- if (!(RETVAL = virNodeDeviceGetParent(dev))) -- _croak_error(); -+ if (!(RETVAL = virNodeDeviceGetParent(dev))) { -+ if (virGetLastError() != NULL) -+ _croak_error(); -+ } - OUTPUT: - RETVAL - -diff --git a/examples/node-devlist.pl b/examples/node-devlist.pl -new file mode 100644 -index 0000000..59f6a82 ---- /dev/null -+++ b/examples/node-devlist.pl -@@ -0,0 +1,11 @@ -+#!/usr/bin/perl -+ -+use Sys::Virt; -+ -+my $conn = Sys::Virt->new(); -+ -+my @nodelist = $conn->list_all_node_devices(); -+foreach my $dev (@nodelist){ -+ my $parent = $dev->get_parent(); -+ printf "%s: < %s\n", $dev->get_name(), $parent; -+} diff --git a/SOURCES/0002-Add-VIR_DOMAIN_UNDEFINE_NVRAM-constant.patch b/SOURCES/0002-Add-VIR_DOMAIN_UNDEFINE_NVRAM-constant.patch new file mode 100644 index 0000000..39af620 --- /dev/null +++ b/SOURCES/0002-Add-VIR_DOMAIN_UNDEFINE_NVRAM-constant.patch @@ -0,0 +1,39 @@ +From 01be795989b56597042072396eaaa38df32c948a Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Fri, 12 Sep 2014 14:21:19 +0100 +Subject: [PATCH] Add VIR_DOMAIN_UNDEFINE_NVRAM constant + +(cherry picked from commit 934b35f2060d25a51aa20298b3f0266d235321b5) +--- + Virt.xs | 1 + + lib/Sys/Virt/Domain.pm | 5 +++++ + 2 files changed, 6 insertions(+) + +diff --git a/Virt.xs b/Virt.xs +index 55d8946..ed7c75b 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -7014,6 +7014,7 @@ BOOT: + + REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_MANAGED_SAVE, UNDEFINE_MANAGED_SAVE); + REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA, UNDEFINE_SNAPSHOTS_METADATA); ++ REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_NVRAM, UNDEFINE_NVRAM); + + REGISTER_CONSTANT(VIR_DOMAIN_START_PAUSED, START_PAUSED); + REGISTER_CONSTANT(VIR_DOMAIN_START_AUTODESTROY, START_AUTODESTROY); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index db9e548..dd7d19d 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -2004,6 +2004,11 @@ domain + Also remove any snapshot metadata when undefining the virtual + domain. + ++=item Sys::Virt::Domain::UNDEFINE_NVRAM ++ ++Also remove any NVRAM state file when undefining the virtual ++domain. ++ + =back + + =head2 JOB TYPES diff --git a/SOURCES/0002-Fix-handling-of-flags-in-get_vcpu_info.patch b/SOURCES/0002-Fix-handling-of-flags-in-get_vcpu_info.patch deleted file mode 100644 index 525d355..0000000 --- a/SOURCES/0002-Fix-handling-of-flags-in-get_vcpu_info.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 97dc203690393940914039824204310fd3d57473 Mon Sep 17 00:00:00 2001 -From: "Daniel P. Berrange" -Date: Tue, 6 Aug 2013 15:46:02 +0100 -Subject: [PATCH] Fix handling of flags in get_vcpu_info() - - https://bugzilla.redhat.com/show_bug.cgi?id=994139 - -We must always use virDomainGetVcpus if flags is zero and -fall back to virDomainGetVcpuPinInfo if we get an error -indicating the guest was shutoff. - -Signed-off-by: Daniel P. Berrange -(cherry picked from commit 08613905c70525810dfc107c54f3b9ddf7e4ae7c) ---- - Virt.xs | 21 +++++++++++++++++---- - examples/vcpuinfo.pl | 4 ++-- - lib/Sys/Virt/Domain.pm | 6 ++++-- - 3 files changed, 23 insertions(+), 8 deletions(-) - -diff --git a/Virt.xs b/Virt.xs -index f8ebce7..e6b431c 100644 ---- a/Virt.xs -+++ b/Virt.xs -@@ -4370,12 +4370,21 @@ get_vcpu_info(dom, flags=0) - - maplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo)); - Newx(cpumaps, dominfo.nrVirtCpu * maplen, unsigned char); -- if (flags && (flags & VIR_DOMAIN_AFFECT_CONFIG)) { -- Newx(info, dominfo.nrVirtCpu, virVcpuInfo); -+ if (!flags) { -+ Newx(info, dominfo.nrVirtCpu, virVcpuInfo); - if ((nvCpus = virDomainGetVcpus(dom, info, dominfo.nrVirtCpu, cpumaps, maplen)) < 0) { -+ virErrorPtr err = virGetLastError(); - Safefree(info); -- Safefree(cpumaps); -- _croak_error(); -+ info = NULL; -+ if (err && err->code == VIR_ERR_OPERATION_INVALID) { -+ if ((nvCpus = virDomainGetVcpuPinInfo(dom, dominfo.nrVirtCpu, cpumaps, maplen, flags)) < 0) { -+ Safefree(cpumaps); -+ _croak_error(); -+ } -+ } else { -+ Safefree(cpumaps); -+ _croak_error(); -+ } - } - } else { - info = NULL; -@@ -4393,6 +4402,10 @@ get_vcpu_info(dom, flags=0) - (void)hv_store(rec, "state", 5, newSViv(info[i].state), 0); - (void)hv_store(rec, "cpuTime", 7, virt_newSVull(info[i].cpuTime), 0); - (void)hv_store(rec, "cpu", 3, newSViv(info[i].cpu), 0); -+ } else { -+ (void)hv_store(rec, "state", 5, newSViv(0), 0); -+ (void)hv_store(rec, "cpuTime", 7, virt_newSVull(0), 0); -+ (void)hv_store(rec, "cpu", 3, newSViv(0), 0); - } - (void)hv_store(rec, "affinity", 8, newSVpvn((char*)cpumaps + (i *maplen), maplen), 0); - PUSHs(newRV_noinc((SV *)rec)); -diff --git a/examples/vcpuinfo.pl b/examples/vcpuinfo.pl -index 668a0aa..6b07433 100644 ---- a/examples/vcpuinfo.pl -+++ b/examples/vcpuinfo.pl -@@ -9,12 +9,12 @@ my $con = Sys::Virt->new(address => $addr, readonly => 1); - - print "VMM type: ", $con->get_type(), "\n"; - --foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_domains) { -+foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_all_domains) { - print "Domain: {\n"; - print " ID: ", $dom->get_id(), " '" , $dom->get_name(), "'\n"; - print " UUID: ", $dom->get_uuid_string(), "\n"; - my $nodeinfo = $con->get_node_info; -- my @info = $dom->get_vcpu_info; -+ my @info = $dom->get_vcpu_info(Sys::Virt::Domain::AFFECT_CONFIG); - - foreach my $info (@info) { - print " VCPU: {\n"; -diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm -index 3207d0b..dc5b9cf 100644 ---- a/lib/Sys/Virt/Domain.pm -+++ b/lib/Sys/Virt/Domain.pm -@@ -1113,7 +1113,7 @@ or multi-card configuration. C<$st> must be a C - object from which the data can be read. C<$flags> is currently unused - and defaults to 0. The mimetype of the screenshot is returned - --=item @vcpuinfo = $dom->get_vcpu_info() -+=item @vcpuinfo = $dom->get_vcpu_info($flags=0) - - Obtain information about the state of all virtual CPUs in a running - guest domain. The returned list will have one element for each vCPU, -@@ -1124,7 +1124,9 @@ time of the vCPU, C the running state and C giving - the allowed shedular placement. The value for C is a - string representing a bitmask against physical CPUs, 8 cpus per - character. To extract the bits use the C function with --the C template. -+the C template. NB The C, C, C values are -+only available if using C<$flags> value of 0, and the domain is -+currently running; otherwise they will all be set to zero. - - =item $dom->pin_vcpu($vcpu, $mask) - diff --git a/SOURCES/0003-Add-virConnectDomainEventTunable-event-callback-cons.patch b/SOURCES/0003-Add-virConnectDomainEventTunable-event-callback-cons.patch new file mode 100644 index 0000000..c2bb57e --- /dev/null +++ b/SOURCES/0003-Add-virConnectDomainEventTunable-event-callback-cons.patch @@ -0,0 +1,451 @@ +From 808e539a93e7e886763721852f68450afd958a1a Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Fri, 26 Sep 2014 14:17:16 +0100 +Subject: [PATCH] Add virConnectDomainEventTunable event callback & constants + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 8a55270db52966d8de67fa2b6ddca4b5c1cdd3d6) +--- + Virt.xs | 290 ++++++++++++++++++++++++++++++------------------- + lib/Sys/Virt/Domain.pm | 72 ++++++++++++ + t/030-api-coverage.t | 1 + + 3 files changed, 249 insertions(+), 114 deletions(-) + +diff --git a/Virt.xs b/Virt.xs +index ed7c75b..e5d2293 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -158,6 +158,120 @@ _populate_constant_ull(HV *stash, const char *name, unsigned long long val) + #define REGISTER_CONSTANT_STR(name, key) _populate_constant_str(stash, #key, name) + #define REGISTER_CONSTANT_ULL(name, key) _populate_constant_ull(stash, #key, name) + ++static HV * ++vir_typed_param_to_hv(virTypedParameter *params, int nparams) ++{ ++ HV *ret = (HV *)sv_2mortal((SV*)newHV()); ++ unsigned int i; ++ const char *field; ++ STRLEN val_length; ++ ++ for (i = 0 ; i < nparams ; i++) { ++ SV *val = NULL; ++ ++ switch (params[i].type) { ++ case VIR_TYPED_PARAM_INT: ++ val = newSViv(params[i].value.i); ++ break; ++ ++ case VIR_TYPED_PARAM_UINT: ++ val = newSViv((int)params[i].value.ui); ++ break; ++ ++ case VIR_TYPED_PARAM_LLONG: ++ val = virt_newSVll(params[i].value.l); ++ break; ++ ++ case VIR_TYPED_PARAM_ULLONG: ++ val = virt_newSVull(params[i].value.ul); ++ break; ++ ++ case VIR_TYPED_PARAM_DOUBLE: ++ val = newSVnv(params[i].value.d); ++ break; ++ ++ case VIR_TYPED_PARAM_BOOLEAN: ++ val = newSViv(params[i].value.b); ++ break; ++ ++ case VIR_TYPED_PARAM_STRING: ++ val_length = strlen(params[i].value.s); ++ val = newSVpv(params[i].value.s, val_length); ++ break; ++ ++ } ++ ++ field = params[i].field; ++ (void)hv_store(ret, field, strlen(params[i].field), val, 0); ++ } ++ ++ return ret; ++} ++ ++ ++static int ++vir_typed_param_from_hv(HV *newparams, virTypedParameter *params, int nparams) ++{ ++ unsigned int i; ++ char * ptr; ++ STRLEN len; ++ ++ /* We only want to set parameters which we're actually changing ++ * so here we figure out which elements of 'params' we need to ++ * update, and overwrite the others ++ */ ++ for (i = 0 ; i < nparams ;) { ++ if (!hv_exists(newparams, params[i].field, strlen(params[i].field))) { ++ if ((nparams-i) > 1) ++ memmove(params+i, params+i+1, sizeof(*params)*(nparams-(i+1))); ++ nparams--; ++ continue; ++ } ++ ++ i++; ++ } ++ ++ for (i = 0 ; i < nparams ; i++) { ++ SV **val; ++ ++ val = hv_fetch (newparams, params[i].field, strlen(params[i].field), 0); ++ ++ switch (params[i].type) { ++ case VIR_TYPED_PARAM_INT: ++ params[i].value.i = SvIV(*val); ++ break; ++ ++ case VIR_TYPED_PARAM_UINT: ++ params[i].value.ui = SvIV(*val); ++ break; ++ ++ case VIR_TYPED_PARAM_LLONG: ++ params[i].value.l = virt_SvIVll(*val); ++ break; ++ ++ case VIR_TYPED_PARAM_ULLONG: ++ params[i].value.ul = virt_SvIVull(*val); ++ break; ++ ++ case VIR_TYPED_PARAM_DOUBLE: ++ params[i].value.d = SvNV(*val); ++ break; ++ ++ case VIR_TYPED_PARAM_BOOLEAN: ++ params[i].value.b = SvIV(*val); ++ break; ++ ++ case VIR_TYPED_PARAM_STRING: ++ ptr = SvPV(*val, len); ++ params[i].value.s = (char *)ptr; ++ break; ++ } ++ } ++ ++ return nparams; ++} ++ ++ + static int + _domain_event_lifecycle_callback(virConnectPtr con, + virDomainPtr dom, +@@ -782,6 +896,49 @@ _domain_event_device_removed_callback(virConnectPtr con, + + + static int ++_domain_event_tunable_callback(virConnectPtr con, ++ virDomainPtr dom, ++ virTypedParameterPtr params, ++ size_t nparams, ++ void *opaque) ++{ ++ AV *data = opaque; ++ SV **self; ++ SV **cb; ++ HV *params_hv; ++ 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); ++ ++ params_hv = vir_typed_param_to_hv(params, nparams); ++ ++ XPUSHs(domref); ++ XPUSHs(newRV(( SV*)params_hv)); ++ PUTBACK; ++ ++ call_sv(*cb, G_DISCARD); ++ ++ FREETMPS; ++ LEAVE; ++ ++ return 0; ++} ++ ++ ++static int + _network_event_lifecycle_callback(virConnectPtr con, + virNetworkPtr net, + int event, +@@ -1358,120 +1515,6 @@ _stream_recv_all_sink(virStreamPtr st, + } + + +-static HV * +-vir_typed_param_to_hv(virTypedParameter *params, int nparams) +-{ +- HV *ret = (HV *)sv_2mortal((SV*)newHV()); +- unsigned int i; +- const char *field; +- STRLEN val_length; +- +- for (i = 0 ; i < nparams ; i++) { +- SV *val = NULL; +- +- switch (params[i].type) { +- case VIR_TYPED_PARAM_INT: +- val = newSViv(params[i].value.i); +- break; +- +- case VIR_TYPED_PARAM_UINT: +- val = newSViv((int)params[i].value.ui); +- break; +- +- case VIR_TYPED_PARAM_LLONG: +- val = virt_newSVll(params[i].value.l); +- break; +- +- case VIR_TYPED_PARAM_ULLONG: +- val = virt_newSVull(params[i].value.ul); +- break; +- +- case VIR_TYPED_PARAM_DOUBLE: +- val = newSVnv(params[i].value.d); +- break; +- +- case VIR_TYPED_PARAM_BOOLEAN: +- val = newSViv(params[i].value.b); +- break; +- +- case VIR_TYPED_PARAM_STRING: +- val_length = strlen(params[i].value.s); +- val = newSVpv(params[i].value.s, val_length); +- break; +- +- } +- +- field = params[i].field; +- (void)hv_store(ret, field, strlen(params[i].field), val, 0); +- } +- +- return ret; +-} +- +- +-static int +-vir_typed_param_from_hv(HV *newparams, virTypedParameter *params, int nparams) +-{ +- unsigned int i; +- char * ptr; +- STRLEN len; +- +- /* We only want to set parameters which we're actually changing +- * so here we figure out which elements of 'params' we need to +- * update, and overwrite the others +- */ +- for (i = 0 ; i < nparams ;) { +- if (!hv_exists(newparams, params[i].field, strlen(params[i].field))) { +- if ((nparams-i) > 1) +- memmove(params+i, params+i+1, sizeof(*params)*(nparams-(i+1))); +- nparams--; +- continue; +- } +- +- i++; +- } +- +- for (i = 0 ; i < nparams ; i++) { +- SV **val; +- +- val = hv_fetch (newparams, params[i].field, strlen(params[i].field), 0); +- +- switch (params[i].type) { +- case VIR_TYPED_PARAM_INT: +- params[i].value.i = SvIV(*val); +- break; +- +- case VIR_TYPED_PARAM_UINT: +- params[i].value.ui = SvIV(*val); +- break; +- +- case VIR_TYPED_PARAM_LLONG: +- params[i].value.l = virt_SvIVll(*val); +- break; +- +- case VIR_TYPED_PARAM_ULLONG: +- params[i].value.ul = virt_SvIVull(*val); +- break; +- +- case VIR_TYPED_PARAM_DOUBLE: +- params[i].value.d = SvNV(*val); +- break; +- +- case VIR_TYPED_PARAM_BOOLEAN: +- params[i].value.b = SvIV(*val); +- break; +- +- case VIR_TYPED_PARAM_STRING: +- ptr = SvPV(*val, len); +- params[i].value.s = (char *)ptr; +- break; +- } +- } +- +- return nparams; +-} +- +- + MODULE = Sys::Virt PACKAGE = Sys::Virt + + PROTOTYPES: ENABLE +@@ -2821,6 +2864,9 @@ PREINIT: + case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED: + callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_device_removed_callback); + break; ++ case VIR_DOMAIN_EVENT_ID_TUNABLE: ++ callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_tunable_callback); ++ break; + default: + callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback); + break; +@@ -7288,6 +7334,7 @@ BOOT: + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_TRAY_CHANGE, EVENT_ID_TRAY_CHANGE); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE, EVENT_ID_BALLOON_CHANGE); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, EVENT_ID_DEVICE_REMOVED); ++ REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_TUNABLE, EVENT_ID_TUNABLE); + + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_NONE, EVENT_WATCHDOG_NONE); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, EVENT_WATCHDOG_PAUSE); +@@ -7522,6 +7569,21 @@ BOOT: + + REGISTER_CONSTANT(VIR_DOMAIN_TIME_SYNC, TIME_SYNC); + ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES, TUNABLE_CPU_CPU_SHARES); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN, TUNABLE_CPU_EMULATORPIN); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD, TUNABLE_CPU_EMULATOR_PERIOD); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA, TUNABLE_CPU_EMULATOR_QUOTA); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_VCPUPIN, TUNABLE_CPU_VCPUPIN); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD, TUNABLE_CPU_VCPU_PERIOD); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA, TUNABLE_CPU_VCPU_QUOTA); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_DISK, TUNABLE_BLKDEV_DISK); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC, TUNABLE_BLKDEV_READ_BYTES_SEC); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC, TUNABLE_BLKDEV_READ_IOPS_SEC); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC, TUNABLE_BLKDEV_TOTAL_BYTES_SEC); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC, TUNABLE_BLKDEV_TOTAL_IOPS_SEC); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC, TUNABLE_BLKDEV_WRITE_BYTES_SEC); ++ REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC, TUNABLE_BLKDEV_WRITE_IOPS_SEC); ++ + stash = gv_stashpv( "Sys::Virt::DomainSnapshot", TRUE ); + REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN, DELETE_CHILDREN); + REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, DELETE_METADATA_ONLY); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index dd7d19d..67bbe52 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -2556,6 +2556,13 @@ Balloon target changes + + Asynchronous guest device removal + ++=item Sys::Virt::Domain::EVENT_ID_TUNABLE ++ ++Changes of any domain tuning parameters. The callback ++will be provided with a hash listing all changed parameters. ++The later DOMAIN TUNABLE constants can be useful when accessing ++the hash keys ++ + =back + + =head2 IO ERROR EVENT CONSTANTS +@@ -3532,6 +3539,71 @@ SIGRT32 + + =back + ++=head2 DOMAIN TUNABLE CONSTANTS ++ ++The following constants are useful when accessing domain ++tuning parameters in APIs and events ++ ++=over 4 ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_CPU_SHARES ++ ++Proportional CPU weight ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_EMULATORPIN ++ ++Emulator thread CPU pinning mask ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_EMULATOR_PERIOD ++ ++Emulator thread CPU period ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_EMULATOR_QUOTA ++ ++Emulator thread CPU quota ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_VCPUPIN ++ ++VCPU thread pinning mask ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_VCPU_PERIOD ++ ++VCPU thread period ++ ++=item Sys::Virt::Domain::TUNABLE_CPU_VCPU_QUOTA ++ ++VCPU thread quota ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_DISK ++ ++The name of guest disks ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_READ_BYTES_SEC ++ ++Read throughput in bytes per sec ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_READ_IOPS_SEC ++ ++Read throughput in I/O operations per sec ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_BYTES_SEC ++ ++Total throughput in bytes per sec ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_TOTAL_IOPS_SEC ++ ++Total throughput in I/O operations per sec ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_BYTES_SEC ++ ++Write throughput in bytes per sec ++ ++=item Sys::Virt::Domain::TUNABLE_BLKDEV_WRITE_IOPS_SEC ++ ++Write throughput in I/O operations per sec ++ ++=back ++ + =head1 AUTHORS + + Daniel P. Berrange +diff --git a/t/030-api-coverage.t b/t/030-api-coverage.t +index 34b8d4d..6d8bd53 100644 +--- a/t/030-api-coverage.t ++++ b/t/030-api-coverage.t +@@ -88,6 +88,7 @@ virConnectDomainEventPMWakeupCallback + virConnectDomainEventTrayChangeCallback + virConnectDomainEventBalloonChangeCallback + virConnectDomainEventDeviceRemovedCallback ++virConnectDomainEventTunableCallback + + virConnectNetworkEventLifecycleCallback + diff --git a/SOURCES/0003-Use-strncpy-instead-of-memcpy-for-migrate-parameters.patch b/SOURCES/0003-Use-strncpy-instead-of-memcpy-for-migrate-parameters.patch deleted file mode 100644 index ad1b471..0000000 --- a/SOURCES/0003-Use-strncpy-instead-of-memcpy-for-migrate-parameters.patch +++ /dev/null @@ -1,92 +0,0 @@ -From aafe1bf39f192679d18be7280ced4ca2e21eb95f Mon Sep 17 00:00:00 2001 -From: "Daniel P. Berrange" -Date: Wed, 18 Dec 2013 11:25:12 +0000 -Subject: [PATCH] Use strncpy instead of memcpy for migrate parameters - -Using memcpy for copying migrate parameter names meant the -code was reading beyond the end of the string constants. -We must use strncpy to only read upto the null terminator. - -Signed-off-by: Daniel P. Berrange -(cherry picked from commit 48ffa420b50d2abf19600e2f5c9ff7694406762f) - -Conflicts: - Virt.xs ---- - Virt.xs | 40 ++++++++++++++++++++-------------------- - 1 file changed, 20 insertions(+), 20 deletions(-) - -diff --git a/Virt.xs b/Virt.xs -index e6b431c..2d6ba0c 100644 ---- a/Virt.xs -+++ b/Virt.xs -@@ -3768,24 +3768,24 @@ _migrate(dom, destcon, newparams, flags=0) - nparams = 5; - Newx(params, nparams, virTypedParameter); - -- memcpy(params[0].field, VIR_MIGRATE_PARAM_URI, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[0].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[1].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[2].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[3].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[4].type = VIR_TYPED_PARAM_ULLONG; - - -@@ -3817,24 +3817,24 @@ _migrate_to_uri(dom, desturi, newparams, flags=0) - nparams = 5; - Newx(params, nparams, virTypedParameter); - -- memcpy(params[0].field, VIR_MIGRATE_PARAM_URI, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[0].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[1].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[2].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[3].type = VIR_TYPED_PARAM_STRING; - -- memcpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH, -- VIR_TYPED_PARAM_FIELD_LENGTH); -+ strncpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH, -+ VIR_TYPED_PARAM_FIELD_LENGTH); - params[4].type = VIR_TYPED_PARAM_ULLONG; - - nparams = vir_typed_param_from_hv(newparams, params, nparams); diff --git a/SOURCES/0004-Add-VIR_MIGRATE_RDMA_PIN_ALL-constant.patch b/SOURCES/0004-Add-VIR_MIGRATE_RDMA_PIN_ALL-constant.patch new file mode 100644 index 0000000..f654b79 --- /dev/null +++ b/SOURCES/0004-Add-VIR_MIGRATE_RDMA_PIN_ALL-constant.patch @@ -0,0 +1,39 @@ +From cab4b686178251aff4a9419531ee4e0e6b76ed04 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Fri, 26 Sep 2014 15:22:15 +0100 +Subject: [PATCH] Add VIR_MIGRATE_RDMA_PIN_ALL constant + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit fa6864339d37804e0073acde95906db5e7ca2da1) +--- + Virt.xs | 1 + + lib/Sys/Virt/Domain.pm | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/Virt.xs b/Virt.xs +index e5d2293..894f9c3 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -7153,6 +7153,7 @@ BOOT: + REGISTER_CONSTANT(VIR_MIGRATE_COMPRESSED, MIGRATE_COMPRESSED); + REGISTER_CONSTANT(VIR_MIGRATE_ABORT_ON_ERROR, MIGRATE_ABORT_ON_ERROR); + REGISTER_CONSTANT(VIR_MIGRATE_AUTO_CONVERGE, MIGRATE_AUTO_CONVERGE); ++ REGISTER_CONSTANT(VIR_MIGRATE_RDMA_PIN_ALL, MIGRATE_RDMA_PIN_ALL); + + REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_BANDWIDTH, MIGRATE_PARAM_BANDWIDTH); + REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DEST_NAME, MIGRATE_PARAM_DEST_NAME); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 67bbe52..17101e6 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -1985,6 +1985,10 @@ Abort if an I/O error occurrs on the disk + Force convergance of the migration operation by + throttling guest runtime + ++=item Sys::Virt::Domain::MIGRATE_RDMA_PIN_ALL ++ ++Pin memory for RDMA transfer ++ + =back + + =head2 UNDEFINE CONSTANTS diff --git a/SOURCES/0005-Add-more-VIR_DOMAIN_STATS_-constants.patch b/SOURCES/0005-Add-more-VIR_DOMAIN_STATS_-constants.patch new file mode 100644 index 0000000..2a1b539 --- /dev/null +++ b/SOURCES/0005-Add-more-VIR_DOMAIN_STATS_-constants.patch @@ -0,0 +1,64 @@ +From 1997c1aff6e32fd54153636f57acfc8f95d95112 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 25 Sep 2014 15:50:56 +0100 +Subject: [PATCH] Add more VIR_DOMAIN_STATS_* constants + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 268808b3ab5dc032f51ada4a099cc21edc8daef3) +--- + Virt.xs | 5 +++++ + lib/Sys/Virt/Domain.pm | 20 ++++++++++++++++++++ + 2 files changed, 25 insertions(+) + +diff --git a/Virt.xs b/Virt.xs +index 894f9c3..2f973a6 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -7188,7 +7188,12 @@ BOOT: + REGISTER_CONSTANT(VIR_KEYCODE_SET_WIN32, KEYCODE_SET_WIN32); + REGISTER_CONSTANT(VIR_KEYCODE_SET_RFB, KEYCODE_SET_RFB); + ++ REGISTER_CONSTANT(VIR_DOMAIN_STATS_BALLOON, STATS_BALLOON); ++ REGISTER_CONSTANT(VIR_DOMAIN_STATS_BLOCK, STATS_BLOCK); ++ REGISTER_CONSTANT(VIR_DOMAIN_STATS_CPU_TOTAL, STATS_CPU_TOTAL); ++ REGISTER_CONSTANT(VIR_DOMAIN_STATS_INTERFACE, STATS_INTERFACE); + REGISTER_CONSTANT(VIR_DOMAIN_STATS_STATE, STATS_STATE); ++ REGISTER_CONSTANT(VIR_DOMAIN_STATS_VCPU, STATS_VCPU); + + REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE, GET_ALL_STATS_ACTIVE); + REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE, GET_ALL_STATS_INACTIVE); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 17101e6..21f8c15 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -3267,10 +3267,30 @@ are returned for stats queries. + + =over + ++=item Sys::Virt::Domain::STATS_BALLOON ++ ++Balloon statistics ++ ++=item Sys::Virt::Domain::STATS_BLOCK ++ ++Block device info ++ ++=item Sys::Virt::Domain::STATS_CPU_TOTAL ++ ++CPU usage info ++ ++=item Sys::Virt::Domain::STATS_INTERFACE ++ ++Network interface info ++ + =item Sys::Virt::Domain::STATS_STATE + + General lifecycle state + ++=item Sys::Virt::Domain::STATS_VCPU ++ ++Virtual CPU info ++ + =back + + =head2 PROCESS SIGNALS diff --git a/SOURCES/0006-Add-missed-VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES.patch b/SOURCES/0006-Add-missed-VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES.patch new file mode 100644 index 0000000..48a1639 --- /dev/null +++ b/SOURCES/0006-Add-missed-VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES.patch @@ -0,0 +1,32 @@ +From 54b30bd80440dc6a60c8c06d909a2fd427d5abc8 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 4 Dec 2014 12:23:57 +0000 +Subject: [PATCH] Add missed VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES + +The VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES constant was +missed in + + commit 62c70c70b12ab600c64851521bd275935d6e2ea6 + Author: Daniel P. Berrange + Date: Wed Sep 26 10:40:09 2012 +0100 + + Add APIs & constants for node memory parameters + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 4813c46aa3a466a7614a66a05653f71316a10a5b) +--- + Virt.xs | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Virt.xs b/Virt.xs +index 2f973a6..54d8fbf 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -7022,6 +7022,7 @@ BOOT: + REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED, NODE_MEMORY_SHARED_PAGES_UNSHARED); + REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE, NODE_MEMORY_SHARED_PAGES_VOLATILE); + REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_FULL_SCANS, NODE_MEMORY_SHARED_FULL_SCANS); ++ REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES, NODE_MEMORY_SHARED_MERGE_ACROSS_NODES); + + REGISTER_CONSTANT(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, BASELINE_CPU_EXPAND_FEATURES); + diff --git a/SOURCES/0007-Add-support-for-VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LI.patch b/SOURCES/0007-Add-support-for-VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LI.patch new file mode 100644 index 0000000..17ce910 --- /dev/null +++ b/SOURCES/0007-Add-support-for-VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LI.patch @@ -0,0 +1,155 @@ +From 7d441b16fe47ca6034b0012f9e6d25c279901a10 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 4 Dec 2014 15:40:50 +0000 +Subject: [PATCH] Add support for VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LIFECYCLE + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 048f0026b8025a1e526bb67bdaeb6cdf2387dd9d) +--- + Virt.xs | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ + lib/Sys/Virt/Domain.pm | 36 +++++++++++++++++++++++++++++++++++ + t/030-api-coverage.t | 1 + + 3 files changed, 88 insertions(+) + +diff --git a/Virt.xs b/Virt.xs +index 54d8fbf..839d9a6 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -939,6 +939,46 @@ _domain_event_tunable_callback(virConnectPtr con, + + + static int ++_domain_event_agent_lifecycle_callback(virConnectPtr con, ++ virDomainPtr dom, ++ int state, ++ int reason, ++ 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(state))); ++ XPUSHs(sv_2mortal(newSViv(reason))); ++ PUTBACK; ++ ++ call_sv(*cb, G_DISCARD); ++ ++ FREETMPS; ++ LEAVE; ++ ++ return 0; ++} ++ ++ ++static int + _network_event_lifecycle_callback(virConnectPtr con, + virNetworkPtr net, + int event, +@@ -2867,6 +2907,9 @@ PREINIT: + case VIR_DOMAIN_EVENT_ID_TUNABLE: + callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_tunable_callback); + break; ++ case VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE: ++ callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_agent_lifecycle_callback); ++ break; + default: + callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback); + break; +@@ -7342,6 +7385,7 @@ BOOT: + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE, EVENT_ID_BALLOON_CHANGE); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED, EVENT_ID_DEVICE_REMOVED); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_TUNABLE, EVENT_ID_TUNABLE); ++ REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE, EVENT_ID_AGENT_LIFECYCLE); + + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_NONE, EVENT_WATCHDOG_NONE); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, EVENT_WATCHDOG_PAUSE); +@@ -7368,6 +7412,13 @@ BOOT: + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN, EVENT_TRAY_CHANGE_OPEN); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE, EVENT_TRAY_CHANGE_CLOSE); + ++ REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED, EVENT_AGENT_LIFECYCLE_STATE_CONNECTED); ++ REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED, EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED); ++ ++ REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL, EVENT_AGENT_LIFECYCLE_REASON_CHANNEL); ++ REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED, EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED); ++ REGISTER_CONSTANT(VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN, EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN); ++ + REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_HARD_LIMIT, MEMORY_HARD_LIMIT); + REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_SOFT_LIMIT, MEMORY_SOFT_LIMIT); + REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_MIN_GUARANTEE, MEMORY_MIN_GUARANTEE); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 21f8c15..728ab1d 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -2567,6 +2567,42 @@ will be provided with a hash listing all changed parameters. + The later DOMAIN TUNABLE constants can be useful when accessing + the hash keys + ++=item Sys::Virt::Domain::EVENT_ID_AGENT_LIFECYCLE ++ ++Domain guest agent lifecycle events. The C parameter ++to the callback will match one of the constants ++ ++=over 4 ++ ++=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_STATE_CONNECTED ++ ++The agent is now connected ++ ++=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED ++ ++The agent is now disconnected ++ ++=back ++ ++The second parameter, C, matches one of the following ++constants ++ ++=over 4 ++ ++=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN ++ ++The reason is unknown ++ ++=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED ++ ++The domain was initially booted ++ ++=item Sys::Virt::Domain::EVENT_AGENT_LIFECYCLE_REASON_CHANNEL ++ ++The channel on a running guest changed state ++ ++=back ++ + =back + + =head2 IO ERROR EVENT CONSTANTS +diff --git a/t/030-api-coverage.t b/t/030-api-coverage.t +index 6d8bd53..592f1d3 100644 +--- a/t/030-api-coverage.t ++++ b/t/030-api-coverage.t +@@ -89,6 +89,7 @@ virConnectDomainEventTrayChangeCallback + virConnectDomainEventBalloonChangeCallback + virConnectDomainEventDeviceRemovedCallback + virConnectDomainEventTunableCallback ++virConnectDomainEventAgentLifecycleCallback + + virConnectNetworkEventLifecycleCallback + diff --git a/SOURCES/0008-Fix-docs-for-Sys-Virt-Domain-get_time-method.patch b/SOURCES/0008-Fix-docs-for-Sys-Virt-Domain-get_time-method.patch new file mode 100644 index 0000000..a70c3bb --- /dev/null +++ b/SOURCES/0008-Fix-docs-for-Sys-Virt-Domain-get_time-method.patch @@ -0,0 +1,30 @@ +From bd76166457ec52e45b6f6c223dd05e52b27a57d3 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 4 Dec 2014 15:57:05 +0000 +Subject: [PATCH] Fix docs for Sys::Virt::Domain::get_time() method + +(cherry picked from commit 91e83ebb6c577f1530e4fb8de9d7e85d4bdcbafb) +--- + lib/Sys/Virt/Domain.pm | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 728ab1d..60d2232 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -473,11 +473,13 @@ the current state. + + =back + +-=item my ($secs, $nsecs) = $dom->get_time($flags=0); ++=item my $time = $dom->get_time($flags=0); + + Get the current time of the guest, in seconds and nanoseconds. + The C<$flags> parameter is currently unused and defaults to +-zero. ++zero. The return value is an array ref with two elements, ++the first contains the time in seconds, the second contains ++the remaining nanoseconds. + + =item $dom->set_time($secs, $nsecs, $flags=0); + diff --git a/SOURCES/0009-Extend-events-example-to-deal-with-agent-lifecycle-e.patch b/SOURCES/0009-Extend-events-example-to-deal-with-agent-lifecycle-e.patch new file mode 100644 index 0000000..70f7c8f --- /dev/null +++ b/SOURCES/0009-Extend-events-example-to-deal-with-agent-lifecycle-e.patch @@ -0,0 +1,35 @@ +From 9e7cccd84c5c0251bc2ce2a2833fb648c77f394c Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 4 Dec 2014 16:05:56 +0000 +Subject: [PATCH] Extend events example to deal with agent lifecycle events + +(cherry picked from commit f74b52f8be94dd1caaeae3113a39e1b33844e792) +--- + examples/events.pl | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/examples/events.pl b/examples/events.pl +index 1895e6b..a38d321 100644 +--- a/examples/events.pl ++++ b/examples/events.pl +@@ -20,10 +20,20 @@ sub lifecycle_event { + print "$dom $event $detail\n"; + } + ++sub agent_lifecycle_event { ++ my $dom = shift; ++ my $state = shift; ++ my $reason = shift; ++ ++ print "Agent $dom state=$state reason=$reason\n"; ++} + + $c->domain_event_register_any(undef, + Sys::Virt::Domain::EVENT_ID_LIFECYCLE, + \&lifecycle_event); ++$c->domain_event_register_any(undef, ++ Sys::Virt::Domain::EVENT_ID_AGENT_LIFECYCLE, ++ \&agent_lifecycle_event); + + $c->register_close_callback( + sub { diff --git a/SOURCES/0010-Fix-constants-for-VIR_DOMAIN_GET_ALL_STATS_.patch b/SOURCES/0010-Fix-constants-for-VIR_DOMAIN_GET_ALL_STATS_.patch new file mode 100644 index 0000000..5d1250b --- /dev/null +++ b/SOURCES/0010-Fix-constants-for-VIR_DOMAIN_GET_ALL_STATS_.patch @@ -0,0 +1,66 @@ +From d4f73be73a230c29520870ca2ff6db03a9854d47 Mon Sep 17 00:00:00 2001 +From: Zhe Peng +Date: Thu, 4 Dec 2014 11:18:03 +0000 +Subject: [PATCH] Fix constants for VIR_DOMAIN_GET_ALL_STATS_* + +The docs for the VIR_DOMAIN_GET_ALL_STATS_* constants mistakenly +referred to Sys::Virt instead of Sys::Virt::Domain + +(cherry picked from commit e01c35dd94de5a8337abf0490057ae53239869ce) +--- + lib/Sys/Virt/Domain.pm | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 60d2232..3bf98f5 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -3260,39 +3260,39 @@ bulk domain stats from C. + + =over 4 + +-=item Sys::Virt::GET_ALL_STATS_ACTIVE ++=item Sys::Virt::Domain::GET_ALL_STATS_ACTIVE + + Include stats for active domains + +-=item Sys::Virt::GET_ALL_STATS_INACTIVE ++=item Sys::Virt::Domain::GET_ALL_STATS_INACTIVE + + Include stats for inactive domains + +-=item Sys::Virt::GET_ALL_STATS_OTHER ++=item Sys::Virt::Domain::GET_ALL_STATS_OTHER + + Include stats for other domains + +-=item Sys::Virt::GET_ALL_STATS_PAUSED ++=item Sys::Virt::Domain::GET_ALL_STATS_PAUSED + + Include stats for paused domains + +-=item Sys::Virt::GET_ALL_STATS_PERSISTENT ++=item Sys::Virt::Domain::GET_ALL_STATS_PERSISTENT + + Include stats for persistent domains + +-=item Sys::Virt::GET_ALL_STATS_RUNNING ++=item Sys::Virt::Domain::GET_ALL_STATS_RUNNING + + Include stats for running domains + +-=item Sys::Virt::GET_ALL_STATS_SHUTOFF ++=item Sys::Virt::Domain::GET_ALL_STATS_SHUTOFF + + Include stats for shutoff domains + +-=item Sys::Virt::GET_ALL_STATS_TRANSIENT ++=item Sys::Virt::Domain::GET_ALL_STATS_TRANSIENT + + Include stats for transient domains + +-=item Sys::Virt::GET_ALL_STATS_ENFORCE_STATS ++=item Sys::Virt::Domain::GET_ALL_STATS_ENFORCE_STATS + + Require that all requested stats fields are returned + diff --git a/SOURCES/0011-Add-new-VIR_DOMAIN_TUNABLE_BLKDEV-constants.patch b/SOURCES/0011-Add-new-VIR_DOMAIN_TUNABLE_BLKDEV-constants.patch new file mode 100644 index 0000000..30afde7 --- /dev/null +++ b/SOURCES/0011-Add-new-VIR_DOMAIN_TUNABLE_BLKDEV-constants.patch @@ -0,0 +1,28 @@ +From 5b79281a49b8afa9a73f7d88a2a6b96e3eacd5d1 Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Thu, 4 Dec 2014 12:39:40 +0000 +Subject: [PATCH] Add new VIR_DOMAIN_TUNABLE_BLKDEV* constants + +Signed-off-by: Daniel P. Berrange +(cherry picked from commit 4275c313128237620b82a8adc3ef4771b5ed91fc) + +(Only pulling in docs for Sys::Virt::NODE_MEMORY_SHARED_MERGE_ACROSS_NODES +--- + lib/Sys/Virt.pm | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/Sys/Virt.pm b/lib/Sys/Virt.pm +index e20405e..b8d75bd 100644 +--- a/lib/Sys/Virt.pm ++++ b/lib/Sys/Virt.pm +@@ -1834,6 +1834,10 @@ How many pages changing too fast to be placed in a tree. + + How many milliseconds the shared memory service should sleep before next scan. + ++=item Sys::Virt::NODE_MEMORY_SHARED_MERGE_ACROSS_NODES ++ ++Whether pages can be merged across NUMA nodes ++ + =back + + =head2 CLOSE REASON CONSTANTS diff --git a/SOURCES/0012-Fix-memory-corruption-when-calling-migrate_to_uri.patch b/SOURCES/0012-Fix-memory-corruption-when-calling-migrate_to_uri.patch new file mode 100644 index 0000000..2be2e9d --- /dev/null +++ b/SOURCES/0012-Fix-memory-corruption-when-calling-migrate_to_uri.patch @@ -0,0 +1,29 @@ +From f2cd3c2e87d0f4193a4200210c4e5cdaa6f26b14 Mon Sep 17 00:00:00 2001 +From: Hao Liu +Date: Tue, 9 Dec 2014 13:09:27 +0800 +Subject: [PATCH] Fix memory corruption when calling migrate_to_uri + +The variable `nparams` didn't change accordingly when adding a new +parameter in commit b2cecf73. + +This patch fixes https://bugzilla.redhat.com/show_bug.cgi?id=1171938 + +Signed-off-by: Hao Liu +(cherry picked from commit 3c5059eab19c612614848d7033bb7e5a0e310779) +--- + Virt.xs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Virt.xs b/Virt.xs +index 839d9a6..091a8e5 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -4301,7 +4301,7 @@ _migrate_to_uri(dom, desturi, newparams, flags=0) + virTypedParameter *params; + int nparams; + PPCODE: +- nparams = 5; ++ nparams = 6; + Newx(params, nparams, virTypedParameter); + + strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, diff --git a/SOURCES/0013-Add-VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING-consta.patch b/SOURCES/0013-Add-VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING-consta.patch new file mode 100644 index 0000000..968c544 --- /dev/null +++ b/SOURCES/0013-Add-VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING-consta.patch @@ -0,0 +1,38 @@ +From 77438da24a0549eb9a8bb37b73c8031a427df87f Mon Sep 17 00:00:00 2001 +From: "Daniel P. Berrange" +Date: Wed, 17 Dec 2014 14:00:38 +0000 +Subject: [PATCH] Add VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING constant + +(cherry picked from commit 26d6790bab3ed1819f2cfe9003d0d47a686ba675) +--- + Virt.xs | 1 + + lib/Sys/Virt/Domain.pm | 4 ++++ + 2 files changed, 5 insertions(+) + +diff --git a/Virt.xs b/Virt.xs +index 091a8e5..b2cf1cd 100644 +--- a/Virt.xs ++++ b/Virt.xs +@@ -7248,6 +7248,7 @@ BOOT: + REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF, GET_ALL_STATS_SHUTOFF); + REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT, GET_ALL_STATS_TRANSIENT); + REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, GET_ALL_STATS_ENFORCE_STATS); ++ REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING, GET_ALL_STATS_BACKING); + + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DEFINED, EVENT_DEFINED); + REGISTER_CONSTANT(VIR_DOMAIN_EVENT_UNDEFINED, EVENT_UNDEFINED); +diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm +index 3bf98f5..09b5152 100644 +--- a/lib/Sys/Virt/Domain.pm ++++ b/lib/Sys/Virt/Domain.pm +@@ -3296,6 +3296,10 @@ Include stats for transient domains + + Require that all requested stats fields are returned + ++=item Sys::Virt::Domain::GET_ALL_STATS_BACKING ++ ++Get stats for image backing files too ++ + =back + + =head2 DOMAIN STATS FIELD CONSTANTS diff --git a/SPECS/perl-Sys-Virt.spec b/SPECS/perl-Sys-Virt.spec index 1f5559d..c77f130 100644 --- a/SPECS/perl-Sys-Virt.spec +++ b/SPECS/perl-Sys-Virt.spec @@ -1,16 +1,26 @@ # Automatically generated by perl-Sys-Virt.spec.PL Name: perl-Sys-Virt -Version: 1.1.1 -Release: 5%{?dist}%{?extra_release} +Version: 1.2.8 +Release: 6%{?dist}%{?extra_release} Summary: Represent and manage a libvirt hypervisor connection License: GPLv2+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/Sys-Virt/ Source0: http://www.cpan.org/authors/id/D/DA/DANBERR/Sys-Virt-%{version}.tar.gz -Patch1: 0001-Fix-error-handling-for-virNodeDeviceGetParent.patch -Patch2: 0002-Fix-handling-of-flags-in-get_vcpu_info.patch -Patch3: 0003-Use-strncpy-instead-of-memcpy-for-migrate-parameters.patch +Patch1: 0001-Add-VIR_DOMAIN_JOB_STATS_COMPLETED-constant.patch +Patch2: 0002-Add-VIR_DOMAIN_UNDEFINE_NVRAM-constant.patch +Patch3: 0003-Add-virConnectDomainEventTunable-event-callback-cons.patch +Patch4: 0004-Add-VIR_MIGRATE_RDMA_PIN_ALL-constant.patch +Patch5: 0005-Add-more-VIR_DOMAIN_STATS_-constants.patch +Patch6: 0006-Add-missed-VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES.patch +Patch7: 0007-Add-support-for-VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LI.patch +Patch8: 0008-Fix-docs-for-Sys-Virt-Domain-get_time-method.patch +Patch9: 0009-Extend-events-example-to-deal-with-agent-lifecycle-e.patch +Patch10: 0010-Fix-constants-for-VIR_DOMAIN_GET_ALL_STATS_.patch +Patch11: 0011-Add-new-VIR_DOMAIN_TUNABLE_BLKDEV-constants.patch +Patch12: 0012-Fix-memory-corruption-when-calling-migrate_to_uri.patch +Patch13: 0013-Add-VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING-consta.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(Test::Pod) @@ -31,6 +41,16 @@ virtualization containers to be managed with a consistent API. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 sed -i -e '/Sys-Virt\.spec/d' Makefile.PL sed -i -e '/\.spec\.PL$/d' MANIFEST @@ -65,6 +85,26 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/* %changelog +* Wed Dec 17 2014 Daniel P. Berrange - 1.2.8-6 +- Add VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING constant (rhbz #1175314) + +* Thu Dec 11 2014 Daniel P. Berrange - 1.2.8-5 +- Fix crash with migrate_to_uri API (rhbz #1171938) + +* Thu Dec 4 2014 Daniel P. Berrange - 1.2.8-4 +- Add agent lifecycle event callbacks & constants (rhbz #1167392) +- Fix docs for get_time method (rhbz #1164972) +- Fix docs for GET_ALL_STATS constnats (rhbz #1170481) + +* Mon Nov 10 2014 Daniel P. Berrange - 1.2.8-3 +- Update for latest constants in libvirt (rhbz #1160793) + +* Tue Sep 30 2014 Daniel P. Berrange - 1.2.8-2 +- Update for latest constants/events in libvirt (rhbz #1147042) + +* Wed Sep 10 2014 Daniel P. Berrange - 1.2.8-1 +- Update to 1.2.8 release (rhbz #1140194) + * Fri Jan 24 2014 Daniel Mach - 1.1.1-5 - Mass rebuild 2014-01-24