[libvirt] [perl PATCH 0/2] Add missing bindings

Pavel Hrdina (2): Add VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE constant Add set_lifecycle_action Changes | 3 ++- Virt.xs | 24 ++++++++++++++++++++ lib/Sys/Virt/Domain.pm | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) -- 2.13.6

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- Changes | 2 +- Virt.xs | 1 + lib/Sys/Virt/Domain.pm | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 0cf810e..06f66c8 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,7 @@ Revision history for perl module Sys::Virt 3.9.0 2017-11-00 - - XXX + - Add VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE constant 3.8.0 2017-10-04 diff --git a/Virt.xs b/Virt.xs index 9243b7f..eb8465f 100644 --- a/Virt.xs +++ b/Virt.xs @@ -8666,6 +8666,7 @@ BOOT: REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_TOTAL, JOB_MEMORY_TOTAL); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_BPS, JOB_MEMORY_BPS); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE, JOB_MEMORY_DIRTY_RATE); + REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE, JOB_MEMORY_PAGE_SIZE); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_ITERATION, JOB_MEMORY_ITERATION); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_SETUP_TIME, JOB_SETUP_TIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_ELAPSED, JOB_TIME_ELAPSED); diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm index 59b0215..273e6e6 100644 --- a/lib/Sys/Virt/Domain.pm +++ b/lib/Sys/Virt/Domain.pm @@ -1566,6 +1566,10 @@ The bytes per second transferred The number of memory pages dirtied per second +=item Sys::Virt::Domain::JOB_MEMORY_PAGE_SIZE + +The memory page size in bytes + =item Sys::Virt::Domain::JOB_MEMORY_ITERATION The total number of iterations over guest memory -- 2.13.6

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- Changes | 1 + Virt.xs | 23 +++++++++++++++++++++ lib/Sys/Virt/Domain.pm | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) diff --git a/Changes b/Changes index 06f66c8..ebc6548 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ Revision history for perl module Sys::Virt 3.9.0 2017-11-00 - Add VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE constant + - Add set_lifecycle_action 3.8.0 2017-10-04 diff --git a/Virt.xs b/Virt.xs index eb8465f..c123769 100644 --- a/Virt.xs +++ b/Virt.xs @@ -6310,6 +6310,16 @@ set_block_threshold(dom, dev, thresholdsv, flags=0) _croak_error(); void +set_lifecycle_action(dom, type, action, flags=0) + virDomainPtr dom; + unsigned int type; + unsigned int action; + unsigned int flags; +PPCODE: + if (virDomainSetLifecycleAction(dom, type, action, flags) < 0) + _croak_error(); + +void destroy(dom_rv, flags=0) SV *dom_rv; unsigned int flags; @@ -9091,6 +9101,19 @@ BOOT: REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, REVERT_PAUSED); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, REVERT_FORCE); + stash = gv_stashpv( "Sys::Virt::Lifecycle", TRUE ); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_POWEROFF, LIFECYCLE_POWEROFF); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_REBOOT, LIFECYCLE_REBOOT); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_CRASH, LIFECYCLE_CRASH); + + stash = gv_stashpv( "Sys::Virt::LifecycleAction", TRUE ); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, LIFECYCLE_ACTION_DESTROY); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, LIFECYCLE_ACTION_RESTART); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME, LIFECYCLE_ACTION_RESTART_RENAME); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE, LIFECYCLE_ACTION_PRESERVE); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY, LIFECYCLE_ACTION_COREDUMP_DESTROY); + REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART, LIFECYCLE_ACTION_COREDUMP_RESTART); + stash = gv_stashpv( "Sys::Virt::StoragePool", TRUE ); REGISTER_CONSTANT(VIR_STORAGE_POOL_INACTIVE, STATE_INACTIVE); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILDING, STATE_BUILDING); diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm index 273e6e6..38b9c9b 100644 --- a/lib/Sys/Virt/Domain.pm +++ b/lib/Sys/Virt/Domain.pm @@ -1999,6 +1999,11 @@ level. The threshold level is unset once the event fires. The event might not be delivered at all if libvirtd was not running at the moment when the threshold was reached. +=item $dom->set_lifecycle_action($type, $action, $flags=0) + +Changes the actions of lifecycle events for domain represented as +<on_$type>$action</on_$type> in the domain XML. + =back =head1 CONSTANTS @@ -4544,6 +4549,57 @@ The I/O threads pinning =back +=head2 DOMAIN LIFECYCLE CONSTANTS + +The following constants are useful when setting action for +lifecycle events. + +=over 4 + +=item Sys::Virt::Domain::LIFECYCLE_POWEROFF + +The poweroff lifecycle event type + +=item Sys::Virt::Domain::LIFECYCLE_REBOOT + +The reboot lifecycle event type + +=item Sys::Virt::Domain::LIFECYCLE_CRASH + +The crash lifecycle event type + +=back + +=head2 DOMAIN LIFECYCLE ACTION CONSTANTS + +=over 4 + +=item Sys::Virt::Domain::LIFECYCLE_ACTION_DESTROY + +The destroy lifecycle action + +=item Sys::Virt::Domain::LIFECYCLE_ACTION_RESTART + +The restart lifecycle action + +=item Sys::Virt::Domain::LIFECYCLE_ACTION_RESTART_RENAME + +The restart-rename lifecycle action + +=item Sys::Virt::Domain::LIFECYCLE_ACTION_PRESERVE + +The preserve lifecycle action + +=item Sys::Virt::Domain::LIFECYCLE_ACTION_COREDUMP_DESTROY + +The coredump-destroy lifecycle action + +=item Sys::Virt::Domain::LIFECYCLE_ACTION_COREDUMP_RESTART + +The coredump-restart lifecycle action + +=back + =head1 AUTHORS Daniel P. Berrange <berrange@redhat.com> -- 2.13.6

On Fri, Oct 20, 2017 at 04:05:38PM +0200, Pavel Hrdina wrote:
Pavel Hrdina (2): Add VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE constant Add set_lifecycle_action
Changes | 3 ++- Virt.xs | 24 ++++++++++++++++++++ lib/Sys/Virt/Domain.pm | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-)
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrange
-
Pavel Hrdina