Sys-Virt-v8.0.0000755001750001750 014170317017 14143 5ustar00berrangeberrange000000000000Sys-Virt-v8.0.0/AUTHORS000444001750001750 73714170317017 15337 0ustar00berrangeberrange000000000000 Sys::Virt Authors ================= Sys::Virt is written and maintained by Daniel P. Berrange Patches contributed by: Anthony Hinsinger Stepan Kasal Ludwig Nussel Zhe Peng Osier Yang Michal Privoznik -- End Sys-Virt-v8.0.0/Build.PL000555001750001750 740014170317017 15600 0ustar00berrangeberrange000000000000#!/usr/bin/perl # # Copyright (C) 2009-2018 Red Hat, Inc. # Copyright (C) 2009 Daniel P. Berrange # # This program is free software; You can redistribute it and/or modify # it under the GNU General Public License as published by the Free # Software Foundation; either version 2, or (at your option) any # later version # # The file "LICENSE" distributed along with this file provides full # details of the terms and conditions # use Module::Build; use strict; use warnings; my $libvirtver = "8.0.0"; my $stat = system "pkg-config --atleast-version=$libvirtver libvirt"; die "cannot run pkg-config to check libvirt version" if $stat == -1; die "libvirt >= $libvirtver is required\n" unless $stat == 0; my $LIBVIRT_LIBS = `pkg-config --libs libvirt`; my $LIBVIRT_CFLAGS = `pkg-config --cflags libvirt`; my $GCC_CFLAGS = ""; if ($ENV{TEST_MAINTAINER}) { $GCC_CFLAGS = qq( -W -Waddress -Wall -Warray-bounds -Wattributes -Wbad-function-cast -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wdouble-promotion -Wempty-body -Wendif-labels -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wformat-zero-length -Wformat=2 -Wfree-nonheap-object -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-parameter-type -Wmultichar -Wnarrowing -Wnonnull -Wnormalized=nfc -Wold-style-declaration -Wold-style-definition -Woverflow -Woverride-init -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-type -Wsequence-point -Wno-shadow -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wswitch -Wsync-nand -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wno-unused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvariadic-macros -Wvector-operation-performance -Wvolatile-register-var -Wwrite-strings -Wno-sign-compare -Wjump-misses-init -Wno-format-nonliteral -Wframe-larger-than=8192 -Wno-suggest-attribute=pure -Wno-suggest-attribute=const -Wno-cast-function-type ); } my $b = Module::Build->new( module_name => "Sys::Virt", license => 'gpl', configure_requires => { 'Module::Build' => 0, }, create_makefile_pl => 'small', dist_author => 'Daniel Berrange ', dist_abstract => 'libvirt Perl API', requires => { 'perl' => '5.16.0', }, extra_compiler_flags => $GCC_CFLAGS . $LIBVIRT_CFLAGS, extra_linker_flags => $LIBVIRT_LIBS, build_requires => { 'ExtUtils::CBuilder' => 0, 'Sys::Hostname' => 0, 'Test::CPAN::Changes' => 0, 'Test::More' => 0, 'Test::Pod' => 0, 'Test::Pod::Coverage' => 0, 'Time::HiRes' => 0, 'XML::XPath' => 0, 'XML::XPath::XMLParser' => 0, }, script_files => [], meta_add => { resources => { license => "http://www.gnu.org/licenses/gpl.html", homepage => "http://libvirt.org/", repository => "https://gitlab.com/libvirt/libvirt-perl", MailingList => "http://www.redhat.com/mailman/listinfo/libvir-list", }, }, PL_files => { 'perl-Sys-Virt.spec.PL' => 'perl-Sys-Virt.spec' }, ); $b->create_build_script; Sys-Virt-v8.0.0/Changes000444001750001750 5337014170317017 15623 0ustar00berrangeberrange000000000000Revision history for perl module Sys::Virt 8.0.0 2022-01-14 - Add VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES and VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES constants - Add VIR_NODE_SEV_MAX_GUESTS and VIR_NODE_SEV_MAX_ES_GUESTS constants - Add VIR_DOMAIN_LAUNCH_SECURITY_SEV_API_MAJOR, VIR_DOMAIN_LAUNCH_SECURITY_SEV_API_MINOR, VIR_DOMAIN_LAUNCH_SECURITY_SEV_BUILD_ID and VIR_DOMAIN_LAUNCH_SECURITY_SEV_POLICY constants - Add virDomainSetLaunchSecurityState and related constants 7.10.0 2021-12-01 - Add VIR_DOMAIN_GUEST_INFO_INTERFACES constant - Fix uninitialized flags in create_network() 7.9.0 2021-11-02 - Add callback for memory device size change domain event - Add VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPD constant 7.8.0 2021-10-01 - Add VIR_NWFILTER_BINDING_CREATE_VALIDATE constant - Add support for virNetworkCreateXMLFlags and associated flags - Add virNodeDeviceGetAutostart, virNodeDeviceSetAutostart, virNodeDeviceIsPersistent and virNodeDeviceIsActive. 7.7.0 2021-09-01 - Add support for virNWFilterDefineXMLFlags and virNetworkDefineXMLFlags APIs and associated flags - Add support for flags with existing virInterfaceDefineXML, virStoragePoolDefineXML and virSecretDefineXML APIs 7.5.0 2021-07-02 - Add VIR_FROM_CH 7.4.0 2021-06-02 - Add VIR_DOMAIN_CORE_DUMP_FORMAT_WIN_DMP constant 7.3.0 2021-05-04 - Add virNodeDeviceCreate, virNodeDeviceDefineXML and virNodeDeviceUndefine - Add new constants for filtering node devices - Add new constants for node device events - Add VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE constant 7.2.0 2021-04-01 - Add virDomainStartDirtyRateCalc API - Add VIR_DOMAIN_DIRTYRATE_* constants - Add VIR_DOMAIN_STATS_DIRTYRATE constant - Fix inverted descriptions for s390 AP device constants 7.1.0 2021-03-01 - Add VIR_ERR_MULTIPLE_DOMAINS constant - Add virDomainGetMessages API and associated constants 7.0.0 2021-01-15 - Add VIR_DOMAIN_GUEST_INFO_DISKS constant 6.10.0 2020-12-01 - Add VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE_VALIDATE constant - Add VIR_ERR_CHECKPOINT_INCONSISTENT constant - Add VIR_VCPU_INFO_CPU_* constants - Add APIs and constants for managing SSH authorized keys 6.9.0 2020-11-09 - Add VIR_CONNECT_COMPARE_CPU_VALIDATE_XML constant - Add VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA constant - Add support for memory failure event callbacks - Add memory failure event constants 6.8.0 2020-10-05 - Add VIR_DOMAIN_MIGRATE_PARAM_DISKS_URI constant - Add VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV constant 6.3.0 2020-05-05 - Add VIR_DOMAIN_JOB_ERRMSG constant 6.1.0 2020-03-09 - Add VIR_ERR_NO_HOSTNAME constant - Add VIR_DOMAIN_GET_HOSTNAME_* constants - Add VIR_DOMAIN_EVENT_CRASHED_CRASHLOADED constant 6.0.0 2020-01-16 - Add VIR_DOMAIN_JOB_SUCCESS and VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED constants - Fix typo breaking migration postcopy bandwidth and autoconvert increment parameter handling - Add handling for VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS constant when invoking migrate - Add VIR_MIGRATE_PARAM_TLS_DESTINATION constant - Add missing create_checkpoint method on Sys::Virt::Domain - Remove docs for has_metadata method which doesn't exit - Fix data type for VIR_CONNECT_IDENTITY_SASL_USER_NAME parameter - Add new domain job constants related to backups - Add new domain backup APIs - Add VIR_DOMAIN_STATS_MEMORY constant 5.10.0 2019-12-03 - Add VIR_FROM_BPF constant - Add virDomainAgentSetResponseTimeout API and associated constants 5.8.0 2019-10-07 - Add virConnectSetIdentity API and constants 5.7.0 2019-09-04 - Add virDomainGetGuestInfo API and constants - Fix Sys::Virt::NetworkPort creation 5.6.0 2019-08-06 - Add VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE constant - Add VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT constant - Add VIR_FROM_TPM constant - Add VIR_SECRET_USAGE_TYPE_VTPM constant - Add DomainCheckpoint class and associated constants 5.5.0 2019-07-03 - Add support for virNetworkPortPtr object and its APIs 5.4.0 2019-06-12 - Add VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC and VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL constants 5.2.0 2019-04-03 - Add VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL constant - Add VIR_ERR_INVALID_DOMAIN_CHECKPOINT, VIR_ERR_NO_DOMAIN_BACKUP, VIR_ERR_NO_DOMAIN_CHECKPOINT constants - Add VIR_FROM_DOMAIN_CHECKPOINT constant - Add VIR_MIGRATE_PARALLEL and VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS constants 5.1.0 2019-03-04 - Add VIR_FROM_FIREWALLD constant - Add VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY constant - Add VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY constant - Add VIR_DOMAIN_SAVE_IMAGE_XML_SECURE and VIR_DOMAIN_SNAPSHOT_XML_SECURE constants - Add virConnectGetStoragePoolCapabilities binding 5.0.0 2019-01-21 - Add VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS constant 4.10.0 2018-12-03 - Add VIR_DOMAIN_SHUTOFF_DAEMON constant - Add VIR_DOMAIN_IOTHREAD_POLL_{MAX_NS|GROW|SHRINK} params and the virDomainSetIOThreadParams binding 4.8.0 2018-10-05 - Avoid clashing storage pool name in tests 4.7.0 2018-09-04 - Various POD spelling error fixes 4.6.0 2018-08-06 - Add VIR_DOMAIN_MEMORY_STAT_DISK_CACHES - Add missing import of Sys::Virt::NWFilterBinding - Include Sys::Virt::NWFilterBinding in dist - Fix multiple bugs allocating & freeing typed parameters 4.5.0 2018-07-03 - Add new types and APIs for virNWFilterBinding - Add VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT - Add new constants and APIs for AMD SEV 4.4.0 2018-06-05 - Switch to Module::Build - Add support for virDomainDetachDeviceAlias - Add support for virConnectBaselineHypervisorCPU - Add support for virConnectCompareHypervisorCPU 4.2.0 2018-04-03 - Add missing define_nwfilter and define_secret APIs in Sys::Virt - Misc docs fixes - Add support for VIR_KEYCODE_SET_QNUM - Add support for VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP 4.1.0 2018-03-05 - Add VIR_ERR_DEVICE_MISSING constants - Remove use of Data::Dumper from example programs - Remove accidental debug message in get_all_domain_stats - Add virStoragePoolLookupByTargetPath API mapping 4.0.0 2018-01-23 - Fix check of return value from virStreamRecv* - Fix rd_req / wr_req hash keys for block stats - Fix misc spelling mistakes - Fix docs for storage pool destroy/undefine 3.9.1 2017-12-05 - Fix package location of lifecycle constants 3.9.0 2017-11-03 - Add VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE constant - Add set_lifecycle_action 3.8.0 2017-10-04 - Add VIR_STORAGE_POOL_EVENT_{DELETED,CREATED} constants 3.7.0 2017-09-04 - Add VIR_FROM_RESCTRL constant - Add migrate_get_max_downtime - Add managed_save_define_xml and managed_save_get_xml_description 3.5.0 2017-07-06 - Add VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB constant 3.4.0 2017-06-05 - Add LIST_CAP_MDEV & LIST_CAP_MDEV_TYPES constants - Fix send_all() callback helper - Introduce flags to Stream::recv() and register RECV_STOP_AT_HOLE constant - Introduce Stream::recv_hole() and Stream::send_hole() - Introduce Stream::sparse_recv_all() - Introduce Stream::sparse_send_all() - Register VOL_DOWNLOAD_SPARSE_STREAM & VOL_UPLOAD_SPARSE_STREAM constants - Add vol-sparse.pl example - Add new domain event constants - Add new LIST_CAP_CCW_DEV constant 3.3.0 2017-05-08 - Add VIR_DOMAIN_JOB_OPERATION* constants 3.2.0 2017-04-03 - Add PERF_PARAM_CPU_CLOCK constant - Add PERF_PARAM_TASK_CLOCK constant - Add PERF_PARAM_PAGE_FAULTS constant - Add PERF_PARAM_CONTEXT_SWITCHES constant - Add PERF_PARAM_CPU_MIGRATIONS constant - Add PERF_PARAM_PAGE_FAULTS_MIN constant - Add PERF_PARAM_PAGE_FAULTS_MAJ constant - Add PERF_PARAM_ALIGNMENT_FAULTS constant - Add PERF_PARAM_EMULATION_FAULTS constant - Add block threshold event - Add virDomainSetBlockThreshold API - Add VIR_MIGRATE_TLS constant 3.1.0 2017-03-03 - Add VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE constant - Add VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM constant - Add virDomainSetVcpu API 3.0.0 2017-01-19 - Add group_name for block iotune - Add new branch instructions perf event - Add PERF_PARAM_BRANCH_MISSES constant - Add PERF_PARAM_BUS_CYCLES constant - Add PERF_PARAM_STALLED_CYCLES_FRONTEND constant - Add PERF_PARAM_STALLED_CYCLES_BACKEND constant - Add PERF_PARAM_REF_CPU_CYCLES constant - Add virStorageVolGetInfoFlags & associated constants - Add domain metdata change event - Add secret event APIs 2.5.0 2016-12-05 - Add VIR_ERR_LIBSSH and VIR_FROM_LIBSSH constants 2.4.0 2016-11-02 - Add VIR_DOMAIN_VCPU_HOTPLUGGABLE constant - Add constants for the new block iotune parameters for length 2.3.0 2016-10-06 - Add PERF_PARAM_CACHE_MISSES, PERF_PARAM_CACHE_REFERENCES, PERF_PARAM_CPU_CYCLES, PERF_PARAM_INSTRUCTIONS constants - Add USAGE_TYPE_TLS - Add ERR_AGENT_UNSYNCED - Add VIR_DOMAIN_UNDEFINE_KEEP_NVRAM constant 2.2.0 2016-09-05 - Add virConnectNodeDeviceEventRegisterAny and virConnectNodeDeviceEventDeregisterAny and associated constants - Add new I/O thread tuning constants - Add VIR_NODE_DEVICE_EVENT_ID_UPDATE constant 2.1.0 2016-08-02 - Add VIR_DOMAIN_MEMORY_STAT_USABLE and VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE constants - Fix handling of VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG with setter methods 2.0.0 2016-07-01 - Add VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL and VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT constants - Add VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE constant - Add virConnectStoragePoolEventRegisterAny and virConnectStoragePoolEventDeregisterAny and associated constants - Add virDomainGetGuestVcpus and virDomainSetGuestVcpus APIs 1.3.5 2016-06-06 - Add VIR_ERR_NO_CLIENT constant - Add PERF_PARAM_MBML and PERF_PARAM_MBMT constants - Fix handling of 'rss' key for memory stats 1.3.4 2016-05-05 - Fix POD error in Domain.pm - Add VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED constant - Reuse VIR_DOMAIN_EVENT_ID_DEVICE callbacks - Add VIR_STORAGE_VOL_PLOOP constant - Add VIR_MIGRATE_PARAM_COMPRESSION* constants - Add VIR_MIGRATE_PARAM_PERSIST_XML constant 1.3.3 2016-04-07 - Add VIR_ERR_AUTH_UNAVAILABLE constant - Add VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD, VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA, VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD & VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA constants - Add VIR_DOMAIN_EVENT_ID_JOB_COMPLETED constant and callback - Add VIR_ERR_NO_SERVER constant - Add VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT constant - Add VIR_MIGRATE_PARAM_DISKS_PORT constant - Add virDomainMigrateStartPostCopy API support - Add constants related to post-copy migration - Add APIS & constants for new perf event support 1.3.2 2016-03-01 - Add VIR_STORAGE_VOL_WIPE_ALG_TRIM constant - Add VIR_FROM_XENXL constant - Add VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION event handling callback 1.3.1 2016-01-20 - Add VIR_STORAGE_POOL_CREATE_NORMAL, VIR_STORAGE_POOL_CREATE_WITH_BUILD, VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE and VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE constants - Add new domain job memory constants 1.3.0 2015-12-10 - Add VIR_FROM_LOGGING constant 1.2.21 2015-11-11 - Add VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS constant 1.2.19 2015-09-03 - Add VIR_DOMAIN_BANDWIDTH_IN_FLOOR constant - Add virDomainRename method - Add domain event constants for rename reason 1.2.18 2015-08-03 - Add VIR_ERR_MIGRATE_FINISH_OK constant 1.2.17 2015-07-17 - Add VIR_FROM_ADMIN constant - Add VIR_MIGRATE_PARAM_MIGRATE_DISKS constant - Fix docs typos in migrate_to_uri method - Add VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI constant 1.2.16 2015-06-01 - Add support for virDomainSetUserPassword 1.2.15 2015-05-05 - Add support for VIR_DOMAIN_EVENT_ID_DEVICE_ADDED event callback & constants. - Add JOB_DOWNTIME_NET constant - Add JOB_TIME_ELAPSED_NET constant - Add virDomainAddIOThread and virDomainDelIOThread API bindings 1.2.14 2015-04-09 - Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE constant - Add VIR_DOMAIN_CONTROL_ERROR_* constants - Add virDomainGetIOThreads and virDomainPinIOThread API bindings - Update the vcpuinfo.pl example to use unpack - Add VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN constant - Add virDomainInterfaceAddress function & constants - Add VIR_DOMAIN_PAUSED_STARTING_UP constant - Adapt to rename of virDomainIOThreadsInfoFree to virDomainIOThreadInfoFree - Adapt to rename of virDomainGetIOThreadsInfo to virDomainGetIOThreadInfo - Add VIR_FROM_THREAD constant 1.2.13 2015-03-05 - Add VIR_STORAGE_VOL_CREATE_REFLINK constant 1.2.12 2015-01-27 - Add VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING constant - Add virDomainDefineXMLFlags API binding - Add VIR_DOMAIN_DEFINE_VALIDATE, VIR_DOMAIN_START_VALIDATE and VIR_ERR_INVALID_SCHEMA constants 1.2.11 2014-12-15 - Add virDomainGetFSInfo API binding - Add missed VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES constant - Add new VIR_DOMAIN_TUNABLE_BLKDEV* constants - Add new VIR_DOMAIN_BLOCK_IOTUNE* constants - Add support for VIR_CONNECT_DOMAIN_EVENT_ID_AGENT_LIFECYCLE event callbacks & constants - Fix docs for Sys::Virt::Domain::get_time method - Demo agent lifecycle events in example program 1.2.9 2014-10-02 - Add VIR_DOMAIN_*_BANDWIDTH_BYTES constants - Add VIR_DOMAIN_BLOCK_REBASE_COPY_DEV constant - Add VIR_DOMAIN_JOB_STATS_COMPLETED constant - Add VIR_DOMAIN_UNDEFINE_NVRAM constant - Add VIR_FROM_POLKIT constant - Add more VIR_DOMAIN_STATS_* constants - Add more VIR_DOMAIN_JOB_* constants - Add virConnectDomainEventTunable event callback & constants - Add virNodeAllocPages API & constants - Add VIR_MIGRATE_RDMA_PIN_ALL constant 1.2.8 2014-09-05 - Add virConnectGetDomainCapabilities API - Add VIR_DOMAIN_BLOCK_REBASE_RELATIVE and VIR_DOMAIN_BLOCK_COMMIT_RELATIVE constants - Add VIR_CONNECT_LIST_STORAGE_POOLS_ZFS constant - Add virDomainOpenGraphicsFD API - Add virDomainBlockCopy and related constants - Add virConnectGetAllDomainStats API & constants 1.2.6 2014-07-02 - Add VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT and VIR_DOMAIN_BLOCK_COMMIT_ACTIVE constants - Add VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 constant - Add virNodeGetFreePages method - Add VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE and VIR_ERR_CPU_INCOMPATIBLE constants - Add virNetworkGetDHCPLeases and constants 1.2.5 2014-06-02 - Add VIR_DOMAIN_{REBOOT,SHUTDOWN}_PARAVIRT constants - Add virDomainFSFreeze/virDomainFSThaw APIs - Add virDomainSetTime/virDomainGetTime APIs 1.2.4 2014-05-06 - Add VIR_FROM_FIREWALL error constant 1.2.3 2014-04-07 - Add VIR_FROM_CRYPTO error constant - Add VIR_MIGRATE_AUTO_CONVERGE migration constant - Add virDomainCoreDumpWithFormat and its constants 1.2.2 2014-03-03 - Add new domain blk I/O constants - Add BHyve error code 1.2.1 2014-01-21 - Add new network event APIs from libvirt 1.2.1 - Add new constants in libvirt 1.2.1 1.2.0 2013-12-02 - Add all new constants in libvirt 1.2.0 - Fix reversed args for virNodeDeviceLookupSCSIHostByWWN 1.1.4 2013-11-05 - Add all new constants in libvirt 1.1.4 - Fix impl of "list_secrets" API (RT #82072) 1.1.3 2013-10-02 - Add all new APIs in libvirt 1.1.3 1.1.2 2013-09-27 - Add all new constants in libvirt 1.1.2 1.1.1 2013-07-30 - Add all new constants/apis in libvirt 1.1.1 1.1.0 2013-07-29 - Add support for v3 of migration APIs - Add all new constants in libvirt 1.1.0 - Fix handling of sparse typed parameters - Fix misc typos in docs 1.0.5 2013-05-14 - Add all new APIs in libvirt 1.0.4 and 1.0.5 1.0.3 2013-03-05 - Add all new APIs in libvirt 1.0.3 1.0.2 2013-02-27 - Add all new APIs in libvirt 1.0.2 1.0.1 2013-02-26 - Add all new APIs and constants in libvirt 1.0.1 - Fix typo preventing listing of NWFilters - Add more testing of object list APIs - Fix some incorrect error handling tests in binding - Remove bogus compare < 0 for size_t variables - Fix const-ness of functions for populating constants - Add option to turn on more GCC warning flags - Fix typos in POD docs 1.0.0 2012-11-16 - Add all new APIs and constants in libvirt 1.0.0 - Fix inconsistent usage of 'uri' in Sys::Virt POD docs - Fix typos in POD docs - Don't explicitly set VIR_TYPED_PARAM_STRING_OKAY flag - Fix hash key field lengths - Add tests for object list APIs - Fix default values for flags parameters - Fix setting of node memory parameters 0.10.2 2012-09-26 - Add all new APIs and constants in libvirt 0.10.2 - Add some constants for macros in libvirt.h related to memory/block/cpu/scheduler parametes - Fix warnings building on Perl with 64 int types - Disable unreliable hostname test case 0.10.0 2012-09-17 - Add all new APIs and constants in libvirt 0.10.0 - Add example program showing use of event callbacks - Fix crash when registering event callback with 'undef' for the domain parameter - Fix typos in the definition of some docs 0.9.13 2012-07-02 - Add all new APIs and constants in libvirt 0.9.13 0.9.12 2012-05-21 - Add all new constants in libvirt 0.9.12 0.9.11 2012-04-16 - Add all new APIs in libvirt 0.9.11 - Add test case to validate API coverage - Fix misc POD docs bugs - Fix reference handling in block stats - Add handling of VIR_TYPED_PARAM_STRING 0.9.10 2012-02-12 - Add all new APIs in libvirt 0.9.10 - Add some constants missing from previous releases - Clarify docs for shutdown/destroy APIs (rt #73908) 0.9.9 2012-01-09 - Add all new APIs in libvirt 0.9.9 - Fix crash in get_hostname - Fix docs typos & nesting screwups - Add example for calculating CPU utilization of host - Update META.yml with correct license info - Add missing dep on Time::HiRes - Convert CHANGES file to Changes & format to comply with Test::CPAN::Changes 0.9.8 2012-01-03 - Add all new APIs in libvirt 0.9.8 - Simplify XS level error reporting code - Cleanup code handling typed parameters 0.9.7 2011-11-08 - Add all new APIs in libvirt 0.9.7 - Add binding for virDomainOpenConsole - Fix missing $flags in documentation - Added example integrating Sys::Virt::Domain->open_graphics GTK3 and GTK-VNC 0.9.5 2011-09-28 - Add all new APIs in libvirt 0.9.5 - Add missing snapshot creation/lookup methods - Fix typo in method listing snapshots - Add missing snapshot constant - Add example for save/restore usage - Re-add abort job binding accidentally deleted 0.9.4 2011-08-03 - Add all new APIs in libvirt 0.9.4 - Requires libvirt >= 0.9.4 - Add missing VIR_DUMP_* and VIR_MIGRATE_* constants from previous releases 0.9.3 2011-07-12 - Add all new APIs in libvirt 0.9.3 - Requires libvirt >= 0.9.3 0.9.2 2011-07-08 - Changed version numbering to track the corresponding minimum required libvirt releases - Add all new APIs in libvirt 0.9.2 - Requires libvirt >= 0.9.2 0.2.8 2011-06-29 - Add all new APIs in libvirt 0.9.0 - Add examples for different ways of using stream APIs to download/upload storage volumes - Requires libvirt >= 0.9.0 0.2.7 2011-06-29 - Honour flags parameter when dumping XML - Use thread local error APIs exclusively - Fix bogus extra URI parameter in migrate_to_uri function - Implement all virStream APIs in Sys::Virt::Stream - Impement virDomainGetSysinfo binding - Call virInitialize when loading module - Add all missing error constants - Update example RPM spec to match Fedora - Requires libvirt >= 0.8.8 0.2.6 2011-02-16 - Fix build with 0.8.7 libvirt by removing reference to non-existent constant only introduced in libvirt > 0.8.7 - Fix test script when hostname is undefined 0.2.5 2011-02-04 - Add all APIs + constants from 0.8.2, 0.8.5 and 0.8.7 releases, with exception of virDomainOpenConsole - Add missing dep on XML::XPath - Requires libvirt >= 0.8.7 0.2.4 2010-05-19 - Add all APIs + constants from 0.7.7, 0.8.0 & 0.8.1 releases - Requires libvirt >= 0.8.1 0.2.3 2010-01-15 - New virSecretPtr APIs - Fix authentication callback handling of NULLs - Document flags parameters to many methods - Add virDomainMigrateToURI and virConnectGetLibVersion - Add virConnectCPUCompare and virDomainMemoryStats - Add vir*IsActive vir*IsPersistent - Add virConnectIsSecure & virConnectIsEncrypted - Add new error codes - Require libvirt >= 0.7.5 0.2.2 2009-09-14 - Add all new APIs upto libvirt 0.7.0 APIs (listing defined network interfaces) - Add missing APIs for looking up storage volumes based on path and key - Fix lookup of network interfaces based on MAC address - Add missing APIs for defining network interfaces and starting defined interfaces 0.2.1 2009-08-25 - Add all new APIs upto libvirt 0.6.4 (network interfaces, storage volume cloning and node device create/delete) - Fix off-by-1 in UUID stringification - Set default values for optional params. - Use SvOK check for potentially undefined string params - Export all the virError related constants - Fix some memory leaks in C layer - Remove bogus module imports from test suite 0.2.0 2009-03-25 - Implement storage, node device, event APIs - Full covereage of all APIs in 0.6.1 release of libvirt - Full documentation coverage - Ability to authenticate when openning connections 0.1.2 2008-02-23 - Added manual written META.yml - Added networking APIs - Added APIs for host capabilities - Added APIs for inactive domains - Switch licensse to GPLv2+ or Artistic for CPAN compatibility - Fix return values for reboot/shutdown/undefine/create APIs - Expanded documentation coverage 0.1.1 2006-06-22 - Fixed POD documentation names - Make Sys::Virt::Error use 'strict' and 'warnings' pragmas - Remove duplicated DESTROY sub in Domain.pm since its already provided in the XS backend - Fixed typo in Makefile.PL - Allow connection URI to be passed to example programs - Minimum required libvirt version is now 0.1.1 - Make Makefile.PL exit if minimum required libvirt is not found by pkg-config - Added bindings for newly introduced APIs in libvirt 0.1.1 0.1.0 2006-04-25 - Added Sys::Virt->get_node_info mapping to virNodeGetInfo - Exposed the constants for domain state in Sys::Virt::Domain - Added binding for virDomainReboot - Change get_uuid to return raw UUID string - Add get_uuid_string to return a printable version - More example programs Sys-Virt-v8.0.0/HACKING000444001750001750 1705614170317017 15320 0ustar00berrangeberrange000000000000 Hacking on libvirt perl ======================= The libvirt Perl release versions are tied directly to the libvirt C library release versions. ie Sys::Virt 1.2.10 will require libvirt version 1.2.10 or newer in order to build. We do not aim to support conditional compilation against versions of libvirt that are older than the version of Sys::Virt. General changes for new APIs ---------------------------- Additions to the libvirt C API will require changes to a minimum of two parts of the Sys::Virt codebase. - Virt.xs - this provides the C glue code to access the libvirt C library APIs and constants from the Perl interpreter. As a general rule, every new function and header file constant/enum requires an addition to this file. The exceptions are functions that are only provided for the benefit of language bindings and not intended for use by application code. For example the reference counting APIs don't need exposing to Perl applications - lib/ - this directory contains the pure Perl part of the binding. There are separate files for each core libvirt object type - lib/Sys/Virt.pm - mapping for virConnectPtr - lib/Sys/Virt/Domain.pm - mapping for virDomainPtr - lib/Sys/Virt/Error.pm - mapping for virErrorPtr - lib/Sys/Virt/Event.pm - mapping for virEventPtr - lib/Sys/Virt/Interface.pm - mapping for virInterfacePtr - lib/Sys/Virt/Network.pm - mapping for virNetworkPtr - lib/Sys/Virt/NodeDevice.pm - mapping for virNodeDevicePtr - lib/Sys/Virt/NWFilter.pm - mapping for virNWFilterPtr - lib/Sys/Virt/Secret.pm - mapping for virSecretPtr - lib/Sys/Virt/StoragePool.pm - mapping for virStoragePoolPtr - lib/Sys/Virt/StorageVol.pm - mapping for virStorageVolPtr - lib/Sys/Virt/Stream.pm - mapping for virStreamPtr There is rarely a need to write Perl code in the .pm modules, as the mapping in the Virt.xs file is usually sufficient. As such the primary purpose of the .pm modules is to hold the POD inline documentation. Every function and constants is required to have full API documentation provided There are a number of unit tests available in the t/ directory which assist in creation of new APIs. - t/010-pod-coverage.t - ensures that every Perl method and constant has POD documentation present - t/030-api-coverage.t - ensures that every C library method/constant in the libvirt-api.xml file has corresponding code in the Virt.xs. Certain functions can be blacklisted in t/030-api-coverage.t as not needed mapping to Perl. This only runs if TEST_MAINTAINER=1 is set. - t/*.t - the other files mostly do functional testing against the test:///default API - if the new function has support in the test driver, then suitable additions should be made If use of the API is not obvious, it is often worth providing a small example program in the examples/ directory. These examples are also useful when adding APIs to ensure that they are operating correctly, if it wasn't possible to unit test them with test:///default. Every addition / change to the API must be documented in the Changes file. New API addition workflow ------------------------- When the libvirt C library is changed, the following workflow is an effective way to update the Perl binding. - Build the libvirt C library # cd $HOME/src/libvirt # ./autogen.sh --system # make - Configure & build the Sys::Virt module to build against the just built libvirt library # cd $HOME/src/libvirt-perl # ../libvirt/run perl Build.PL # ../libvirt/run ./Build - Run the test suite to identify which new functions/constants need handling # TEST_MAINTAINER=1 ../libvirt/run ./Build test - For each missing item reported in the test suite... - Edit Virt.xs to add the C binding - Edit lib/*.pm to add the POD documentation (and occasionally Perl glue code) - Edit Changes to document the addition - Run the test suite (without maintainer mode) to verify POD docs # ../libvirt/run make test - Optionally add to one of the t/*.t test cases - Optionally add demo to examples/ - Commit the changes to GIT Understanding Virt.xs glue layer -------------------------------- The Perl XS glue (Virt.xs) is a pretty bizarre language, that mostly looks like C but is actually run through a Perl specific preprocessor to turn it into real C code. Learning and understanding XS code well is a really difficult task, but fortunately such knowledge is rarely required in order to add new APIs to the Perl Sys::Virt code. When adding constants just look for the REGISTER_CONSTANT() macro at the end of Virt.xs. Make sure that the constant is registered against the correct Sys::Virt::XXXX object namespace - look for the adjacent 'gv_stashpv' calls to see which namespace is currently in effect. When adding methods, you must again make sure they are put in the correct object namespace. For methods, look for the statements that look like: MODULE = Sys::Virt::NWFilter PACKAGE = Sys::Virt::NWFilter these indicate the start of a namespace for the object in question. When implementing the binding for a method, if not already familiar with XS code, the best technique is to just do cut+paste programming. Find an existing libvirt API call that has the same kind of API signature as the new API. Then just copy the XS code for that method and tweak the parameter names as needed. Async event callbacks have a little bit of special handling too. The callbacks are all implemented as static methods at the very top of the Virt.XS file. Look for method names like _domain_event_pmsuspend_callback and just copy the code for an existing callback method that has a similar set of parameters to the new callback. Once the callback is implemented look for the domain_event_register_any() or network_event_register_any() methods and extend the switch() statement so that it maps the event ID constant to your new callback. Making new releases ------------------- The Sys::Virt releases are hosted on the Perl project CPAN infrastructure rather than libvirt.org 1. Build the new release of libvirt as an RPM and install it on the local machine. 2. Set the release date in the Changes file and commit the change 3. Tag the release with a GPG signed tag using vX.Y.Z syntax for the tag name git tag -s -m 'Release 1.2.14' v1.2.14 4. Clone the repository or run 'git clean -x -f -d' to ensure a 100% pristine state 5. Run autobuild.sh to test the full test suite and generate local RPMs. This results in Sys-Virt-1.2.14.tar.gz file being created 6. Take the src.rpm file that was just generated by autobuild.sh and run a scratch build against Fedora rawhide # cd $HOME/src/fedora/perl-Sys-Virt # fedpkg scratch-build --srpm /path/to/src/rpm/file 7. Push the Changes commit and tag to GIT master # git push # git push origin v1.2.14 If there is a failure at any step then this must be corrected as follows a. Delete the signed release tag git tag -d v1.2.14 b. Fix whatever the problem was and update the Changes file if appropriate c. Go to release process step 3 again. Assuming the release has now been made, the Sys-Virt-1.2.14.tar.gz file should be uploaded to CPAN using https://pause.cpan.org form. The upload is currently done by Daniel Berrange (username DANBERR). Now open the tree for the next release version by editing the files lib/Sys/Virt.pm, README, Build.PL to update the version number listed. Also edit Changes to add a placeholder entry for the new release number. Run 'make test' to ensure Changes file is syntax valid. Sys-Virt-v8.0.0/INSTALL000444001750001750 105614170317017 15333 0ustar00berrangeberrange000000000000 Sys::Virt Installation ====================== Sys::Virt requires that libvirt already be installed on the system. The libvirt libraries and header files are located using the pkg-config database. If libvirt is installed to a prefix other than /usr, then be sure to set the PKG_CONFIG_PATH environment variable before building this module: $ export PKG_CONFIG_PATH=/some/prefix/lib/pkgconfig Then follow the standard procedure for a Module::Build based installation: $ perl Build.PL $ ./Build $ ./Build test $ sudo ./Build install -- End Sys-Virt-v8.0.0/LICENSE000444001750001750 5460214170317017 15334 0ustar00berrangeberrange000000000000This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version or b) the "Artistic License" The text of both licenses follows below... --------------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS --------------------------------------------------------------------------- The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Pack- age. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipi- ents of the item may redistribute it under the same conditions they received it. Conditions 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and asso- ciated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Stan- dard Version. 3. You may otherwise modify your copy of this Package in any way, pro- vided that you insert a prominent notice in each changed file stat- ing how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or orga- nization. c) rename any non-standard executables so the names do not con- flict with standard executables, which must also be provided, and provide a separate manual page for each non-standard exe- cutable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the follow- ing: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equiv- alent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Ver- sion. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly com- mercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Pack- age's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever gener- ated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of pro- ducing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other lan- guages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or pro- mote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End --------------------------------------------------------------------------- Sys-Virt-v8.0.0/MANIFEST000444001750001750 274414170317017 15440 0ustar00berrangeberrange000000000000AUTHORS Build.PL Changes examples/auth.pl examples/devices.pl examples/dhcp-leases.pl examples/dom-fsinfo.pl examples/dom-ifinfo.pl examples/dom-migrate.pl examples/dom-stats.pl examples/dump-info.pl examples/dump-xml.pl examples/emulator-pin.pl examples/events.pl examples/fs-freeze.pl examples/hv-stat.pl examples/iothreadinfo.pl examples/node-alloc.pl examples/node-cpu.pl examples/node-devlist.pl examples/node-info.pl examples/node-ksm.pl examples/open-console.pl examples/save-restore.pl examples/send-key.pl examples/vcpuinfo.pl examples/vol-download-all.pl examples/vol-download-nonblock.pl examples/vol-download.pl examples/vol-sparse.pl examples/vol-upload-all.pl examples/vol-upload-nonblock.pl examples/vol-upload.pl HACKING INSTALL lib/Sys/Virt.pm lib/Sys/Virt.xs lib/Sys/Virt/Domain.pm lib/Sys/Virt/DomainSnapshot.pm lib/Sys/Virt/DomainCheckpoint.pm lib/Sys/Virt/Error.pm lib/Sys/Virt/Event.pm lib/Sys/Virt/Interface.pm lib/Sys/Virt/Network.pm lib/Sys/Virt/NetworkPort.pm lib/Sys/Virt/NodeDevice.pm lib/Sys/Virt/NWFilter.pm lib/Sys/Virt/NWFilterBinding.pm lib/Sys/Virt/Secret.pm lib/Sys/Virt/StoragePool.pm lib/Sys/Virt/StorageVol.pm lib/Sys/Virt/Stream.pm LICENSE MANIFEST perl-Sys-Virt.spec perl-Sys-Virt.spec.PL prepare-release.sh README t/005-pod.t t/010-pod-coverage.t t/015-changes.t t/020-constants.t t/030-api-coverage.t t/100-connect.t t/200-domains.t t/300-networks.t t/400-storage-pools.t t/500-storage-vols.t t/600-interfaces.t t/800-events.t typemap Makefile.PL META.yml META.json Sys-Virt-v8.0.0/META.json000444001750001750 542014170317017 15722 0ustar00berrangeberrange000000000000{ "abstract" : "libvirt Perl API", "author" : [ "Daniel Berrange " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4231", "license" : [ "gpl_1" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Sys-Virt", "prereqs" : { "build" : { "requires" : { "ExtUtils::CBuilder" : "0", "Sys::Hostname" : "0", "Test::CPAN::Changes" : "0", "Test::More" : "0", "Test::Pod" : "0", "Test::Pod::Coverage" : "0", "Time::HiRes" : "0", "XML::XPath" : "0", "XML::XPath::XMLParser" : "0" } }, "configure" : { "requires" : { "Module::Build" : "0" } }, "runtime" : { "requires" : { "perl" : "v5.16.0" } } }, "provides" : { "Sys::Virt" : { "file" : "lib/Sys/Virt.pm", "version" : "v8.0.0" }, "Sys::Virt::Domain" : { "file" : "lib/Sys/Virt/Domain.pm" }, "Sys::Virt::DomainCheckpoint" : { "file" : "lib/Sys/Virt/DomainCheckpoint.pm" }, "Sys::Virt::DomainSnapshot" : { "file" : "lib/Sys/Virt/DomainSnapshot.pm" }, "Sys::Virt::Error" : { "file" : "lib/Sys/Virt/Error.pm" }, "Sys::Virt::Event" : { "file" : "lib/Sys/Virt/Event.pm" }, "Sys::Virt::Interface" : { "file" : "lib/Sys/Virt/Interface.pm" }, "Sys::Virt::NWFilter" : { "file" : "lib/Sys/Virt/NWFilter.pm" }, "Sys::Virt::NWFilterBinding" : { "file" : "lib/Sys/Virt/NWFilterBinding.pm" }, "Sys::Virt::Network" : { "file" : "lib/Sys/Virt/Network.pm" }, "Sys::Virt::NetworkPort" : { "file" : "lib/Sys/Virt/NetworkPort.pm" }, "Sys::Virt::NodeDevice" : { "file" : "lib/Sys/Virt/NodeDevice.pm" }, "Sys::Virt::Secret" : { "file" : "lib/Sys/Virt/Secret.pm" }, "Sys::Virt::StoragePool" : { "file" : "lib/Sys/Virt/StoragePool.pm" }, "Sys::Virt::StorageVol" : { "file" : "lib/Sys/Virt/StorageVol.pm" }, "Sys::Virt::Stream" : { "file" : "lib/Sys/Virt/Stream.pm" } }, "release_status" : "stable", "resources" : { "homepage" : "http://libvirt.org/", "license" : [ "http://www.gnu.org/licenses/gpl.html" ], "repository" : { "url" : "https://gitlab.com/libvirt/libvirt-perl" }, "x_MailingList" : "http://www.redhat.com/mailman/listinfo/libvir-list" }, "version" : "v8.0.0", "x_serialization_backend" : "JSON::PP version 4.06" } Sys-Virt-v8.0.0/META.yml000444001750001750 347314170317017 15560 0ustar00berrangeberrange000000000000--- abstract: 'libvirt Perl API' author: - 'Daniel Berrange ' build_requires: ExtUtils::CBuilder: '0' Sys::Hostname: '0' Test::CPAN::Changes: '0' Test::More: '0' Test::Pod: '0' Test::Pod::Coverage: '0' Time::HiRes: '0' XML::XPath: '0' XML::XPath::XMLParser: '0' configure_requires: Module::Build: '0' dynamic_config: 1 generated_by: 'Module::Build version 0.4231, CPAN::Meta::Converter version 2.150010' license: gpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Sys-Virt provides: Sys::Virt: file: lib/Sys/Virt.pm version: v8.0.0 Sys::Virt::Domain: file: lib/Sys/Virt/Domain.pm Sys::Virt::DomainCheckpoint: file: lib/Sys/Virt/DomainCheckpoint.pm Sys::Virt::DomainSnapshot: file: lib/Sys/Virt/DomainSnapshot.pm Sys::Virt::Error: file: lib/Sys/Virt/Error.pm Sys::Virt::Event: file: lib/Sys/Virt/Event.pm Sys::Virt::Interface: file: lib/Sys/Virt/Interface.pm Sys::Virt::NWFilter: file: lib/Sys/Virt/NWFilter.pm Sys::Virt::NWFilterBinding: file: lib/Sys/Virt/NWFilterBinding.pm Sys::Virt::Network: file: lib/Sys/Virt/Network.pm Sys::Virt::NetworkPort: file: lib/Sys/Virt/NetworkPort.pm Sys::Virt::NodeDevice: file: lib/Sys/Virt/NodeDevice.pm Sys::Virt::Secret: file: lib/Sys/Virt/Secret.pm Sys::Virt::StoragePool: file: lib/Sys/Virt/StoragePool.pm Sys::Virt::StorageVol: file: lib/Sys/Virt/StorageVol.pm Sys::Virt::Stream: file: lib/Sys/Virt/Stream.pm requires: perl: v5.16.0 resources: MailingList: http://www.redhat.com/mailman/listinfo/libvir-list homepage: http://libvirt.org/ license: http://www.gnu.org/licenses/gpl.html repository: https://gitlab.com/libvirt/libvirt-perl version: v8.0.0 x_serialization_backend: 'CPAN::Meta::YAML version 0.018' Sys-Virt-v8.0.0/Makefile.PL000444001750001750 44714170317017 16237 0ustar00berrangeberrange000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.4231 require 5.016000; use Module::Build::Compat 0.02; Module::Build::Compat->run_build_pl(args => \@ARGV); require Module::Build; Module::Build::Compat->write_makefile(build_class => 'Module::Build'); Sys-Virt-v8.0.0/README000444001750001750 60314170317017 15137 0ustar00berrangeberrange000000000000 Sys::Virt Readme ================ This module provides a Perl XS binding for the libvirt APIs. For further details on libvirt consult its website http://libvirt.org/ The only pre-requisite for this module is libvirt itself and the Module::Build buld system. For installation instructions, consult the INSTALL file. The current minimum required version of libvirt is 8.0.0 -- End Sys-Virt-v8.0.0/perl-Sys-Virt.spec000444001750001750 363614170317017 17624 0ustar00berrangeberrange000000000000# Automatically generated by perl-Sys-Virt.spec.PL Name: perl-Sys-Virt Version: 8.0.0 Release: 1%{?dist} Summary: Represent and manage a libvirt hypervisor connection License: GPLv2+ or Artistic URL: https://metacpan.org/release/Sys-Virt Source0: https://cpan.metacpan.org/authors/id/D/DA/DANBERR/Sys-Virt-v%{version}.tar.gz # Build BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc BuildRequires: libvirt-devel >= %{version} BuildRequires: make BuildRequires: perl-devel %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: perl-interpreter BuildRequires: perl-generators %endif BuildRequires: perl(ExtUtils::CBuilder) BuildRequires: perl(Module::Build) BuildRequires: sed # Runtime BuildRequires: perl(overload) BuildRequires: perl(strict) BuildRequires: perl(warnings) BuildRequires: perl(XSLoader) # Tests only BuildRequires: perl(base) BuildRequires: perl(Sys::Hostname) BuildRequires: perl(Test::More) BuildRequires: perl(Time::HiRes) BuildRequires: perl(XML::XPath) BuildRequires: perl(XML::XPath::XMLParser) # Optional tests only BuildRequires: perl(Test::CPAN::Changes) BuildRequires: perl(Test::Pod) >= 1.00 BuildRequires: perl(Test::Pod::Coverage) >= 1.00 BuildRequires: git Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version)) %description The Sys::Virt module provides a Perl XS binding to the libvirt virtual machine management APIs. This allows machines running within arbitrary virtualization containers to be managed with a consistent API. %prep %autosetup -S git -n Sys-Virt-v%{version} %build %{__perl} Build.PL installdirs=vendor ./Build %install ./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 %{_fixperms} $RPM_BUILD_ROOT/* %check ./Build test %files %license LICENSE %doc AUTHORS Changes README examples/ %{perl_vendorarch}/auto/* %{perl_vendorarch}/Sys* %{_mandir}/man3/* %changelog Sys-Virt-v8.0.0/perl-Sys-Virt.spec.PL000444001750001750 453514170317017 20135 0ustar00berrangeberrange000000000000# -*- rpm-spec -*- # Copyright (C) 2006 Daniel Berrange # use strict; die unless (scalar @ARGV == 1); open PM, './lib/Sys/Virt.pm' or die "lib/Sys/Virt.pm: $!"; my $ver; while () { if (/our \$VERSION = '(.*)'/) { $ver = $1; last; } } die "cannot find version" unless $ver; local $/ = undef; $_ = ; s/\@VERSION\@/$ver/g; open SPEC, ">$ARGV[0]" or die "$!"; print SPEC $_; close SPEC; __DATA__ # Automatically generated by perl-Sys-Virt.spec.PL Name: perl-Sys-Virt Version: @VERSION@ Release: 1%{?dist} Summary: Represent and manage a libvirt hypervisor connection License: GPLv2+ or Artistic URL: https://metacpan.org/release/Sys-Virt Source0: https://cpan.metacpan.org/authors/id/D/DA/DANBERR/Sys-Virt-v%{version}.tar.gz # Build BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc BuildRequires: libvirt-devel >= %{version} BuildRequires: make BuildRequires: perl-devel %if 0%{?fedora} || 0%{?rhel} > 7 BuildRequires: perl-interpreter BuildRequires: perl-generators %endif BuildRequires: perl(ExtUtils::CBuilder) BuildRequires: perl(Module::Build) BuildRequires: sed # Runtime BuildRequires: perl(overload) BuildRequires: perl(strict) BuildRequires: perl(warnings) BuildRequires: perl(XSLoader) # Tests only BuildRequires: perl(base) BuildRequires: perl(Sys::Hostname) BuildRequires: perl(Test::More) BuildRequires: perl(Time::HiRes) BuildRequires: perl(XML::XPath) BuildRequires: perl(XML::XPath::XMLParser) # Optional tests only BuildRequires: perl(Test::CPAN::Changes) BuildRequires: perl(Test::Pod) >= 1.00 BuildRequires: perl(Test::Pod::Coverage) >= 1.00 BuildRequires: git Requires: perl(:MODULE_COMPAT_%(eval "$(perl -V:version)"; echo $version)) %description The Sys::Virt module provides a Perl XS binding to the libvirt virtual machine management APIs. This allows machines running within arbitrary virtualization containers to be managed with a consistent API. %prep %autosetup -S git -n Sys-Virt-v%{version} %build %{__perl} Build.PL installdirs=vendor ./Build %install ./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 %{_fixperms} $RPM_BUILD_ROOT/* %check ./Build test %files %license LICENSE %doc AUTHORS Changes README examples/ %{perl_vendorarch}/auto/* %{perl_vendorarch}/Sys* %{_mandir}/man3/* %changelog Sys-Virt-v8.0.0/prepare-release.sh000555001750001750 42614170317017 17675 0ustar00berrangeberrange000000000000#!/bin/sh NAME=Sys-Virt set -e rm -rf blib _build Build $NAME-*.tar.gz export TEST_MAINTAINER=1 perl Build.PL install_base=$HOME/builder ./Build ./Build test ./Build install ./Build dist if [ -f /usr/bin/rpmbuild ]; then rpmbuild --nodeps -ta --clean $NAME-*.tar.gz fi Sys-Virt-v8.0.0/typemap000444001750001750 1311014170317017 15716 0ustar00berrangeberrange000000000000TYPEMAP const char * T_PV const unsigned char * T_PV virConnectPtr O_OBJECT_connect virDomainPtr O_OBJECT_domain virNetworkPtr O_OBJECT_network virNetworkPortPtr O_OBJECT_network_port virNWFilterPtr O_OBJECT_nwfilter virNWFilterBindingPtr O_OBJECT_nwfilter_binding virInterfacePtr O_OBJECT_interface virStoragePoolPtr O_OBJECT_storagepool virStorageVolPtr O_OBJECT_storagevol virNodeDevicePtr O_OBJECT_nodedevice virSecretPtr O_OBJECT_secret virDomainSnapshotPtr O_OBJECT_domainsnapshot virDomainCheckpointPtr O_OBJECT_domaincheckpoint virStreamPtr O_OBJECT_stream INPUT O_OBJECT_connect if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_connect sv_setref_pv( $arg, "Sys::Virt", (void*)$var ); INPUT O_OBJECT_domain if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_domain sv_setref_pv( $arg, "Sys::Virt::Domain", (void*)$var ); INPUT O_OBJECT_network if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_network sv_setref_pv( $arg, "Sys::Virt::Network", (void*)$var ); INPUT O_OBJECT_network_port if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_network_port sv_setref_pv( $arg, "Sys::Virt::NetworkPort", (void*)$var ); INPUT O_OBJECT_storagepool if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_storagepool sv_setref_pv( $arg, "Sys::Virt::StoragePool", (void*)$var ); INPUT O_OBJECT_storagevol if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_storagevol sv_setref_pv( $arg, "Sys::Virt::StorageVol", (void*)$var ); INPUT O_OBJECT_nodedevice if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_nodedevice sv_setref_pv( $arg, "Sys::Virt::NodeDevice", (void*)$var ); INPUT O_OBJECT_interface if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_interface sv_setref_pv( $arg, "Sys::Virt::Interface", (void*)$var ); INPUT O_OBJECT_secret if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_secret sv_setref_pv( $arg, "Sys::Virt::Secret", (void*)$var ); INPUT O_OBJECT_nwfilter if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_nwfilter sv_setref_pv( $arg, "Sys::Virt::NWFilter", (void*)$var ); INPUT O_OBJECT_nwfilter_binding if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_nwfilter_binding sv_setref_pv( $arg, "Sys::Virt::NWFilterBinding", (void*)$var ); INPUT O_OBJECT_domainsnapshot if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_domainsnapshot sv_setref_pv( $arg, "Sys::Virt::DomainSnapshot", (void*)$var ); INPUT O_OBJECT_domaincheckpoint if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_domaincheckpoint sv_setref_pv( $arg, "Sys::Virt::DomainCheckpoint", (void*)$var ); INPUT O_OBJECT_stream if (sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG)) $var = INT2PTR($type, SvIV((SV*)SvRV( $arg ))); else { warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); XSRETURN_UNDEF; } OUTPUT O_OBJECT_stream sv_setref_pv( $arg, "Sys::Virt::Stream", (void*)$var ); Sys-Virt-v8.0.0/examples000755001750001750 014170317017 15761 5ustar00berrangeberrange000000000000Sys-Virt-v8.0.0/examples/auth.pl000444001750001750 120514170317017 17412 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; my $addr = @ARGV ? shift @ARGV : ""; print "Addr $addr\n"; my $con = Sys::Virt->new(address => $addr, readonly => 0, auth => 1, credlist => [ Sys::Virt::CRED_AUTHNAME, Sys::Virt::CRED_PASSPHRASE, ], callback => sub { my $creds = shift; foreach my $cred (@{$creds}) { if ($cred->{type} == Sys::Virt::CRED_AUTHNAME) { $cred->{result} = "test"; } if ($cred->{type} == Sys::Virt::CRED_PASSPHRASE) { $cred->{result} = "123456"; } } return 0; }); print "VMM type: ", $con->get_type(), "\n"; Sys-Virt-v8.0.0/examples/devices.pl000444001750001750 44214170317017 20055 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; my $addr = @ARGV ? shift @ARGV : undef; my $con = Sys::Virt->new(address => $addr, readonly => 1); my @devs = $con->list_node_devices("net"); print "Available NICS\n"; foreach (@devs) { print "NIC: ", $_->get_name(), "\n"; } Sys-Virt-v8.0.0/examples/dhcp-leases.pl000444001750001750 64114170317017 20624 0ustar00berrangeberrange000000000000#!/usr/bin/perl use Sys::Virt; my $c = Sys::Virt->new(uri => "qemu:///system", readonly => 1); $n = $c->get_network_by_name("default"); foreach my $lease ($n->get_dhcp_leases()) { print "Interface ", $lease->{iface}, "\n"; print " MAC: ", $lease->{mac}, "\n"; print " IP: ", $lease->{ipaddr}, "\n"; print " Host: ", $lease->{hostname}, "\n" if $lease->{hostname}; print "\n"; } Sys-Virt-v8.0.0/examples/dom-fsinfo.pl000444001750001750 52614170317017 20477 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Sys::Virt::Domain; my $uri = @ARGV ? shift @ARGV : undef; my $c = Sys::Virt->new(uri => $uri); my $dom = $c->get_domain_by_name(shift @ARGV); my @fs = $dom->get_fs_info(); foreach my $fs (@fs) { printf "%s (%s) at %s\n", $fs->{name}, $fs->{fstype}, $fs->{mountpoint}; } Sys-Virt-v8.0.0/examples/dom-ifinfo.pl000444001750001750 101714170317017 20501 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Sys::Virt::Domain; my $uri = @ARGV ? shift @ARGV : undef; my $c = Sys::Virt->new(uri => $uri); my $dom = $c->get_domain_by_name(shift @ARGV); my @nics = $dom->get_interface_addresses( Sys::Virt::Domain::INTERFACE_ADDRESSES_SRC_LEASE); foreach my $nic (@nics) { print "Interface ", $nic->{name}, "\n"; print " MAC: ", $nic->{hwaddr}, "\n"; foreach my $addr (@{$nic->{addrs}}) { print " IP: ", $addr->{addr}, "\n"; } print "\n"; } Sys-Virt-v8.0.0/examples/dom-migrate.pl000444001750001750 74414170317017 20645 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Sys::Virt::Domain; if (int(@ARGV) < 4) { die "syntax: $0 URI DOMAIN DEST-URI DISK1 [DISK2 [DISK3 ...]]"; } my $uri = shift @ARGV; my $c = Sys::Virt->new(uri => $uri); my $dom = $c->get_domain_by_name(shift @ARGV); my $desturi = shift @ARGV; my @disks = @ARGV; $dom->migrate_to_uri( $desturi, { Sys::Virt::Domain::MIGRATE_PARAM_MIGRATE_DISKS => \@disks, }, Sys::Virt::Domain::MIGRATE_PEER2PEER); Sys-Virt-v8.0.0/examples/dom-stats.pl000444001750001750 104014170317017 20361 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Sys::Virt::Domain; my $uri = @ARGV ? shift @ARGV : undef; my $c = Sys::Virt->new(uri => $uri); my @doms; foreach my $name (@ARGV) { push @doms, $c->get_domain_by_name($name); } my @stats = $c->get_all_domain_stats(Sys::Virt::Domain::STATS_STATE, \@doms, Sys::Virt::Domain::GET_ALL_STATS_ENFORCE_STATS); foreach my $stats (@stats) { print "Guest ", $stats->{'dom'}->get_name(), "\n"; print " State: ", $stats->{'data'}->{'state.state'}, "\n"; } Sys-Virt-v8.0.0/examples/dump-info.pl000444001750001750 155014170317017 20352 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; my $addr = @ARGV ? shift @ARGV : ""; print "Addr $addr\n"; my $con = Sys::Virt->new(address => $addr, readonly => 1); print "VMM type: ", $con->get_type(), "\n"; print "Node: {\n"; my $ninfo = $con->get_node_info; foreach (sort { $a cmp $b } keys %{$ninfo}) { print " ", $_, ": ", $ninfo->{$_}, "\n"; } print "}\n"; print "libvirt Version: ", $con->get_major_version(), ".", $con->get_minor_version(), ".", $con->get_micro_version(), "\n"; foreach my $dom (sort { $a->get_id <=> $b->get_id } $con->list_domains) { print "Domain: {\n"; print " ID: ", $dom->get_id(), " '" , $dom->get_name(), "'\n"; print " UUID: ", $dom->get_uuid_string(), "\n"; my $info = $dom->get_info; foreach (sort { $a cmp $b } keys %{$info}) { print " ", $_, ": ", $info->{$_}, "\n"; } print "}\n"; } Sys-Virt-v8.0.0/examples/dump-xml.pl000444001750001750 56614170317017 20205 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; my $addr = ""; if (@ARGV == 2) { $addr = shift @ARGV; } if (@ARGV != 1) { print STDERR "syntax: $0 [URI] DOMAIN-NAME\n"; exit 1; } my $con = Sys::Virt->new(address => $addr, readonly => 1); my $name = shift @ARGV; my $dom = $con->get_domain_by_name($name); print $dom->get_xml_description(), "\n"; Sys-Virt-v8.0.0/examples/emulator-pin.pl000444001750001750 153714170317017 21075 0ustar00berrangeberrange000000000000#!/usr/bin/perl use Sys::Virt; my $uri = shift @ARGV; my $c = Sys::Virt->new(uri => $uri); my $d = $c->get_domain_by_name("vm1"); unless ($d->is_active()) { $d->create; } my $mask = $d->get_emulator_pin_info; @bits = split(//, unpack("b*", $mask)); print join(":", @bits), "\n"; if ($bits[0] == '1' && $bits[1] == '1') { @bits[0] = 0; my $newmask = ''; for(my $i = 0 ; $i <= $#bits ; $i++) { vec($newmask, $i, 1) = $bits[$i]; } @bits = split(//, unpack("b*", $newmask)); print join(":", @bits), "\n"; $d->pin_emulator($newmask); $newermask = $d->get_emulator_pin_info; @bits = split(//, unpack("b*", $newermask)); print join(":", @bits), "\n"; $d->pin_emulator($mask); $newermask = $d->get_emulator_pin_info; @bits = split(//, unpack("b*", $newermask)); print join(":", @bits), "\n"; } Sys-Virt-v8.0.0/examples/events.pl000444001750001750 200614170317017 17755 0ustar00berrangeberrange000000000000#!/usr/bin/perl use Sys::Virt; use Sys::Virt::Event; my $uri = shift @ARGV; Sys::Virt::Event::register_default(); my $quit = 0; my $c = Sys::Virt->new(uri => $uri, readonly => 1); sub lifecycle_event { my $conn = shift; my $dom = shift; my $event = shift; my $detail = shift; printf "%s %s %d %d\n", $conn->get_uri, $dom->get_name, $event, $detail; } sub agent_lifecycle_event { my $conn = shift; my $dom = shift; my $state = shift; my $reason = shift; printf "Agent %s %s state=%d reason=%d\n", $conn->get_uri, $dom->get_name, $state, $reason; } $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 { my $con = shift ; my $reason = shift ; print "Closed reason=$reason\n"; $quit = 1; }); while (!$quit) { Sys::Virt::Event::run_default(); } Sys-Virt-v8.0.0/examples/fs-freeze.pl000444001750001750 55614170317017 20327 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; die "syntax: $0 URI DOMAIN-NAME MOUNT-POINTS\n" unless int(@ARGV) >= 2; my $uri = shift @ARGV; my $domname = shift @ARGV; my @mountpoints = @ARGV; print "Addr $uri\n"; my $con = Sys::Virt->new(address => $uri, readonly => 0); my $dom = $con->get_domain_by_name($domname); $dom->fs_freeze(\@mountpoints); Sys-Virt-v8.0.0/examples/hv-stat.pl000444001750001750 306414170317017 20044 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Sys::Virt::Domain; use Time::HiRes qw(time); my $addr = @ARGV ? shift @ARGV : ""; my $hv = Sys::Virt->new(address => $addr, readonly => 1); my $interval = @ARGV ? shift @ARGV : 1; my $iterations = @ARGV ? shift @ARGV : 1; my %states = ( &Sys::Virt::Domain::STATE_NOSTATE => "nostate", &Sys::Virt::Domain::STATE_RUNNING => "running", &Sys::Virt::Domain::STATE_BLOCKED => "blocked", &Sys::Virt::Domain::STATE_PAUSED => "paused", &Sys::Virt::Domain::STATE_SHUTDOWN => "shutdown", &Sys::Virt::Domain::STATE_SHUTOFF => "shutoff", &Sys::Virt::Domain::STATE_CRASHED => "crashed", &Sys::Virt::Domain::STATE_RUNNING => "running", ); my %cpuTime; my $sample; for (my $i = 0 ; $i < $iterations ; $i++) { sleep $interval if $i; my $now = time; my @domains = $hv->list_domains; my @stats; if (!($i % 10)) { printf " %-4s %-15s %-8s %-6s %-4s\n", "ID", "Name", "State", "CPU", "Memory"; } foreach my $domain (sort { $a->get_id <=> $b->get_id } @domains) { my $uuid = $domain->get_uuid_string; my $info = $domain->get_info; my $cpudelta = exists $cpuTime{$uuid} ? $info->{cpuTime} - $cpuTime{$uuid} : 0; my $timedelta = defined $sample ? ($now - $sample)*1000*1000*1000 :0; $cpuTime{$uuid} = $info->{cpuTime}; my $util = $timedelta > 0 ? $cpudelta * 100 / $timedelta : 0; printf " %-4d %-15s %-8s %-6s %-4dMB \n", $domain->get_id, $domain->get_name, $states{$info->{state}}, (sprintf "%d%%",$util), ($info->{memory}/1024); } $sample = $now; print "\n"; } Sys-Virt-v8.0.0/examples/iothreadinfo.pl000444001750001750 167314170317017 21135 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; my $addr = @ARGV ? shift @ARGV : ""; print "Addr $addr\n"; 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_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_iothread_info(Sys::Virt::Domain::AFFECT_CONFIG); foreach my $info (@info) { print " IOThread: {\n"; foreach (sort { $a cmp $b } keys %{$info}) { if ($_ eq "affinity") { print " ", $_, ": "; my @bits = split(//, unpack("b$nodeinfo->{cpus}", $info->{$_})); print join ("", @bits), "\n"; } else { print " ", $_, ": ", $info->{$_}, "\n"; } } print " }\n"; } print "}\n"; } Sys-Virt-v8.0.0/examples/node-alloc.pl000444001750001750 46314170317017 20453 0ustar00berrangeberrange000000000000#!/usr/bin/perl use Sys::Virt; if (int(@ARGV) < 2) { die "syntax: $0 URI PAGESIZE=1COUNT1 PAGESIZE2=COUNT2..."; } my $uri = shift @ARGV; my $c = Sys::Virt->new(uri => $uri); my @pages; foreach (@ARGV) { my @bits = split /=/; push @pages, \@bits; } $c->node_alloc_pages(\@pages, -1, -1); Sys-Virt-v8.0.0/examples/node-cpu.pl000444001750001750 225114170317017 20165 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Time::HiRes qw(time); my $addr = @ARGV ? shift @ARGV : ""; my $hv = Sys::Virt->new(address => $addr, readonly => 1); my $interval = @ARGV ? shift @ARGV : 1; my $iterations = @ARGV ? shift @ARGV : 1; my $nodeinfo = $hv->get_node_info(); my $ncpus = $nodeinfo->{cpus}; my @cpuTime; my $then; for (my $c = 0 ; $c < $ncpus ; $c++) { printf "CPU %3d ", $c; } print "\n"; for (my $i = 0 ; $i < $iterations ; $i++) { sleep $interval if $i; my $now = time; for (my $c = 0 ; $c < $ncpus ; $c++) { my $info = $hv->get_node_cpu_stats($c); my $used = $info->{kernel} + $info->{user}; if (exists $cpuTime[$c]) { my $cpudelta = $used - $cpuTime[$c]; my $timedelta = ($now - $then) * 1000*1000*1000; my $util = $cpudelta * 100 / $timedelta; printf "%03.02f%% ", $util; } $cpuTime[$c] = $used; } print "\n"; $then = $now; } my ($totcpus, $onlinemask, $nonline) = $hv->get_node_cpu_map(); printf "CPUs total %d, online %d\n", $totcpus, $nonline; my @bits = split(//, unpack("b*", $onlinemask)); for (my $i = 0 ; $i < $totcpus ; $i++) { printf " %d: %d\n", $i, $bits[$i]; } Sys-Virt-v8.0.0/examples/node-devlist.pl000444001750001750 34614170317017 21033 0ustar00berrangeberrange000000000000#!/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; } Sys-Virt-v8.0.0/examples/node-info.pl000444001750001750 231314170317017 20330 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use XML::XPath; use XML::XPath::XMLParser; my $addr = @ARGV ? shift @ARGV : ""; my $hv = Sys::Virt->new(address => $addr, readonly => 1); my $info = $hv->get_node_info(); my @models = $hv->get_cpu_model_names($info->{model}); print "Available CPU model names:\n"; print join ("\n", map { " " . $_ } sort{ lc $a cmp lc $b } @models), "\n"; my @pagesizes = ( 4, 2048, 1048576 ); my @info = $hv->get_node_free_pages(\@pagesizes, 0, 0); print "Free pages per NUMA node:\n"; foreach my $info (@info) { print " Node: ", $info->{cell}, "\n"; print " Free: "; for (my $i = 0; $i <= $#pagesizes; $i++) { my $pagesize = $pagesizes[$i]; printf "%d @ %d KB, ", $info->{pages}->{$pagesize}, $pagesize; } print "\n"; } my $poolCaps = $hv->get_storage_pool_capabilities(); my @poolTypes = (); my $xp = XML::XPath->new(xml => $poolCaps); my $nodeset = $xp->find('/storagepoolCapabilities/pool[@supported="yes"]/@type'); foreach my $node ($nodeset->get_nodelist) { push (@poolTypes, $node->getNodeValue()); } print "Supported pool types: @poolTypes\n"; my $xml = $hv->get_domain_capabilities(undef, "x86_64", undef, "kvm"); print $xml; Sys-Virt-v8.0.0/examples/node-ksm.pl000444001750001750 122114170317017 20164 0ustar00berrangeberrange000000000000#!/usr/bin/perl use warnings; use strict; use Sys::Virt; my $pagetoscan = shift @ARGV || 200; my $sleepmillis = shift @ARGV || 100; my $uri = "qemu:///system"; my $con = Sys::Virt->new(address => $uri); my $params = $con->get_node_memory_parameters(); foreach my $key (keys %{$params}) { printf "%s: %d\n", $key, $params->{$key}; } my %param = (Sys::Virt::NODE_MEMORY_SHARED_PAGES_TO_SCAN => $pagetoscan, Sys::Virt::NODE_MEMORY_SHARED_SLEEP_MILLISECS => $sleepmillis); $con->set_node_memory_parameters(\%param); $params = $con->get_node_memory_parameters(); foreach my $key (keys %{$params}) { printf "%s: %d\n", $key, $params->{$key}; } Sys-Virt-v8.0.0/examples/open-console.pl000444001750001750 152014170317017 21052 0ustar00berrangeberrange000000000000#!/usr/bin/perl use Gtk3 -init; use Sys::Virt; Glib::Object::Introspection->setup( basename => 'GtkVnc', version => '2.0', package => 'GtkVnc'); Glib::Object::Introspection->setup( basename => 'GVnc', version => '1.0', package => 'GVnc'); GVnc::util_set_debug(true); my $window = Gtk3::Window->new ('toplevel'); my $display = GtkVnc::Display->new(); my ($SOCK1, $SOCK2); if (1) { use IO::Socket; ($SOCK1, $SOCK2) = IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "cannot create socketpair: $!"; my $c = Sys::Virt->new(uri => "qemu:///session"); my $d = $c->get_domain_by_name("vm-vnc"); $d->open_graphics(0, $SOCK1->fileno); $display->open_fd($SOCK2->fileno); } else { $display->open_host("localhost", "5900"); } $window->add($display); $window->show_all; Gtk3::main; Sys-Virt-v8.0.0/examples/save-restore.pl000444001750001750 217714170317017 21101 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; my $xml = < perl-demo 219200 219136 1 hvm destroy restart destroy EOF my $conn = Sys::Virt->new(uri => "qemu:///session"); print "Starting a transient guest\n"; my $dom = $conn->create_domain($xml); print "Saving the guest\n"; my $curxml = $dom->get_xml_description(); $dom->save("perl-demo.img", $curxml, Sys::Virt::Domain::SAVE_BYPASS_CACHE); my $newxml = $conn->get_save_image_xml_description("perl-demo.img"); print $newxml; print "Restoring the guest\n"; $conn->restore_domain("perl-demo.img", $newxml, Sys::Virt::Domain::SAVE_BYPASS_CACHE); print "Destroying the guest\n"; $dom = $conn->get_domain_by_name("perl-demo"); $dom->destroy; unlink "perl-demo.img"; Sys-Virt-v8.0.0/examples/send-key.pl000444001750001750 72114170317017 20152 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; die "syntax: $0 URI DOMAIN-NAME\n" unless int(@ARGV) == 2; my $uri = shift @ARGV; my $domname = shift @ARGV; print "Addr $uri\n"; my $con = Sys::Virt->new(address => $uri, readonly => 0); my $dom = $con->get_domain_by_name($domname); my @codes = ( 35, 18, 38, 38, 24, 57, 17, 24, 19, 38, 32, 28, ); $dom->send_key(Sys::Virt::Domain::KEYCODE_SET_LINUX, 100, \@codes); Sys-Virt-v8.0.0/examples/vcpuinfo.pl000444001750001750 170114170317017 20303 0ustar00berrangeberrange000000000000# -*- perl -*- use strict; use warnings; use Sys::Virt; my $addr = @ARGV ? shift @ARGV : ""; print "Addr $addr\n"; 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_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(Sys::Virt::Domain::AFFECT_CONFIG); foreach my $info (@info) { print " VCPU: {\n"; foreach (sort { $a cmp $b } keys %{$info}) { if ($_ eq "affinity") { print " ", $_, ": "; my @mask = split(//, unpack("b$nodeinfo->{cpus}", $info->{$_})); print join ("", @mask), "\n"; print "\n"; } else { print " ", $_, ": ", $info->{$_}, "\n"; } } print " }\n"; } print "}\n"; } Sys-Virt-v8.0.0/examples/vol-download-all.pl000444001750001750 121514170317017 21625 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; my $c = Sys::Virt->new(uri => "qemu:///session"); my $st = $c->new_stream(); die "syntax: $0 VOL-PATH OUTPUT-FILE" unless int(@ARGV) == 2; my $volpath = shift @ARGV; my $f = shift @ARGV; my $vol = $c->get_storage_volume_by_path($volpath); open FILE, ">$f" or die "cannot create $f: $!"; sub foo { my $st = shift; my $data = shift; my $nbytes = shift; return syswrite FILE, $data, $nbytes; }; eval { $vol->download($st, 0, 0); $st->recv_all(\&foo); $st->finish(); }; if ($@) { unlink $f if $@; close FILE; die $@; } close FILE or die "cannot save $f: $!"; Sys-Virt-v8.0.0/examples/vol-download-nonblock.pl000444001750001750 220214170317017 22657 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; Sys::Virt::Event::register_default(); my $c = Sys::Virt->new(uri => "qemu:///session"); my $st = $c->new_stream(Sys::Virt::Stream::NONBLOCK); die "syntax: $0 VOL-PATH OUTPUT-FILE" unless int(@ARGV) == 2; my $volpath = shift @ARGV; my $f = shift @ARGV; my $vol = $c->get_storage_volume_by_path($volpath); my $quit = 0; open FILE, ">$f" or die "cannot create $f: $!"; sub streamevent { my $st = shift; my $events = shift; if ($events & (Sys::Virt::Stream::EVENT_HANGUP | Sys::Virt::Stream::EVENT_ERROR)) { $quit = 1; return; } my $data; my $rv = $st->recv($data, 1024); if ($rv == 0) { $quit = 1; $st->remove_callback(); return; } while ($rv > 0) { my $ret = syswrite FILE, $data, $rv; $data = substr $data, $ret; $rv -= $ret; } } eval { $vol->download($st, 0, 0); $st->add_callback(Sys::Virt::Stream::EVENT_READABLE, \&streamevent); while (!$quit) { Sys::Virt::Event::run_default(); } $st->finish(); }; if ($@) { unlink $f if $@; close FILE; die $@; } close FILE or die "cannot save $f: $!"; Sys-Virt-v8.0.0/examples/vol-download.pl000444001750001750 137314170317017 21064 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; my $c = Sys::Virt->new(uri => "qemu:///session"); my $st = $c->new_stream(); die "syntax: $0 VOL-PATH OUTPUT-FILE" unless int(@ARGV) == 2; my $volpath = shift @ARGV; my $f = shift @ARGV; my $vol = $c->get_storage_volume_by_path($volpath); open FILE, ">$f" or die "cannot create $f: $!"; eval { $vol->download($st, 0, 0); while (1) { my $nbytes = 1024; my $data; my $rv = $st->recv($data, $nbytes); last if $rv == 0; while ($rv > 0) { my $done = syswrite FILE, $data, $rv; if ($done) { $data = substr $data, $done; $rv -= $done; } } } $st->finish(); }; if ($@) { unlink $f if $@; close FILE; die $@; } close FILE or die "cannot save $f: $!"; Sys-Virt-v8.0.0/examples/vol-sparse.pl000555001750001750 672514170317017 20563 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; use Fcntl; my $FILE; sub download_handler { my $st = shift; my $data = shift; my $nbytes = shift; return syswrite FILE, $data, $nbytes; } sub download_hole_handler { my $st = shift; my $offset = shift; my $pos = sysseek FILE, $offset, Fcntl::SEEK_CUR or die "Unable to seek in $FILE: $!"; truncate FILE, $pos; } sub download { my $vol = shift; my $st = shift; my $filename = shift; my $offset = 0; my $length = 0; open FILE, ">$filename" or die "unable to create $filename: $!"; eval { $vol->download($st, $offset, $length, Sys::Virt::StorageVol::VOL_DOWNLOAD_SPARSE_STREAM); $st->sparse_recv_all(\&download_handler, \&download_hole_handler); $st->finish(); }; if ($@) { unlink $filename if $@; close FILE; die $@; } close FILE or die "cannot save $filename: $!" } sub upload_handler { my $st = $_[0]; my $nbytes = $_[2]; return sysread FILE, $_[1], $nbytes; } sub upload_hole_handler { my $st = shift; my $in_data; my $section_len; # HACK, Perl lacks SEEK_DATA and SEEK_HOLE. my $SEEK_DATA = 3; my $SEEK_HOLE = 4; my $cur = sysseek FILE, 0, Fcntl::SEEK_CUR; eval { my $data = sysseek FILE, $cur, $SEEK_DATA; # There are three options: # 1) $data == $cur; $cur is in data # 2) $data > $cur; $cur is in a hole, next data at $data # 3) $data < 0; either $cur is in trailing hole, or $cur is beyond EOF. if (!defined($data)) { # case 3 $in_data = 0; my $end = sysseek FILE, 0, Fcntl::SEEK_END or die "Unable to get EOF position: $!"; $section_len = $end - $cur; } elsif ($data > $cur) { #case 2 $in_data = 0; $section_len = $data - $cur; } else { #case 1 my $hole = sysseek FILE, $data, $SEEK_HOLE; if (!defined($hole) or $hole eq $data) { die "Blah"; } $in_data = 1; $section_len = $hole - $data; } }; die "Blah" if ($@); # reposition file back sysseek FILE, $cur, Fcntl::SEEK_SET; return ($in_data, $section_len); } sub upload_skip_handler { my $st = shift; my $offset = shift; sysseek FILE, $offset, Fcntl::SEEK_CUR or die "Unable to seek in $FILE"; return 0; } sub upload { my $vol = shift; my $st = shift; my $filename = shift; my $offset = 0; my $length = 0; open FILE, "<$filename" or die "unable to open $filename: $!"; eval { $vol->upload($st, $offset, $length, Sys::Virt::StorageVol::VOL_UPLOAD_SPARSE_STREAM); $st->sparse_send_all(\&upload_handler, \&upload_hole_handler, \&upload_skip_handler); $st->finish(); }; if ($@) { close FILE; die $@; } close FILE or die "cannot close $filename: $!" } die "syntax: $0 URI --download/--upload VOLUME FILE" unless int(@ARGV) == 4; my $uri = shift @ARGV; my $action = shift @ARGV; my $volpath = shift @ARGV; my $filename = shift @ARGV; my $c = Sys::Virt->new(uri => $uri) or die "Unable to connect to $uri"; my $vol = $c->get_storage_volume_by_key($volpath) or die "No such volume"; my $st = $c->new_stream(); if ($action eq "--download") { download($vol, $st, $filename); } elsif ($action eq "--upload") { upload($vol, $st, $filename); } else { die "unknown action $action"; } Sys-Virt-v8.0.0/examples/vol-upload-all.pl000444001750001750 114614170317017 21305 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; my $c = Sys::Virt->new(uri => "qemu:///session"); my $st = $c->new_stream(); die "syntax: $0 VOL-PATH INPUT-FILE" unless int(@ARGV) == 2; my $volpath = shift @ARGV; my $f = shift @ARGV; my $vol = $c->get_storage_volume_by_path($volpath); open FILE, "<$f" or die "cannot open $f: $!"; sub foo { my $st = $_[0]; my $nbytes = $_[2]; return sysread FILE, $_[1], $nbytes; }; eval { $vol->upload($st, 0, 0); $st->send_all(\&foo); $st->finish(); }; if ($@) { close FILE; die $@; } close FILE or die "cannot save $f: $!"; Sys-Virt-v8.0.0/examples/vol-upload-nonblock.pl000444001750001750 234214170317017 22341 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; Sys::Virt::Event::register_default(); my $c = Sys::Virt->new(uri => "qemu:///session"); my $st = $c->new_stream(Sys::Virt::Stream::NONBLOCK); die "syntax: $0 VOL-PATH INPUT-FILE" unless int(@ARGV) == 2; my $volpath = shift @ARGV; my $f = shift @ARGV; my $vol = $c->get_storage_volume_by_path($volpath); my $quit = 0; open FILE, "<$f" or die "cannot open $f: $!"; my $nextdata; my $nextdatalen; sub moredata { return if $nextdatalen; $nextdatalen = sysread FILE, $nextdata, 1024; } sub streamevent { my $st = shift; my $events = shift; if ($events & (Sys::Virt::Stream::EVENT_HANGUP | Sys::Virt::Stream::EVENT_ERROR)) { $quit = 1; return; } &moredata; if ($nextdatalen == 0) { $quit = 1; $st->remove_callback(); return; } my $rv = $st->send($nextdata, $nextdatalen); if ($rv > 0) { $nextdata = substr $nextdata, $rv; $nextdatalen -= $rv; } } eval { $vol->upload($st, 0, 0); $st->add_callback(Sys::Virt::Stream::EVENT_WRITABLE, \&streamevent); while (!$quit) { Sys::Virt::Event::run_default(); } $st->finish(); }; if ($@) { close FILE; die $@; } close FILE or die "cannot save $f: $!"; Sys-Virt-v8.0.0/examples/vol-upload.pl000444001750001750 142214170317017 20534 0ustar00berrangeberrange000000000000#!/usr/bin/perl use strict; use warnings; use Sys::Virt; my $c = Sys::Virt->new(uri => "qemu:///session"); my $st = $c->new_stream(); die "syntax: $0 VOL-PATH INPUT-FILE" unless int(@ARGV) == 2; my $volpath = shift @ARGV; my $f = shift @ARGV; my $vol = $c->get_storage_volume_by_path($volpath); open FILE, "<$f" or die "cannot open $f: $!"; eval { $vol->upload($st, 0, 0); while (1) { my $nbytes = 1024; my $data; my $rv = sysread FILE, $data, $nbytes; if ($rv < 0) { die "cannot read $f: $!"; } last if $rv == 0; while ($rv > 0) { my $done = $st->send($data, $rv); if ($done) { $data = substr $data, $done; $rv -= $done; } } } $st->finish(); }; if ($@) { close FILE; die $@; } close FILE or die "cannot save $f: $!"; Sys-Virt-v8.0.0/lib000755001750001750 014170317017 14711 5ustar00berrangeberrange000000000000Sys-Virt-v8.0.0/lib/Sys000755001750001750 014170317017 15467 5ustar00berrangeberrange000000000000Sys-Virt-v8.0.0/lib/Sys/Virt.pm000444001750001750 20232714170317017 17154 0ustar00berrangeberrange000000000000# -*- perl -*- # # Copyright (C) 2006 Red Hat # Copyright (C) 2006-2007 Daniel P. Berrange # # This program is free software; You can redistribute it and/or modify # it under either: # # a) the GNU General Public License as published by the Free # Software Foundation; either version 2, or (at your option) any # later version, # # or # # b) the "Artistic License" # # The file "LICENSE" distributed along with this file provides full # details of the terms and conditions of the two licenses. =pod =head1 NAME Sys::Virt - Represent and manage a libvirt hypervisor connection =head1 SYNOPSIS my $conn = Sys::Virt->new(uri => $uri); my @domains = $conn->list_domains(); foreach my $dom (@domains) { print "Domain ", $dom->get_id, " ", $dom->get_name, "\n"; } =head1 DESCRIPTION The Sys::Virt module provides a Perl XS binding to the libvirt virtual machine management APIs. This allows machines running within arbitrary virtualization containers to be managed with a consistent API. =head1 ERROR HANDLING Any operations in the Sys::Virt API which have failure scenarios will result in an instance of the L module being thrown. To catch these errors, simply wrap the method in an eval block: eval { my $conn = Sys::Virt->new(uri => $uri); }; if ($@) { print STDERR "Unable to open connection to $addr" . $@->message . "\n"; } For details of the information contained in the error objects, consult the L manual page. =head1 METHODS =over 4 =cut package Sys::Virt; use strict; use warnings; use Sys::Virt::Error; use Sys::Virt::Domain; use Sys::Virt::Network; use Sys::Virt::NetworkPort; use Sys::Virt::StoragePool; use Sys::Virt::StorageVol; use Sys::Virt::NodeDevice; use Sys::Virt::Interface; use Sys::Virt::Secret; use Sys::Virt::NWFilter; use Sys::Virt::NWFilterBinding; use Sys::Virt::DomainSnapshot; use Sys::Virt::DomainCheckpoint; use Sys::Virt::Stream; our $VERSION = '8.0.0'; require XSLoader; XSLoader::load('Sys::Virt', $VERSION); =item my $conn = Sys::Virt->new(uri => $uri, readonly => $ro, flags => $flags); Attach to the virtualization host identified by C. The C parameter may be omitted, in which case the default connection made will be to the local Xen hypervisor. Some example URIs include: =over 4 =item xen:/// Xen on the local machine =item test:///default Dummy "in memory" driver for test suites =item qemu:///system System-wide driver for QEMU / KVM virtualization =item qemu:///session Per-user driver for QEMU virtualization =item qemu+tls://somehost/system System-wide QEMU driver on C using TLS security =item xen+tcp://somehost/ Xen driver on C using TCP / SASL security =back For further details consult C If the optional C parameter is supplied, then an unprivileged connection to the hypervisor will be attempted. If it is not supplied, then it defaults to making a fully privileged connection to the hypervisor. If the calling application is not running as root, it may be necessary to provide authentication callbacks. If the optional C parameter is set to a non-zero value, authentication will be enabled during connection, using the default set of credential gathering callbacks. The default callbacks prompt for credentials on the console, so are not suitable for graphical applications. For such apps a custom implementation should be supplied. The C parameter should be an array reference listing the set of credential types that will be supported. The credential constants in this module can be used as values in this list. The C parameter should be a subroutine reference containing the code necessary to gather the credentials. When invoked it will be supplied with a single parameter, an array reference of requested credentials. The elements of the array are hash references, with keys C giving the type of credential, C giving a user descriptive user prompt, C giving name of the credential required. The answer should be collected from the user, and returned by setting the C key. This key may already be set with a default result if applicable As a simple example returning hardcoded credentials my $uri = "qemu+tcp://192.168.122.1/system"; my $username = "test"; my $password = "123456"; my $con = Sys::Virt->new(uri => $uri, auth => 1, credlist => [ Sys::Virt::CRED_AUTHNAME, Sys::Virt::CRED_PASSPHRASE, ], callback => sub { my $creds = shift; foreach my $cred (@{$creds}) { if ($cred->{type} == Sys::Virt::CRED_AUTHNAME) { $cred->{result} = $username; } if ($cred->{type} == Sys::Virt::CRED_PASSPHRASE) { $cred->{result} = $password; } } return 0; }); For backwards compatibility with earlier releases, the C
parameter is accepted as a synonym for the C parameter. The use of C is recommended for all newly written code. =cut sub new { my $proto = shift; my $class = ref($proto) || $proto; my %params = @_; my $uri = exists $params{address} ? $params{address} : exists $params{uri} ? $params{uri} : undef; my $flags = exists $params{flags} ? $params{flags} : 0; if ($params{readonly}) { $flags |= &Sys::Virt::CONNECT_RO; } my $auth = exists $params{auth} ? $params{auth} : 0; my $authcb = exists $params{callback} ? $params{callback} : undef; my $credlist = exists $params{credlist} ? $params{credlist} : undef; my $self; if ($auth) { $self = Sys::Virt::_open_auth($uri, $credlist, $authcb, $flags); } else { $self = Sys::Virt::_open($uri, $flags); } bless $self, $class; return $self; } =item $conn->set_identity($identity, $flags=0) Change the identity that is used for access control over the connection. Normally the remote daemon will use the identity associated with the UNIX domain socket that the app opens. Only a privileged client is usually able to override this. The C<$identity> should be a hash reference whose keys are one of the IDENTITY constants. The C<$flags> parameter is currently unused, and defaults to 0 if omitted. =item my $st = $conn->new_stream($flags) Create a new stream, with the given flags =cut sub new_stream { my $self = shift; my $flags = shift || 0; return Sys::Virt::Stream->_new(connection => $self, flags => $flags); } =item my $dom = $conn->create_domain($xml, $flags); Create a new domain based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The C<$flags> parameter accepts one of the DOMAIN CREATION constants documented in L, and defaults to 0 if omitted. =cut sub create_domain { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::Domain->_new(connection => $self, xml => $xml, flags => $flags); } =item my $dom = $conn->create_domain_with_files($xml, $fds, $flags); Create a new domain based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The C<$fds> parameter is an array of UNIX file descriptors which will be passed to the init process of the container. This is only supported with container based virtualization. The C<$flags> parameter accepts one of the DOMAIN CREATION constants documented in L, and defaults to 0 if omitted. =cut sub create_domain_with_files { my $self = shift; my $xml = shift; my $fds = shift; my $flags = shift || 0; return Sys::Virt::Domain->_new(connection => $self, xml => $xml, fds => $fds, flags => $flags); } =item my $dom = $conn->define_domain($xml, $flags=0); Defines, but does not start, a new domain based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The defined domain can be later started by calling the C method on the returned C object. =cut sub define_domain { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::Domain->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags); } =item my $net = $conn->create_network($xml, $flags=0); Create a new network based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. =cut sub create_network { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::Network->_new(connection => $self, xml => $xml, flags => $flags); } =item my $net = $conn->define_network($xml, $flags = 0); Defines, but does not start, a new network based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The defined network can be later started by calling the C method on the returned C object. =cut sub define_network { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::Network->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags); } =item my $nwfilter = $conn->define_nwfilter($xml, $flags=0); Defines a new network filter based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. =cut sub define_nwfilter { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::NWFilter->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags); } =item my $secret = $conn->define_secret($xml, $flags=0); Defines a new secret based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. =cut sub define_secret { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::Secret->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags); } =item my $pool = $conn->create_storage_pool($xml); Create a new storage pool based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. =cut sub create_storage_pool { my $self = shift; my $xml = shift; return Sys::Virt::StoragePool->_new(connection => $self, xml => $xml); } =item my $pool = $conn->define_storage_pool($xml, $flags=0); Defines, but does not start, a new storage pol based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The defined pool can be later started by calling the C method on the returned C object. =cut sub define_storage_pool { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::StoragePool->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags); } =item my $pool = $conn->create_interface($xml); Create a new interface based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. =cut sub create_interface { my $self = shift; my $xml = shift; return Sys::Virt::Interface->_new(connection => $self, xml => $xml); } =item my $binding = $conn->create_nwfilter_binding($xml, $flags=0); Create a new network filter binding based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. =cut sub create_nwfilter_binding { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::NWFilterBinding->_new(connection => $self, xml => $xml, flags => $flags); } =item my $iface = $conn->define_interface($xml, $flags=0); Defines, but does not start, a new interface based on the XML description passed into the C<$xml> parameter. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The defined interface can be later started by calling the C method on the returned C object. =cut sub define_interface { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::Interface->_new(connection => $self, xml => $xml, nocreate => 1, flags => $flags); } =item my $dev = $conn->create_node_device($xml, $flags=0); Create a new virtual node device based on the XML description passed into the C<$xml> parameter. The C<$flags> parameter is currently unused and defaults to zero. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. =cut sub create_node_device { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::NodeDevice->_new(connection => $self, xml => $xml, flags => $flags); } =item my $dev = $conn->define_node_device($xml, $flags=0); Defines, but does not start, a new node dev based on the XML description passed into the C<$xml> parameter. The C<$flags> parameter is currently unused and defaults to zero. The returned object is an instance of the L class. This method is not available with unprivileged connections to the hypervisor. The defined node device can be later started by calling the C method on the returned C object. =cut sub define_node_device { my $self = shift; my $xml = shift; my $flags = shift || 0; return Sys::Virt::NodeDevice->_new(connection => $self, xml => $xml, flags => $flags, nocreate => 1); } =item my @doms = $conn->list_domains() Return a list of all running domains currently known to the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_domains { my $self = shift; my $nids = $self->num_of_domains(); my @ids = $self->list_domain_ids($nids); my @domains; foreach my $id (@ids) { eval { push @domains, Sys::Virt::Domain->_new(connection => $self, id => $id); }; if ($@) { # nada - domain went away before we could look it up }; } return @domains; } =item my $nids = $conn->num_of_domains() Return the number of running domains known to the hypervisor. This can be used as the C parameter to C. =item my @domIDs = $conn->list_domain_ids($maxids) Return a list of all domain IDs currently known to the hypervisor. The IDs can be used with the C method. =item my @doms = $conn->list_defined_domains() Return a list of all domains defined, but not currently running, on the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_defined_domains { my $self = shift; my $nnames = $self->num_of_defined_domains(); my @names = $self->list_defined_domain_names($nnames); my @domains; foreach my $name (@names) { eval { push @domains, Sys::Virt::Domain->_new(connection => $self, name => $name); }; if ($@) { # nada - domain went away before we could look it up }; } return @domains; } =item my $ndoms = $conn->num_of_defined_domains() Return the number of running domains known to the hypervisor. This can be used as the C parameter to C. =item my @names = $conn->list_defined_domain_names($maxnames) Return a list of names of all domains defined, but not currently running, on the hypervisor. The names can be used with the C method. =item my @doms = $conn->list_all_domains($flags) Return a list of all domains currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the L class. The C<$flags> parameter can be used to filter the list of returned domains. =item my @nets = $conn->list_networks() Return a list of all networks currently known to the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_networks { my $self = shift; my $nnames = $self->num_of_networks(); my @names = $self->list_network_names($nnames); my @networks; foreach my $name (@names) { eval { push @networks, Sys::Virt::Network->_new(connection => $self, name => $name); }; if ($@) { # nada - network went away before we could look it up }; } return @networks; } =item my $nnets = $conn->num_of_networks() Return the number of running networks known to the hypervisor. This can be used as the C parameter to C. =item my @netNames = $conn->list_network_names($maxnames) Return a list of all network names currently known to the hypervisor. The names can be used with the C method. =item my @nets = $conn->list_defined_networks() Return a list of all networks defined, but not currently running, on the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_defined_networks { my $self = shift; my $nnames = $self->num_of_defined_networks(); my @names = $self->list_defined_network_names($nnames); my @networks; foreach my $name (@names) { eval { push @networks, Sys::Virt::Network->_new(connection => $self, name => $name); }; if ($@) { # nada - network went away before we could look it up }; } return @networks; } =item my $nnets = $conn->num_of_defined_networks() Return the number of running networks known to the host. This can be used as the C parameter to C. =item my @names = $conn->list_defined_network_names($maxnames) Return a list of names of all networks defined, but not currently running, on the host. The names can be used with the C method. =item my @nets = $conn->list_all_networks($flags) Return a list of all networks currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the L class. The C<$flags> parameter can be used to filter the list of returned networks. =item my @pools = $conn->list_storage_pools() Return a list of all storage pools currently known to the host. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_storage_pools { my $self = shift; my $nnames = $self->num_of_storage_pools(); my @names = $self->list_storage_pool_names($nnames); my @pools; foreach my $name (@names) { eval { push @pools, Sys::Virt::StoragePool->_new(connection => $self, name => $name); }; if ($@) { # nada - storage pool went away before we could look it up }; } return @pools; } =item my $npools = $conn->num_of_storage_pools() Return the number of running storage pools known to the hypervisor. This can be used as the C parameter to C. =item my @poolNames = $conn->list_storage_pool_names($maxnames) Return a list of all storage pool names currently known to the hypervisor. The IDs can be used with the C method. =item my @pools = $conn->list_defined_storage_pools() Return a list of all storage pools defined, but not currently running, on the host. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_defined_storage_pools { my $self = shift; my $nnames = $self->num_of_defined_storage_pools(); my @names = $self->list_defined_storage_pool_names($nnames); my @pools; foreach my $name (@names) { eval { push @pools, Sys::Virt::StoragePool->_new(connection => $self, name => $name); }; if ($@) { # nada - storage pool went away before we could look it up }; } return @pools; } =item my $npools = $conn->num_of_defined_storage_pools() Return the number of running networks known to the host. This can be used as the C parameter to C. =item my @names = $conn->list_defined_storage_pool_names($maxnames) Return a list of names of all storage pools defined, but not currently running, on the host. The names can be used with the C method. =item my @pools = $conn->list_all_storage_pools($flags) Return a list of all storage pools currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the L class. The C<$flags> parameter can be used to filter the list of returned pools. =item my @devs = $conn->list_node_devices($capability) Return a list of all devices currently known to the host OS. The elements in the returned list are instances of the L class. The optional C parameter allows the list to be restricted to only devices with a particular capability type. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_node_devices { my $self = shift; my $cap = shift; my $nnames = $self->num_of_node_devices($cap); my @names = $self->list_node_device_names($cap, $nnames); my @devs; foreach my $name (@names) { eval { push @devs, Sys::Virt::NodeDevice->_new(connection => $self, name => $name); }; if ($@) { # nada - device went away before we could look it up }; } return @devs; } =item my $ndevs = $conn->num_of_node_devices($capability[, $flags]) Return the number of host devices known to the hypervisor. This can be used as the C parameter to C. The C parameter allows the list to be restricted to only devices with a particular capability type, and should be left as C if the full list is required. The optional parameter is currently unused and defaults to 0 if omitted. =item my @devNames = $conn->list_node_device_names($capability, $maxnames[, $flags]) Return a list of all host device names currently known to the hypervisor. The names can be used with the C method. The C parameter allows the list to be restricted to only devices with a particular capability type, and should be left as C if the full list is required. The optional parameter is currently unused and defaults to 0 if omitted. =item my @devs = $conn->list_all_node_devices($flags) Return a list of all node devices currently known to the hypervisor. The elements in the returned list are instances of the L class. The C<$flags> parameter can be used to filter the list of returned devices. =item my @ifaces = $conn->list_interfaces() Return a list of all network interfaces currently known to the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_interfaces { my $self = shift; my $nnames = $self->num_of_interfaces(); my @names = $self->list_interface_names($nnames); my @interfaces; foreach my $name (@names) { eval { push @interfaces, Sys::Virt::Interface->_new(connection => $self, name => $name); }; if ($@) { # nada - interface went away before we could look it up }; } return @interfaces; } =item my $nifaces = $conn->num_of_interfaces() Return the number of running interfaces known to the hypervisor. This can be used as the C parameter to C. =item my @names = $conn->list_interface_names($maxnames) Return a list of all interface names currently known to the hypervisor. The names can be used with the C method. =item my @ifaces = $conn->list_defined_interfaces() Return a list of all network interfaces currently known to the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_defined_interfaces { my $self = shift; my $nnames = $self->num_of_defined_interfaces(); my @names = $self->list_defined_interface_names($nnames); my @interfaces; foreach my $name (@names) { eval { push @interfaces, Sys::Virt::Interface->_new(connection => $self, name => $name); }; if ($@) { # nada - interface went away before we could look it up }; } return @interfaces; } =item my $nifaces = $conn->num_of_defined_interfaces() Return the number of inactive interfaces known to the hypervisor. This can be used as the C parameter to C. =item my @names = $conn->list_defined_interface_names($maxnames) Return a list of inactive interface names currently known to the hypervisor. The names can be used with the C method. =item my @ifaces = $conn->list_all_interfaces($flags) Return a list of all interfaces currently known to the hypervisor, whether running or shutoff. The elements in the returned list are instances of the L class. The C<$flags> parameter can be used to filter the list of returned interfaces. =item my @ifaces = $conn->list_secrets() Return a list of all secrets currently known to the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_secrets { my $self = shift; my $nuuids = $self->num_of_secrets(); my @uuids = $self->list_secret_uuids($nuuids); my @secrets; foreach my $uuid (@uuids) { eval { push @secrets, Sys::Virt::Secret->_new(connection => $self, uuid => $uuid); }; if ($@) { # nada - secret went away before we could look it up }; } return @secrets; } =item my $nuuids = $conn->num_of_secrets() Return the number of secrets known to the hypervisor. This can be used as the C parameter to C. =item my @uuids = $conn->list_secret_uuids($maxuuids) Return a list of all secret uuids currently known to the hypervisor. The uuids can be used with the C method. =item my @secrets = $conn->list_all_secrets($flags) Return a list of all secrets currently known to the hypervisor. The elements in the returned list are instances of the L class. The C<$flags> parameter can be used to filter the list of returned secrets. =item my @nwfilters = $conn->list_nwfilters() Return a list of all nwfilters currently known to the hypervisor. The elements in the returned list are instances of the L class. This method requires O(n) RPC calls, so the C method is recommended as a more efficient alternative. =cut sub list_nwfilters { my $self = shift; my $nnames = $self->num_of_nwfilters(); my @names = $self->list_nwfilter_names($nnames); my @nwfilters; foreach my $name (@names) { eval { push @nwfilters, Sys::Virt::NWFilter->_new(connection => $self, name => $name); }; if ($@) { # nada - nwfilter went away before we could look it up }; } return @nwfilters; } =item my $nnwfilters = $conn->num_of_nwfilters() Return the number of running nwfilters known to the hypervisor. This can be used as the C parameter to C. =item my @filterNames = $conn->list_nwfilter_names($maxnames) Return a list of all nwfilter names currently known to the hypervisor. The names can be used with the C method. =item my @nwfilters = $conn->list_all_nwfilters($flags) Return a list of all nwfilters currently known to the hypervisor. The elements in the returned list are instances of the L class. The C<$flags> parameter is currently unused and defaults to zero. =item my @bindings = $conn->list_all_nwfilter_bindings($flags) Return a list of all nwfilter bindings currently known to the hypervisor. The elements in the returned list are instances of the L class. The C<$flags> parameter is currently unused and defaults to zero. =item $conn->define_save_image_xml($file, $dxml, $flags=0) Update the XML associated with a virtual machine's save image. The C<$file> parameter is the fully qualified path to the save image XML, while C<$dxml> is the new XML document to write. The C<$flags> parameter is currently unused and defaults to zero. =item $xml = $conn->get_save_image_xml_description($file, $flags=1) Retrieve the current XML configuration associated with the virtual machine's save image identified by C<$file>. The C<$flags> parameter accepts the same constants as C. =item my $dom = $conn->get_domain_by_name($name) Return the domain with a name of C<$name>. The returned object is an instance of the L class. =cut sub get_domain_by_name { my $self = shift; my $name = shift; return Sys::Virt::Domain->_new(connection => $self, name => $name); } =item my $dom = $conn->get_domain_by_id($id) Return the domain with a local id of C<$id>. The returned object is an instance of the L class. =cut sub get_domain_by_id { my $self = shift; my $id = shift; return Sys::Virt::Domain->_new(connection => $self, id => $id); } =item my $dom = $conn->get_domain_by_uuid($uuid) Return the domain with a globally unique id of C<$uuid>. The returned object is an instance of the L class. =cut sub get_domain_by_uuid { my $self = shift; my $uuid = shift; return Sys::Virt::Domain->_new(connection => $self, uuid => $uuid); } =item my $net = $conn->get_network_by_name($name) Return the network with a name of C<$name>. The returned object is an instance of the L class. =cut sub get_network_by_name { my $self = shift; my $name = shift; return Sys::Virt::Network->_new(connection => $self, name => $name); } =item my $net = $conn->get_network_by_uuid($uuid) Return the network with a globally unique id of C<$uuid>. The returned object is an instance of the L class. =cut sub get_network_by_uuid { my $self = shift; my $uuid = shift; return Sys::Virt::Network->_new(connection => $self, uuid => $uuid); } =item my $pool = $conn->get_storage_pool_by_name($name) Return the storage pool with a name of C<$name>. The returned object is an instance of the L class. =cut sub get_storage_pool_by_name { my $self = shift; my $name = shift; return Sys::Virt::StoragePool->_new(connection => $self, name => $name); } =item my $pool = $conn->get_storage_pool_by_uuid($uuid) Return the storage pool with a globally unique id of C<$uuid>. The returned object is an instance of the L class. =cut sub get_storage_pool_by_uuid { my $self = shift; my $uuid = shift; return Sys::Virt::StoragePool->_new(connection => $self, uuid => $uuid); } =item my $pool = $conn->get_storage_pool_by_volume($vol) Return the storage pool with a storage volume C<$vol>. The C<$vol> parameter must be an instance of the L class. The returned object is an instance of the L class. =cut sub get_storage_pool_by_volume { my $self = shift; my $volume = shift; return Sys::Virt::StoragePool->_new(connection => $self, volume => $volume); } =item my $pool = $conn->get_storage_pool_by_target_path($path) Return the storage pool with a target path of C<$path>. The returned object is an instance of the L class. =cut sub get_storage_pool_by_target_path { my $self = shift; my $path = shift; return Sys::Virt::StoragePool->_new(connection => $self, target_path => $path); } =item my $vol = $conn->get_storage_volume_by_path($path) Return the storage volume with a location of C<$path>. The returned object is an instance of the L class. =cut sub get_storage_volume_by_path { my $self = shift; my $path = shift; return Sys::Virt::StorageVol->_new(connection => $self, path => $path); } =item my $vol = $conn->get_storage_volume_by_key($key) Return the storage volume with a globally unique id of C<$key>. The returned object is an instance of the L class. =cut sub get_storage_volume_by_key { my $self = shift; my $key = shift; return Sys::Virt::StorageVol->_new(connection => $self, key => $key); } =item my $dev = $conn->get_node_device_by_name($name) Return the node device with a name of C<$name>. The returned object is an instance of the L class. =cut sub get_node_device_by_name { my $self = shift; my $name = shift; return Sys::Virt::NodeDevice->_new(connection => $self, name => $name); } =item my $dev = $conn->get_node_device_scsihost_by_wwn($wwnn, $wwpn, $flags=0) Return the node device which is a SCSI host identified by C<$wwnn> and C<$wwpn>. The C<$flags> parameter is unused and defaults to zero. The returned object is an instance of the L class. =cut sub get_node_device_scsihost_by_wwn { my $self = shift; my $wwnn = shift; my $wwpn = shift; return Sys::Virt::NodeDevice->_new(connection => $self, wwnn => $wwnn, wwpn => $wwpn); } =item my $iface = $conn->get_interface_by_name($name) Return the interface with a name of C<$name>. The returned object is an instance of the L class. =cut sub get_interface_by_name { my $self = shift; my $name = shift; return Sys::Virt::Interface->_new(connection => $self, name => $name); } =item my $iface = $conn->get_interface_by_mac($mac) Return the interface with a MAC address of C<$mac>. The returned object is an instance of the L class. =cut sub get_interface_by_mac { my $self = shift; my $mac = shift; return Sys::Virt::Interface->_new(connection => $self, mac => $mac); } =item my $sec = $conn->get_secret_by_uuid($uuid) Return the secret with a globally unique id of C<$uuid>. The returned object is an instance of the L class. =cut sub get_secret_by_uuid { my $self = shift; my $uuid = shift; return Sys::Virt::Secret->_new(connection => $self, uuid => $uuid); } =item my $sec = $conn->get_secret_by_usage($usageType, $usageID) Return the secret with a usage type of C<$usageType>, identified by C<$usageID>. The returned object is an instance of the L class. =cut sub get_secret_by_usage { my $self = shift; my $type = shift; my $id = shift; return Sys::Virt::Secret->_new(connection => $self, usageType => $type, usageID => $id); } =item my $nwfilter = $conn->get_nwfilter_by_name($name) Return the domain with a name of C<$name>. The returned object is an instance of the L class. =cut sub get_nwfilter_by_name { my $self = shift; my $name = shift; return Sys::Virt::NWFilter->_new(connection => $self, name => $name); } =item my $nwfilter = $conn->get_nwfilter_by_uuid($uuid) Return the nwfilter with a globally unique id of C<$uuid>. The returned object is an instance of the L class. =cut sub get_nwfilter_by_uuid { my $self = shift; my $uuid = shift; return Sys::Virt::NWFilter->_new(connection => $self, uuid => $uuid); } =item my $binding = $conn->get_nwfilter_binding_by_port_dev($name) Return the network filter binding for the port device C<$name>. The returned object is an instance of the L class. =cut sub get_nwfilter_binding_by_port_dev { my $self = shift; my $name = shift; return Sys::Virt::NWFilterBinding->_new(connection => $self, portdev => $name); } =item my $xml = $conn->find_storage_pool_sources($type, $srcspec[, $flags]) Probe for available storage pool sources for the pool of type C<$type>. The C<$srcspec> parameter can be C, or a parameter to refine the discovery process, for example a server hostname for NFS discovery. The C<$flags> parameter is optional, and if omitted defaults to zero. The returned scalar is an XML document describing the discovered storage pool sources. =item my @stats = $conn->get_all_domain_stats($stats, \@doms=undef, $flags=0); Get a list of all statistics for domains known to the hypervisor. The C<$stats> parameter controls which data fields to return and should be a combination of the DOMAIN STATS FIELD CONSTANTS. The optional C<@doms> parameter is a list of Sys::Virt::Domain objects to return stats for. If this is undefined, then all domains will be returned. The C<$flags> method can be used to filter the list of returned domains. The return data for the method is a list, one element for each domain. The element will be a hash with two keys, C pointing to an instance of C and C pointing to another hash reference containing the actual statistics. =item $conn->interface_change_begin($flags) Begin a transaction for changing the configuration of one or more network interfaces =item $conn->interface_change_commit($flags) Complete a transaction for changing the configuration of one or more network interfaces =item $conn->interface_change_rollback($flags) Abort a transaction for changing the configuration of one or more network interfaces =item $conn->restore_domain($savefile) Recreate a domain from the saved state file given in the C<$savefile> parameter. =item $conn->get_max_vcpus($domtype) Return the maximum number of vcpus that can be configured for a domain of type C<$domtype> =item my $hostname = $conn->get_hostname() Return the name of the host with which this connection is associated. =item my $uri = $conn->get_uri() Return the URI associated with the open connection. This may be different from the URI used when initially connecting to libvirt, when 'auto-probing' or drivers occurrs. =item my $xml = $conn->get_sysinfo() Return an XML documenting representing the host system information, typically obtained from SMBIOS tables. =item my $type = $conn->get_type() Return the type of virtualization backend accessed by this hypervisor object. Currently the only supported type is C. =item my $xml = $conn->domain_xml_from_native($format, $config); Convert the native hypervisor configuration C<$config> which is in format <$format> into libvirrt domain XML. Valid values of C<$format> vary between hypervisor drivers. =item my $config = $conn->domain_xml_to_native($format, $xml) Convert the libvirt domain XML configuration C<$xml> to a native hypervisor configuration in format C<$format> =item my $ver = $conn->get_version() Return the complete version number as a string encoded in the formula C<(major * 1000000) + (minor * 1000) + micro>. =item my $ver = $conn->get_major_version Return the major version number of the libvirt library. =cut sub get_major_version { my $self = shift; my $ver = $self->get_version; return ($ver - ($ver % 1000000))/1000000; } =item my $ver = $conn->get_minor_version Return the minor version number of the libvirt library. =cut sub get_minor_version { my $self = shift; my $ver = $self->get_version; my $mver = $ver % 1000000; return ($mver - ($mver % 1000)) / 1000; } =item my $ver = $conn->get_micro_version Return the micro version number of the libvirt library. =cut sub get_micro_version { my $self = shift; return $self->get_version % 1000; } sub get_version { my $self = shift; if (defined $self) { return $self->_get_conn_version; } else { return &Sys::Virt::_get_library_version(); } } =item my $ver = $conn->get_library_version Return the version number of the API associated with the active connection. This differs from C in that if the connection is to a remote libvirtd daemon, it will return the API version of the remote libvirt, rather than the local client. =cut sub get_library_version { my $self = shift; return $self->_get_conn_library_version; } 1; =pod =item $conn->is_secure() Returns a true value if the current connection is secure against network interception. This implies either use of UNIX sockets, or encryption with a TCP stream. =item $conn->is_encrypted() Returns a true value if the current connection data stream is encrypted. =item $conn->is_alive() Returns a true value if the connection is alive, as determined by keep-alive packets or other recent RPC traffic. =item $conn->set_keep_alive($interval, $count) Change the operation of the keep alive protocol to send C<$count> packets spaced C<$interval> seconds apart before considering the connection dead. =item my $info = $con->get_node_info() Returns a hash reference summarising the capabilities of the host node. The elements of the hash are as follows: =over 4 =item memory The amount of physical memory in the host =item model The model of the CPU, eg x86_64 =item cpus The total number of logical CPUs. =item mhz The peak MHZ of the CPU =item nodes The number of NUMA cells =item sockets The number of CPU sockets =item cores The number of cores per socket =item threads The number of threads per core =back NB, more accurate information about the total number of CPUs and those online can be obtained using the C method. =item my ($totcpus, $onlinemap, $totonline) = $con->get_node_cpu_map(); Returns an array containing information about the CPUs available on the host. The first element, C, specifies the total number of CPUs available to the host regardles of their online stat. The second element, C, provides a bitmap detailing which CPUs are currently online. The third element, C, specifies the total number of online CPUs. The values in the bitmap can be extracted using the C method as follows: my @onlinemap = split(//, unpack("b*", $onlinemap)); =item my $info = $con->get_node_cpu_stats($cpuNum=-1, $flags=0) Returns a hash reference providing information about the host CPU statistics. If <$cpuNum> is omitted, it defaults to C which causes it to return cumulative information for all CPUs in the host. If C<$cpuNum> is zero or larger, it returns information just for the specified number. The C<$flags> parameter is currently unused and defaults to zero. The fields in the returned hash reference are =over 4 =item kernel The time spent in kernelspace =item user The time spent in userspace =item idle The idle time =item iowait The I/O wait time =item utilization The overall percentage utilization. =back =item my $info = $con->get_node_memory_stats($cellNum=-1, $flags=0) Returns a hash reference providing information about the host memory statistics. If <$cellNum> is omitted, it defaults to C which causes it to return cumulative information for all NUMA cells in the host. If C<$cellNum> is zero or larger, it returns information just for the specified number. The C<$flags> parameter is currently unused and defaults to zero. The fields in the returned hash reference are =over 4 =item total The total memory =item free The free memory =item buffers The memory consumed by buffers =item cached The memory consumed for cache =back =item my $params = $conn->get_node_memory_parameters($flags=0) Return a hash reference containing the set of memory tunable parameters for the node. The keys in the hash are one of the constants MEMORY PARAMETERS described later. The C<$flags> parameter is currently unused, and defaults to 0 if omitted. =item $conn->set_node_memory_parameters($params, $flags=0) Update the memory tunable parameters for the node. The C<$params> should be a hash reference whose keys are one of the MEMORY PARAMETERS constants. The C<$flags> parameter is currently unused, and defaults to 0 if omitted. =item $info = $conn->get_node_sev_info($flags=0) Get the AMD SEV information for the host. C<$flags> is currently unused and defaults to 0 if omitted. The returned hash contains the following keys: =over 4 =item Sys::Virt::SEV_CBITPOS The CBit position =item Sys::Virt::SEV_CERT_CHAIN The certificate chain =item Sys::Virt::SEV_PDH Platform diffie-hellman key =item Sys::Virt::SEV_REDUCED_PHYS_BITS The number of physical address bits used by SEV =item Sys::Virt::SEV_MAX_GUESTS Maximum number of SEV guests that can be launched =item Sys::Virt::SEV_MAX_ES_GUESTS Maximum number of SEV-ES guests that can be launched =back =item $conn->node_suspend_for_duration($target, $duration, $flags=0) Suspend the the host, using mode C<$target> which is one of the NODE SUSPEND constants listed later. The C<$duration> parameter controls how long the node is suspended for before waking up. =item $conn->domain_event_register($callback) Register a callback to received notifications of domain state change events. Only a single callback can be registered with each connection instance. The callback will be invoked with four parameters, an instance of C for the connection, an instance of C for the domain changing state, and a C and C arguments, corresponding to the event constants defined in the C module. Before discarding the connection object, the callback must be deregistered, otherwise the connection object memory will never be released in garbage collection. =item $conn->domain_event_deregister() Unregister a callback, allowing the connection object to be garbage collected. =item $callback = $conn->domain_event_register_any($dom, $eventID, $callback) Register a callback to received notifications of domain events. The C<$dom> parameter can be C to request events on all known domains, or a specific C object to filter events. The C<$eventID> parameter is one of the EVENT ID constants described later in this document. The C<$callback> is a subroutine reference that will receive the events. All callbacks receive a C connection as the first parameter and a C object indicating the domain on which the event occurred as the second parameter. Subsequent parameters vary according to the event type =over =item EVENT_ID_LIFECYCLE Extra C and C parameters defining the lifecycle transition that occurred. =item EVENT_ID_REBOOT No extra parameters =item EVENT_ID_RTC_CHANGE The C gives the offset from UTC in seconds =item EVENT_ID_WATCHDOG The C defines the action that is taken as a result of the watchdog triggering. One of the WATCHDOG constants described later =item EVENT_ID_IO_ERROR The C is the file on the host which had the error. The C is the unique device alias from the guest configuration associated with C. The C is the action taken as a result of the error, one of the IO ERROR constants described later =item EVENT_ID_GRAPHICS The C is the stage of the connection, one of the GRAPHICS PHASE constants described later. The C and C parameters follow with the details of the local and remote network addresses. The C describes how the user was authenticated (if at all). Finally C is an array ref containing authenticated identities for the user, if any. =back The return value is a unique callback ID that must be used when unregistering the event. =item $conn->domain_event_deregister_any($callbackID) Unregister a callback, associated with the C<$callbackID> previously obtained from C. =item $callback = $conn->network_event_register_any($net, $eventID, $callback) Register a callback to received notifications of network events. The C<$net> parameter can be C to request events on all known networks, or a specific C object to filter events. The C<$eventID> parameter is one of the EVENT ID constants described later in this document. The C<$callback> is a subroutine reference that will receive the events. All callbacks receive a C connection as the first parameter and a C object indicating the network on which the event occurred as the second parameter. Subsequent parameters vary according to the event type =over =item EVENT_ID_LIFECYCLE Extra C and C parameters defining the lifecycle transition that occurred. =back The return value is a unique callback ID that must be used when unregistering the event. =item $conn->network_event_deregister_any($callbackID) Unregister a callback, associated with the C<$callbackID> previously obtained from C. =item $callback = $conn->storage_pool_event_register_any($pool, $eventID, $callback) Register a callback to received notifications of storage pool events. The C<$pool> parameter can be C to request events on all known storage pools, or a specific C object to filter events. The C<$eventID> parameter is one of the EVENT ID constants described later in this document. The C<$callback> is a subroutine reference that will receive the events. All callbacks receive a C connection as the first parameter and a C object indicating the storage pool on which the event occurred as the second parameter. Subsequent parameters vary according to the event type =over =item EVENT_ID_LIFECYCLE Extra C and C parameters defining the lifecycle transition that occurred. =item EVENT_ID_REFRESH No extra parameters. =back The return value is a unique callback ID that must be used when unregistering the event. =item $conn->storage_pool_event_deregister_any($callbackID) Unregister a callback, associated with the C<$callbackID> previously obtained from C. =item $callback = $conn->node_device_event_register_any($dev, $eventID, $callback) Register a callback to received notifications of node device events. The C<$dev> parameter can be C to request events on all known node devices, or a specific C object to filter events. The C<$eventID> parameter is one of the EVENT ID constants described later in this document. The C<$callback> is a subroutine reference that will receive the events. All callbacks receive a C connection as the first parameter and a C object indicating the node device on which the event occurred as the second parameter. Subsequent parameters vary according to the event type =over =item EVENT_ID_LIFECYCLE Extra C and C parameters defining the lifecycle transition that occurred. =back The return value is a unique callback ID that must be used when unregistering the event. =item $conn->node_device_event_deregister_any($callbackID) Unregister a callback, associated with the C<$callbackID> previously obtained from C. =item $callback = $conn->secret_event_register_any($secret, $eventID, $callback) Register a callback to received notifications of secret events. The C<$secret> parameter can be C to request events on all known secrets, or a specific C object to filter events. The C<$eventID> parameter is one of the EVENT ID constants described later in this document. The C<$callback> is a subroutine reference that will receive the events. All callbacks receive a C connection as the first parameter and a C object indicating the secret on which the event occurred as the second parameter. Subsequent parameters vary according to the event type =over =item EVENT_ID_LIFECYCLE Extra C and C parameters defining the lifecycle transition that occurred. =item EVENT_ID_VALUE_CHANGED No extra parameters. =back The return value is a unique callback ID that must be used when unregistering the event. =item $conn->secret_event_deregister_any($callbackID) Unregister a callback, associated with the C<$callbackID> previously obtained from C. =item $conn->register_close_callback($coderef); Register a callback to be invoked when the connection is closed. The callback will be invoked with two parameters, the C<$conn> it was registered against, and the reason for the close event. The reason value will be one of the C listed later in this document. =item $conn->unregister_close_callback(); Remove the previously registered close callback. =item my $xml = $con->baseline_cpu(\@xml, $flags=0) Given an array ref whose elements are XML documents describing host CPUs, compute the baseline CPU model that is operable across all hosts. The XML for the baseline CPU model is returned. The optional C<$flags> parameter can take one of =over 4 =item Sys::Virt::BASELINE_CPU_EXPAND_FEATURES Expand the CPU definition to list all feature flags, even those implied by the model name. =item Sys::Virt::BASELINE_CPU_MIGRATABLE Only include features which can be live migrated. =back =item my $xml = $con->baseline_hypervisor_cpu($emulator, $arch, $machine, $virttype, \@xml, $flags=0) Given an array ref whose elements are XML documents describing host CPUs, compute the baseline CPU model that is operable across all hosts. The XML for the baseline CPU model is returned. Either C<$emulator> or C<$arch> must be a valid string referring to an emulator binary or an architecture name respectively. The C<$machine> parameter is an optional name of a guest machine, and C<$virttype> is an optional name of the virtualization type. The optional C<$flags> parameter accepts the same values as C. =item @names = $con->get_cpu_model_names($arch, $flags=0) Get a list of valid CPU models names for the architecture given by C<$arch>. The C<$arch> value should be one of the architectures listed in the capabilities XML document. The C<$flags> parameter is currently unused and defaults to 0. =item my $info = $con->get_node_security_model() Returns a hash reference summarising the security model of the host node. There are two keys in the hash, C specifying the name of the security model (eg 'selinux') and C specifying the 'domain of interpretation' for security labels. =item my $xml = $con->get_capabilities(); Returns an XML document describing the hypervisor capabilities =item my $xml = $con->get_domain_capabilities($emulator, $arch, $machine, $virttype, flags=0); Returns an XML document describing the capabilities of the requested guest configuration. Either C<$emulator> or C<$arch> must be a valid string referring to an emulator binary or an architecture name respectively. The C<$machine> parameter is an optional name of a guest machine, and C<$virttype> is an optional name of the virtualization type. C<$flags> is unused and defaults to zero. =item my $xml = $con->get_storage_pool_capabilities($flags=0); Returns an XML document describing the storage pool driver capabilities (e.g. which storage pool types are supported and so on). C<$flags> is currently unused and defaults to zero. =item my $result = $con->compare_cpu($xml, $flags=0); Checks whether the CPU definition in C<$xml> is compatible with the current hypervisor connection. This can be used to determine whether it is safe to migrate a guest to this host. The returned result is one of the constants listed later The optional C<$flags> parameter can take one of the following constants =over 4 =item Sys::Virt::COMPARE_CPU_FAIL_INCOMPATIBLE Raise a fatal error if the CPUs are not compatible, instead of just returning a special error code. =item Sys::Virt::COMPARE_CPU_VALIDATE_XML Validate input XML document against the RNG schema. =back =item my $result = $con->compare_hypervisor_cpu($emulator, $arch, $machine, $virttype, $xml, $flags=0); Checks whether the CPU definition in C<$xml> is compatible with the current hypervisor connection. This can be used to determine whether it is safe to migrate a guest to this host. Either C<$emulator> or C<$arch> must be a valid string referring to an emulator binary or an architecture name respectively. The C<$machine> parameter is an optional name of a guest machine, and C<$virttype> is an optional name of the virtualization type. The returned result is one of the constants listed later The optional C<$flags> parameter can take the same values as the C method. =item $mem = $con->get_node_free_memory(); Returns the current free memory on the host =item @mem = $con->get_node_cells_free_memory($start, $end); Returns the free memory on each NUMA cell between C<$start> and C<$end>. =item @pages = $con->get_node_free_pages(\@pagesizes, $start, $end); Returns information about the number of pages free on each NUMA cell between C<$start> and C<$end> inclusive. The C<@pagesizes> parameter should be an arrayref specifying which pages sizes information should be returned for. Information about supported page sizes is available in the capabilities XML. The returned array has an element for each NUMA cell requested. The elements are hash references with two keys, 'cell' specifies the NUMA cell number and 'pages' specifies the free page information for that cell. The 'pages' value is another hash reference where the keys are the page sizes and the values are the free count for that size. =item $con->node_alloc_pages(\@pages, $start, $end, $flags=0) Allocate further huge pages for the reserved dev. The <\@pages> parameter is an array reference with one entry per page size to allocate for. Each entry is a further array reference where the first element is the page size and the second element is the page count. The same number of pages will be allocated on each NUMA node in the range C<$start> to C<$end> inclusive. The C<$flags> parameter accepts two contants =over 4 =item Sys::Virt::NODE_ALLOC_PAGES_ADD The requested number of pages will be added to the existing huge page reservation. =item Sys::Virt::NODE_ALLOC_PAGES_SET The huge page reservation will be set to exactly the requested number =back =back =head1 CONSTANTS The following sets of constants are useful when dealing with APIs in this package =head2 CONNECTION When opening a connection the following constants can be used: =over 4 =item Sys::Virt::CONNECT_RO Request a read-only connection =item Sys::Virt::CONNECT_NO_ALIASES Prevent the resolution of URI aliases =back =head2 CREDENTIAL TYPES When providing authentication callbacks, the following constants indicate the type of credential being requested =over 4 =item Sys::Virt::CRED_AUTHNAME Identity to act as =item Sys::Virt::CRED_USERNAME Identity to authorize as =item Sys::Virt::CRED_CNONCE Client supplies a nonce =item Sys::Virt::CRED_REALM Authentication realm =item Sys::Virt::CRED_ECHOPROMPT Challenge response non-secret =item Sys::Virt::CRED_NOECHOPROMPT Challenge response secret =item Sys::Virt::CRED_PASSPHRASE Passphrase secret =item Sys::Virt::CRED_LANGUAGE RFC 1766 language code =item Sys::Virt::CRED_EXTERNAL Externally provided credential =back =head2 IDENTITY CONSTANTS The following constants are useful to change the connection identity =over 4 =item Sys::Virt::IDENTITY_USER_NAME The process user name =item Sys::Virt::IDENTITY_UNIX_USER_ID The process UNIX user ID =item Sys::Virt::IDENTITY_GROUP_NAME The process group name =item Sys::Virt::IDENTITY_UNIX_GROUP_ID The process UNIX group ID =item Sys::Virt::IDENTITY_PROCESS_ID The process ID. =item Sys::Virt::IDENTITY_PROCESS_TIME The process start time. =item Sys::Virt::IDENTITY_SASL_USER_NAME The SASL authenticated user name =item Sys::Virt::IDENTITY_X509_DISTINGUISHED_NAME The X509 certificate distinguished name for the TLS connection =item Sys::Virt::IDENTITY_SELINUX_CONTEXT The SELinux process context =back =head2 CPU COMPARISON CONSTANTS =over 4 =item Sys::Virt::CPU_COMPARE_INCOMPATIBLE This host is missing one or more CPU features in the CPU description =item Sys::Virt::CPU_COMPARE_IDENTICAL The host has an identical CPU description =item Sys::Virt::CPU_COMPARE_SUPERSET The host offers a superset of the CPU descriptoon =back =head2 NODE SUSPEND CONSTANTS =over 4 =item Sys::Virt::NODE_SUSPEND_TARGET_MEM Suspends to memory (equivalent of S3 on x86 architectures) =item Sys::Virt::NODE_SUSPEND_TARGET_DISK Suspends to disk (equivalent of S5 on x86 architectures) =item Sys::Virt::NODE_SUSPEND_TARGET_HYBRID Suspends to memory and disk (equivalent of S3+S5 on x86 architectures) =back =head2 NODE VCPU CONSTANTS =over 4 =item Sys::Virt::NODE_CPU_STATS_ALL_CPUS Request statistics for all CPUs =back =head2 NODE MEMORY CONSTANTS =over 4 =item Sys::Virt::NODE_MEMORY_STATS_ALL_CELLS Request statistics for all memory cells =back =head2 MEMORY PARAMETERS The following constants are used to name memory parameters of the node =over 4 =item Sys::Virt::NODE_MEMORY_SHARED_FULL_SCANS How many times all mergeable areas have been scanned. =item Sys::Virt::NODE_MEMORY_SHARED_PAGES_SHARED How many the shared memory pages are being used. =item Sys::Virt::NODE_MEMORY_SHARED_PAGES_SHARING How many sites are sharing the pages =item Sys::Virt::NODE_MEMORY_SHARED_PAGES_TO_SCAN How many present pages to scan before the shared memory service goes to sleep =item Sys::Virt::NODE_MEMORY_SHARED_PAGES_UNSHARED How many pages unique but repeatedly checked for merging. =item Sys::Virt::NODE_MEMORY_SHARED_PAGES_VOLATILE How many pages changing too fast to be placed in a tree. =item Sys::Virt::NODE_MEMORY_SHARED_SLEEP_MILLISECS 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 The following constants related to the connection close callback, describe the reason for the closing of the connection. =over 4 =item Sys::Virt::CLOSE_REASON_CLIENT The client application requested the connection be closed =item Sys::Virt::CLOSE_REASON_EOF End-of-file was encountered reading data from the connection =item Sys::Virt::CLOSE_REASON_ERROR An I/O error was encountered reading/writing data from/to the connection =item Sys::Virt::CLOSE_REASON_KEEPALIVE The connection keepalive timer triggered due to lack of response from the server =back =head2 CPU STATS CONSTANTS The following constants provide the names of known CPU stats fields =over 4 =item Sys::Virt::NODE_CPU_STATS_IDLE Time spent idle =item Sys::Virt::NODE_CPU_STATS_IOWAIT Time spent waiting for I/O to complete =item Sys::Virt::NODE_CPU_STATS_KERNEL Time spent executing kernel code =item Sys::Virt::NODE_CPU_STATS_USER Time spent executing user code =item Sys::Virt::NODE_CPU_STATS_INTR Time spent processing interrupts =item Sys::Virt::NODE_CPU_STATS_UTILIZATION Percentage utilization of the CPU. =back =head2 MEMORY STAS CONSTANTS The following constants provide the names of known memory stats fields =over 4 =item Sys::Virt::NODE_MEMORY_STATS_BUFFERS The amount of memory consumed by I/O buffers =item Sys::Virt::NODE_MEMORY_STATS_CACHED The amount of memory consumed by disk cache =item Sys::Virt::NODE_MEMORY_STATS_FREE The amount of free memory =item Sys::Virt::NODE_MEMORY_STATS_TOTAL The total amount of memory =back =head2 IP address constants The following constants are used to interpret IP address types =over 4 =item Sys::Virt::IP_ADDR_TYPE_IPV4 An IPv4 address type =item Sys::Virt::IP_ADDR_TYPE_IPV6 An IPv6 address type =back =head1 BUGS Hopefully none, but the XS code needs to be audited to ensure it is not leaking memory. =head1 AUTHORS Daniel P. Berrange =head1 COPYRIGHT Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2009 Daniel P. Berrange =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file. =head1 SEE ALSO L, L, L, L, L, C =cut Sys-Virt-v8.0.0/lib/Sys/Virt.xs000444001750001750 112105214170317017 17206 0ustar00berrangeberrange000000000000/* -*- c -*- * * Copyright (C) 2006-2016 Red Hat * Copyright (C) 2006-2014 Daniel P. Berrange * * This program is free software; You can redistribute it and/or modify * it under either: * * a) the GNU General Public License as published by the Free * Software Foundation; either version 2, or (at your option) any * later version, * * or * * b) the "Artistic License" * * The file "LICENSE" distributed along with this file provides full * details of the terms and conditions of the two licenses. */ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include #include /* * On 32-bit OS (and some 64-bit) Perl does not have an * integer type capable of storing 64 bit numbers. So * we serialize to/from strings on these platforms */ static long long virt_SvIVll(SV *sv) { #ifdef USE_64_BIT_ALL return SvIV(sv); #else return strtoll(SvPV_nolen(sv), NULL, 10); #endif } static unsigned long long virt_SvIVull(SV *sv) { #ifdef USE_64_BIT_ALL return SvIV(sv); #else return strtoull(SvPV_nolen(sv), NULL, 10); #endif } #ifndef PRId64 #define PRId64 "lld" #endif static SV * virt_newSVll(long long val) { #ifdef USE_64_BIT_ALL return newSViv(val); #else char buf[100]; int len; len = snprintf(buf, 100, "%" PRId64, val); return newSVpv(buf, len); #endif } #ifndef PRIu64 #define PRIu64 "llu" #endif static SV * virt_newSVull(unsigned long long val) { #ifdef USE_64_BIT_ALL return newSVuv(val); #else char buf[100]; int len; len = snprintf(buf, 100, "%" PRIu64, val); return newSVpv(buf, len); #endif } static void ignoreVirErrorFunc(void * userData, virErrorPtr error) { /* Do nothing */ } static SV * _sv_from_error(virErrorPtr error) { HV *hv; hv = newHV (); /* Map virErrorPtr attributes to hash keys */ (void)hv_store (hv, "level", 5, newSViv (error ? error->level : 0), 0); (void)hv_store (hv, "code", 4, newSViv (error ? error->code : 0), 0); (void)hv_store (hv, "domain", 6, newSViv (error ? error->domain : VIR_FROM_NONE), 0); (void)hv_store (hv, "message", 7, newSVpv (error && error->message ? error->message : "Unknown problem", 0), 0); return sv_bless (newRV_noinc ((SV*) hv), gv_stashpv ("Sys::Virt::Error", TRUE)); } static void _croak_error(void) { virErrorPtr error = virGetLastError(); sv_setsv(ERRSV, _sv_from_error (error)); /* croak does not return, so we free this now to avoid leaking */ virResetError(error); croak (Nullch); } static void _populate_constant(HV *stash, const char *name, int val) { SV *valsv; valsv = newSViv(0); sv_setuv(valsv,val); newCONSTSUB(stash, name, valsv); } static void _populate_constant_str(HV *stash, const char *name, const char *value) { SV *valsv; valsv = newSVpv(value, strlen(value)); newCONSTSUB(stash, name, valsv); } static void _populate_constant_ull(HV *stash, const char *name, unsigned long long val) { SV *valsv; valsv = virt_newSVull(val); newCONSTSUB(stash, name, valsv); } #define REGISTER_CONSTANT(name, key) _populate_constant(stash, #key, name) #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(virTypedParameterPtr 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, virTypedParameterPtr 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); if (!(params[i].value.s = strdup((char *)ptr))) abort(); break; } } return nparams; } static void vir_typed_param_add_string_list_from_hv(HV *newparams, virTypedParameterPtr *params, int *nparams, const char *key) { if (!hv_exists(newparams, key, strlen(key))) { return; } SSize_t nstr, i; virTypedParameterPtr localparams = *params; SV **val = hv_fetch(newparams, key, strlen(key), 0); AV *av = (AV*)(SvRV(*val)); nstr = av_len(av) + 1; Renew(localparams, *nparams + nstr, virTypedParameter); for (i = 0 ; i < nstr ; i++) { STRLEN len; SV **subval = av_fetch(av, i, 0); char *ptr = SvPV(*subval, len); strncpy(localparams[*nparams + i].field, key, VIR_TYPED_PARAM_FIELD_LENGTH); localparams[*nparams + i].field[VIR_TYPED_PARAM_FIELD_LENGTH - 1] = '\0'; localparams[*nparams + i].type = VIR_TYPED_PARAM_STRING; if (!(localparams[*nparams + i].value.s = strdup(ptr))) abort(); } *params = localparams; *nparams += nstr; } static void vir_typed_param_safe_free(virTypedParameterPtr params, int nparams) { virTypedParamsClear(params, nparams); Safefree(params); } static int _domain_event_lifecycle_callback(virConnectPtr con, virDomainPtr dom, int event, int detail, 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(event))); XPUSHs(sv_2mortal(newSViv(detail))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_generic_callback(virConnectPtr con, virDomainPtr dom, 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); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_rtcchange_callback(virConnectPtr con, virDomainPtr dom, long long utcoffset, 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(virt_newSVll(utcoffset))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_watchdog_callback(virConnectPtr con, virDomainPtr dom, int action, 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(action))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_io_error_callback(virConnectPtr con, virDomainPtr dom, const char *srcPath, const char *devAlias, int action, 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(newSVpv(srcPath, 0))); XPUSHs(sv_2mortal(newSVpv(devAlias, 0))); XPUSHs(sv_2mortal(newSViv(action))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_disk_change_callback(virConnectPtr con, virDomainPtr dom, const char *oldSrcPath, const char *newSrcPath, const char *devAlias, 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(newSVpv(oldSrcPath, 0))); XPUSHs(sv_2mortal(newSVpv(newSrcPath, 0))); XPUSHs(sv_2mortal(newSVpv(devAlias, 0))); XPUSHs(sv_2mortal(newSViv(reason))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_tray_change_callback(virConnectPtr con, virDomainPtr dom, const char *devAlias, 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(newSVpv(devAlias, 0))); XPUSHs(sv_2mortal(newSViv(reason))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_pmwakeup_callback(virConnectPtr con, virDomainPtr dom, 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(reason))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_pmsuspend_callback(virConnectPtr con, virDomainPtr dom, 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(reason))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_pmsuspend_disk_callback(virConnectPtr con, virDomainPtr dom, 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(reason))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_io_error_reason_callback(virConnectPtr con, virDomainPtr dom, const char *srcPath, const char *devAlias, int action, const char *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(newSVpv(srcPath, 0))); XPUSHs(sv_2mortal(newSVpv(devAlias, 0))); XPUSHs(sv_2mortal(newSViv(action))); XPUSHs(sv_2mortal(newSVpv(reason, 0))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_graphics_callback(virConnectPtr con, virDomainPtr dom, int phase, virDomainEventGraphicsAddressPtr local, virDomainEventGraphicsAddressPtr remote, const char *authScheme, virDomainEventGraphicsSubjectPtr subject, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *domref; HV *local_hv; HV *remote_hv; AV *subject_av; int i; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); local_hv = newHV(); (void)hv_store(local_hv, "family", 6, newSViv(local->family), 0); (void)hv_store(local_hv, "node", 4, newSVpv(local->node, 0), 0); (void)hv_store(local_hv, "service", 7, newSVpv(local->service, 0), 0); remote_hv = newHV(); (void)hv_store(remote_hv, "family", 6, newSViv(remote->family), 0); (void)hv_store(remote_hv, "node", 4, newSVpv(remote->node, 0), 0); (void)hv_store(remote_hv, "service", 7, newSVpv(remote->service, 0), 0); subject_av = newAV(); for (i = 0 ; i < subject->nidentity ; i++) { HV *identity = newHV(); (void)hv_store(identity, "type", 4, newSVpv(subject->identities[i].type, 0), 0); (void)hv_store(identity, "name", 4, newSVpv(subject->identities[i].name, 0), 0); av_push(subject_av, newRV_noinc((SV *)identity)); } 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(phase))); XPUSHs(newRV_noinc((SV*)local_hv)); XPUSHs(newRV_noinc((SV*)remote_hv)); XPUSHs(sv_2mortal(newSVpv(authScheme, 0))); XPUSHs(newRV_noinc((SV*)subject_av)); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_block_job_callback(virConnectPtr con, virDomainPtr dom, const char *path, int type, int status, 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(newSVpv(path, 0))); XPUSHs(sv_2mortal(newSViv(type))); XPUSHs(sv_2mortal(newSViv(status))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_balloonchange_callback(virConnectPtr con, virDomainPtr dom, unsigned long long actual, 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(virt_newSVull(actual))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_device_generic_callback(virConnectPtr con, virDomainPtr dom, const char *devAlias, 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(newSVpv(devAlias, 0))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } 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; SvREFCNT_dec(*self); return 0; } 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; SvREFCNT_dec(*self); return 0; } static int _domain_event_migration_iteration_callback(virConnectPtr con, virDomainPtr dom, int iteration, 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(iteration))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_job_completed_callback(virConnectPtr con, virDomainPtr dom, virTypedParameterPtr params, int 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; SvREFCNT_dec(*self); return 0; } 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; SvREFCNT_dec(*self); return 0; } static int _domain_event_block_threshold_callback(virConnectPtr con, virDomainPtr dom, const char *dev, const char *path, unsigned long long threshold, unsigned long long excess, 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(newSVpv(dev, 0))); XPUSHs(sv_2mortal(newSVpv(path, 0))); XPUSHs(sv_2mortal(newSViv(threshold))); XPUSHs(sv_2mortal(newSViv(excess))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_memory_failure_callback(virConnectPtr con, virDomainPtr dom, int recipient, int action, unsigned int flags, 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(recipient))); XPUSHs(sv_2mortal(newSViv(action))); XPUSHs(sv_2mortal(newSViv(flags))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _domain_event_memory_device_size_change_callback(virConnectPtr con, virDomainPtr dom, const char *alias, unsigned long long size, 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(newSVpv(alias, 0))); XPUSHs(sv_2mortal(virt_newSVull(size))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _network_event_lifecycle_callback(virConnectPtr con, virNetworkPtr net, int event, int detail, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *netref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); netref = sv_newmortal(); sv_setref_pv(netref, "Sys::Virt::Network", (void*)net); virNetworkRef(net); XPUSHs(netref); XPUSHs(sv_2mortal(newSViv(event))); XPUSHs(sv_2mortal(newSViv(detail))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _network_event_generic_callback(virConnectPtr con, virNetworkPtr net, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *netref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); netref = sv_newmortal(); sv_setref_pv(netref, "Sys::Virt::Network", (void*)net); virNetworkRef(net); XPUSHs(netref); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _storage_pool_event_generic_callback(virConnectPtr con, virStoragePoolPtr pool, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *poolref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); poolref = sv_newmortal(); sv_setref_pv(poolref, "Sys::Virt::StoragePool", (void*)pool); virStoragePoolRef(pool); XPUSHs(poolref); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _storage_pool_event_lifecycle_callback(virConnectPtr con, virStoragePoolPtr pool, int event, int detail, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *poolref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); poolref = sv_newmortal(); sv_setref_pv(poolref, "Sys::Virt::StoragePool", (void*)pool); virStoragePoolRef(pool); XPUSHs(poolref); XPUSHs(sv_2mortal(newSViv(event))); XPUSHs(sv_2mortal(newSViv(detail))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _node_device_event_generic_callback(virConnectPtr con, virNodeDevicePtr dev, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *devref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); devref = sv_newmortal(); sv_setref_pv(devref, "Sys::Virt::NodeDevice", (void*)dev); virNodeDeviceRef(dev); XPUSHs(devref); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _node_device_event_lifecycle_callback(virConnectPtr con, virNodeDevicePtr dev, int event, int detail, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *devref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); devref = sv_newmortal(); sv_setref_pv(devref, "Sys::Virt::NodeDevice", (void*)dev); virNodeDeviceRef(dev); XPUSHs(devref); XPUSHs(sv_2mortal(newSViv(event))); XPUSHs(sv_2mortal(newSViv(detail))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _secret_event_lifecycle_callback(virConnectPtr con, virSecretPtr secret, int event, int detail, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *secretref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); secretref = sv_newmortal(); sv_setref_pv(secretref, "Sys::Virt::Secret", (void*)secret); virSecretRef(secret); XPUSHs(secretref); XPUSHs(sv_2mortal(newSViv(event))); XPUSHs(sv_2mortal(newSViv(detail))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static int _secret_event_generic_callback(virConnectPtr con, virSecretPtr secret, void *opaque) { AV *data = opaque; SV **self; SV **cb; SV *secretref; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); secretref = sv_newmortal(); sv_setref_pv(secretref, "Sys::Virt::Secret", (void*)secret); virSecretRef(secret); XPUSHs(secretref); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); return 0; } static void _domain_event_free(void *opaque) { SV *sv = opaque; SvREFCNT_dec(sv); } static void _network_event_free(void *opaque) { SV *sv = opaque; SvREFCNT_dec(sv); } static void _storage_pool_event_free(void *opaque) { SV *sv = opaque; SvREFCNT_dec(sv); } static void _node_device_event_free(void *opaque) { SV *sv = opaque; SvREFCNT_dec(sv); } static void _secret_event_free(void *opaque) { SV *sv = opaque; SvREFCNT_dec(sv); } static void _close_callback(virConnectPtr con, int reason, void *opaque) { AV *data = opaque; SV **self; SV **cb; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); XPUSHs(sv_2mortal(newSViv(reason))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); } static void _close_callback_free(void *opaque) { SV *sv = opaque; SvREFCNT_dec(sv); } static int _event_add_handle(int fd, int events, virEventHandleCallback cb, void *opaque, virFreeCallback ff) { SV *cbref; SV *opaqueref; SV *ffref; int ret; int watch = 0; dSP; ENTER; SAVETMPS; cbref= sv_newmortal(); opaqueref= sv_newmortal(); ffref= sv_newmortal(); sv_setref_pv(cbref, NULL, cb); sv_setref_pv(opaqueref, NULL, opaque); sv_setref_pv(ffref, NULL, ff); PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(fd))); XPUSHs(sv_2mortal(newSViv(events))); XPUSHs(cbref); XPUSHs(opaqueref); XPUSHs(ffref); PUTBACK; ret = call_pv("Sys::Virt::Event::_add_handle", G_SCALAR); SPAGAIN; if (ret == 1) watch = POPi; FREETMPS; LEAVE; if (ret != 1) return -1; return watch; } static void _event_update_handle(int watch, int events) { dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(watch))); XPUSHs(sv_2mortal(newSViv(events))); PUTBACK; call_pv("Sys::Virt::Event::_update_handle", G_DISCARD); FREETMPS; LEAVE; } static int _event_remove_handle(int watch) { dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(watch))); PUTBACK; call_pv("Sys::Virt::Event::_remove_handle", G_DISCARD); FREETMPS; LEAVE; return 0; return 0; } static int _event_add_timeout(int interval, virEventTimeoutCallback cb, void *opaque, virFreeCallback ff) { SV *cbref; SV *opaqueref; SV *ffref; int ret; int timer = 0; dSP; ENTER; SAVETMPS; cbref = sv_newmortal(); opaqueref = sv_newmortal(); ffref = sv_newmortal(); sv_setref_pv(cbref, NULL, cb); sv_setref_pv(opaqueref, NULL, opaque); sv_setref_pv(ffref, NULL, ff); PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(interval))); XPUSHs(cbref); XPUSHs(opaqueref); XPUSHs(ffref); PUTBACK; ret = call_pv("Sys::Virt::Event::_add_timeout", G_SCALAR); SPAGAIN; if (ret == 1) timer = POPi; FREETMPS; LEAVE; if (ret != 1) return -1; return timer; } static void _event_update_timeout(int timer, int interval) { dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(timer))); XPUSHs(sv_2mortal(newSViv(interval))); PUTBACK; call_pv("Sys::Virt::Event::_update_timeout", G_DISCARD); FREETMPS; LEAVE; } static int _event_remove_timeout(int timer) { dSP; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(timer))); PUTBACK; call_pv("Sys::Virt::Event::_remove_timeout", G_DISCARD); FREETMPS; LEAVE; return 0; } static int _open_auth_callback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata) { dSP; int i, ret, success = -1; AV *credlist; credlist = newAV(); ENTER; SAVETMPS; PUSHMARK(SP); for (i = 0 ; i < ncred ; i++) { HV *credrec = newHV(); (void)hv_store(credrec, "type", 4, newSViv(cred[i].type), 0); (void)hv_store(credrec, "prompt", 6, newSVpv(cred[i].prompt, 0), 0); (void)hv_store(credrec, "challenge", 9, newSVpv(cred[i].challenge, 0), 0); if (cred[i].defresult != NULL) (void)hv_store(credrec, "result", 6, newSVpv(cred[i].defresult, 0), 0); else (void)hv_fetch(credrec, "result", 6, 1); av_push(credlist, newRV_noinc((SV *)credrec)); } SvREFCNT_inc((SV*)credlist); XPUSHs(newRV_noinc((SV*)credlist)); PUTBACK; ret = call_sv((SV*)cbdata, G_SCALAR); SPAGAIN; if (ret == 1) success = POPi; for (i = 0 ; i < ncred ; i++) { SV **credsv = av_fetch(credlist, i, 0); HV *credrec = (HV*)SvRV(*credsv); SV **val = hv_fetch(credrec, "result", 6, 0); if (val && SvOK(*val)) { STRLEN len; char *result = SvPV(*val, len); if (!(cred[i].result = malloc(len+1))) abort(); memcpy(cred[i].result, result, len+1); cred[i].resultlen = (unsigned int)len; } else { cred[i].resultlen = 0; cred[i].result = NULL; } } FREETMPS; LEAVE; return success; } static void _event_handle_helper(int watch, int fd, int events, void *opaque) { SV *cb = opaque; dSP; SvREFCNT_inc(cb); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(watch))); XPUSHs(sv_2mortal(newSViv(fd))); XPUSHs(sv_2mortal(newSViv(events))); PUTBACK; call_sv(cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(cb); } static void _event_timeout_helper(int timer, void *opaque) { SV *cb = opaque; dSP; SvREFCNT_inc(cb); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(timer))); PUTBACK; call_sv(cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(cb); } static void _event_cb_free(void *opaque) { SV *data = opaque; SvREFCNT_dec(data); } static void _stream_event_callback(virStreamPtr st, int events, void *opaque) { AV *data = opaque; SV **self; SV **cb; dSP; self = av_fetch(data, 0, 0); cb = av_fetch(data, 1, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); XPUSHs(sv_2mortal(newSViv(events))); PUTBACK; call_sv(*cb, G_DISCARD); FREETMPS; LEAVE; SvREFCNT_dec(*self); } static void _stream_event_free(void *opaque) { AV *data = opaque; SvREFCNT_dec(data); } static int _stream_send_all_source(virStreamPtr st, char *data, size_t nbytes, void *opaque) { AV *av = opaque; SV **self; SV **handler; SV *datasv; int rv; int ret; dSP; self = av_fetch(av, 0, 0); handler = av_fetch(av, 1, 0); datasv = newSVpv("", 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); XPUSHs(datasv); XPUSHs(sv_2mortal(newSViv(nbytes))); PUTBACK; rv = call_sv((SV*)*handler, G_SCALAR); SPAGAIN; if (rv == 1) { ret = POPi; } else { ret = -1; } if (ret > 0) { const char *newdata = SvPV_nolen(datasv); if (ret > nbytes) ret = nbytes; memcpy(data, newdata, nbytes); } FREETMPS; LEAVE; SvREFCNT_dec(*self); SvREFCNT_dec(datasv); return ret; } static int _stream_sparse_send_all_hole_handler(virStreamPtr st, int *inData, long long *length, void *opaque) { AV *av = opaque; SV **self; SV **hole_handler; SV *inDataSV; SV *lengthSV; int count; int ret; dSP; self = av_fetch(av, 0, 0); hole_handler = av_fetch(av, 2, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); PUTBACK; count = call_sv((SV*)*hole_handler, G_ARRAY); SPAGAIN; if (count == 2) { /* @hole_handler returns (in_data, length), but on a stack. * Therefore the order is reversed. */ lengthSV = POPs; inDataSV = POPs; *inData = virt_SvIVll(inDataSV); *length = virt_SvIVll(lengthSV); ret = 0; } else { ret = -1; } PUTBACK; FREETMPS; LEAVE; SvREFCNT_dec(*self); return ret; } static int _stream_sparse_send_all_skip_handler(virStreamPtr st, long long length, void *opaque) { AV *av = opaque; SV **self; SV **skip_handler; int rv; int ret; dSP; self = av_fetch(av, 0, 0); skip_handler = av_fetch(av, 3, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); XPUSHs(sv_2mortal(virt_newSVll(length))); PUTBACK; rv = call_sv((SV*)*skip_handler, G_SCALAR); SPAGAIN; if (rv == 1) { ret = POPi; } else { ret = -1; } PUTBACK; FREETMPS; LEAVE; SvREFCNT_dec(*self); return ret; } static int _stream_recv_all_sink(virStreamPtr st, const char *data, size_t nbytes, void *opaque) { AV *av = opaque; SV **self; SV **handler; SV *datasv; int rv; int ret; dSP; self = av_fetch(av, 0, 0); handler = av_fetch(av, 1, 0); datasv = newSVpv(data, nbytes); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); XPUSHs(datasv); XPUSHs(sv_2mortal(newSViv(nbytes))); PUTBACK; rv = call_sv((SV*)*handler, G_SCALAR); SPAGAIN; if (rv == 1) { ret = POPi; } else { ret = -1; } FREETMPS; LEAVE; SvREFCNT_dec(*self); SvREFCNT_dec(datasv); return ret; } static int _stream_sparse_recv_hole_handler(virStreamPtr st, long long offset, void *opaque) { AV *av = opaque; SV **self; SV **hole_handler; int rv; int ret; dSP; self = av_fetch(av, 0, 0); hole_handler = av_fetch(av, 2, 0); SvREFCNT_inc(*self); ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(*self); XPUSHs(sv_2mortal(virt_newSVll(offset))); PUTBACK; rv = call_sv((SV*)*hole_handler, G_SCALAR); SPAGAIN; if (rv == 1) { ret = POPi; } else { ret = -1; } FREETMPS; LEAVE; SvREFCNT_dec(*self); return ret; } MODULE = Sys::Virt PACKAGE = Sys::Virt PROTOTYPES: ENABLE virConnectPtr _open(name, flags) SV *name; unsigned int flags; PREINIT: const char *uri = NULL; CODE: if (SvOK(name)) uri = SvPV_nolen(name); if (!(RETVAL = virConnectOpenAuth(uri, NULL, flags))) _croak_error(); OUTPUT: RETVAL virConnectPtr _open_auth(name, creds, cb, flags) SV *name; SV *creds; SV *cb; unsigned int flags; PREINIT: AV *credlist; virConnectAuth auth; int i; const char *uri = NULL; CODE: if (SvOK(name)) uri = SvPV_nolen(name); if (SvOK(cb) && SvOK(creds)) { memset(&auth, 0, sizeof auth); credlist = (AV*)SvRV(creds); auth.ncredtype = av_len(credlist) + 1; Newx(auth.credtype, auth.ncredtype, int); for (i = 0 ; i < auth.ncredtype ; i++) { SV **type = av_fetch(credlist, i, 0); auth.credtype[i] = SvIV(*type); } auth.cb = _open_auth_callback; auth.cbdata = cb; RETVAL = virConnectOpenAuth(uri, &auth, flags); Safefree(auth.credtype); } else { RETVAL = virConnectOpenAuth(uri, virConnectAuthPtrDefault, flags); } if (!RETVAL) _croak_error(); OUTPUT: RETVAL void restore_domain(con, from, dxmlsv=&PL_sv_undef, flags=0) virConnectPtr con; const char *from; SV *dxmlsv; unsigned int flags; PREINIT: const char *dxml = NULL; PPCODE: if (SvOK(dxmlsv)) dxml = SvPV_nolen(dxmlsv); if (dxml || flags) { if (virDomainRestoreFlags(con, from, dxml, flags) < 0) _croak_error(); } else { if (virDomainRestore(con, from) < 0) _croak_error(); } SV * get_save_image_xml_description(con, file, flags=0) virConnectPtr con; const char *file; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virDomainSaveImageGetXMLDesc(con, file, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void define_save_image_xml(con, file, xml, flags=0) virConnectPtr con; const char *file; const char *xml; unsigned int flags; PPCODE: if (virDomainSaveImageDefineXML(con, file, xml, flags) < 0) _croak_error(); unsigned long _get_library_version(void) PREINIT: unsigned long version; CODE: if (virGetVersion(&version, NULL, NULL) < 0) _croak_error(); RETVAL = version; OUTPUT: RETVAL unsigned long _get_conn_version(con) virConnectPtr con; PREINIT: unsigned long version; CODE: if (virConnectGetVersion(con, &version) < 0) _croak_error(); RETVAL = version; OUTPUT: RETVAL unsigned long _get_conn_library_version(con) virConnectPtr con; PREINIT: unsigned long version; CODE: if (virConnectGetLibVersion(con, &version) < 0) _croak_error(); RETVAL = version; OUTPUT: RETVAL int is_encrypted(conn) virConnectPtr conn; CODE: if ((RETVAL = virConnectIsEncrypted(conn)) < 0) _croak_error(); OUTPUT: RETVAL int is_secure(conn) virConnectPtr conn; CODE: if ((RETVAL = virConnectIsSecure(conn)) < 0) _croak_error(); OUTPUT: RETVAL int is_alive(conn) virConnectPtr conn; CODE: if ((RETVAL = virConnectIsAlive(conn)) < 0) _croak_error(); OUTPUT: RETVAL void set_keep_alive(conn, interval, count) virConnectPtr conn; int interval; unsigned int count; PPCODE: if (virConnectSetKeepAlive(conn, interval, count) < 0) _croak_error(); const char * get_type(con) virConnectPtr con; CODE: RETVAL = virConnectGetType(con); OUTPUT: RETVAL char * get_uri(con) virConnectPtr con; CODE: RETVAL = virConnectGetURI(con); OUTPUT: RETVAL char * get_sysinfo(con, flags=0) virConnectPtr con; unsigned int flags; CODE: RETVAL = virConnectGetSysinfo(con, flags); OUTPUT: RETVAL HV * get_node_info(con) virConnectPtr con; PREINIT: virNodeInfo info; CODE: if (virNodeGetInfo(con, &info) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "model", 5, newSVpv(info.model, 0), 0); (void)hv_store (RETVAL, "memory", 6, newSViv(info.memory), 0); (void)hv_store (RETVAL, "cpus", 4, newSViv(info.cpus), 0); (void)hv_store (RETVAL, "mhz", 3, newSViv(info.mhz), 0); (void)hv_store (RETVAL, "nodes", 5, newSViv(info.nodes), 0); (void)hv_store (RETVAL, "sockets", 7, newSViv(info.sockets), 0); (void)hv_store (RETVAL, "cores", 5, newSViv(info.cores), 0); (void)hv_store (RETVAL, "threads", 7, newSViv(info.threads), 0); OUTPUT: RETVAL HV * get_node_security_model(con) virConnectPtr con; PREINIT: virSecurityModel secmodel; CODE: if (virNodeGetSecurityModel(con, &secmodel) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "model", 5, newSVpv(secmodel.model, 0), 0); (void)hv_store (RETVAL, "doi", 3, newSVpv(secmodel.doi, 0), 0); OUTPUT: RETVAL HV * get_node_sev_info(conn, flags=0) virConnectPtr conn; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; CODE: if (virNodeGetSEVInfo(conn, ¶ms, &nparams, flags) < 0) { _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); virTypedParamsFree(params, nparams); OUTPUT: RETVAL void get_node_cpu_map(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: unsigned char *cpumaps; unsigned int online; int ncpus; PPCODE: if ((ncpus = virNodeGetCPUMap(con, &cpumaps, &online, flags)) < 0) _croak_error(); EXTEND(SP, 3); PUSHs(sv_2mortal(newSViv(ncpus))); PUSHs(sv_2mortal(newSVpvn((char*)cpumaps, VIR_CPU_MAPLEN(ncpus)))); PUSHs(sv_2mortal(newSViv(online))); free(cpumaps); SV * get_node_free_memory(con) virConnectPtr con; PREINIT: unsigned long long mem; CODE: if ((mem = virNodeGetFreeMemory(con)) == 0) _croak_error(); RETVAL = virt_newSVull(mem); OUTPUT: RETVAL void get_node_cells_free_memory(con, start, end) virConnectPtr con; int start; int end; PREINIT: unsigned long long *mem; int i, num, ncells; PPCODE: ncells = (end - start) + 1; Newx(mem, ncells, unsigned long long); if ((num = virNodeGetCellsFreeMemory(con, mem, start, ncells)) < 0) { Safefree(mem); _croak_error(); } EXTEND(SP, num); for (i = 0 ; i < num ; i++) { SV *val = newSViv(mem[i]); PUSHs(sv_2mortal(val)); } Safefree(mem); void get_node_free_pages(con, pagesizes, start, end, flags=0) virConnectPtr con; SV *pagesizes; int start; int end; unsigned int flags; PREINIT: AV *pagesizeslist; unsigned int *pages; unsigned int npages; unsigned long long *counts; int ncells; int i, j; PPCODE: ncells = (end - start) + 1; pagesizeslist = (AV *)SvRV(pagesizes); npages = av_len(pagesizeslist) + 1; Newx(pages, npages, unsigned int); for (i = 0; i < npages; i++) { SV **pagesize = av_fetch(pagesizeslist, i, 0); pages[i] = SvIV(*pagesize); } Newx(counts, npages * ncells, unsigned long long); if (virNodeGetFreePages(con, npages, pages, start, ncells, counts, flags) < 0) { Safefree(counts); Safefree(pages); _croak_error(); } EXTEND(SP, ncells); for (i = 0; i < ncells; i++) { HV *rec = newHV(); HV *prec = newHV(); (void)hv_store(rec, "cell", 4, newSViv(start + i), 0); (void)hv_store(rec, "pages", 5, newRV_noinc((SV *)prec), 0); for (j = 0; j < npages; j++) { (void)hv_store_ent(prec, newSViv(pages[j]), virt_newSVull(counts[(i * npages) + j]), 0); } PUSHs(newRV_noinc((SV *)rec)); } Safefree(counts); Safefree(pages); void node_alloc_pages(con, pages, start, end, flags=0) virConnectPtr con; SV *pages; int start; int end; unsigned int flags; PREINIT: AV *pageslist; unsigned int npages; unsigned int *pagesizes; unsigned long long *pagecounts; unsigned int ncells; unsigned int i; PPCODE: ncells = (end - start) + 1; pageslist = (AV *)SvRV(pages); npages = av_len(pageslist) + 1; Newx(pagesizes, npages, unsigned int); Newx(pagecounts, npages, unsigned long long); for (i = 0; i < npages; i++) { SV **pageinforv = av_fetch(pageslist, i, 0); AV *pageinfo = (AV*)SvRV(*pageinforv); SV **pagesize = av_fetch(pageinfo, 0, 0); SV **pagecount = av_fetch(pageinfo, 1, 0); pagesizes[i] = SvIV(*pagesize); pagecounts[i] = virt_SvIVull(*pagecount); } if (virNodeAllocPages(con, npages, pagesizes, pagecounts, start, ncells, flags) < 0) { Safefree(pagesizes); Safefree(pagecounts); _croak_error(); } Safefree(pagesizes); Safefree(pagecounts); HV * get_node_cpu_stats(con, cpuNum=VIR_NODE_CPU_STATS_ALL_CPUS, flags=0) virConnectPtr con; int cpuNum; unsigned int flags; PREINIT: virNodeCPUStatsPtr params; int nparams = 0; int i; CODE: if (virNodeGetCPUStats(con, cpuNum, NULL, &nparams, flags) < 0) _croak_error(); Newx(params, nparams, virNodeCPUStats); if (virNodeGetCPUStats(con, cpuNum, params, &nparams, flags) < 0) { Safefree(params); _croak_error(); } RETVAL = (HV *)sv_2mortal((SV*)newHV()); for (i = 0 ; i < nparams ; i++) { if (strcmp(params[i].field, VIR_NODE_CPU_STATS_KERNEL) == 0) { (void)hv_store (RETVAL, "kernel", 6, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_USER) == 0) { (void)hv_store (RETVAL, "user", 4, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_IDLE) == 0) { (void)hv_store (RETVAL, "idle", 4, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_IOWAIT) == 0) { (void)hv_store (RETVAL, "iowait", 6, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_INTR) == 0) { (void)hv_store (RETVAL, "intr", 4, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_CPU_STATS_UTILIZATION) == 0) { (void)hv_store (RETVAL, "utilization", 11, virt_newSVull(params[i].value), 0); } } Safefree(params); OUTPUT: RETVAL HV * get_node_memory_stats(con, cellNum=VIR_NODE_MEMORY_STATS_ALL_CELLS, flags=0) virConnectPtr con; int cellNum; unsigned int flags; PREINIT: virNodeMemoryStatsPtr params; int nparams = 0; int i; CODE: if (virNodeGetMemoryStats(con, cellNum, NULL, &nparams, flags) < 0) _croak_error(); Newx(params, nparams, virNodeMemoryStats); if (virNodeGetMemoryStats(con, cellNum, params, &nparams, flags) < 0) { Safefree(params); _croak_error(); } RETVAL = (HV *)sv_2mortal((SV*)newHV()); for (i = 0 ; i < nparams ; i++) { if (strcmp(params[i].field, VIR_NODE_MEMORY_STATS_TOTAL) == 0) { (void)hv_store (RETVAL, "total", 5, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_MEMORY_STATS_FREE) == 0) { (void)hv_store (RETVAL, "free", 4, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_MEMORY_STATS_BUFFERS) == 0) { (void)hv_store (RETVAL, "buffers", 7, virt_newSVull(params[i].value), 0); } else if (strcmp(params[i].field, VIR_NODE_MEMORY_STATS_CACHED) == 0) { (void)hv_store (RETVAL, "cached", 6, virt_newSVull(params[i].value), 0); } } Safefree(params); OUTPUT: RETVAL HV * get_node_memory_parameters(conn, flags=0) virConnectPtr conn; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 0; if (virNodeGetMemoryParameters(conn, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virNodeGetMemoryParameters(conn, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_node_memory_parameters(conn, newparams, flags=0) virConnectPtr conn; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 0; if (virNodeGetMemoryParameters(conn, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virNodeGetMemoryParameters(conn, params, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virNodeSetMemoryParameters(conn, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); void set_identity(conn, newident, flags=0) virConnectPtr conn; HV *newident; unsigned int flags; PREINIT: virTypedParameterPtr ident; int nident; PPCODE: nident = 9; Newx(ident, nident, virTypedParameter); strncpy(ident[0].field, VIR_CONNECT_IDENTITY_USER_NAME, VIR_TYPED_PARAM_FIELD_LENGTH); ident[0].type = VIR_TYPED_PARAM_STRING; strncpy(ident[1].field, VIR_CONNECT_IDENTITY_UNIX_USER_ID, VIR_TYPED_PARAM_FIELD_LENGTH); ident[1].type = VIR_TYPED_PARAM_ULLONG; strncpy(ident[2].field, VIR_CONNECT_IDENTITY_GROUP_NAME, VIR_TYPED_PARAM_FIELD_LENGTH); ident[2].type = VIR_TYPED_PARAM_STRING; strncpy(ident[3].field, VIR_CONNECT_IDENTITY_UNIX_GROUP_ID, VIR_TYPED_PARAM_FIELD_LENGTH); ident[3].type = VIR_TYPED_PARAM_ULLONG; strncpy(ident[4].field, VIR_CONNECT_IDENTITY_PROCESS_ID, VIR_TYPED_PARAM_FIELD_LENGTH); ident[4].type = VIR_TYPED_PARAM_LLONG; strncpy(ident[5].field, VIR_CONNECT_IDENTITY_PROCESS_TIME, VIR_TYPED_PARAM_FIELD_LENGTH); ident[5].type = VIR_TYPED_PARAM_ULLONG; strncpy(ident[6].field, VIR_CONNECT_IDENTITY_SASL_USER_NAME, VIR_TYPED_PARAM_FIELD_LENGTH); ident[6].type = VIR_TYPED_PARAM_STRING; strncpy(ident[7].field, VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME, VIR_TYPED_PARAM_FIELD_LENGTH); ident[7].type = VIR_TYPED_PARAM_STRING; strncpy(ident[8].field, VIR_CONNECT_IDENTITY_SELINUX_CONTEXT, VIR_TYPED_PARAM_FIELD_LENGTH); ident[8].type = VIR_TYPED_PARAM_STRING; nident = vir_typed_param_from_hv(newident, ident, nident); if (virConnectSetIdentity(conn, ident, nident, flags) < 0) { vir_typed_param_safe_free(ident, nident); _croak_error(); } vir_typed_param_safe_free(ident, nident); void node_suspend_for_duration(conn, target, duration, flags=0) virConnectPtr conn; unsigned int target; SV *duration; unsigned int flags; PPCODE: if (virNodeSuspendForDuration(conn, target, virt_SvIVull(duration), flags) < 0) _croak_error(); char * find_storage_pool_sources(con, type, srcspec, flags=0) virConnectPtr con; const char *type; const char *srcspec; unsigned int flags; CODE: if ((RETVAL = virConnectFindStoragePoolSources(con, type, srcspec, flags)) == NULL) _croak_error(); OUTPUT: RETVAL SV * get_capabilities(con) virConnectPtr con; PREINIT: char *xml; CODE: if (!(xml = virConnectGetCapabilities(con))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL SV * get_domain_capabilities(con, emulatorsv, archsv, machinesv, virttypesv, flags=0) virConnectPtr con; SV *emulatorsv; SV *archsv; SV *machinesv; SV *virttypesv; unsigned int flags; PREINIT: char *emulator = NULL; char *arch = NULL; char *machine = NULL; char *virttype = NULL; char *xml; CODE: if (SvOK(emulatorsv)) emulator = SvPV_nolen(emulatorsv); if (SvOK(archsv)) arch = SvPV_nolen(archsv); if (SvOK(machinesv)) machine = SvPV_nolen(machinesv); if (SvOK(virttypesv)) virttype = SvPV_nolen(virttypesv); if (!(xml = virConnectGetDomainCapabilities(con, emulator, arch, machine, virttype, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL SV * get_storage_pool_capabilities(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virConnectGetStoragePoolCapabilities(con, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL SV * compare_cpu(con, xml, flags=0) virConnectPtr con; char *xml; unsigned int flags; PREINIT: int rc; CODE: if ((rc = virConnectCompareCPU(con, xml, flags)) < 0) _croak_error(); RETVAL = newSViv(rc); OUTPUT: RETVAL SV * compare_hypervisor_cpu(con, emulatorsv, archsv, machinesv, virttypesv, xml, flags=0) virConnectPtr con; SV *emulatorsv; SV *archsv; SV *machinesv; SV *virttypesv; char *xml; unsigned int flags; PREINIT: char *emulator = NULL; char *arch = NULL; char *machine = NULL; char *virttype = NULL; int rc; CODE: if (SvOK(emulatorsv)) emulator = SvPV_nolen(emulatorsv); if (SvOK(archsv)) arch = SvPV_nolen(archsv); if (SvOK(machinesv)) machine = SvPV_nolen(machinesv); if (SvOK(virttypesv)) virttype = SvPV_nolen(virttypesv); if ((rc = virConnectCompareHypervisorCPU(con, emulator, arch, machine, virttype, xml, flags)) < 0) _croak_error(); RETVAL = newSViv(rc); OUTPUT: RETVAL SV * baseline_cpu(con, xml, flags=0) virConnectPtr con; SV *xml; unsigned int flags; PREINIT: AV *xmllist; const char **xmlstr; int xmllen; int i; char *retxml; CODE: xmllist = (AV*)SvRV(xml); xmllen = av_len(xmllist) + 1; Newx(xmlstr, xmllen, const char *); for (i = 0 ; i < xmllen ; i++) { SV **doc = av_fetch(xmllist, i, 0); xmlstr[i] = SvPV_nolen(*doc); } if (!(retxml = virConnectBaselineCPU(con, xmlstr, xmllen, flags))) { Safefree(xmlstr); _croak_error(); } Safefree(xmlstr); RETVAL = newSVpv(retxml, 0); free(retxml); OUTPUT: RETVAL SV * baseline_hypervisor_cpu(con, emulatorsv, archsv, machinesv, virttypesv, xml, flags=0) virConnectPtr con; SV *emulatorsv; SV *archsv; SV *machinesv; SV *virttypesv; SV *xml; unsigned int flags; PREINIT: char *emulator = NULL; char *arch = NULL; char *machine = NULL; char *virttype = NULL; AV *xmllist; const char **xmlstr; int xmllen; int i; char *retxml; CODE: if (SvOK(emulatorsv)) emulator = SvPV_nolen(emulatorsv); if (SvOK(archsv)) arch = SvPV_nolen(archsv); if (SvOK(machinesv)) machine = SvPV_nolen(machinesv); if (SvOK(virttypesv)) virttype = SvPV_nolen(virttypesv); xmllist = (AV*)SvRV(xml); xmllen = av_len(xmllist) + 1; Newx(xmlstr, xmllen, const char *); for (i = 0 ; i < xmllen ; i++) { SV **doc = av_fetch(xmllist, i, 0); xmlstr[i] = SvPV_nolen(*doc); } if (!(retxml = virConnectBaselineHypervisorCPU(con, emulator, arch, machine, virttype, xmlstr, xmllen, flags))) { Safefree(xmlstr); _croak_error(); } Safefree(xmlstr); RETVAL = newSVpv(retxml, 0); free(retxml); OUTPUT: RETVAL void get_cpu_model_names(con, arch, flags=0) virConnectPtr con; char *arch; unsigned int flags; PREINIT: int nnames; int i; char **names = NULL; PPCODE: if ((nnames = virConnectGetCPUModelNames(con, arch, &names, flags)) < 0) _croak_error(); EXTEND(SP, nnames); for (i = 0 ; i < nnames ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } free(names); int get_max_vcpus(con, type) virConnectPtr con; char *type; CODE: if ((RETVAL = virConnectGetMaxVcpus(con, type)) < 0) _croak_error(); OUTPUT: RETVAL SV * get_hostname(con) virConnectPtr con; PREINIT: char *host; CODE: if (!(host = virConnectGetHostname(con))) _croak_error(); RETVAL = newSVpv(host, 0); free(host); OUTPUT: RETVAL int num_of_domains(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfDomains(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_domain_ids(con, maxids) virConnectPtr con; int maxids PREINIT: int *ids; int i, nid; PPCODE: Newx(ids, maxids, int); if ((nid = virConnectListDomains(con, ids, maxids)) < 0) { Safefree(ids); _croak_error(); } EXTEND(SP, nid); for (i = 0 ; i < nid ; i++) { PUSHs(sv_2mortal(newSViv(ids[i]))); } Safefree(ids); int num_of_defined_domains(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfDefinedDomains(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_defined_domain_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int ndom; int i; PPCODE: Newx(names, maxnames, char *); if ((ndom = virConnectListDefinedDomains(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, ndom); for (i = 0 ; i < ndom ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); void list_all_domains(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virDomainPtr *doms; int i, ndom; SV *domrv; PPCODE: if ((ndom = virConnectListAllDomains(con, &doms, flags)) < 0) _croak_error(); EXTEND(SP, ndom); for (i = 0 ; i < ndom ; i++) { domrv = sv_newmortal(); sv_setref_pv(domrv, "Sys::Virt::Domain", doms[i]); PUSHs(domrv); } free(doms); void list_all_interfaces(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virInterfacePtr *ifaces; int i, niface; SV *ifacerv; PPCODE: if ((niface = virConnectListAllInterfaces(con, &ifaces, flags)) < 0) _croak_error(); EXTEND(SP, niface); for (i = 0 ; i < niface ; i++) { ifacerv = sv_newmortal(); sv_setref_pv(ifacerv, "Sys::Virt::Interface", ifaces[i]); PUSHs(ifacerv); } free(ifaces); void list_all_nwfilters(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virNWFilterPtr *nwfilters; int i, nnwfilter; SV *nwfilterrv; PPCODE: if ((nnwfilter = virConnectListAllNWFilters(con, &nwfilters, flags)) < 0) _croak_error(); EXTEND(SP, nnwfilter); for (i = 0 ; i < nnwfilter ; i++) { nwfilterrv = sv_newmortal(); sv_setref_pv(nwfilterrv, "Sys::Virt::NWFilter", nwfilters[i]); PUSHs(nwfilterrv); } free(nwfilters); void list_all_nwfilter_bindings(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virNWFilterBindingPtr *bindings; int i, nbinding; SV *bindingrv; PPCODE: if ((nbinding = virConnectListAllNWFilterBindings(con, &bindings, flags)) < 0) _croak_error(); EXTEND(SP, nbinding); for (i = 0 ; i < nbinding ; i++) { bindingrv = sv_newmortal(); sv_setref_pv(bindingrv, "Sys::Virt::NWFilterBinding", bindings[i]); PUSHs(bindingrv); } free(bindings); void list_all_networks(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virNetworkPtr *nets; int i, nnet; SV *netrv; PPCODE: if ((nnet = virConnectListAllNetworks(con, &nets, flags)) < 0) _croak_error(); EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { netrv = sv_newmortal(); sv_setref_pv(netrv, "Sys::Virt::Network", nets[i]); PUSHs(netrv); } free(nets); void list_all_node_devices(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virNodeDevicePtr *devs; int i, ndev; SV *devrv; PPCODE: if ((ndev = virConnectListAllNodeDevices(con, &devs, flags)) < 0) _croak_error(); EXTEND(SP, ndev); for (i = 0 ; i < ndev ; i++) { devrv = sv_newmortal(); sv_setref_pv(devrv, "Sys::Virt::NodeDevice", devs[i]); PUSHs(devrv); } free(devs); void list_all_secrets(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virSecretPtr *secrets; int i, nsecret; SV *secretrv; PPCODE: if ((nsecret = virConnectListAllSecrets(con, &secrets, flags)) < 0) _croak_error(); EXTEND(SP, nsecret); for (i = 0 ; i < nsecret ; i++) { secretrv = sv_newmortal(); sv_setref_pv(secretrv, "Sys::Virt::Secret", secrets[i]); PUSHs(secretrv); } free(secrets); void list_all_storage_pools(con, flags=0) virConnectPtr con; unsigned int flags; PREINIT: virStoragePoolPtr *pools; int i, npool; SV *poolrv; PPCODE: if ((npool = virConnectListAllStoragePools(con, &pools, flags)) < 0) _croak_error(); EXTEND(SP, npool); for (i = 0 ; i < npool ; i++) { poolrv = sv_newmortal(); sv_setref_pv(poolrv, "Sys::Virt::StoragePool", pools[i]); PUSHs(poolrv); } free(pools); int num_of_networks(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfNetworks(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_network_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int i, nnet; PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListNetworks(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_defined_networks(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfDefinedNetworks(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_defined_network_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int ndom; int i; PPCODE: Newx(names, maxnames, char *); if ((ndom = virConnectListDefinedNetworks(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, ndom); for (i = 0 ; i < ndom ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_storage_pools(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfStoragePools(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_storage_pool_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int i, nnet; PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListStoragePools(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_defined_storage_pools(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfDefinedStoragePools(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_defined_storage_pool_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int ndom; int i; PPCODE: Newx(names, maxnames, char *); if ((ndom = virConnectListDefinedStoragePools(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, ndom); for (i = 0 ; i < ndom ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_node_devices(con, cap, flags=0) virConnectPtr con; SV *cap; int flags PREINIT: const char *capname = NULL; CODE: if (SvOK(cap)) capname = SvPV_nolen(cap); if ((RETVAL = virNodeNumOfDevices(con, capname, flags)) < 0) _croak_error(); OUTPUT: RETVAL void list_node_device_names(con, cap, maxnames, flags=0) virConnectPtr con; SV *cap; int maxnames; int flags; PREINIT: char **names; int i, nnet; const char *capname = NULL; PPCODE: if (SvOK(cap)) capname = SvPV_nolen(cap); Newx(names, maxnames, char *); if ((nnet = virNodeListDevices(con, capname, names, maxnames, flags)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_interfaces(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfInterfaces(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_interface_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int i, nnet; PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListInterfaces(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_defined_interfaces(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfDefinedInterfaces(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_defined_interface_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int i, nnet; PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListDefinedInterfaces(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); int num_of_secrets(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfSecrets(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_secret_uuids(con, maxuuids) virConnectPtr con; int maxuuids; PREINIT: char **uuids; int i, nsecret; PPCODE: Newx(uuids, maxuuids, char *); if ((nsecret = virConnectListSecrets(con, uuids, maxuuids)) < 0) { Safefree(uuids); _croak_error(); } EXTEND(SP, nsecret); for (i = 0 ; i < nsecret ; i++) { PUSHs(sv_2mortal(newSVpv(uuids[i], 0))); free(uuids[i]); } Safefree(uuids); int num_of_nwfilters(con) virConnectPtr con; CODE: if ((RETVAL = virConnectNumOfNWFilters(con)) < 0) _croak_error(); OUTPUT: RETVAL void list_nwfilter_names(con, maxnames) virConnectPtr con; int maxnames; PREINIT: char **names; int i, nnet; PPCODE: Newx(names, maxnames, char *); if ((nnet = virConnectListNWFilters(con, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); void get_all_domain_stats(con, stats, doms_sv=&PL_sv_undef, flags=0) virConnectPtr con; unsigned int stats; SV *doms_sv; unsigned int flags; PREINIT: AV *doms_av; int ndoms; int nstats; int i; virDomainPtr *doms = NULL; virDomainStatsRecordPtr *statsrec = NULL; PPCODE: if (SvOK(doms_sv)) { doms_av = (AV*)SvRV(doms_sv); ndoms = av_len(doms_av) + 1; } else { ndoms = 0; } if (ndoms) { Newx(doms, ndoms + 1, virDomainPtr); for (i = 0 ; i < ndoms ; i++) { SV **dom = av_fetch(doms_av, i, 0); doms[i] = (virDomainPtr)SvIV((SV*)SvRV(*dom)); } doms[ndoms] = NULL; if ((nstats = virDomainListGetStats(doms, stats, &statsrec, flags)) < 0) { Safefree(doms); _croak_error(); } } else { doms = NULL; if ((nstats = virConnectGetAllDomainStats(con, stats, &statsrec, flags)) < 0) { Safefree(doms); _croak_error(); } } EXTEND(SP, nstats); for (i = 0 ; i < nstats ; i++) { HV *rec = newHV(); SV *dom = sv_newmortal(); HV *data = vir_typed_param_to_hv(statsrec[i]->params, statsrec[i]->nparams); sv_setref_pv(dom, "Sys::Virt::Domain", statsrec[i]->dom); virDomainRef(statsrec[i]->dom); hv_store(rec, "dom", 3, SvREFCNT_inc(dom), 0); hv_store(rec, "data", 4, newRV((SV*)data), 0); PUSHs(newRV_noinc((SV*)rec)); } virDomainStatsRecordListFree(statsrec); Safefree(doms); SV * domain_xml_from_native(con, configtype, configdata, flags=0) virConnectPtr con; const char *configtype; const char *configdata; unsigned int flags; PREINIT: char *xmldata; CODE: if (!(xmldata = virConnectDomainXMLFromNative(con, configtype, configdata, flags))) _croak_error(); RETVAL = newSVpv(xmldata, 0); free(xmldata); OUTPUT: RETVAL SV * domain_xml_to_native(con, configtype, xmldata, flags=0) virConnectPtr con; const char *configtype; const char *xmldata; unsigned int flags; PREINIT: char *configdata; CODE: if (!(configdata = virConnectDomainXMLToNative(con, configtype, xmldata, flags))) _croak_error(); RETVAL = newSVpv(configdata, 0); free(configdata); OUTPUT: RETVAL void domain_event_register(conref, cb) SV* conref; SV* cb; PREINIT: AV *opaque; virConnectPtr con; PPCODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if (virConnectDomainEventRegister(con, _domain_event_lifecycle_callback, opaque, _domain_event_free) < 0) _croak_error(); void domain_event_deregister(con) virConnectPtr con; PPCODE: virConnectDomainEventDeregister(con, _domain_event_lifecycle_callback); int domain_event_register_any(conref, domref, eventID, cb) SV* conref; SV* domref; int eventID; SV* cb; PREINIT: AV *opaque; virConnectPtr con; virDomainPtr dom; virConnectDomainEventGenericCallback callback; CODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); if (SvROK(domref)) { dom = (virDomainPtr)SvIV((SV*)SvRV(domref)); } else { dom = NULL; } switch (eventID) { case VIR_DOMAIN_EVENT_ID_LIFECYCLE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_lifecycle_callback); break; case VIR_DOMAIN_EVENT_ID_REBOOT: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback); break; case VIR_DOMAIN_EVENT_ID_RTC_CHANGE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_rtcchange_callback); break; case VIR_DOMAIN_EVENT_ID_WATCHDOG: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_watchdog_callback); break; case VIR_DOMAIN_EVENT_ID_IO_ERROR: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_io_error_callback); break; case VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_io_error_reason_callback); break; case VIR_DOMAIN_EVENT_ID_GRAPHICS: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_graphics_callback); break; case VIR_DOMAIN_EVENT_ID_CONTROL_ERROR: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback); break; case VIR_DOMAIN_EVENT_ID_BLOCK_JOB: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_block_job_callback); break; case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_block_job_callback); break; case VIR_DOMAIN_EVENT_ID_DISK_CHANGE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_disk_change_callback); break; case VIR_DOMAIN_EVENT_ID_TRAY_CHANGE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_tray_change_callback); break; case VIR_DOMAIN_EVENT_ID_PMSUSPEND: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_pmsuspend_callback); break; case VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_pmsuspend_disk_callback); break; case VIR_DOMAIN_EVENT_ID_PMWAKEUP: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_pmwakeup_callback); break; case VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_balloonchange_callback); break; case VIR_DOMAIN_EVENT_ID_DEVICE_ADDED: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_device_generic_callback); break; case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_device_generic_callback); break; 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; case VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_migration_iteration_callback); break; case VIR_DOMAIN_EVENT_ID_JOB_COMPLETED: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_job_completed_callback); break; 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; case VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_block_threshold_callback); break; case VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_memory_failure_callback); break; case VIR_DOMAIN_EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_memory_device_size_change_callback); break; default: callback = VIR_DOMAIN_EVENT_CALLBACK(_domain_event_generic_callback); break; } opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if ((RETVAL = virConnectDomainEventRegisterAny(con, dom, eventID, callback, opaque, _domain_event_free)) < 0) _croak_error(); OUTPUT: RETVAL void domain_event_deregister_any(con, callbackID) virConnectPtr con; int callbackID; PPCODE: virConnectDomainEventDeregisterAny(con, callbackID); int network_event_register_any(conref, netref, eventID, cb) SV* conref; SV* netref; int eventID; SV* cb; PREINIT: AV *opaque; virConnectPtr con; virNetworkPtr net; virConnectNetworkEventGenericCallback callback; CODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); if (SvROK(netref)) { net = (virNetworkPtr)SvIV((SV*)SvRV(netref)); } else { net = NULL; } switch (eventID) { case VIR_NETWORK_EVENT_ID_LIFECYCLE: callback = VIR_NETWORK_EVENT_CALLBACK(_network_event_lifecycle_callback); break; default: callback = VIR_NETWORK_EVENT_CALLBACK(_network_event_generic_callback); break; } opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if ((RETVAL = virConnectNetworkEventRegisterAny(con, net, eventID, callback, opaque, _network_event_free)) < 0) _croak_error(); OUTPUT: RETVAL void network_event_deregister_any(con, callbackID) virConnectPtr con; int callbackID; PPCODE: virConnectNetworkEventDeregisterAny(con, callbackID); int storage_pool_event_register_any(conref, poolref, eventID, cb) SV* conref; SV* poolref; int eventID; SV* cb; PREINIT: AV *opaque; virConnectPtr con; virStoragePoolPtr pool; virConnectStoragePoolEventGenericCallback callback; CODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); if (SvROK(poolref)) { pool = (virStoragePoolPtr)SvIV((SV*)SvRV(poolref)); } else { pool = NULL; } switch (eventID) { case VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE: callback = VIR_STORAGE_POOL_EVENT_CALLBACK(_storage_pool_event_lifecycle_callback); break; case VIR_STORAGE_POOL_EVENT_ID_REFRESH: callback = VIR_STORAGE_POOL_EVENT_CALLBACK(_storage_pool_event_generic_callback); break; default: callback = VIR_STORAGE_POOL_EVENT_CALLBACK(_storage_pool_event_generic_callback); break; } opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if ((RETVAL = virConnectStoragePoolEventRegisterAny(con, pool, eventID, callback, opaque, _storage_pool_event_free)) < 0) _croak_error(); OUTPUT: RETVAL void storage_pool_event_deregister_any(con, callbackID) virConnectPtr con; int callbackID; PPCODE: virConnectStoragePoolEventDeregisterAny(con, callbackID); int node_device_event_register_any(conref, devref, eventID, cb) SV* conref; SV* devref; int eventID; SV* cb; PREINIT: AV *opaque; virConnectPtr con; virNodeDevicePtr dev; virConnectNodeDeviceEventGenericCallback callback; CODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); if (SvROK(devref)) { dev = (virNodeDevicePtr)SvIV((SV*)SvRV(devref)); } else { dev = NULL; } switch (eventID) { case VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE: callback = VIR_NODE_DEVICE_EVENT_CALLBACK(_node_device_event_lifecycle_callback); break; case VIR_NODE_DEVICE_EVENT_ID_UPDATE: callback = VIR_NODE_DEVICE_EVENT_CALLBACK(_node_device_event_generic_callback); break; default: callback = VIR_NODE_DEVICE_EVENT_CALLBACK(_node_device_event_generic_callback); break; } opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if ((RETVAL = virConnectNodeDeviceEventRegisterAny(con, dev, eventID, callback, opaque, _node_device_event_free)) < 0) _croak_error(); OUTPUT: RETVAL void node_device_event_deregister_any(con, callbackID) virConnectPtr con; int callbackID; PPCODE: virConnectNodeDeviceEventDeregisterAny(con, callbackID); int secret_event_register_any(conref, secretref, eventID, cb) SV* conref; SV* secretref; int eventID; SV* cb; PREINIT: AV *opaque; virConnectPtr con; virSecretPtr secret; virConnectSecretEventGenericCallback callback; CODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); if (SvROK(secretref)) { secret = (virSecretPtr)SvIV((SV*)SvRV(secretref)); } else { secret = NULL; } switch (eventID) { case VIR_SECRET_EVENT_ID_LIFECYCLE: callback = VIR_SECRET_EVENT_CALLBACK(_secret_event_lifecycle_callback); break; case VIR_SECRET_EVENT_ID_VALUE_CHANGED: callback = VIR_SECRET_EVENT_CALLBACK(_secret_event_generic_callback); break; default: callback = VIR_SECRET_EVENT_CALLBACK(_secret_event_generic_callback); break; } opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if ((RETVAL = virConnectSecretEventRegisterAny(con, secret, eventID, callback, opaque, _secret_event_free)) < 0) _croak_error(); OUTPUT: RETVAL void secret_event_deregister_any(con, callbackID) virConnectPtr con; int callbackID; PPCODE: virConnectSecretEventDeregisterAny(con, callbackID); void register_close_callback(conref, cb) SV* conref; SV* cb; PREINIT: AV *opaque; virConnectPtr con; PPCODE: con = (virConnectPtr)SvIV((SV*)SvRV(conref)); opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(conref); av_push(opaque, conref); av_push(opaque, cb); if (virConnectRegisterCloseCallback(con, _close_callback, opaque, _close_callback_free) < 0) _croak_error(); void unregister_close_callback(con) virConnectPtr con; PPCODE: virConnectUnregisterCloseCallback(con, _close_callback); void interface_change_begin(conn, flags=0) virConnectPtr conn; unsigned int flags; PPCODE: if (virInterfaceChangeBegin(conn, flags) < 0) _croak_error(); void interface_change_commit(conn, flags=0) virConnectPtr conn; unsigned int flags; PPCODE: if (virInterfaceChangeCommit(conn, flags) < 0) _croak_error(); void interface_change_rollback(conn, flags=0) virConnectPtr conn; unsigned int flags; PPCODE: if (virInterfaceChangeRollback(conn, flags) < 0) _croak_error(); void DESTROY(con_rv) SV *con_rv; PREINIT: virConnectPtr con; PPCODE: con = (virConnectPtr)SvIV((SV*)SvRV(con_rv)); if (con) { virConnectClose(con); sv_setiv((SV*)SvRV(con_rv), 0); } MODULE = Sys::Virt::Domain PACKAGE = Sys::Virt::Domain virDomainPtr _create(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (flags) { if (!(RETVAL = virDomainCreateXML(con, xml, flags))) _croak_error(); } else { if (!(RETVAL = virDomainCreateLinux(con, xml, 0))) _croak_error(); } OUTPUT: RETVAL virDomainPtr _create_with_files(con, xml, fdssv, flags=0) virConnectPtr con; const char *xml; SV *fdssv; unsigned int flags; PREINIT: AV *fdsav; unsigned int nfds; int *fds; int i; CODE: if (!SvROK(fdssv)) return; fdsav = (AV*)SvRV(fdssv); nfds = av_len(fdsav) + 1; Newx(fds, nfds, int); for (i = 0 ; i < nfds ; i++) { SV **fd = av_fetch(fdsav, i, 0); fds[i] = SvIV(*fd); } if (!(RETVAL = virDomainCreateXMLWithFiles(con, xml, nfds, fds, flags))) { Safefree(fds); _croak_error(); } Safefree(fds); OUTPUT: RETVAL virDomainPtr _define_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (flags) { if (!(RETVAL = virDomainDefineXMLFlags(con, xml, flags))) _croak_error(); } else { if (!(RETVAL = virDomainDefineXML(con, xml))) _croak_error(); } OUTPUT: RETVAL virDomainPtr _lookup_by_id(con, id) virConnectPtr con; int id; CODE: if (!(RETVAL = virDomainLookupByID(con, id))) _croak_error(); OUTPUT: RETVAL virDomainPtr _lookup_by_name(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virDomainLookupByName(con, name))) _croak_error(); OUTPUT: RETVAL virDomainPtr _lookup_by_uuid(con, uuid) virConnectPtr con; const unsigned char *uuid; CODE: if (!(RETVAL = virDomainLookupByUUID(con, uuid))) _croak_error(); OUTPUT: RETVAL virDomainPtr _lookup_by_uuid_string(con, uuid) virConnectPtr con; const char *uuid; CODE: if (!(RETVAL = virDomainLookupByUUIDString(con, uuid))) _croak_error(); OUTPUT: RETVAL int get_id(dom) virDomainPtr dom; CODE: RETVAL = virDomainGetID(dom); OUTPUT: RETVAL SV * get_uuid(dom) virDomainPtr dom; PREINIT: unsigned char rawuuid[VIR_UUID_BUFLEN]; CODE: if ((virDomainGetUUID(dom, rawuuid)) < 0) _croak_error(); RETVAL = newSVpv((char*)rawuuid, sizeof(rawuuid)); OUTPUT: RETVAL SV * get_uuid_string(dom) virDomainPtr dom; PREINIT: char uuid[VIR_UUID_STRING_BUFLEN]; CODE: if ((virDomainGetUUIDString(dom, uuid)) < 0) _croak_error(); RETVAL = newSVpv(uuid, 0); OUTPUT: RETVAL const char * get_name(dom) virDomainPtr dom; CODE: if (!(RETVAL = virDomainGetName(dom))) _croak_error(); OUTPUT: RETVAL const char * get_hostname(dom, flags=0) virDomainPtr dom; unsigned int flags; CODE: if (!(RETVAL = virDomainGetHostname(dom, flags))) _croak_error(); OUTPUT: RETVAL char * get_metadata(dom, type, uri=&PL_sv_undef, flags=0) virDomainPtr dom; int type; SV *uri; unsigned int flags; PREINIT: const char *uristr = NULL; CODE: if (SvOK(uri)) uristr = SvPV_nolen(uri); if (!(RETVAL = virDomainGetMetadata(dom, type, uristr, flags))) _croak_error(); OUTPUT: RETVAL void set_metadata(dom, type, metadata=&PL_sv_undef, key=&PL_sv_undef, uri=&PL_sv_undef, flags=0) virDomainPtr dom; int type; SV *metadata; SV *key; SV *uri; unsigned int flags; PREINIT: const char *metadatastr = NULL; const char *keystr = NULL; const char *uristr = NULL; PPCODE: if (SvOK(metadata)) metadatastr = SvPV_nolen(metadata); if (SvOK(key)) keystr = SvPV_nolen(key); if (SvOK(uri)) uristr = SvPV_nolen(uri); if (virDomainSetMetadata(dom, type, metadatastr, keystr, uristr, flags) < 0) _croak_error(); int is_active(dom) virDomainPtr dom; CODE: if ((RETVAL = virDomainIsActive(dom)) < 0) _croak_error(); OUTPUT: RETVAL int is_persistent(dom) virDomainPtr dom; CODE: if ((RETVAL = virDomainIsPersistent(dom)) < 0) _croak_error(); OUTPUT: RETVAL int is_updated(dom) virDomainPtr dom; CODE: if ((RETVAL = virDomainIsUpdated(dom)) < 0) _croak_error(); OUTPUT: RETVAL void suspend(dom) virDomainPtr dom; PPCODE: if ((virDomainSuspend(dom)) < 0) _croak_error(); void resume(dom) virDomainPtr dom; PPCODE: if ((virDomainResume(dom)) < 0) _croak_error(); void pm_wakeup(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if ((virDomainPMWakeup(dom, flags)) < 0) _croak_error(); void save(dom, to, dxmlsv=&PL_sv_undef, flags=0) virDomainPtr dom; const char *to; SV *dxmlsv; unsigned int flags; PREINIT: const char *dxml = NULL; PPCODE: if (SvOK(dxmlsv)) dxml = SvPV_nolen(dxmlsv); if (dxml || flags) { if ((virDomainSaveFlags(dom, to, dxml, flags)) < 0) _croak_error(); } else { if ((virDomainSave(dom, to)) < 0) _croak_error(); } void managed_save(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if ((virDomainManagedSave(dom, flags)) < 0) _croak_error(); int has_managed_save_image(dom, flags=0) virDomainPtr dom; unsigned int flags; CODE: if ((RETVAL = virDomainHasManagedSaveImage(dom, flags)) < 0) _croak_error(); OUTPUT: RETVAL void managed_save_remove(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if ((virDomainManagedSaveRemove(dom, flags)) < 0) _croak_error(); void managed_save_define_xml(dom, xml, flags=0) virDomainPtr dom; const char *xml; unsigned int flags; PPCODE: if (virDomainManagedSaveDefineXML(dom, xml, flags) < 0) _croak_error(); SV * managed_save_get_xml_description(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virDomainManagedSaveGetXMLDesc(dom, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void core_dump(dom, to, flags=0) virDomainPtr dom; const char *to; unsigned int flags; PPCODE: if (virDomainCoreDump(dom, to, flags) < 0) _croak_error(); void core_dump_format(dom, to, format, flags=0) virDomainPtr dom; const char *to; unsigned int format; unsigned int flags; PPCODE: if (virDomainCoreDumpWithFormat(dom, to, format, flags) < 0) _croak_error(); HV * get_info(dom) virDomainPtr dom; PREINIT: virDomainInfo info; CODE: if (virDomainGetInfo(dom, &info) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "state", 5, newSViv(info.state), 0); (void)hv_store (RETVAL, "maxMem", 6, newSViv(info.maxMem), 0); (void)hv_store (RETVAL, "memory", 6, newSViv(info.memory), 0); (void)hv_store (RETVAL, "nrVirtCpu", 9, newSViv(info.nrVirtCpu), 0); (void)hv_store (RETVAL, "cpuTime", 7, virt_newSVull(info.cpuTime), 0); OUTPUT: RETVAL AV * get_time(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: long long secs; unsigned int nsecs; CODE: if (virDomainGetTime(dom, &secs, &nsecs, flags) < 0) _croak_error(); RETVAL = (AV *)sv_2mortal((SV*)newAV()); (void)av_push(RETVAL, virt_newSVull(secs)); (void)av_push(RETVAL, newSViv(nsecs)); OUTPUT: RETVAL void set_time(dom, secssv, nsecs, flags=0) virDomainPtr dom; SV *secssv; unsigned int nsecs; unsigned int flags; PREINIT: long long secs; PPCODE: secs = virt_SvIVll(secssv); if (virDomainSetTime(dom, secs, nsecs, flags) < 0) _croak_error(); void set_user_password(dom, username, password, flags=0) virDomainPtr dom; const char *username; const char *password; unsigned int flags; PPCODE: if (virDomainSetUserPassword(dom, username, password, flags) < 0) _croak_error(); void rename(dom, newname, flags=0) virDomainPtr dom; const char *newname; unsigned int flags; PPCODE: if (virDomainRename(dom, newname, flags) < 0) _croak_error(); HV * get_control_info(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainControlInfo info; CODE: if (virDomainGetControlInfo(dom, &info, flags) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "state", 5, newSViv(info.state), 0); (void)hv_store (RETVAL, "details", 7, newSViv(info.details), 0); (void)hv_store (RETVAL, "stateTime", 9, virt_newSVull(info.stateTime), 0); OUTPUT: RETVAL void get_state(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: int state; int reason; PPCODE: if (virDomainGetState(dom, &state, &reason, flags) < 0) _croak_error(); XPUSHs(sv_2mortal(newSViv(state))); XPUSHs(sv_2mortal(newSViv(reason))); void open_console(dom, st, devname, flags=0) virDomainPtr dom; virStreamPtr st; SV *devname; unsigned int flags; PREINIT: const char *devnamestr = NULL; PPCODE: if (SvOK(devname)) devnamestr = SvPV_nolen(devname); if (virDomainOpenConsole(dom, devnamestr, st, flags) < 0) _croak_error(); void open_channel(dom, st, devname, flags=0) virDomainPtr dom; virStreamPtr st; SV *devname; unsigned int flags; PREINIT: const char *devnamestr = NULL; PPCODE: if (SvOK(devname)) devnamestr = SvPV_nolen(devname); if (virDomainOpenChannel(dom, devnamestr, st, flags) < 0) _croak_error(); void open_graphics(dom, idx, fd, flags=0) virDomainPtr dom; unsigned int idx; int fd; unsigned int flags; PPCODE: if (virDomainOpenGraphics(dom, idx, fd, flags) < 0) _croak_error(); int open_graphics_fd(dom, idx, flags=0) virDomainPtr dom; unsigned int idx; unsigned int flags; CODE: if ((RETVAL = virDomainOpenGraphicsFD(dom, idx, flags)) < 0) _croak_error(); OUTPUT: RETVAL SV * screenshot(dom, st, screen, flags=0) virDomainPtr dom; virStreamPtr st; unsigned int screen; unsigned int flags; PREINIT: char *mimetype; CODE: if (!(mimetype = virDomainScreenshot(dom, st, screen, flags))) _croak_error(); RETVAL = newSVpv(mimetype, 0); free(mimetype); OUTPUT: RETVAL HV * get_block_info(dom, dev, flags=0) virDomainPtr dom; const char *dev; unsigned int flags; PREINIT: virDomainBlockInfo info; CODE: if (virDomainGetBlockInfo(dom, dev, &info, flags) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "capacity", 8, virt_newSVull(info.capacity), 0); (void)hv_store (RETVAL, "allocation", 10, virt_newSVull(info.allocation), 0); (void)hv_store (RETVAL, "physical", 8, virt_newSVull(info.physical), 0); OUTPUT: RETVAL HV * get_job_info(dom) virDomainPtr dom; PREINIT: virDomainJobInfo info; CODE: if (virDomainGetJobInfo(dom, &info) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "type", 4, newSViv(info.type), 0); (void)hv_store (RETVAL, "timeElapsed", 11, virt_newSVull(info.timeElapsed), 0); (void)hv_store (RETVAL, "timeRemaining", 13, virt_newSVull(info.timeRemaining), 0); (void)hv_store (RETVAL, "dataTotal", 9, virt_newSVull(info.dataTotal), 0); (void)hv_store (RETVAL, "dataProcessed", 13, virt_newSVull(info.dataProcessed), 0); (void)hv_store (RETVAL, "dataRemaining", 13, virt_newSVull(info.dataRemaining), 0); (void)hv_store (RETVAL, "memTotal", 8, virt_newSVull(info.memTotal), 0); (void)hv_store (RETVAL, "memProcessed", 12, virt_newSVull(info.memProcessed), 0); (void)hv_store (RETVAL, "memRemaining", 12, virt_newSVull(info.memRemaining), 0); (void)hv_store (RETVAL, "fileTotal", 9, virt_newSVull(info.fileTotal), 0); (void)hv_store (RETVAL, "fileProcessed", 13, virt_newSVull(info.fileProcessed), 0); (void)hv_store (RETVAL, "fileRemaining", 13, virt_newSVull(info.fileRemaining), 0); OUTPUT: RETVAL void get_job_stats(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: int type; virTypedParameterPtr params = NULL; int nparams = 0; HV *paramsHv; SV *typeSv; PPCODE: if (virDomainGetJobStats(dom, &type, ¶ms, &nparams, flags) < 0) { _croak_error(); } typeSv = newSViv(type); paramsHv = vir_typed_param_to_hv(params, nparams); virTypedParamsFree(params, nparams); EXTEND(SP, 2); PUSHs(newRV_noinc((SV*)typeSv)); PUSHs(newRV_noinc((SV*)paramsHv)); void abort_job(dom) virDomainPtr dom; PPCODE: if (virDomainAbortJob(dom) < 0) _croak_error(); void abort_block_job(dom, path, flags=0) virDomainPtr dom; const char *path; unsigned int flags; PPCODE: if (virDomainBlockJobAbort(dom, path, flags) < 0) _croak_error(); HV * get_block_job_info(dom, path, flags=0) virDomainPtr dom; const char *path; unsigned int flags; PREINIT: virDomainBlockJobInfo info; CODE: if (virDomainGetBlockJobInfo(dom, path, &info, flags) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "type", 4, newSViv(info.type), 0); (void)hv_store (RETVAL, "bandwidth", 9, virt_newSVull(info.bandwidth), 0); (void)hv_store (RETVAL, "cur", 3, virt_newSVull(info.cur), 0); (void)hv_store (RETVAL, "end", 3, virt_newSVull(info.end), 0); OUTPUT: RETVAL void set_block_job_speed(dom, path, bandwidth, flags=0) virDomainPtr dom; const char *path; unsigned long bandwidth; unsigned int flags; PPCODE: if (virDomainBlockJobSetSpeed(dom, path, bandwidth, flags) < 0) _croak_error(); void block_pull(dom, path, bandwidth, flags=0) virDomainPtr dom; const char *path; unsigned long bandwidth; unsigned int flags; PPCODE: if (virDomainBlockPull(dom, path, bandwidth, flags) < 0) _croak_error(); void block_rebase(dom, path, base, bandwidth, flags=0) virDomainPtr dom; const char *path; const char *base; unsigned long bandwidth; unsigned int flags; PPCODE: if (virDomainBlockRebase(dom, path, base, bandwidth, flags) < 0) _croak_error(); void block_copy(dom, path, destxml, newparams, flags=0) virDomainPtr dom; const char *path; const char *destxml; HV *newparams; unsigned long flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 3; Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_DOMAIN_BLOCK_COPY_BANDWIDTH, VIR_TYPED_PARAM_FIELD_LENGTH); params[0].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[1].field, VIR_DOMAIN_BLOCK_COPY_GRANULARITY, VIR_TYPED_PARAM_FIELD_LENGTH); params[1].type = VIR_TYPED_PARAM_UINT; strncpy(params[2].field, VIR_DOMAIN_BLOCK_COPY_BUF_SIZE, VIR_TYPED_PARAM_FIELD_LENGTH); params[2].type = VIR_TYPED_PARAM_UINT; nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainBlockCopy(dom, path, destxml, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); void block_commit(dom, path, base, top, bandwidth, flags=0) virDomainPtr dom; const char *path; const char *base; const char *top; unsigned long bandwidth; unsigned int flags; PPCODE: if (virDomainBlockCommit(dom, path, base, top, bandwidth, flags) < 0) _croak_error(); void get_disk_errors(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainDiskErrorPtr errors; unsigned int maxerrors; int ret; int i; PPCODE: if ((ret = virDomainGetDiskErrors(dom, NULL, 0, 0)) < 0) _croak_error(); maxerrors = ret; Newx(errors, maxerrors, virDomainDiskError); if ((ret = virDomainGetDiskErrors(dom, errors, maxerrors, flags)) < 0) { Safefree(errors); _croak_error(); } EXTEND(SP, ret); for (i = 0 ; i < ret ; i++) { HV *rec = newHV(); (void)hv_store(rec, "path", 4, newSVpv(errors[i].disk, 0), 0); (void)hv_store(rec, "error", 5, newSViv(errors[i].error), 0); PUSHs(newRV_noinc((SV *)rec)); } Safefree(errors); HV * get_scheduler_parameters(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; char *type; CODE: if (!(type = virDomainGetSchedulerType(dom, &nparams))) _croak_error(); free(type); Newx(params, nparams, virTypedParameter); if (flags) { if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } } else { if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_scheduler_parameters(dom, newparams, flags=0) virDomainPtr dom; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; char *type; PPCODE: if (!(type = virDomainGetSchedulerType(dom, &nparams))) _croak_error(); free(type); Newx(params, nparams, virTypedParameter); if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (flags) { if (virDomainSetSchedulerParametersFlags(dom, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } } else { if (virDomainSetSchedulerParameters(dom, params, nparams) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } } vir_typed_param_safe_free(params, nparams); HV * get_memory_parameters(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 0; if (virDomainGetMemoryParameters(dom, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetMemoryParameters(dom, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_memory_parameters(dom, newparams, flags=0) virDomainPtr dom; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 0; if (virDomainGetMemoryParameters(dom, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetMemoryParameters(dom, params, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetMemoryParameters(dom, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); HV * get_numa_parameters(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 0; if (virDomainGetNumaParameters(dom, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetNumaParameters(dom, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_numa_parameters(dom, newparams, flags=0) virDomainPtr dom; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 0; if (virDomainGetNumaParameters(dom, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetNumaParameters(dom, params, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetNumaParameters(dom, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); HV * get_blkio_parameters(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 0; if (virDomainGetBlkioParameters(dom, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virBlkioParameter); if (virDomainGetBlkioParameters(dom, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_blkio_parameters(dom, newparams, flags=0) virDomainPtr dom; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 0; if (virDomainGetBlkioParameters(dom, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virBlkioParameter); if (virDomainGetBlkioParameters(dom, params, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetBlkioParameters(dom, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); HV * get_perf_events(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; CODE: if (virDomainGetPerfEvents(dom, ¶ms, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_perf_events(dom, newparams, flags=0) virDomainPtr dom; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; PPCODE: if (virDomainGetPerfEvents(dom, ¶ms, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetPerfEvents(dom, params, nparams, flags) < 0) _croak_error(); vir_typed_param_safe_free(params, nparams); HV * get_launch_security_info(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; CODE: if (virDomainGetLaunchSecurityInfo(dom, ¶ms, &nparams, flags) < 0) { _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); virTypedParamsFree(params, nparams); OUTPUT: RETVAL void set_launch_security_state(dom, newparams, flags=0) virDomainPtr dom; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 3; Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET, VIR_TYPED_PARAM_FIELD_LENGTH); params[0].type = VIR_TYPED_PARAM_STRING; strncpy(params[1].field, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_HEADER, VIR_TYPED_PARAM_FIELD_LENGTH); params[1].type = VIR_TYPED_PARAM_STRING; strncpy(params[2].field, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_SET_ADDRESS, VIR_TYPED_PARAM_FIELD_LENGTH); params[2].type = VIR_TYPED_PARAM_ULLONG; nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetLaunchSecurityState(dom, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); HV * get_guest_info(dom, types=0, flags=0) virDomainPtr dom; int types; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; CODE: if (virDomainGetGuestInfo(dom, types, ¶ms, &nparams, flags) < 0) { _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); virTypedParamsFree(params, nparams); OUTPUT: RETVAL unsigned long get_max_memory(dom) virDomainPtr dom; CODE: if (!(RETVAL = virDomainGetMaxMemory(dom))) _croak_error(); OUTPUT: RETVAL void set_max_memory(dom, val) virDomainPtr dom; unsigned long val; PPCODE: if (virDomainSetMaxMemory(dom, val) < 0) _croak_error(); void set_memory(dom, val, flags=0) virDomainPtr dom; unsigned long val; unsigned int flags; PPCODE: if (flags) { if (virDomainSetMemoryFlags(dom, val, flags) < 0) _croak_error(); } else { if (virDomainSetMemory(dom, val) < 0) _croak_error(); } void set_memory_stats_period(dom, val, flags=0) virDomainPtr dom; int val; unsigned int flags; PPCODE: if (virDomainSetMemoryStatsPeriod(dom, val, flags) < 0) _croak_error(); int get_max_vcpus(dom) virDomainPtr dom; CODE: if (!(RETVAL = virDomainGetMaxVcpus(dom))) _croak_error(); OUTPUT: RETVAL void set_vcpus(dom, num, flags=0) virDomainPtr dom; int num; int flags; PPCODE: if (flags) { if (virDomainSetVcpusFlags(dom, num, flags) < 0) _croak_error(); } else { if (virDomainSetVcpus(dom, num) < 0) _croak_error(); } void set_vcpu(dom, cpumap, state, flags=0) virDomainPtr dom; const char *cpumap; int state; unsigned int flags; PPCODE: if (virDomainSetVcpu(dom, cpumap, state, flags) < 0) _croak_error(); int get_vcpus(dom, flags=0) virDomainPtr dom; int flags; CODE: if ((RETVAL = virDomainGetVcpusFlags(dom, flags)) < 0) _croak_error(); OUTPUT: RETVAL void set_guest_vcpus(dom, cpumap, state, flags=0) virDomainPtr dom; const char *cpumap; int state; unsigned int flags; PPCODE: if (virDomainSetGuestVcpus(dom, cpumap, state, flags) < 0) _croak_error(); HV * get_guest_vcpus(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; unsigned int nparams = 0; CODE: if (virDomainGetGuestVcpus(dom, ¶ms, &nparams, flags) < 0) { _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); virTypedParamsFree(params, nparams); OUTPUT: RETVAL void set_autostart(dom, autostart) virDomainPtr dom; int autostart; PPCODE: if (virDomainSetAutostart(dom, autostart) < 0) _croak_error(); int get_autostart(dom) virDomainPtr dom; PREINIT: int autostart; CODE: if (virDomainGetAutostart(dom, &autostart) < 0) _croak_error(); RETVAL = autostart; OUTPUT: RETVAL char * get_scheduler_type(dom) virDomainPtr dom; PREINIT: int nparams; CODE: if ((RETVAL = virDomainGetSchedulerType(dom, &nparams)) == NULL) _croak_error(); OUTPUT: RETVAL SV * get_os_type(dom) virDomainPtr dom; PREINIT: char *type; CODE: if (!(type = virDomainGetOSType(dom))) _croak_error(); RETVAL = newSVpv(type, 0); free(type); OUTPUT: RETVAL SV * get_xml_description(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virDomainGetXMLDesc(dom, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void shutdown(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (flags) { if (virDomainShutdownFlags(dom, flags) < 0) _croak_error(); } else { if (virDomainShutdown(dom) < 0) _croak_error(); } void reboot(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (virDomainReboot(dom, flags) < 0) _croak_error(); void pm_suspend_for_duration(dom, target, duration, flags=0) virDomainPtr dom; unsigned int target; SV *duration; unsigned int flags; PPCODE: if (virDomainPMSuspendForDuration(dom, target, virt_SvIVull(duration), flags) < 0) _croak_error(); void reset(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (virDomainReset(dom, flags) < 0) _croak_error(); void inject_nmi(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (virDomainInjectNMI(dom, flags) < 0) _croak_error(); void undefine(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (flags) { if (virDomainUndefineFlags(dom, flags) < 0) _croak_error(); } else { if (virDomainUndefine(dom) < 0) _croak_error(); } void create(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (flags) { if (virDomainCreateWithFlags(dom, flags) < 0) _croak_error(); } else { if (virDomainCreate(dom) < 0) _croak_error(); } void create_with_files(dom, fdssv, flags=0) virDomainPtr dom; SV *fdssv; unsigned int flags; PREINIT: AV *fdsav; unsigned int nfds; int *fds; int i; PPCODE: if (!SvROK(fdssv)) return; fdsav = (AV*)SvRV(fdssv); nfds = av_len(fdsav) + 1; Newx(fds, nfds, int); for (i = 0 ; i < nfds ; i++) { SV **fd = av_fetch(fdsav, i, 0); fds[i] = SvIV(*fd); } if (virDomainCreateWithFiles(dom, nfds, fds, flags) < 0) { Safefree(fds); _croak_error(); } Safefree(fds); virDomainPtr _migrate(dom, destcon, newparams, flags=0) virDomainPtr dom; virConnectPtr destcon; HV *newparams; unsigned long flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 19; Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_FIELD_LENGTH); params[0].type = VIR_TYPED_PARAM_STRING; strncpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_FIELD_LENGTH); params[1].type = VIR_TYPED_PARAM_STRING; strncpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_FIELD_LENGTH); params[2].type = VIR_TYPED_PARAM_STRING; strncpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_FIELD_LENGTH); params[3].type = VIR_TYPED_PARAM_STRING; strncpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_FIELD_LENGTH); params[4].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[5].field, VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_FIELD_LENGTH); params[5].type = VIR_TYPED_PARAM_STRING; strncpy(params[6].field, VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_FIELD_LENGTH); params[6].type = VIR_TYPED_PARAM_INT; strncpy(params[7].field, VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_FIELD_LENGTH); params[7].type = VIR_TYPED_PARAM_STRING; strncpy(params[8].field, VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_FIELD_LENGTH); params[8].type = VIR_TYPED_PARAM_INT; strncpy(params[9].field, VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_FIELD_LENGTH); params[9].type = VIR_TYPED_PARAM_INT; strncpy(params[10].field, VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_FIELD_LENGTH); params[10].type = VIR_TYPED_PARAM_INT; strncpy(params[11].field, VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_FIELD_LENGTH); params[11].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[12].field, VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_FIELD_LENGTH); params[12].type = VIR_TYPED_PARAM_STRING; strncpy(params[13].field, VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_FIELD_LENGTH); params[13].type = VIR_TYPED_PARAM_INT; strncpy(params[14].field, VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_FIELD_LENGTH); params[14].type = VIR_TYPED_PARAM_INT; strncpy(params[15].field, VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_FIELD_LENGTH); params[15].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[16].field, VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_FIELD_LENGTH); params[16].type = VIR_TYPED_PARAM_INT; strncpy(params[17].field, VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_FIELD_LENGTH); params[17].type = VIR_TYPED_PARAM_STRING; strncpy(params[18].field, VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_FIELD_LENGTH); params[18].type = VIR_TYPED_PARAM_STRING; nparams = vir_typed_param_from_hv(newparams, params, nparams); vir_typed_param_add_string_list_from_hv(newparams, ¶ms, &nparams, VIR_MIGRATE_PARAM_MIGRATE_DISKS); /* No need to support virDomainMigrate/virDomainMigrate2, since * virDomainMigrate3 takes care to call the older APIs internally * if it is possible todo so */ if ((RETVAL = virDomainMigrate3(dom, destcon, params, nparams, flags)) == NULL) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void _migrate_to_uri(dom, desturi, newparams, flags=0) virDomainPtr dom; const char *desturi; HV *newparams; unsigned long flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 19; Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_MIGRATE_PARAM_URI, VIR_TYPED_PARAM_FIELD_LENGTH); params[0].type = VIR_TYPED_PARAM_STRING; strncpy(params[1].field, VIR_MIGRATE_PARAM_DEST_NAME, VIR_TYPED_PARAM_FIELD_LENGTH); params[1].type = VIR_TYPED_PARAM_STRING; strncpy(params[2].field, VIR_MIGRATE_PARAM_DEST_XML, VIR_TYPED_PARAM_FIELD_LENGTH); params[2].type = VIR_TYPED_PARAM_STRING; strncpy(params[3].field, VIR_MIGRATE_PARAM_GRAPHICS_URI, VIR_TYPED_PARAM_FIELD_LENGTH); params[3].type = VIR_TYPED_PARAM_STRING; strncpy(params[4].field, VIR_MIGRATE_PARAM_BANDWIDTH, VIR_TYPED_PARAM_FIELD_LENGTH); params[4].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[5].field, VIR_MIGRATE_PARAM_LISTEN_ADDRESS, VIR_TYPED_PARAM_FIELD_LENGTH); params[5].type = VIR_TYPED_PARAM_STRING; strncpy(params[6].field, VIR_MIGRATE_PARAM_DISKS_PORT, VIR_TYPED_PARAM_FIELD_LENGTH); params[6].type = VIR_TYPED_PARAM_INT; strncpy(params[7].field, VIR_MIGRATE_PARAM_COMPRESSION, VIR_TYPED_PARAM_FIELD_LENGTH); params[7].type = VIR_TYPED_PARAM_STRING; strncpy(params[8].field, VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, VIR_TYPED_PARAM_FIELD_LENGTH); params[8].type = VIR_TYPED_PARAM_INT; strncpy(params[9].field, VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, VIR_TYPED_PARAM_FIELD_LENGTH); params[9].type = VIR_TYPED_PARAM_INT; strncpy(params[10].field, VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, VIR_TYPED_PARAM_FIELD_LENGTH); params[10].type = VIR_TYPED_PARAM_INT; strncpy(params[11].field, VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, VIR_TYPED_PARAM_FIELD_LENGTH); params[11].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[12].field, VIR_MIGRATE_PARAM_PERSIST_XML, VIR_TYPED_PARAM_FIELD_LENGTH); params[12].type = VIR_TYPED_PARAM_STRING; strncpy(params[13].field, VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_FIELD_LENGTH); params[13].type = VIR_TYPED_PARAM_INT; strncpy(params[14].field, VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_FIELD_LENGTH); params[14].type = VIR_TYPED_PARAM_INT; strncpy(params[15].field, VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_FIELD_LENGTH); params[15].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[16].field, VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_FIELD_LENGTH); params[16].type = VIR_TYPED_PARAM_INT; strncpy(params[17].field, VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_FIELD_LENGTH); params[17].type = VIR_TYPED_PARAM_STRING; strncpy(params[18].field, VIR_MIGRATE_PARAM_DISKS_URI, VIR_TYPED_PARAM_FIELD_LENGTH); params[18].type = VIR_TYPED_PARAM_STRING; nparams = vir_typed_param_from_hv(newparams, params, nparams); vir_typed_param_add_string_list_from_hv(newparams, ¶ms, &nparams, VIR_MIGRATE_PARAM_MIGRATE_DISKS); /* No need to support virDomainMigrateToURI/virDomainMigrateToURI2, since * virDomainMigrate3 takes care to call the older APIs internally * if it is possible todo so */ if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); void migrate_set_max_downtime(dom, downtime, flags=0) virDomainPtr dom; SV *downtime; unsigned int flags; PREINIT: unsigned long long downtimeVal; PPCODE: downtimeVal = virt_SvIVull(downtime); if (virDomainMigrateSetMaxDowntime(dom, downtimeVal, flags) < 0) _croak_error(); SV * migrate_get_max_downtime(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: unsigned long long downtime; CODE: if (virDomainMigrateGetMaxDowntime(dom, &downtime, flags) < 0) _croak_error(); RETVAL = virt_newSVull(downtime); OUTPUT: RETVAL void migrate_set_max_speed(dom, bandwidth, flags=0) virDomainPtr dom; unsigned long bandwidth; unsigned int flags; PPCODE: if (virDomainMigrateSetMaxSpeed(dom, bandwidth, flags) < 0) _croak_error(); unsigned long migrate_get_max_speed(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: unsigned long speed; CODE: if (virDomainMigrateGetMaxSpeed(dom, &speed, flags) < 0) _croak_error(); RETVAL = speed; OUTPUT: RETVAL void migrate_set_compression_cache(dom, cacheSizeSv, flags=0) virDomainPtr dom; SV *cacheSizeSv; unsigned int flags; PREINIT: unsigned long long cacheSize; PPCODE: cacheSize = virt_SvIVull(cacheSizeSv); if (virDomainMigrateSetCompressionCache(dom, cacheSize, flags) < 0) _croak_error(); SV * migrate_get_compression_cache(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: unsigned long long cacheSize; CODE: if (virDomainMigrateGetCompressionCache(dom, &cacheSize, flags) < 0) _croak_error(); RETVAL = virt_newSVull(cacheSize); OUTPUT: RETVAL void migrate_start_post_copy(dom, flags=0) virDomainPtr dom; unsigned int flags; PPCODE: if (virDomainMigrateStartPostCopy(dom, flags) < 0) _croak_error(); void attach_device(dom, xml, flags=0) virDomainPtr dom; const char *xml; unsigned int flags; PPCODE: if (flags) { if (virDomainAttachDeviceFlags(dom, xml, flags) < 0) _croak_error(); } else { if (virDomainAttachDevice(dom, xml) < 0) _croak_error(); } void detach_device(dom, xml, flags=0) virDomainPtr dom; const char *xml; unsigned int flags; PPCODE: if (flags) { if (virDomainDetachDeviceFlags(dom, xml, flags) < 0) _croak_error(); } else { if (virDomainDetachDevice(dom, xml) < 0) _croak_error(); } void detach_device_alias(dom, alias, flags=0) virDomainPtr dom; const char *alias; unsigned int flags; PPCODE: if (virDomainDetachDeviceAlias(dom, alias, flags) < 0) _croak_error(); void update_device(dom, xml, flags=0) virDomainPtr dom; const char *xml; unsigned int flags; PPCODE: if (virDomainUpdateDeviceFlags(dom, xml, flags) < 0) _croak_error(); HV * get_block_iotune(dom, disk, flags=0) virDomainPtr dom; const char *disk; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 0; RETVAL = NULL; if (virDomainGetBlockIoTune(dom, disk, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetBlockIoTune(dom, disk, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_block_iotune(dom, disk, newparams, flags=0) virDomainPtr dom; const char *disk; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 0; if (virDomainGetBlockIoTune(dom, disk, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetBlockIoTune(dom, disk, params, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetBlockIoTune(dom, disk, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); HV * get_interface_parameters(dom, intf, flags=0) virDomainPtr dom; const char *intf; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; CODE: nparams = 0; RETVAL = NULL; if (virDomainGetInterfaceParameters(dom, intf, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetInterfaceParameters(dom, intf, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_interface_parameters(dom, intf, newparams, flags=0) virDomainPtr dom; const char *intf; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; int nparams; PPCODE: nparams = 0; if (virDomainGetInterfaceParameters(dom, intf, NULL, &nparams, 0) < 0) _croak_error(); Newx(params, nparams, virTypedParameter); if (virDomainGetInterfaceParameters(dom, intf, params, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetInterfaceParameters(dom, intf, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); HV * block_stats(dom, path, flags=0) virDomainPtr dom; const char *path; unsigned int flags; PREINIT: virDomainBlockStatsStruct stats; virTypedParameterPtr params; int nparams; unsigned int i; const char *field; CODE: nparams = 0; RETVAL = NULL; if (virDomainBlockStatsFlags(dom, path, NULL, &nparams, 0) < 0) { virErrorPtr err = virGetLastError(); if (err && err->code == VIR_ERR_NO_SUPPORT && !flags) { if (virDomainBlockStats(dom, path, &stats, sizeof(stats)) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "rd_req", 6, virt_newSVll(stats.rd_req), 0); (void)hv_store (RETVAL, "rd_bytes", 8, virt_newSVll(stats.rd_bytes), 0); (void)hv_store (RETVAL, "wr_req", 6, virt_newSVll(stats.wr_req), 0); (void)hv_store (RETVAL, "wr_bytes", 8, virt_newSVll(stats.wr_bytes), 0); (void)hv_store (RETVAL, "errs", 4, virt_newSVll(stats.errs), 0); } else { _croak_error(); } } else { Newx(params, nparams, virTypedParameter); if (virDomainBlockStatsFlags(dom, path, params, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); for (i = 0 ; i < nparams ; i++) { field = NULL; /* For back compat with previous hash above */ if (strcmp(params[i].field, "rd_operations") == 0) field = "rd_req"; else if (strcmp(params[i].field, "wr_operations") == 0) field = "wr_req"; else if (strcmp(params[i].field, "flush_operations") == 0) field = "flush_reqs"; if (field) { SV *val = hv_delete(RETVAL, params[i].field, strlen(params[i].field), 0); SvREFCNT_inc(val); (void)hv_store(RETVAL, field, strlen(field), val, 0); } } vir_typed_param_safe_free(params, nparams); } OUTPUT: RETVAL HV * interface_stats(dom, path) virDomainPtr dom; const char *path; PREINIT: virDomainInterfaceStatsStruct stats; CODE: if (virDomainInterfaceStats(dom, path, &stats, sizeof(stats)) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "rx_bytes", 8, virt_newSVll(stats.rx_bytes), 0); (void)hv_store (RETVAL, "rx_packets", 10, virt_newSVll(stats.rx_packets), 0); (void)hv_store (RETVAL, "rx_errs", 7, virt_newSVll(stats.rx_errs), 0); (void)hv_store (RETVAL, "rx_drop", 7, virt_newSVll(stats.rx_drop), 0); (void)hv_store (RETVAL, "tx_bytes", 8, virt_newSVll(stats.tx_bytes), 0); (void)hv_store (RETVAL, "tx_packets", 10, virt_newSVll(stats.tx_packets), 0); (void)hv_store (RETVAL, "tx_errs", 7, virt_newSVll(stats.tx_errs), 0); (void)hv_store (RETVAL, "tx_drop", 7, virt_newSVll(stats.tx_drop), 0); OUTPUT: RETVAL HV * memory_stats(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainMemoryStatPtr stats; int i, got; CODE: Newx(stats, VIR_DOMAIN_MEMORY_STAT_NR, virDomainMemoryStatStruct); if ((got = virDomainMemoryStats(dom, stats, VIR_DOMAIN_MEMORY_STAT_NR, flags)) < 0) { Safefree(stats); _croak_error(); } RETVAL = (HV *)sv_2mortal((SV*)newHV()); for (i = 0 ; i < got ; i++) { switch (stats[i].tag) { case VIR_DOMAIN_MEMORY_STAT_SWAP_IN: (void)hv_store (RETVAL, "swap_in", 7, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_SWAP_OUT: (void)hv_store (RETVAL, "swap_out", 8, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT: (void)hv_store (RETVAL, "major_fault", 11, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT: (void)hv_store (RETVAL, "minor_fault", 11, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_UNUSED: (void)hv_store (RETVAL, "unused", 6, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_AVAILABLE: (void)hv_store (RETVAL, "available", 9, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON: (void)hv_store (RETVAL, "actual_balloon", 14, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_RSS: (void)hv_store (RETVAL, "rss", 3, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE: (void)hv_store (RETVAL, "last_update", 11, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_USABLE: (void)hv_store (RETVAL, "usable", 6, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_DISK_CACHES: (void)hv_store (RETVAL, "disk_caches", 11, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC: (void)hv_store (RETVAL, "hugetlb_pgalloc", 15, virt_newSVll(stats[i].val), 0); break; case VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL: (void)hv_store (RETVAL, "hugetlb_pgfail", 14, virt_newSVll(stats[i].val), 0); break; } } Safefree(stats); OUTPUT: RETVAL void send_key(dom, codeset, holdtime, keycodesSV, flags=0) virDomainPtr dom; unsigned int codeset; unsigned int holdtime; SV *keycodesSV; unsigned int flags; PREINIT: AV *keycodesAV; unsigned int *keycodes; int nkeycodes; int i; PPCODE: if (!SvROK(keycodesSV)) return; keycodesAV = (AV*)SvRV(keycodesSV); nkeycodes = av_len(keycodesAV) + 1; Newx(keycodes, nkeycodes, unsigned int); for (i = 0 ; i < nkeycodes ; i++) { SV **code = av_fetch(keycodesAV, i, 0); keycodes[i] = SvIV(*code); } if (virDomainSendKey(dom, codeset, holdtime, keycodes, nkeycodes, flags) < 0) { Safefree(keycodes); _croak_error(); } Safefree(keycodes); void block_resize(dom, disk, size, flags=0) virDomainPtr dom; const char *disk; SV *size; unsigned int flags; PPCODE: if (virDomainBlockResize(dom, disk, virt_SvIVull(size), flags) < 0) _croak_error(); SV * block_peek(dom, path, offset, size, flags=0) virDomainPtr dom; const char *path; unsigned int offset; size_t size; unsigned int flags; PREINIT: char *buf; CODE: Newx(buf, size, char); if (virDomainBlockPeek(dom, path, offset, size, buf, flags) < 0) { Safefree(buf); _croak_error(); } RETVAL = newSVpvn(buf, size); OUTPUT: RETVAL SV * memory_peek(dom, offset, size, flags=0) virDomainPtr dom; unsigned int offset; size_t size; unsigned int flags; PREINIT: char *buf; CODE: Newx(buf, size, char); if (virDomainMemoryPeek(dom, offset, size, buf, flags) < 0) { Safefree(buf); _croak_error(); } RETVAL = newSVpvn(buf, size); OUTPUT: RETVAL HV * get_security_label(dom) virDomainPtr dom; PREINIT: virSecurityLabel seclabel; CODE: if (virDomainGetSecurityLabel(dom, &seclabel) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "label", 5, newSVpv(seclabel.label, 0), 0); (void)hv_store (RETVAL, "enforcing", 9, newSViv(seclabel.enforcing), 0); OUTPUT: RETVAL void get_security_label_list(dom) virDomainPtr dom; PREINIT: virSecurityLabelPtr seclabels; int nlabels; int i; PPCODE: if ((nlabels = virDomainGetSecurityLabelList(dom, &seclabels)) < 0) _croak_error(); EXTEND(SP, nlabels); for (i = 0 ; i < nlabels ; i++) { HV *rec = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (rec, "label", 5, newSVpv(seclabels[i].label, 0), 0); (void)hv_store (rec, "enforcing", 9, newSViv(seclabels[i].enforcing), 0); PUSHs(newRV_noinc((SV*)rec)); } free(seclabels); void get_cpu_stats(dom, start_cpu, ncpus, flags=0) virDomainPtr dom; int start_cpu; unsigned int ncpus; unsigned int flags; PREINIT: virTypedParameterPtr params; unsigned int nparams; int ret; int i; PPCODE: if ((ret = virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0)) < 0) _croak_error(); nparams = ret; if (ncpus == 0) { if ((ret = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0)) < 0) _croak_error(); ncpus = ret; } Newx(params, ncpus * nparams, virTypedParameter); if ((ret = virDomainGetCPUStats(dom, params, nparams, start_cpu, ncpus, flags)) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } EXTEND(SP, ret); for (i = 0 ; i < ret ; i++) { HV *rec = vir_typed_param_to_hv(params + (i * nparams), nparams); PUSHs(newRV_noinc((SV *)rec)); } vir_typed_param_safe_free(params, nparams); void get_vcpu_info(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virVcpuInfoPtr info; unsigned char *cpumaps; size_t maplen; virNodeInfo nodeinfo; virDomainInfo dominfo; int nvCpus; int i; PPCODE: if (virNodeGetInfo(virDomainGetConnect(dom), &nodeinfo) < 0) _croak_error(); if (virDomainGetInfo(dom, &dominfo) < 0) _croak_error(); maplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo)); Newx(cpumaps, dominfo.nrVirtCpu * maplen, unsigned char); if (!flags) { Newx(info, dominfo.nrVirtCpu, virVcpuInfo); if ((nvCpus = virDomainGetVcpus(dom, info, dominfo.nrVirtCpu, cpumaps, maplen)) < 0) { virErrorPtr err = virGetLastError(); Safefree(info); 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; if ((nvCpus = virDomainGetVcpuPinInfo(dom, dominfo.nrVirtCpu, cpumaps, maplen, flags)) < 0) { Safefree(cpumaps); _croak_error(); } } EXTEND(SP, nvCpus); for (i = 0 ; i < nvCpus ; i++) { HV *rec = newHV(); (void)hv_store(rec, "number", 6, newSViv(i), 0); if (info) { (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)); } if (info) Safefree(info); Safefree(cpumaps); void pin_vcpu(dom, vcpu, mask, flags=0) virDomainPtr dom; unsigned int vcpu; SV *mask; unsigned int flags; PREINIT: STRLEN masklen; unsigned char *maps; PPCODE: maps = (unsigned char *)SvPV(mask, masklen); if (flags) { if (virDomainPinVcpuFlags(dom, vcpu, maps, masklen, flags) < 0) _croak_error(); } else { if (virDomainPinVcpu(dom, vcpu, maps, masklen) < 0) _croak_error(); } void pin_emulator(dom, mask, flags=0) virDomainPtr dom; SV *mask; unsigned int flags; PREINIT: STRLEN masklen; unsigned char *maps; PPCODE: maps = (unsigned char *)SvPV(mask, masklen); if (virDomainPinEmulator(dom, maps, masklen, flags) < 0) _croak_error(); SV * get_emulator_pin_info(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: unsigned char *cpumaps; int maplen; virNodeInfo nodeinfo; int nCpus; CODE: if (virNodeGetInfo(virDomainGetConnect(dom), &nodeinfo) < 0) _croak_error(); nCpus = VIR_NODEINFO_MAXCPUS(nodeinfo); maplen = VIR_CPU_MAPLEN(nCpus); Newx(cpumaps, maplen, unsigned char); if ((virDomainGetEmulatorPinInfo(dom, cpumaps, maplen, flags)) < 0) { Safefree(cpumaps); _croak_error(); } RETVAL = newSVpvn((char*)cpumaps, maplen); Safefree(cpumaps); OUTPUT: RETVAL void get_iothread_info(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainIOThreadInfoPtr *iothrinfo; int niothreads; int i; PPCODE: if ((niothreads = virDomainGetIOThreadInfo(dom, &iothrinfo, flags)) < 0) _croak_error(); EXTEND(SP, niothreads); for (i = 0 ; i < niothreads ; i++) { HV *rec = newHV(); (void)hv_store(rec, "number", 6, newSViv(iothrinfo[i]->iothread_id), 0); (void)hv_store(rec, "affinity", 8, newSVpvn((char*)iothrinfo[i]->cpumap, iothrinfo[i]->cpumaplen), 0); PUSHs(newRV_noinc((SV *)rec)); } for (i = 0 ; i < niothreads ; i++) { virDomainIOThreadInfoFree(iothrinfo[i]); } free(iothrinfo); void pin_iothread(dom, iothread_id, mask, flags=0) virDomainPtr dom; unsigned int iothread_id; SV *mask; unsigned int flags; PREINIT: STRLEN masklen; unsigned char *maps; PPCODE: maps = (unsigned char *)SvPV(mask, masklen); if (virDomainPinIOThread(dom, iothread_id, maps, masklen, flags) < 0) _croak_error(); void add_iothread(dom, iothread_id, flags=0) virDomainPtr dom; unsigned int iothread_id; unsigned int flags; PPCODE: if (virDomainAddIOThread(dom, iothread_id, flags) < 0) _croak_error(); void del_iothread(dom, iothread_id, flags=0) virDomainPtr dom; unsigned int iothread_id; unsigned int flags; PPCODE: if (virDomainDelIOThread(dom, iothread_id, flags) < 0) _croak_error(); void set_iothread(dom, iothread_id, newparams, flags=0) virDomainPtr dom; unsigned int iothread_id; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params; size_t nparams; PPCODE: nparams = 3; Newx(params, nparams, virTypedParameter); strncpy(params[0].field, VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, VIR_TYPED_PARAM_FIELD_LENGTH); params[0].type = VIR_TYPED_PARAM_ULLONG; strncpy(params[1].field, VIR_DOMAIN_IOTHREAD_POLL_GROW, VIR_TYPED_PARAM_FIELD_LENGTH); params[1].type = VIR_TYPED_PARAM_UINT; strncpy(params[2].field, VIR_DOMAIN_IOTHREAD_POLL_SHRINK, VIR_TYPED_PARAM_FIELD_LENGTH); params[2].type = VIR_TYPED_PARAM_UINT; nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virDomainSetIOThreadParams(dom, iothread_id, params, nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } vir_typed_param_safe_free(params, nparams); int num_of_snapshots(dom, flags=0) virDomainPtr dom; unsigned int flags; CODE: if ((RETVAL = virDomainSnapshotNum(dom, flags)) < 0) _croak_error(); OUTPUT: RETVAL void list_snapshot_names(dom, maxnames, flags=0) virDomainPtr dom; int maxnames; unsigned int flags; PREINIT: char **names; int nsnap; int i; PPCODE: Newx(names, maxnames, char *); if ((nsnap = virDomainSnapshotListNames(dom, names, maxnames, flags)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nsnap); for (i = 0 ; i < nsnap ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); void list_all_snapshots(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainSnapshotPtr *domsss; int i, ndomss; SV *domssrv; PPCODE: if ((ndomss = virDomainListAllSnapshots(dom, &domsss, flags)) < 0) _croak_error(); EXTEND(SP, ndomss); for (i = 0 ; i < ndomss ; i++) { domssrv = sv_newmortal(); sv_setref_pv(domssrv, "Sys::Virt::DomainSnapshot", domsss[i]); PUSHs(domssrv); } free(domsss); void list_all_checkpoints(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainCheckpointPtr *domcps; int i, ndomcp; SV *domcprv; PPCODE: if ((ndomcp = virDomainListAllCheckpoints(dom, &domcps, flags)) < 0) _croak_error(); EXTEND(SP, ndomcp); for (i = 0 ; i < ndomcp ; i++) { domcprv = sv_newmortal(); sv_setref_pv(domcprv, "Sys::Virt::DomainCheckpoint", domcps[i]); PUSHs(domcprv); } free(domcps); int has_current_snapshot(dom, flags=0) virDomainPtr dom; unsigned int flags; CODE: if ((RETVAL = virDomainHasCurrentSnapshot(dom, flags)) < 0) _croak_error(); OUTPUT: RETVAL virDomainSnapshotPtr current_snapshot(dom, flags=0) virDomainPtr dom; unsigned int flags; CODE: if (!(RETVAL = virDomainSnapshotCurrent(dom, flags))) _croak_error(); OUTPUT: RETVAL void fs_trim(dom, mountPoint, minimumsv, flags=0) virDomainPtr dom; const char *mountPoint; SV *minimumsv; unsigned int flags; PREINIT: unsigned long long minimum; PPCODE: minimum = virt_SvIVull(minimumsv); if (virDomainFSTrim(dom, mountPoint, minimum, flags) < 0) _croak_error(); void fs_freeze(dom, mountPointsSV, flags=0) virDomainPtr dom; SV *mountPointsSV; unsigned int flags; PREINIT: AV *mountPointsAV; const char **mountPoints; unsigned int nMountPoints; unsigned int i; PPCODE: mountPointsAV = (AV*)SvRV(mountPointsSV); nMountPoints = av_len(mountPointsAV) + 1; if (nMountPoints) { Newx(mountPoints, nMountPoints, const char *); for (i = 0 ; i < nMountPoints ; i++) { SV **mountPoint = av_fetch(mountPointsAV, i, 0); mountPoints[i] = SvPV_nolen(*mountPoint); } } else { mountPoints = NULL; } if (virDomainFSFreeze(dom, mountPoints, nMountPoints, flags) < 0) { Safefree(mountPoints); _croak_error(); } Safefree(mountPoints); void fs_thaw(dom, mountPointsSV, flags=0) virDomainPtr dom; SV *mountPointsSV; unsigned int flags; PREINIT: AV *mountPointsAV; const char **mountPoints; unsigned int nMountPoints; unsigned int i; PPCODE: mountPointsAV = (AV*)SvRV(mountPointsSV); nMountPoints = av_len(mountPointsAV) + 1; if (nMountPoints) { Newx(mountPoints, nMountPoints, const char *); for (i = 0 ; i < nMountPoints ; i++) { SV **mountPoint = av_fetch(mountPointsAV, i, 0); mountPoints[i] = SvPV_nolen(*mountPoint); } } else { mountPoints = NULL; } if (virDomainFSThaw(dom, mountPoints, nMountPoints, flags) < 0) { Safefree(mountPoints); _croak_error(); } Safefree(mountPoints); void get_fs_info(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: virDomainFSInfoPtr *info; int ninfo; size_t i, j; PPCODE: if ((ninfo = virDomainGetFSInfo(dom, &info, flags)) < 0) _croak_error(); EXTEND(SP, ninfo); for (i = 0 ; i < ninfo ; i++) { HV *hv = newHV(); AV *av = newAV(); (void)hv_store(hv, "mountpoint", 10, newSVpv(info[i]->mountpoint, 0), 0); (void)hv_store(hv, "name", 4, newSVpv(info[i]->name, 0), 0); (void)hv_store(hv, "fstype", 6, newSVpv(info[i]->fstype, 0), 0); for (j = 0; j < info[i]->ndevAlias; j++) av_push(av, newSVpv(info[i]->devAlias[j], 0)); (void)hv_store(hv, "devalias", 8, newRV_noinc((SV*)av), 0); virDomainFSInfoFree(info[i]); PUSHs(newRV_noinc((SV*)hv)); } free(info); void get_interface_addresses(dom, src, flags=0) virDomainPtr dom; unsigned int src; unsigned int flags; PREINIT: virDomainInterfacePtr *info; int ninfo; size_t i, j; PPCODE: if ((ninfo = virDomainInterfaceAddresses(dom, &info, src, flags)) < 0) _croak_error(); EXTEND(SP, ninfo); for (i = 0; i < ninfo; i++) { HV *hv = newHV(); AV *av = newAV(); (void)hv_store(hv, "name", 4, newSVpv(info[i]->name, 0), 0); if (info[i]->hwaddr) { (void)hv_store(hv, "hwaddr", 6, newSVpv(info[i]->hwaddr, 0), 0); } for (j = 0; j < info[i]->naddrs; j++) { HV *subhv = newHV(); (void)hv_store(subhv, "type", 4, newSViv(info[i]->addrs[j].type), 0); (void)hv_store(subhv, "addr", 4, newSVpv(info[i]->addrs[j].addr, 0), 0); (void)hv_store(subhv, "prefix", 6, newSViv(info[i]->addrs[j].prefix), 0); av_push(av, newRV_noinc((SV*)subhv)); } (void)hv_store(hv, "addrs", 5, newRV_noinc((SV*)av), 0); virDomainInterfaceFree(info[i]); PUSHs(newRV_noinc((SV*)hv)); } free(info); void send_process_signal(dom, pidsv, signum, flags=0) virDomainPtr dom; SV *pidsv; unsigned int signum; unsigned int flags; PREINIT: long long pid; PPCODE: pid = virt_SvIVull(pidsv); if (virDomainSendProcessSignal(dom, pid, signum, flags) < 0) _croak_error(); void set_block_threshold(dom, dev, thresholdsv, flags=0) virDomainPtr dom; const char *dev; SV *thresholdsv; unsigned int flags; PREINIT: unsigned long long threshold; PPCODE: threshold = virt_SvIVull(thresholdsv); if (virDomainSetBlockThreshold(dom, dev, threshold, 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 set_agent_response_timeout(dom, timeout, flags=0) virDomainPtr dom; int timeout; unsigned int flags; PPCODE: if (virDomainAgentSetResponseTimeout(dom, timeout, flags) < 0) _croak_error(); void backup_begin(dom, backupxmlsv, checkpointxmlsv, flags=0) virDomainPtr dom; SV *backupxmlsv; SV *checkpointxmlsv; unsigned int flags; PREINIT: const char *backupxml = NULL; const char *checkpointxml = NULL; CODE: if (SvOK(backupxmlsv)) backupxml = SvPV_nolen(backupxmlsv); if (SvOK(checkpointxmlsv)) checkpointxml = SvPV_nolen(checkpointxmlsv); if (virDomainBackupBegin(dom, backupxml, checkpointxml, flags) < 0) _croak_error(); SV * backup_get_xml_description(dom, flags=0) virDomainPtr dom; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virDomainBackupGetXMLDesc(dom, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void authorized_ssh_keys_get(dom, user, flags = 0) virDomainPtr dom; const char *user; unsigned int flags; PREINIT: int ret; char **keys = NULL; unsigned int i; PPCODE: if ((ret = virDomainAuthorizedSSHKeysGet(dom, user, &keys, flags)) < 0) _croak_error(); EXTEND(SP, ret); for (i = 0 ; i < ret ; i++) { PUSHs(sv_2mortal(newSVpv(keys[i], 0))); free(keys[i]); } free(keys); void authorized_ssh_keys_set(dom, user, keysSV, flags = 0) virDomainPtr dom; const char *user; SV *keysSV; unsigned int flags; PREINIT: AV *keysAV; const char **keys; unsigned int nkeys; unsigned int i; PPCODE: keysAV = (AV*)SvRV(keysSV); nkeys = av_len(keysAV) + 1; if (nkeys) { Newx(keys, nkeys, const char *); for (i = 0 ; i < nkeys ; i++) { SV **mountPoint = av_fetch(keysAV, i, 0); keys[i] = SvPV_nolen(*mountPoint); } } else { keys = NULL; } if (virDomainAuthorizedSSHKeysSet(dom, user, keys, nkeys, flags) < 0) { Safefree(keys); _croak_error(); } Safefree(keys); void get_messages(dom, flags = 0) virDomainPtr dom; unsigned int flags; PREINIT: int ret; char **msgs = NULL; unsigned int i; PPCODE: if ((ret = virDomainGetMessages(dom, &msgs, flags)) < 0) _croak_error(); EXTEND(SP, ret); for (i = 0 ; i < ret ; i++) { PUSHs(sv_2mortal(newSVpv(msgs[i], 0))); free(msgs[i]); } free(msgs); void start_dirty_rate_calc(dom, secs, flags = 0) virDomainPtr dom; int secs; unsigned int flags; PPCODE: if ((virDomainStartDirtyRateCalc(dom, secs, flags) < 0)) _croak_error(); void destroy(dom_rv, flags=0) SV *dom_rv; unsigned int flags; PREINIT: virDomainPtr dom; PPCODE: dom = (virDomainPtr)SvIV((SV*)SvRV(dom_rv)); if (flags) { if (virDomainDestroyFlags(dom, flags) < 0) _croak_error(); } else { if (virDomainDestroy(dom) < 0) _croak_error(); } void DESTROY(dom_rv) SV *dom_rv; PREINIT: virDomainPtr dom; PPCODE: dom = (virDomainPtr)SvIV((SV*)SvRV(dom_rv)); if (dom) { virDomainFree(dom); sv_setiv((SV*)SvRV(dom_rv), 0); } MODULE = Sys::Virt::Network PACKAGE = Sys::Virt::Network virNetworkPtr _create_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (flags) { if (!(RETVAL = virNetworkCreateXMLFlags(con, xml, flags))) _croak_error(); } else { if (!(RETVAL = virNetworkCreateXML(con, xml))) _croak_error(); } OUTPUT: RETVAL virNetworkPtr _define_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (flags) { if (!(RETVAL = virNetworkDefineXMLFlags(con, xml, flags))) _croak_error(); } else { if (!(RETVAL = virNetworkDefineXML(con, xml))) _croak_error(); } OUTPUT: RETVAL virNetworkPtr _lookup_by_name(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virNetworkLookupByName(con, name))) _croak_error(); OUTPUT: RETVAL virNetworkPtr _lookup_by_uuid(con, uuid) virConnectPtr con; const unsigned char *uuid; CODE: if (!(RETVAL = virNetworkLookupByUUID(con, uuid))) _croak_error(); OUTPUT: RETVAL virNetworkPtr _lookup_by_uuid_string(con, uuid) virConnectPtr con; const char *uuid; CODE: if (!(RETVAL = virNetworkLookupByUUIDString(con, uuid))) _croak_error(); OUTPUT: RETVAL SV * get_uuid(net) virNetworkPtr net; PREINIT: unsigned char rawuuid[VIR_UUID_BUFLEN]; CODE: if ((virNetworkGetUUID(net, rawuuid)) < 0) _croak_error(); RETVAL = newSVpv((char*)rawuuid, sizeof(rawuuid)); OUTPUT: RETVAL SV * get_uuid_string(net) virNetworkPtr net; PREINIT: char uuid[VIR_UUID_STRING_BUFLEN]; CODE: if ((virNetworkGetUUIDString(net, uuid)) < 0) _croak_error(); RETVAL = newSVpv(uuid, 0); OUTPUT: RETVAL const char * get_name(net) virNetworkPtr net; CODE: if (!(RETVAL = virNetworkGetName(net))) _croak_error(); OUTPUT: RETVAL int is_active(net) virNetworkPtr net; CODE: if ((RETVAL = virNetworkIsActive(net)) < 0) _croak_error(); OUTPUT: RETVAL int is_persistent(net) virNetworkPtr net; CODE: if ((RETVAL = virNetworkIsPersistent(net)) < 0) _croak_error(); OUTPUT: RETVAL SV * get_bridge_name(net) virNetworkPtr net; PREINIT: char *name; CODE: if (!(name = virNetworkGetBridgeName(net))) _croak_error(); RETVAL = newSVpv(name, 0); free(name); OUTPUT: RETVAL SV * get_xml_description(net, flags=0) virNetworkPtr net; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virNetworkGetXMLDesc(net, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void undefine(net) virNetworkPtr net; PPCODE: if (virNetworkUndefine(net) < 0) _croak_error(); void create(net) virNetworkPtr net; PPCODE: if (virNetworkCreate(net) < 0) _croak_error(); void update(net, command, section, parentIndex, xml, flags=0) virNetworkPtr net; unsigned int command; unsigned int section; int parentIndex; const char *xml; unsigned int flags; PPCODE: if (virNetworkUpdate(net, command, section, parentIndex, xml, flags) < 0) _croak_error(); void set_autostart(net, autostart) virNetworkPtr net; int autostart; PPCODE: if (virNetworkSetAutostart(net, autostart) < 0) _croak_error(); int get_autostart(net) virNetworkPtr net; PREINIT: int autostart; CODE: if (virNetworkGetAutostart(net, &autostart) < 0) _croak_error(); RETVAL = autostart; OUTPUT: RETVAL void get_dhcp_leases(net, macsv=&PL_sv_undef, flags=0) virNetworkPtr net; SV *macsv; unsigned int flags; PREINIT: virNetworkDHCPLeasePtr *leases = NULL; int nleases; const char *mac = NULL; int i; PPCODE: if (SvOK(macsv)) mac = SvPV_nolen(macsv); if ((nleases = virNetworkGetDHCPLeases(net, mac, &leases, flags)) < 0) _croak_error(); EXTEND(SP, nleases); for (i = 0 ; i < nleases ; i++) { HV *hv = newHV(); (void)hv_store(hv, "iface", 5, newSVpv(leases[i]->iface, 0), 0); (void)hv_store(hv, "expirytime", 10, virt_newSVll(leases[i]->expirytime), 0); (void)hv_store(hv, "type", 4, newSViv(leases[i]->type), 0); (void)hv_store(hv, "mac", 3, newSVpv(leases[i]->mac, 0), 0); (void)hv_store(hv, "iaid", 4, newSVpv(leases[i]->iaid, 0), 0); (void)hv_store(hv, "ipaddr", 6, newSVpv(leases[i]->ipaddr, 0), 0); (void)hv_store(hv, "prefix", 6, newSViv(leases[i]->prefix), 0); (void)hv_store(hv, "hostname", 8, newSVpv(leases[i]->hostname, 0), 0); (void)hv_store(hv, "clientid", 8, newSVpv(leases[i]->clientid, 0), 0); virNetworkDHCPLeaseFree(leases[i]); PUSHs(newRV_noinc((SV*)hv)); } free(leases); void list_all_ports(net, flags=0) virNetworkPtr net; unsigned int flags; PREINIT: virNetworkPortPtr *ports; int i, nport; SV *portrv; PPCODE: if ((nport = virNetworkListAllPorts(net, &ports, flags)) < 0) _croak_error(); EXTEND(SP, nport); for (i = 0 ; i < nport ; i++) { portrv = sv_newmortal(); sv_setref_pv(portrv, "Sys::Virt::NetworkPort", ports[i]); PUSHs(portrv); } free(ports); void destroy(net_rv) SV *net_rv; PREINIT: virNetworkPtr net; PPCODE: net = (virNetworkPtr)SvIV((SV*)SvRV(net_rv)); if (virNetworkDestroy(net) < 0) _croak_error(); void DESTROY(net_rv) SV *net_rv; PREINIT: virNetworkPtr net; PPCODE: net = (virNetworkPtr)SvIV((SV*)SvRV(net_rv)); if (net) { virNetworkFree(net); sv_setiv((SV*)SvRV(net_rv), 0); } MODULE = Sys::Virt::NetworkPort PACKAGE = Sys::Virt::NetworkPort virNetworkPortPtr _create_xml(net, xml, flags=0) virNetworkPtr net; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virNetworkPortCreateXML(net, xml, flags))) _croak_error(); OUTPUT: RETVAL virNetworkPortPtr _lookup_by_uuid(net, uuid) virNetworkPtr net; const unsigned char *uuid; CODE: if (!(RETVAL = virNetworkPortLookupByUUID(net, uuid))) _croak_error(); OUTPUT: RETVAL virNetworkPortPtr _lookup_by_uuid_string(net, uuid) virNetworkPtr net; const char *uuid; CODE: if (!(RETVAL = virNetworkPortLookupByUUIDString(net, uuid))) _croak_error(); OUTPUT: RETVAL SV * get_uuid(port) virNetworkPortPtr port; PREINIT: unsigned char rawuuid[VIR_UUID_BUFLEN]; CODE: if ((virNetworkPortGetUUID(port, rawuuid)) < 0) _croak_error(); RETVAL = newSVpv((char*)rawuuid, sizeof(rawuuid)); OUTPUT: RETVAL SV * get_uuid_string(port) virNetworkPortPtr port; PREINIT: char uuid[VIR_UUID_STRING_BUFLEN]; CODE: if ((virNetworkPortGetUUIDString(port, uuid)) < 0) _croak_error(); RETVAL = newSVpv(uuid, 0); OUTPUT: RETVAL SV * get_xml_description(port, flags=0) virNetworkPortPtr port; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virNetworkPortGetXMLDesc(port, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL HV * get_parameters(port, flags=0) virNetworkPortPtr port; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; CODE: if (virNetworkPortGetParameters(port, ¶ms, &nparams, flags) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } RETVAL = vir_typed_param_to_hv(params, nparams); vir_typed_param_safe_free(params, nparams); OUTPUT: RETVAL void set_parameters(port, newparams, flags=0) virNetworkPortPtr port; HV *newparams; unsigned int flags; PREINIT: virTypedParameterPtr params = NULL; int nparams = 0; PPCODE: if (virNetworkPortGetParameters(port, ¶ms, &nparams, 0) < 0) { vir_typed_param_safe_free(params, nparams); _croak_error(); } nparams = vir_typed_param_from_hv(newparams, params, nparams); if (virNetworkPortSetParameters(port, params, nparams, flags) < 0) _croak_error(); vir_typed_param_safe_free(params, nparams); void delete(port, flags=0) virNetworkPortPtr port; unsigned int flags; PPCODE: if (virNetworkPortDelete(port, flags) < 0) _croak_error(); void DESTROY(port_rv) SV *port_rv; PREINIT: virNetworkPortPtr port; PPCODE: port = (virNetworkPortPtr)SvIV((SV*)SvRV(port_rv)); if (port) { virNetworkPortFree(port); sv_setiv((SV*)SvRV(port_rv), 0); } MODULE = Sys::Virt::StoragePool PACKAGE = Sys::Virt::StoragePool virStoragePoolPtr _create_xml(con, xml) virConnectPtr con; const char *xml; CODE: if (!(RETVAL = virStoragePoolCreateXML(con, xml, 0))) _croak_error(); OUTPUT: RETVAL virStoragePoolPtr _define_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virStoragePoolDefineXML(con, xml, flags))) _croak_error(); OUTPUT: RETVAL virStoragePoolPtr _lookup_by_name(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virStoragePoolLookupByName(con, name))) _croak_error(); OUTPUT: RETVAL virStoragePoolPtr _lookup_by_uuid(con, uuid) virConnectPtr con; const unsigned char *uuid; CODE: if (!(RETVAL = virStoragePoolLookupByUUID(con, uuid))) _croak_error(); OUTPUT: RETVAL virStoragePoolPtr _lookup_by_uuid_string(con, uuid) virConnectPtr con; const char *uuid; CODE: if (!(RETVAL = virStoragePoolLookupByUUIDString(con, uuid))) _croak_error(); OUTPUT: RETVAL virStoragePoolPtr _lookup_by_volume(vol) virStorageVolPtr vol; CODE: if (!(RETVAL = virStoragePoolLookupByVolume(vol))) _croak_error(); OUTPUT: RETVAL virStoragePoolPtr _lookup_by_target_path(con, path) virConnectPtr con; const char *path; CODE: if (!(RETVAL = virStoragePoolLookupByTargetPath(con, path))) _croak_error(); OUTPUT: RETVAL SV * get_uuid(pool) virStoragePoolPtr pool; PREINIT: unsigned char rawuuid[VIR_UUID_BUFLEN]; CODE: if ((virStoragePoolGetUUID(pool, rawuuid)) < 0) _croak_error(); RETVAL = newSVpv((char*)rawuuid, sizeof(rawuuid)); OUTPUT: RETVAL SV * get_uuid_string(pool) virStoragePoolPtr pool; PREINIT: char uuid[VIR_UUID_STRING_BUFLEN]; CODE: if ((virStoragePoolGetUUIDString(pool, uuid)) < 0) _croak_error(); RETVAL = newSVpv(uuid, 0); OUTPUT: RETVAL const char * get_name(pool) virStoragePoolPtr pool; CODE: if (!(RETVAL = virStoragePoolGetName(pool))) _croak_error(); OUTPUT: RETVAL int is_active(pool) virStoragePoolPtr pool; CODE: if ((RETVAL = virStoragePoolIsActive(pool)) < 0) _croak_error(); OUTPUT: RETVAL int is_persistent(pool) virStoragePoolPtr pool; CODE: if ((RETVAL = virStoragePoolIsPersistent(pool)) < 0) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(pool, flags=0) virStoragePoolPtr pool; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virStoragePoolGetXMLDesc(pool, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void undefine(pool) virStoragePoolPtr pool; PPCODE: if (virStoragePoolUndefine(pool) < 0) _croak_error(); void create(pool) virStoragePoolPtr pool; PPCODE: if (virStoragePoolCreate(pool, 0) < 0) _croak_error(); void refresh(pool, flags=0) virStoragePoolPtr pool; int flags; PPCODE: if (virStoragePoolRefresh(pool, flags) < 0) _croak_error(); void build(pool, flags=0) virStoragePoolPtr pool; int flags; PPCODE: if (virStoragePoolBuild(pool, flags) < 0) _croak_error(); void delete(pool, flags=0) virStoragePoolPtr pool; int flags; PPCODE: if (virStoragePoolDelete(pool, flags) < 0) _croak_error(); void set_autostart(pool, autostart) virStoragePoolPtr pool; int autostart; PPCODE: if (virStoragePoolSetAutostart(pool, autostart) < 0) _croak_error(); int get_autostart(pool) virStoragePoolPtr pool; PREINIT: int autostart; CODE: if (virStoragePoolGetAutostart(pool, &autostart) < 0) _croak_error(); RETVAL = autostart; OUTPUT: RETVAL HV * get_info(pool) virStoragePoolPtr pool; PREINIT: virStoragePoolInfo info; CODE: if (virStoragePoolGetInfo(pool, &info) < 0) _croak_error(); RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "state", 5, newSViv(info.state), 0); (void)hv_store (RETVAL, "capacity", 8, virt_newSVull(info.capacity), 0); (void)hv_store (RETVAL, "allocation", 10, virt_newSVull(info.allocation), 0); (void)hv_store (RETVAL, "available", 9, virt_newSVull(info.available), 0); OUTPUT: RETVAL void destroy(pool_rv) SV *pool_rv; PREINIT: virStoragePoolPtr pool; PPCODE: pool = (virStoragePoolPtr)SvIV((SV*)SvRV(pool_rv)); if (virStoragePoolDestroy(pool) < 0) _croak_error(); int num_of_storage_volumes(pool) virStoragePoolPtr pool; CODE: if ((RETVAL = virStoragePoolNumOfVolumes(pool)) < 0) _croak_error(); OUTPUT: RETVAL void list_storage_vol_names(pool, maxnames) virStoragePoolPtr pool; int maxnames; PREINIT: char **names; int i, nnet; PPCODE: Newx(names, maxnames, char *); if ((nnet = virStoragePoolListVolumes(pool, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); void list_all_volumes(pool, flags=0) virStoragePoolPtr pool; unsigned int flags; PREINIT: virStorageVolPtr *vols; int i, nvolss; SV *volssrv; PPCODE: if ((nvolss = virStoragePoolListAllVolumes(pool, &vols, flags)) < 0) _croak_error(); EXTEND(SP, nvolss); for (i = 0 ; i < nvolss ; i++) { volssrv = sv_newmortal(); sv_setref_pv(volssrv, "Sys::Virt::StorageVol", vols[i]); PUSHs(volssrv); } free(vols); void DESTROY(pool_rv) SV *pool_rv; PREINIT: virStoragePoolPtr pool; PPCODE: pool = (virStoragePoolPtr)SvIV((SV*)SvRV(pool_rv)); if (pool) { virStoragePoolFree(pool); sv_setiv((SV*)SvRV(pool_rv), 0); } MODULE = Sys::Virt::StorageVol PACKAGE = Sys::Virt::StorageVol virStorageVolPtr _create_xml(pool, xml, flags=0) virStoragePoolPtr pool; const char *xml; int flags; CODE: if (!(RETVAL = virStorageVolCreateXML(pool, xml, flags))) _croak_error(); OUTPUT: RETVAL virStorageVolPtr _create_xml_from(pool, xml, clone, flags=0) virStoragePoolPtr pool; const char *xml; virStorageVolPtr clone; int flags; CODE: if (!(RETVAL = virStorageVolCreateXMLFrom(pool, xml, clone, flags))) _croak_error(); OUTPUT: RETVAL virStorageVolPtr _lookup_by_name(pool, name) virStoragePoolPtr pool; const char *name; CODE: if (!(RETVAL = virStorageVolLookupByName(pool, name))) _croak_error(); OUTPUT: RETVAL virStorageVolPtr _lookup_by_key(con, key) virConnectPtr con; const char *key; CODE: if (!(RETVAL = virStorageVolLookupByKey(con, key))) _croak_error(); OUTPUT: RETVAL virStorageVolPtr _lookup_by_path(con, path) virConnectPtr con; const char *path; CODE: if (!(RETVAL = virStorageVolLookupByPath(con, path))) _croak_error(); OUTPUT: RETVAL const char * get_name(vol) virStorageVolPtr vol; CODE: if (!(RETVAL = virStorageVolGetName(vol))) _croak_error(); OUTPUT: RETVAL const char * get_key(vol) virStorageVolPtr vol; CODE: if (!(RETVAL = virStorageVolGetKey(vol))) _croak_error(); OUTPUT: RETVAL const char * get_path(vol) virStorageVolPtr vol; CODE: if (!(RETVAL = virStorageVolGetPath(vol))) _croak_error(); OUTPUT: RETVAL void resize(vol, capacity, flags=0) virStorageVolPtr vol; SV *capacity; unsigned int flags; PPCODE: if (virStorageVolResize(vol, virt_SvIVull(capacity), flags) < 0) _croak_error(); SV * get_xml_description(vol, flags=0) virStorageVolPtr vol; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virStorageVolGetXMLDesc(vol, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void delete(vol, flags=0) virStorageVolPtr vol; unsigned int flags; PPCODE: if (virStorageVolDelete(vol, flags) < 0) _croak_error(); void wipe(vol, flags=0) virStorageVolPtr vol; unsigned int flags; PPCODE: if (virStorageVolWipe(vol, flags) < 0) _croak_error(); void wipe_pattern(vol, algorithm, flags=0) virStorageVolPtr vol; unsigned int algorithm unsigned int flags; PPCODE: if (virStorageVolWipePattern(vol, algorithm, flags) < 0) _croak_error(); HV * get_info(vol, flags=0) virStorageVolPtr vol; unsigned int flags; PREINIT: virStorageVolInfo info; CODE: if (flags != 0) { if (virStorageVolGetInfoFlags(vol, &info, flags) < 0) _croak_error(); } else { if (virStorageVolGetInfo(vol, &info) < 0) _croak_error(); } RETVAL = (HV *)sv_2mortal((SV*)newHV()); (void)hv_store (RETVAL, "type", 4, newSViv(info.type), 0); (void)hv_store (RETVAL, "capacity", 8, virt_newSVull(info.capacity), 0); (void)hv_store (RETVAL, "allocation", 10, virt_newSVull(info.allocation), 0); OUTPUT: RETVAL void download(vol, st, offsetsv, lengthsv, flags=0) virStorageVolPtr vol; virStreamPtr st; SV *offsetsv; SV *lengthsv; unsigned int flags; PREINIT: unsigned long long offset; unsigned long long length; PPCODE: offset = virt_SvIVull(offsetsv); length = virt_SvIVull(lengthsv); if (virStorageVolDownload(vol, st, offset, length, flags) < 0) _croak_error(); void upload(vol, st, offsetsv, lengthsv, flags=0) virStorageVolPtr vol; virStreamPtr st; SV *offsetsv; SV *lengthsv; unsigned int flags; PREINIT: unsigned long long offset; unsigned long long length; PPCODE: offset = virt_SvIVull(offsetsv); length = virt_SvIVull(lengthsv); if (virStorageVolUpload(vol, st, offset, length, flags) < 0) _croak_error(); void DESTROY(vol_rv) SV *vol_rv; PREINIT: virStorageVolPtr vol; PPCODE: vol = (virStorageVolPtr)SvIV((SV*)SvRV(vol_rv)); if (vol) { virStorageVolFree(vol); sv_setiv((SV*)SvRV(vol_rv), 0); } MODULE = Sys::Virt::NodeDevice PACKAGE = Sys::Virt::NodeDevice virNodeDevicePtr _create_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virNodeDeviceCreateXML(con, xml, flags))) _croak_error(); OUTPUT: RETVAL virNodeDevicePtr _define_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virNodeDeviceDefineXML(con, xml, flags))) _croak_error(); OUTPUT: RETVAL virNodeDevicePtr _lookup_by_name(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virNodeDeviceLookupByName(con, name))) _croak_error(); OUTPUT: RETVAL virNodeDevicePtr _lookup_scsihost_by_wwn(con, wwnn, wwpn, flags=0) virConnectPtr con; const char *wwnn; const char *wwpn; unsigned int flags; CODE: if (!(RETVAL = virNodeDeviceLookupSCSIHostByWWN(con, wwnn, wwpn, flags))) _croak_error(); OUTPUT: RETVAL const char * get_name(dev) virNodeDevicePtr dev; CODE: if (!(RETVAL = virNodeDeviceGetName(dev))) _croak_error(); OUTPUT: RETVAL const char * get_parent(dev) virNodeDevicePtr dev; CODE: if (!(RETVAL = virNodeDeviceGetParent(dev))) { if (virGetLastError() != NULL) _croak_error(); } OUTPUT: RETVAL SV * get_xml_description(dev, flags=0) virNodeDevicePtr dev; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virNodeDeviceGetXMLDesc(dev, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void dettach(dev, driversv, flags=0) virNodeDevicePtr dev; SV *driversv; unsigned int flags; PREINIT: const char *driver = NULL; STRLEN len; PPCODE: if (SvOK(driversv)) { driver = SvPV(driversv, len); } if (flags || driver) { if (virNodeDeviceDetachFlags(dev, driver, flags) < 0) _croak_error(); } else { if (virNodeDeviceDettach(dev) < 0) _croak_error(); } void reattach(dev) virNodeDevicePtr dev; PPCODE: if (virNodeDeviceReAttach(dev) < 0) _croak_error(); void reset(dev) virNodeDevicePtr dev; PPCODE: if (virNodeDeviceReset(dev) < 0) _croak_error(); void create(dev, flags=0) virNodeDevicePtr dev; unsigned int flags; PPCODE: if (virNodeDeviceCreate(dev, flags) < 0) _croak_error(); void undefine(dev, flags=0) virNodeDevicePtr dev; unsigned int flags; PPCODE: if (virNodeDeviceUndefine(dev, flags) < 0) _croak_error(); void list_capabilities(dev) virNodeDevicePtr dev; PREINIT: int maxnames; char **names; int i, nnet; PPCODE: if ((maxnames = virNodeDeviceNumOfCaps(dev)) < 0) _croak_error(); Newx(names, maxnames, char *); if ((nnet = virNodeDeviceListCaps(dev, names, maxnames)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nnet); for (i = 0 ; i < nnet ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); void set_autostart(nodedev, autostart) virNodeDevicePtr nodedev; int autostart; PPCODE: if (virNodeDeviceSetAutostart(nodedev, autostart) < 0) _croak_error(); int get_autostart(nodedev) virNodeDevicePtr nodedev; PREINIT: int autostart; CODE: if (virNodeDeviceGetAutostart(nodedev, &autostart) < 0) _croak_error(); RETVAL = autostart; OUTPUT: RETVAL int is_active(nodedev) virNodeDevicePtr nodedev; CODE: if ((RETVAL = virNodeDeviceIsActive(nodedev)) < 0) _croak_error(); OUTPUT: RETVAL int is_persistent(nodedev) virNodeDevicePtr nodedev; CODE: if ((RETVAL = virNodeDeviceIsPersistent(nodedev)) < 0) _croak_error(); OUTPUT: RETVAL void destroy(dev_rv) SV *dev_rv; PREINIT: virNodeDevicePtr dev; PPCODE: dev = (virNodeDevicePtr)SvIV((SV*)SvRV(dev_rv)); if (virNodeDeviceDestroy(dev) < 0) _croak_error(); void DESTROY(dev_rv) SV *dev_rv; PREINIT: virNodeDevicePtr dev; PPCODE: dev = (virNodeDevicePtr)SvIV((SV*)SvRV(dev_rv)); if (dev) { virNodeDeviceFree(dev); sv_setiv((SV*)SvRV(dev_rv), 0); } MODULE = Sys::Virt::Interface PACKAGE = Sys::Virt::Interface virInterfacePtr _define_xml(con, xml, flags = 0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virInterfaceDefineXML(con, xml, flags))) _croak_error(); OUTPUT: RETVAL virInterfacePtr _lookup_by_name(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virInterfaceLookupByName(con, name))) _croak_error(); OUTPUT: RETVAL virInterfacePtr _lookup_by_mac(con, mac) virConnectPtr con; const char *mac; CODE: if (!(RETVAL = virInterfaceLookupByMACString(con, mac))) _croak_error(); OUTPUT: RETVAL const char * get_mac(iface) virInterfacePtr iface; CODE: if (!(RETVAL = virInterfaceGetMACString(iface))) _croak_error(); OUTPUT: RETVAL const char * get_name(iface) virInterfacePtr iface; CODE: if (!(RETVAL = virInterfaceGetName(iface))) _croak_error(); OUTPUT: RETVAL int is_active(iface) virInterfacePtr iface; CODE: if ((RETVAL = virInterfaceIsActive(iface)) < 0) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(iface, flags=0) virInterfacePtr iface; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virInterfaceGetXMLDesc(iface, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void undefine(iface) virInterfacePtr iface; PPCODE: if (virInterfaceUndefine(iface) < 0) _croak_error(); void create(iface, flags=0) virInterfacePtr iface; unsigned int flags; PPCODE: if (virInterfaceCreate(iface, flags) < 0) _croak_error(); void destroy(iface_rv, flags=0) SV *iface_rv; unsigned int flags; PREINIT: virInterfacePtr iface; PPCODE: iface = (virInterfacePtr)SvIV((SV*)SvRV(iface_rv)); if (virInterfaceDestroy(iface, flags) < 0) _croak_error(); void DESTROY(iface_rv) SV *iface_rv; PREINIT: virInterfacePtr iface; PPCODE: iface = (virInterfacePtr)SvIV((SV*)SvRV(iface_rv)); if (iface) { virInterfaceFree(iface); sv_setiv((SV*)SvRV(iface_rv), 0); } MODULE = Sys::Virt::Secret PACKAGE = Sys::Virt::Secret virSecretPtr _define_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virSecretDefineXML(con, xml, flags))) _croak_error(); OUTPUT: RETVAL virSecretPtr _lookup_by_usage(con, usageType, usageID) virConnectPtr con; int usageType; const char *usageID; CODE: if (!(RETVAL = virSecretLookupByUsage(con, usageType, usageID))) { _croak_error(); } OUTPUT: RETVAL virSecretPtr _lookup_by_uuid(con, uuid) virConnectPtr con; const unsigned char *uuid; CODE: if (!(RETVAL = virSecretLookupByUUID(con, uuid))) _croak_error(); OUTPUT: RETVAL virSecretPtr _lookup_by_uuid_string(con, uuid) virConnectPtr con; const char *uuid; CODE: if (!(RETVAL = virSecretLookupByUUIDString(con, uuid))) _croak_error(); OUTPUT: RETVAL SV * get_uuid(sec) virSecretPtr sec; PREINIT: unsigned char rawuuid[VIR_UUID_BUFLEN]; CODE: if ((virSecretGetUUID(sec, rawuuid)) < 0) _croak_error(); RETVAL = newSVpv((char*)rawuuid, sizeof(rawuuid)); OUTPUT: RETVAL SV * get_uuid_string(sec) virSecretPtr sec; PREINIT: char uuid[VIR_UUID_STRING_BUFLEN]; CODE: if ((virSecretGetUUIDString(sec, uuid)) < 0) _croak_error(); RETVAL = newSVpv(uuid, 0); OUTPUT: RETVAL const char * get_usage_id(sec) virSecretPtr sec; CODE: if (!(RETVAL = virSecretGetUsageID(sec))) _croak_error(); OUTPUT: RETVAL int get_usage_type(sec) virSecretPtr sec; CODE: if (!(RETVAL = virSecretGetUsageType(sec))) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(sec, flags=0) virSecretPtr sec; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virSecretGetXMLDesc(sec, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void undefine(sec) virSecretPtr sec; PPCODE: if (virSecretUndefine(sec) < 0) _croak_error(); void set_value(sec, value, flags=0) virSecretPtr sec; SV *value; unsigned int flags; PREINIT: unsigned char *bytes; STRLEN len; PPCODE: bytes = (unsigned char *)SvPV(value, len); if (virSecretSetValue(sec, bytes, len, flags) < 0) _croak_error(); SV * get_value(sec, flags=0) virSecretPtr sec; unsigned int flags; PREINIT: unsigned char *bytes; size_t len; CODE: if ((bytes = virSecretGetValue(sec, &len, flags)) == NULL) _croak_error(); RETVAL = newSVpv((char*)bytes, len); OUTPUT: RETVAL void DESTROY(sec_rv) SV *sec_rv; PREINIT: virSecretPtr sec; PPCODE: sec = (virSecretPtr)SvIV((SV*)SvRV(sec_rv)); if (sec) { virSecretFree(sec); sv_setiv((SV*)SvRV(sec_rv), 0); } MODULE = Sys::Virt::NWFilter PACKAGE = Sys::Virt::NWFilter virNWFilterPtr _define_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (flags) { if (!(RETVAL = virNWFilterDefineXMLFlags(con, xml, flags))) _croak_error(); } else { if (!(RETVAL = virNWFilterDefineXML(con, xml))) _croak_error(); } OUTPUT: RETVAL virNWFilterPtr _lookup_by_name(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virNWFilterLookupByName(con, name))) _croak_error(); OUTPUT: RETVAL virNWFilterPtr _lookup_by_uuid(con, uuid) virConnectPtr con; const unsigned char *uuid; CODE: if (!(RETVAL = virNWFilterLookupByUUID(con, uuid))) _croak_error(); OUTPUT: RETVAL virNWFilterPtr _lookup_by_uuid_string(con, uuid) virConnectPtr con; const char *uuid; CODE: if (!(RETVAL = virNWFilterLookupByUUIDString(con, uuid))) _croak_error(); OUTPUT: RETVAL SV * get_uuid(filter) virNWFilterPtr filter; PREINIT: unsigned char rawuuid[VIR_UUID_BUFLEN]; CODE: if ((virNWFilterGetUUID(filter, rawuuid)) < 0) _croak_error(); RETVAL = newSVpv((char*)rawuuid, sizeof(rawuuid)); OUTPUT: RETVAL SV * get_uuid_string(filter) virNWFilterPtr filter; PREINIT: char uuid[VIR_UUID_STRING_BUFLEN]; CODE: if ((virNWFilterGetUUIDString(filter, uuid)) < 0) _croak_error(); RETVAL = newSVpv(uuid, 0); OUTPUT: RETVAL const char * get_name(filter) virNWFilterPtr filter; CODE: if (!(RETVAL = virNWFilterGetName(filter))) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(filter, flags=0) virNWFilterPtr filter; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virNWFilterGetXMLDesc(filter, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void undefine(filter) virNWFilterPtr filter; PPCODE: if (virNWFilterUndefine(filter) < 0) _croak_error(); void DESTROY(filter_rv) SV *filter_rv; PREINIT: virNWFilterPtr filter; PPCODE: filter = (virNWFilterPtr)SvIV((SV*)SvRV(filter_rv)); if (filter) { virNWFilterFree(filter); sv_setiv((SV*)SvRV(filter_rv), 0); } MODULE = Sys::Virt::NWFilterBinding PACKAGE = Sys::Virt::NWFilterBinding virNWFilterBindingPtr _create_xml(con, xml, flags=0) virConnectPtr con; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virNWFilterBindingCreateXML(con, xml, flags))) _croak_error(); OUTPUT: RETVAL virNWFilterBindingPtr _lookup_by_port_dev(con, name) virConnectPtr con; const char *name; CODE: if (!(RETVAL = virNWFilterBindingLookupByPortDev(con, name))) _croak_error(); OUTPUT: RETVAL const char * get_port_dev(binding) virNWFilterBindingPtr binding; CODE: if (!(RETVAL = virNWFilterBindingGetPortDev(binding))) _croak_error(); OUTPUT: RETVAL const char * get_filter_name(binding) virNWFilterBindingPtr binding; CODE: if (!(RETVAL = virNWFilterBindingGetFilterName(binding))) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(binding, flags=0) virNWFilterBindingPtr binding; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virNWFilterBindingGetXMLDesc(binding, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void delete(binding) virNWFilterBindingPtr binding; PPCODE: if (virNWFilterBindingDelete(binding) < 0) _croak_error(); void DESTROY(binding_rv) SV *binding_rv; PREINIT: virNWFilterBindingPtr binding; PPCODE: binding = (virNWFilterBindingPtr)SvIV((SV*)SvRV(binding_rv)); if (binding) { virNWFilterBindingFree(binding); sv_setiv((SV*)SvRV(binding_rv), 0); } MODULE = Sys::Virt::DomainSnapshot PACKAGE = Sys::Virt::DomainSnapshot virDomainSnapshotPtr _create_xml(dom, xml, flags=0) virDomainPtr dom; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virDomainSnapshotCreateXML(dom, xml, flags))) _croak_error(); OUTPUT: RETVAL virDomainSnapshotPtr _lookup_by_name(dom, name, flags=0) virDomainPtr dom; const char *name; unsigned int flags; CODE: if (!(RETVAL = virDomainSnapshotLookupByName(dom, name, flags))) _croak_error(); OUTPUT: RETVAL const char * get_name(domss) virDomainSnapshotPtr domss; CODE: if (!(RETVAL = virDomainSnapshotGetName(domss))) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virDomainSnapshotGetXMLDesc(domss, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void revert_to(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; PPCODE: if (virDomainRevertToSnapshot(domss, flags) < 0) _croak_error(); void delete(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; PPCODE: if (virDomainSnapshotDelete(domss, flags) < 0) _croak_error(); virDomainSnapshotPtr get_parent(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; CODE: if (!(RETVAL = virDomainSnapshotGetParent(domss, flags))) _croak_error(); OUTPUT: RETVAL int num_of_child_snapshots(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; CODE: if ((RETVAL = virDomainSnapshotNumChildren(domss, flags)) < 0) _croak_error(); OUTPUT: RETVAL int is_current(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; CODE: if ((RETVAL = virDomainSnapshotIsCurrent(domss, flags)) < 0) _croak_error(); OUTPUT: RETVAL int has_metadata(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; CODE: if ((RETVAL = virDomainSnapshotHasMetadata(domss, flags)) < 0) _croak_error(); OUTPUT: RETVAL void list_child_snapshot_names(domss, maxnames, flags=0) virDomainSnapshotPtr domss; int maxnames; unsigned int flags; PREINIT: char **names; int nsnap; int i; PPCODE: Newx(names, maxnames, char *); if ((nsnap = virDomainSnapshotListChildrenNames(domss, names, maxnames, flags)) < 0) { Safefree(names); _croak_error(); } EXTEND(SP, nsnap); for (i = 0 ; i < nsnap ; i++) { PUSHs(sv_2mortal(newSVpv(names[i], 0))); free(names[i]); } Safefree(names); void list_all_children(domss, flags=0) virDomainSnapshotPtr domss; unsigned int flags; PREINIT: virDomainSnapshotPtr *domsss; int i, ndomss; SV *domssrv; PPCODE: if ((ndomss = virDomainSnapshotListAllChildren(domss, &domsss, flags)) < 0) _croak_error(); EXTEND(SP, ndomss); for (i = 0 ; i < ndomss ; i++) { domssrv = sv_newmortal(); sv_setref_pv(domssrv, "Sys::Virt::DomainSnapshot", domsss[i]); PUSHs(domssrv); } free(domsss); void DESTROY(domss_rv) SV *domss_rv; PREINIT: virDomainSnapshotPtr domss; PPCODE: domss = (virDomainSnapshotPtr)SvIV((SV*)SvRV(domss_rv)); if (domss) { virDomainSnapshotFree(domss); sv_setiv((SV*)SvRV(domss_rv), 0); } MODULE = Sys::Virt::DomainCheckpoint PACKAGE = Sys::Virt::DomainCheckpoint virDomainCheckpointPtr _create_xml(dom, xml, flags=0) virDomainPtr dom; const char *xml; unsigned int flags; CODE: if (!(RETVAL = virDomainCheckpointCreateXML(dom, xml, flags))) _croak_error(); OUTPUT: RETVAL virDomainCheckpointPtr _lookup_by_name(dom, name, flags=0) virDomainPtr dom; const char *name; unsigned int flags; CODE: if (!(RETVAL = virDomainCheckpointLookupByName(dom, name, flags))) _croak_error(); OUTPUT: RETVAL const char * get_name(domcp) virDomainCheckpointPtr domcp; CODE: if (!(RETVAL = virDomainCheckpointGetName(domcp))) _croak_error(); OUTPUT: RETVAL SV * get_xml_description(domcp, flags=0) virDomainCheckpointPtr domcp; unsigned int flags; PREINIT: char *xml; CODE: if (!(xml = virDomainCheckpointGetXMLDesc(domcp, flags))) _croak_error(); RETVAL = newSVpv(xml, 0); free(xml); OUTPUT: RETVAL void delete(domcp, flags=0) virDomainCheckpointPtr domcp; unsigned int flags; PPCODE: if (virDomainCheckpointDelete(domcp, flags) < 0) _croak_error(); virDomainCheckpointPtr get_parent(domcp, flags=0) virDomainCheckpointPtr domcp; unsigned int flags; CODE: if (!(RETVAL = virDomainCheckpointGetParent(domcp, flags))) _croak_error(); OUTPUT: RETVAL void list_all_children(domcp, flags=0) virDomainCheckpointPtr domcp; unsigned int flags; PREINIT: virDomainCheckpointPtr *domcps; int i, ndomcp; SV *domcprv; PPCODE: if ((ndomcp = virDomainCheckpointListAllChildren(domcp, &domcps, flags)) < 0) _croak_error(); EXTEND(SP, ndomcp); for (i = 0 ; i < ndomcp ; i++) { domcprv = sv_newmortal(); sv_setref_pv(domcprv, "Sys::Virt::DomainCheckpoint", domcps[i]); PUSHs(domcprv); } free(domcps); void DESTROY(domcp_rv) SV *domcp_rv; PREINIT: virDomainCheckpointPtr domcp; PPCODE: domcp = (virDomainCheckpointPtr)SvIV((SV*)SvRV(domcp_rv)); if (domcp) { virDomainCheckpointFree(domcp); sv_setiv((SV*)SvRV(domcp_rv), 0); } MODULE = Sys::Virt::Event PACKAGE = Sys::Virt::Event PROTOTYPES: ENABLE void _register_impl() PPCODE: virEventRegisterImpl(_event_add_handle, _event_update_handle, _event_remove_handle, _event_add_timeout, _event_update_timeout, _event_remove_timeout); void register_default() PPCODE: virEventRegisterDefaultImpl(); void run_default() PPCODE: virEventRunDefaultImpl(); int add_handle(fd, events, coderef) int fd; int events; SV *coderef; PREINIT: int watch; CODE: SvREFCNT_inc(coderef); if ((watch = virEventAddHandle(fd, events, _event_handle_helper, coderef, _event_cb_free)) < 0) { SvREFCNT_dec(coderef); _croak_error(); } RETVAL = watch; OUTPUT: RETVAL void update_handle(watch, events) int watch; int events; PPCODE: virEventUpdateHandle(watch, events); void remove_handle(watch) int watch; PPCODE: if (virEventRemoveHandle(watch) < 0) _croak_error(); int add_timeout(frequency, coderef) int frequency; SV *coderef; PREINIT: int timer; CODE: SvREFCNT_inc(coderef); if ((timer = virEventAddTimeout(frequency, _event_timeout_helper, coderef, _event_cb_free)) < 0) { SvREFCNT_dec(coderef); _croak_error(); } RETVAL = timer; OUTPUT: RETVAL void update_timeout(timer, frequency) int timer; int frequency; PPCODE: virEventUpdateTimeout(timer, frequency); void remove_timeout(timer) int timer; PPCODE: if (virEventRemoveTimeout(timer) < 0) _croak_error(); void _run_handle_callback_helper(watch, fd, event, cbref, opaqueref) int watch; int fd; int event; SV *cbref; SV *opaqueref; PREINIT: virEventHandleCallback cb; void *opaque; PPCODE: cb = (virEventHandleCallback)SvIV((SV*)SvRV(cbref)); opaque = (void*)SvIV((SV*)SvRV(opaqueref)); cb(watch, fd, event, opaque); void _run_timeout_callback_helper(timer, cbref, opaqueref) int timer; SV *cbref; SV *opaqueref; PREINIT: virEventTimeoutCallback cb; void *opaque; PPCODE: cb = (virEventTimeoutCallback)SvIV((SV*)SvRV(cbref)); opaque = (void*)SvIV((SV*)SvRV(opaqueref)); cb(timer, opaque); void _free_callback_opaque_helper(ffref, opaqueref) SV *ffref; SV *opaqueref; PREINIT: virFreeCallback ff; void *opaque; PPCODE: opaque = SvOK(opaqueref) ? (void*)SvIV((SV*)SvRV(opaqueref)) : NULL; ff = SvOK(ffref) ? (virFreeCallback)SvIV((SV*)SvRV(ffref)) : NULL; if (opaque != NULL && ff != NULL) ff(opaque); MODULE = Sys::Virt::Stream PACKAGE = Sys::Virt::Stream virStreamPtr _new_obj(con, flags=0) virConnectPtr con; unsigned int flags; CODE: if (!(RETVAL = virStreamNew(con, flags))) _croak_error(); OUTPUT: RETVAL int send(st, data, nbytes) virStreamPtr st; SV *data; size_t nbytes; PREINIT: const char *rawdata; STRLEN len; CODE: if (SvOK(data)) { rawdata = SvPV(data, len); if (nbytes > len) nbytes = len; } else { rawdata = ""; nbytes = 0; } if ((RETVAL = virStreamSend(st, rawdata, nbytes)) < 0 && RETVAL != -2) _croak_error(); OUTPUT: RETVAL int recv(st, data, nbytes, flags=0) virStreamPtr st; SV *data; size_t nbytes; unsigned int flags; PREINIT: char *rawdata; CODE: Newx(rawdata, nbytes, char); if (flags) RETVAL = virStreamRecvFlags(st, rawdata, nbytes, flags); else RETVAL = virStreamRecv(st, rawdata, nbytes); if (RETVAL < 0 && RETVAL != -2 && RETVAL != -3) { Safefree(rawdata); _croak_error(); } if (RETVAL > 0) { sv_setpvn(data, rawdata, RETVAL); } Safefree(rawdata); OUTPUT: RETVAL SV * recv_hole(st, flags=0) virStreamPtr st; unsigned int flags; PREINIT: long long length; CODE: if (virStreamRecvHole(st, &length, flags) < 0) _croak_error(); RETVAL = virt_newSVll(length); OUTPUT: RETVAL void send_hole(st, lengthSV, flags=0) virStreamPtr st; SV *lengthSV; unsigned int flags; PREINIT: long long length; PPCODE: length = virt_SvIVll(lengthSV); if (virStreamSendHole(st, length, flags) < 0) _croak_error(); void send_all(stref, handler) SV *stref; SV *handler; PREINIT: AV *opaque; virStreamPtr st; CODE: st = (virStreamPtr)SvIV((SV*)SvRV(stref)); opaque = newAV(); SvREFCNT_inc(handler); SvREFCNT_inc(stref); av_push(opaque, stref); av_push(opaque, handler); if (virStreamSendAll(st, _stream_send_all_source, opaque) < 0) _croak_error(); SvREFCNT_dec(opaque); void recv_all(stref, handler) SV *stref; SV *handler; PREINIT: AV *opaque; virStreamPtr st; CODE: st = (virStreamPtr)SvIV((SV*)SvRV(stref)); opaque = newAV(); SvREFCNT_inc(handler); SvREFCNT_inc(stref); av_push(opaque, stref); av_push(opaque, handler); if (virStreamRecvAll(st, _stream_recv_all_sink, opaque) < 0) _croak_error(); SvREFCNT_dec(opaque); void sparse_recv_all(stref, handler, hole_handler) SV *stref; SV *handler; SV *hole_handler; PREINIT: AV *opaque; virStreamPtr st; CODE: st = (virStreamPtr)SvIV((SV*)SvRV(stref)); opaque = newAV(); SvREFCNT_inc(stref); SvREFCNT_inc(handler); SvREFCNT_inc(hole_handler); av_push(opaque, stref); av_push(opaque, handler); av_push(opaque, hole_handler); if (virStreamSparseRecvAll(st, _stream_recv_all_sink, _stream_sparse_recv_hole_handler, opaque) < 0) _croak_error(); SvREFCNT_dec(opaque); void sparse_send_all(stref, handler, hole_handler, skip_handler) SV *stref; SV *handler; SV *hole_handler; SV *skip_handler; PREINIT: AV *opaque; virStreamPtr st; CODE: st = (virStreamPtr)SvIV((SV*)SvRV(stref)); opaque = newAV(); SvREFCNT_inc(stref); SvREFCNT_inc(handler); SvREFCNT_inc(hole_handler); SvREFCNT_inc(skip_handler); av_push(opaque, stref); av_push(opaque, handler); av_push(opaque, hole_handler); av_push(opaque, skip_handler); if (virStreamSparseSendAll(st, _stream_send_all_source, _stream_sparse_send_all_hole_handler, _stream_sparse_send_all_skip_handler, opaque) < 0) _croak_error(); SvREFCNT_dec(opaque); void add_callback(stref, events, cb) SV* stref; int events; SV* cb; PREINIT: AV *opaque; virStreamPtr st; PPCODE: st = (virStreamPtr)SvIV((SV*)SvRV(stref)); opaque = newAV(); SvREFCNT_inc(cb); SvREFCNT_inc(stref); av_push(opaque, stref); av_push(opaque, cb); if (virStreamEventAddCallback(st, events, _stream_event_callback, opaque, _stream_event_free) < 0) _croak_error(); void update_callback(st, events) virStreamPtr st; int events; PPCODE: if (virStreamEventUpdateCallback(st, events) < 0) _croak_error(); void remove_callback(st) virStreamPtr st; PPCODE: if (virStreamEventRemoveCallback(st) < 0) _croak_error(); void finish(st) virStreamPtr st; PPCODE: if (virStreamFinish(st) < 0) _croak_error(); void abort(st) virStreamPtr st; PPCODE: if (virStreamAbort(st) < 0) _croak_error(); void DESTROY(st_rv) SV *st_rv; PREINIT: virStreamPtr st; PPCODE: st = (virStreamPtr)SvIV((SV*)SvRV(st_rv)); if (st) { virStreamFree(st); sv_setiv((SV*)SvRV(st_rv), 0); } MODULE = Sys::Virt PACKAGE = Sys::Virt PROTOTYPES: ENABLE BOOT: { HV *stash; virSetErrorFunc(NULL, ignoreVirErrorFunc); virInitialize(); stash = gv_stashpv( "Sys::Virt", TRUE ); REGISTER_CONSTANT(VIR_CONNECT_RO, CONNECT_RO); REGISTER_CONSTANT(VIR_CONNECT_NO_ALIASES, CONNECT_NO_ALIASES); REGISTER_CONSTANT(VIR_CRED_USERNAME, CRED_USERNAME); REGISTER_CONSTANT(VIR_CRED_AUTHNAME, CRED_AUTHNAME); REGISTER_CONSTANT(VIR_CRED_LANGUAGE, CRED_LANGUAGE); REGISTER_CONSTANT(VIR_CRED_CNONCE, CRED_CNONCE); REGISTER_CONSTANT(VIR_CRED_PASSPHRASE, CRED_PASSPHRASE); REGISTER_CONSTANT(VIR_CRED_ECHOPROMPT, CRED_ECHOPROMPT); REGISTER_CONSTANT(VIR_CRED_NOECHOPROMPT, CRED_NOECHOPROMPT); REGISTER_CONSTANT(VIR_CRED_REALM, CRED_REALM); REGISTER_CONSTANT(VIR_CRED_EXTERNAL, CRED_EXTERNAL); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_USER_NAME, IDENTITY_USER_NAME); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_UNIX_USER_ID, IDENTITY_UNIX_USER_ID); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_GROUP_NAME, IDENTITY_GROUP_NAME); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_UNIX_GROUP_ID, IDENTITY_UNIX_GROUP_ID); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_PROCESS_ID, IDENTITY_PROCESS_ID); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_PROCESS_TIME, IDENTITY_PROCESS_TIME); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_SASL_USER_NAME, IDENTITY_SASL_USER_NAME); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME, IDENTITY_X509_DISTINGUISHED_NAME); REGISTER_CONSTANT_STR(VIR_CONNECT_IDENTITY_SELINUX_CONTEXT, IDENTITY_SELINUX_CONTEXT); /* Don't bother with VIR_CPU_COMPARE_ERROR since we die in that case */ REGISTER_CONSTANT(VIR_CPU_COMPARE_INCOMPATIBLE, CPU_COMPARE_INCOMPATIBLE); REGISTER_CONSTANT(VIR_CPU_COMPARE_IDENTICAL, CPU_COMPARE_IDENTICAL); REGISTER_CONSTANT(VIR_CPU_COMPARE_SUPERSET, CPU_COMPARE_SUPERSET); REGISTER_CONSTANT(VIR_NODE_SUSPEND_TARGET_MEM, NODE_SUSPEND_TARGET_MEM); REGISTER_CONSTANT(VIR_NODE_SUSPEND_TARGET_DISK, NODE_SUSPEND_TARGET_DISK); REGISTER_CONSTANT(VIR_NODE_SUSPEND_TARGET_HYBRID, NODE_SUSPEND_TARGET_HYBRID); REGISTER_CONSTANT(VIR_NODE_CPU_STATS_ALL_CPUS, NODE_CPU_STATS_ALL_CPUS); REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_IDLE, NODE_CPU_STATS_IDLE); REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_IOWAIT, NODE_CPU_STATS_IOWAIT); REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_KERNEL, NODE_CPU_STATS_KERNEL); REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_USER, NODE_CPU_STATS_USER); REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_INTR, NODE_CPU_STATS_INTR); REGISTER_CONSTANT_STR(VIR_NODE_CPU_STATS_UTILIZATION, NODE_CPU_STATS_UTILIZATION); REGISTER_CONSTANT(VIR_NODE_MEMORY_STATS_ALL_CELLS, NODE_MEMORY_STATS_ALL_CELLS); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_STATS_BUFFERS, NODE_MEMORY_STATS_BUFFERS); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_STATS_CACHED, NODE_MEMORY_STATS_CACHED); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_STATS_FREE, NODE_MEMORY_STATS_FREE); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_STATS_TOTAL, NODE_MEMORY_STATS_TOTAL); REGISTER_CONSTANT(VIR_CONNECT_CLOSE_REASON_CLIENT, CLOSE_REASON_CLIENT); REGISTER_CONSTANT(VIR_CONNECT_CLOSE_REASON_EOF, CLOSE_REASON_EOF); REGISTER_CONSTANT(VIR_CONNECT_CLOSE_REASON_ERROR, CLOSE_REASON_ERROR); REGISTER_CONSTANT(VIR_CONNECT_CLOSE_REASON_KEEPALIVE, CLOSE_REASON_KEEPALIVE); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN, NODE_MEMORY_SHARED_PAGES_TO_SCAN); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS, NODE_MEMORY_SHARED_SLEEP_MILLISECS); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_SHARED, NODE_MEMORY_SHARED_PAGES_SHARED); REGISTER_CONSTANT_STR(VIR_NODE_MEMORY_SHARED_PAGES_SHARING, NODE_MEMORY_SHARED_PAGES_SHARING); 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); REGISTER_CONSTANT(VIR_CONNECT_BASELINE_CPU_MIGRATABLE, BASELINE_CPU_MIGRATABLE); REGISTER_CONSTANT(VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE, COMPARE_CPU_FAIL_INCOMPATIBLE); REGISTER_CONSTANT(VIR_CONNECT_COMPARE_CPU_VALIDATE_XML, COMPARE_CPU_VALIDATE_XML); REGISTER_CONSTANT(VIR_IP_ADDR_TYPE_IPV4, IP_ADDR_TYPE_IPV4); REGISTER_CONSTANT(VIR_IP_ADDR_TYPE_IPV6, IP_ADDR_TYPE_IPV6); REGISTER_CONSTANT(VIR_NODE_ALLOC_PAGES_ADD, NODE_ALLOC_PAGES_ADD); REGISTER_CONSTANT(VIR_NODE_ALLOC_PAGES_SET, NODE_ALLOC_PAGES_SET); REGISTER_CONSTANT_STR(VIR_NODE_SEV_CBITPOS, SEV_CBITPOS); REGISTER_CONSTANT_STR(VIR_NODE_SEV_CERT_CHAIN, SEV_CERT_CHAIN); REGISTER_CONSTANT_STR(VIR_NODE_SEV_PDH, SEV_PDH); REGISTER_CONSTANT_STR(VIR_NODE_SEV_REDUCED_PHYS_BITS, SEV_REDUCED_PHYS_BITS); REGISTER_CONSTANT_STR(VIR_NODE_SEV_MAX_GUESTS, SEV_MAX_GUESTS); REGISTER_CONSTANT_STR(VIR_NODE_SEV_MAX_ES_GUESTS, SEV_MAX_ES_GUESTS); stash = gv_stashpv( "Sys::Virt::Event", TRUE ); REGISTER_CONSTANT(VIR_EVENT_HANDLE_READABLE, HANDLE_READABLE); REGISTER_CONSTANT(VIR_EVENT_HANDLE_WRITABLE, HANDLE_WRITABLE); REGISTER_CONSTANT(VIR_EVENT_HANDLE_ERROR, HANDLE_ERROR); REGISTER_CONSTANT(VIR_EVENT_HANDLE_HANGUP, HANDLE_HANGUP); stash = gv_stashpv( "Sys::Virt::Domain", TRUE ); REGISTER_CONSTANT(VIR_DOMAIN_NOSTATE, STATE_NOSTATE); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING, STATE_RUNNING); REGISTER_CONSTANT(VIR_DOMAIN_BLOCKED, STATE_BLOCKED); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED, STATE_PAUSED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN, STATE_SHUTDOWN); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF, STATE_SHUTOFF); REGISTER_CONSTANT(VIR_DOMAIN_CRASHED, STATE_CRASHED); REGISTER_CONSTANT(VIR_DOMAIN_PMSUSPENDED, STATE_PMSUSPENDED); REGISTER_CONSTANT(VIR_DUMP_CRASH, DUMP_CRASH); REGISTER_CONSTANT(VIR_DUMP_LIVE, DUMP_LIVE); REGISTER_CONSTANT(VIR_DUMP_BYPASS_CACHE, DUMP_BYPASS_CACHE); REGISTER_CONSTANT(VIR_DUMP_RESET, DUMP_RESET); REGISTER_CONSTANT(VIR_DUMP_MEMORY_ONLY, DUMP_MEMORY_ONLY); REGISTER_CONSTANT(VIR_DOMAIN_SAVE_BYPASS_CACHE, SAVE_BYPASS_CACHE); REGISTER_CONSTANT(VIR_DOMAIN_SAVE_RUNNING, SAVE_RUNNING); REGISTER_CONSTANT(VIR_DOMAIN_SAVE_PAUSED, SAVE_PAUSED); 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_UNDEFINE_KEEP_NVRAM, UNDEFINE_KEEP_NVRAM); REGISTER_CONSTANT(VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA, UNDEFINE_CHECKPOINTS_METADATA); REGISTER_CONSTANT(VIR_DOMAIN_START_PAUSED, START_PAUSED); REGISTER_CONSTANT(VIR_DOMAIN_START_AUTODESTROY, START_AUTODESTROY); REGISTER_CONSTANT(VIR_DOMAIN_START_BYPASS_CACHE, START_BYPASS_CACHE); REGISTER_CONSTANT(VIR_DOMAIN_START_FORCE_BOOT, START_FORCE_BOOT); REGISTER_CONSTANT(VIR_DOMAIN_START_VALIDATE, START_VALIDATE); REGISTER_CONSTANT(VIR_DOMAIN_DEFINE_VALIDATE, DEFINE_VALIDATE); REGISTER_CONSTANT(VIR_DOMAIN_NOSTATE_UNKNOWN, STATE_NOSTATE_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_UNKNOWN, STATE_RUNNING_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_BOOTED, STATE_RUNNING_BOOTED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_MIGRATED, STATE_RUNNING_MIGRATED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_RESTORED, STATE_RUNNING_RESTORED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_FROM_SNAPSHOT, STATE_RUNNING_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_UNPAUSED, STATE_RUNNING_UNPAUSED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_MIGRATION_CANCELED, STATE_RUNNING_MIGRATION_CANCELED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_SAVE_CANCELED, STATE_RUNNING_SAVE_CANCELED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_WAKEUP, STATE_RUNNING_WAKEUP); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_CRASHED, STATE_RUNNING_CRASHED); REGISTER_CONSTANT(VIR_DOMAIN_RUNNING_POSTCOPY, STATE_RUNNING_POSTCOPY); REGISTER_CONSTANT(VIR_DOMAIN_BLOCKED_UNKNOWN, STATE_BLOCKED_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_UNKNOWN, STATE_PAUSED_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_USER, STATE_PAUSED_USER); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_MIGRATION, STATE_PAUSED_MIGRATION); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_SAVE, STATE_PAUSED_SAVE); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_DUMP, STATE_PAUSED_DUMP); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_IOERROR, STATE_PAUSED_IOERROR); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_WATCHDOG, STATE_PAUSED_WATCHDOG); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_FROM_SNAPSHOT, STATE_PAUSED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_SHUTTING_DOWN, STATE_PAUSED_SHUTTING_DOWN); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_SNAPSHOT, STATE_PAUSED_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_CRASHED, STATE_PAUSED_CRASHED); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_STARTING_UP, STATE_PAUSED_STARTING_UP); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_POSTCOPY, STATE_PAUSED_POSTCOPY); REGISTER_CONSTANT(VIR_DOMAIN_PAUSED_POSTCOPY_FAILED, STATE_PAUSED_POSTCOPY_FAILED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_UNKNOWN, STATE_SHUTDOWN_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_USER, STATE_SHUTDOWN_USER); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_UNKNOWN, STATE_SHUTOFF_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_SHUTDOWN, STATE_SHUTOFF_SHUTDOWN); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_DESTROYED, STATE_SHUTOFF_DESTROYED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_CRASHED, STATE_SHUTOFF_CRASHED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_MIGRATED, STATE_SHUTOFF_MIGRATED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_SAVED, STATE_SHUTOFF_SAVED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_FAILED, STATE_SHUTOFF_FAILED); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, STATE_SHUTOFF_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_SHUTOFF_DAEMON, STATE_SHUTOFF_DAEMON); REGISTER_CONSTANT(VIR_DOMAIN_CRASHED_UNKNOWN, STATE_CRASHED_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_CRASHED_PANICKED, STATE_CRASHED_PANICKED); REGISTER_CONSTANT(VIR_DOMAIN_PMSUSPENDED_UNKNOWN, STATE_PMSUSPENDED_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN, STATE_PMSUSPENDED_DISK_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH, OPEN_GRAPHICS_SKIPAUTH); REGISTER_CONSTANT(VIR_DOMAIN_CONSOLE_FORCE, OPEN_CONSOLE_FORCE); REGISTER_CONSTANT(VIR_DOMAIN_CONSOLE_SAFE, OPEN_CONSOLE_SAFE); REGISTER_CONSTANT(VIR_DOMAIN_CHANNEL_FORCE, OPEN_CHANNEL_FORCE); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD, SCHEDULER_EMULATOR_PERIOD); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA, SCHEDULER_EMULATOR_QUOTA); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD, SCHEDULER_IOTHREAD_PERIOD); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA, SCHEDULER_IOTHREAD_QUOTA); REGISTER_CONSTANT_STR(VIR_DOMAIN_CPU_STATS_CPUTIME, CPU_STATS_CPUTIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_CPU_STATS_SYSTEMTIME, CPU_STATS_SYSTEMTIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_CPU_STATS_USERTIME, CPU_STATS_USERTIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_CPU_STATS_VCPUTIME, CPU_STATS_VCPUTIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_ERRS, BLOCK_STATS_ERRS); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ, BLOCK_STATS_FLUSH_REQ); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES, BLOCK_STATS_FLUSH_TOTAL_TIMES); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_READ_BYTES, BLOCK_STATS_READ_BYTES); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_READ_REQ, BLOCK_STATS_READ_REQ); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES, BLOCK_STATS_READ_TOTAL_TIMES); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES, BLOCK_STATS_WRITE_BYTES); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, BLOCK_STATS_WRITE_REQ); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES, BLOCK_STATS_WRITE_TOTAL_TIMES); REGISTER_CONSTANT(VIR_MIGRATE_LIVE, MIGRATE_LIVE); REGISTER_CONSTANT(VIR_MIGRATE_PEER2PEER, MIGRATE_PEER2PEER); REGISTER_CONSTANT(VIR_MIGRATE_TUNNELLED, MIGRATE_TUNNELLED); REGISTER_CONSTANT(VIR_MIGRATE_PERSIST_DEST, MIGRATE_PERSIST_DEST); REGISTER_CONSTANT(VIR_MIGRATE_UNDEFINE_SOURCE, MIGRATE_UNDEFINE_SOURCE); REGISTER_CONSTANT(VIR_MIGRATE_PAUSED, MIGRATE_PAUSED); REGISTER_CONSTANT(VIR_MIGRATE_NON_SHARED_DISK, MIGRATE_NON_SHARED_DISK); REGISTER_CONSTANT(VIR_MIGRATE_NON_SHARED_INC, MIGRATE_NON_SHARED_INC); REGISTER_CONSTANT(VIR_MIGRATE_CHANGE_PROTECTION, MIGRATE_CHANGE_PROTECTION); REGISTER_CONSTANT(VIR_MIGRATE_UNSAFE, MIGRATE_UNSAFE); REGISTER_CONSTANT(VIR_MIGRATE_OFFLINE, MIGRATE_OFFLINE); 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(VIR_MIGRATE_POSTCOPY, MIGRATE_POSTCOPY); REGISTER_CONSTANT(VIR_MIGRATE_TLS, MIGRATE_TLS); REGISTER_CONSTANT(VIR_MIGRATE_PARALLEL, MIGRATE_PARALLEL); REGISTER_CONSTANT(VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES, MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_BANDWIDTH, MIGRATE_PARAM_BANDWIDTH); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DEST_NAME, MIGRATE_PARAM_DEST_NAME); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DEST_XML, MIGRATE_PARAM_DEST_XML); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_GRAPHICS_URI, MIGRATE_PARAM_GRAPHICS_URI); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_URI, MIGRATE_PARAM_URI); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_LISTEN_ADDRESS, MIGRATE_PARAM_LISTEN_ADDRESS); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_MIGRATE_DISKS, MIGRATE_PARAM_MIGRATE_DISKS); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DISKS_PORT, MIGRATE_PARAM_DISK_PORT); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_COMPRESSION, MIGRATE_PARAM_COMPRESSION); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS, MIGRATE_PARAM_COMPRESSION_MT_THREADS); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS, MIGRATE_PARAM_COMPRESSION_MT_DTHREADS); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL, MIGRATE_PARAM_COMPRESSION_MT_LEVEL); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE, MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_PERSIST_XML, MIGRATE_PARAM_PERSIST_XML); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, MIGRATE_PARAM_AUTO_CONVERGE_INITIAL); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, MIGRATE_PARAM_BANDWIDTH_POSTCOPY); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, MIGRATE_PARAM_PARALLEL_CONNECTIONS); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_TLS_DESTINATION, MIGRATE_PARAM_TLS_DESTINATION); REGISTER_CONSTANT_STR(VIR_MIGRATE_PARAM_DISKS_URI, MIGRATE_PARAM_DISKS_URI); REGISTER_CONSTANT(VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY, MIGRATE_MAX_SPEED_POSTCOPY); REGISTER_CONSTANT(VIR_DOMAIN_XML_SECURE, XML_SECURE); REGISTER_CONSTANT(VIR_DOMAIN_XML_INACTIVE, XML_INACTIVE); REGISTER_CONSTANT(VIR_DOMAIN_XML_UPDATE_CPU, XML_UPDATE_CPU); REGISTER_CONSTANT(VIR_DOMAIN_XML_MIGRATABLE, XML_MIGRATABLE); REGISTER_CONSTANT(VIR_MEMORY_VIRTUAL, MEMORY_VIRTUAL); REGISTER_CONSTANT(VIR_MEMORY_PHYSICAL, MEMORY_PHYSICAL); REGISTER_CONSTANT(VIR_VCPU_OFFLINE, VCPU_OFFLINE); REGISTER_CONSTANT(VIR_VCPU_RUNNING, VCPU_RUNNING); REGISTER_CONSTANT(VIR_VCPU_BLOCKED, VCPU_BLOCKED); REGISTER_CONSTANT(VIR_VCPU_INFO_CPU_OFFLINE, VCPU_INFO_CPU_OFFLINE); REGISTER_CONSTANT(VIR_VCPU_INFO_CPU_UNAVAILABLE, VCPU_INFO_CPU_UNAVAILABLE); REGISTER_CONSTANT(VIR_KEYCODE_SET_LINUX, KEYCODE_SET_LINUX); REGISTER_CONSTANT(VIR_KEYCODE_SET_XT, KEYCODE_SET_XT); REGISTER_CONSTANT(VIR_KEYCODE_SET_ATSET1, KEYCODE_SET_ATSET1); REGISTER_CONSTANT(VIR_KEYCODE_SET_ATSET2, KEYCODE_SET_ATSET2); REGISTER_CONSTANT(VIR_KEYCODE_SET_ATSET3, KEYCODE_SET_ATSET3); REGISTER_CONSTANT(VIR_KEYCODE_SET_OSX, KEYCODE_SET_OSX); REGISTER_CONSTANT(VIR_KEYCODE_SET_XT_KBD, KEYCODE_SET_XT_KBD); REGISTER_CONSTANT(VIR_KEYCODE_SET_USB, KEYCODE_SET_USB); REGISTER_CONSTANT(VIR_KEYCODE_SET_WIN32, KEYCODE_SET_WIN32); REGISTER_CONSTANT(VIR_KEYCODE_SET_RFB, KEYCODE_SET_RFB); REGISTER_CONSTANT(VIR_KEYCODE_SET_QNUM, KEYCODE_SET_QNUM); 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_DOMAIN_STATS_PERF, STATS_PERF); REGISTER_CONSTANT(VIR_DOMAIN_STATS_IOTHREAD, STATS_IOTHREAD); REGISTER_CONSTANT(VIR_DOMAIN_STATS_MEMORY, STATS_MEMORY); REGISTER_CONSTANT(VIR_DOMAIN_STATS_DIRTYRATE, STATS_DIRTYRATE); 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); REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER, GET_ALL_STATS_OTHER); REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED, GET_ALL_STATS_PAUSED); REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT, GET_ALL_STATS_PERSISTENT); REGISTER_CONSTANT(VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING, GET_ALL_STATS_RUNNING); 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_NOWAIT, GET_ALL_STATS_NOWAIT); 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); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STARTED, EVENT_STARTED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED, EVENT_SUSPENDED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_RESUMED, EVENT_RESUMED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED, EVENT_STOPPED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN, EVENT_SHUTDOWN); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_PMSUSPENDED, EVENT_PMSUSPENDED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_PMSUSPENDED_DISK, EVENT_PMSUSPENDED_DISK); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_CRASHED, EVENT_CRASHED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DEFINED_ADDED, EVENT_DEFINED_ADDED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DEFINED_UPDATED, EVENT_DEFINED_UPDATED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DEFINED_RENAMED, EVENT_DEFINED_RENAMED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT, EVENT_DEFINED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_UNDEFINED_REMOVED, EVENT_UNDEFINED_REMOVED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_UNDEFINED_RENAMED, EVENT_UNDEFINED_RENAMED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STARTED_BOOTED, EVENT_STARTED_BOOTED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STARTED_MIGRATED, EVENT_STARTED_MIGRATED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STARTED_RESTORED, EVENT_STARTED_RESTORED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT, EVENT_STARTED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STARTED_WAKEUP, EVENT_STARTED_WAKEUP); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_CRASHED_PANICKED, EVENT_CRASHED_PANICKED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_CRASHED_CRASHLOADED, EVENT_CRASHED_CRASHLOADED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_PAUSED, EVENT_SUSPENDED_PAUSED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED, EVENT_SUSPENDED_MIGRATED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_IOERROR, EVENT_SUSPENDED_IOERROR); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG, EVENT_SUSPENDED_WATCHDOG); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_RESTORED, EVENT_SUSPENDED_RESTORED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT, EVENT_SUSPENDED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR, EVENT_SUSPENDED_API_ERROR); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY, EVENT_SUSPENDED_POSTCOPY); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED, EVENT_SUSPENDED_POSTCOPY_FAILED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_RESUMED_UNPAUSED, EVENT_RESUMED_UNPAUSED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_RESUMED_MIGRATED, EVENT_RESUMED_MIGRATED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT, EVENT_RESUMED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_RESUMED_POSTCOPY, EVENT_RESUMED_POSTCOPY); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN, EVENT_STOPPED_SHUTDOWN); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_DESTROYED, EVENT_STOPPED_DESTROYED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_CRASHED, EVENT_STOPPED_CRASHED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_MIGRATED, EVENT_STOPPED_MIGRATED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_SAVED, EVENT_STOPPED_SAVED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_FAILED, EVENT_STOPPED_FAILED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT, EVENT_STOPPED_FROM_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED, EVENT_SHUTDOWN_FINISHED); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN_HOST, EVENT_SHUTDOWN_HOST); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_SHUTDOWN_GUEST, EVENT_SHUTDOWN_GUEST); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY, EVENT_PMSUSPENDED_MEMORY); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_OK, CONTROL_OK); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_JOB, CONTROL_JOB); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_OCCUPIED, CONTROL_OCCUPIED); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR, CONTROL_ERROR); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_NONE, CONTROL_ERROR_REASON_NONE); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN, CONTROL_ERROR_REASON_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL, CONTROL_ERROR_REASON_INTERNAL); REGISTER_CONSTANT(VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR, CONTROL_ERROR_REASON_MONITOR); REGISTER_CONSTANT(VIR_DOMAIN_DEVICE_MODIFY_CURRENT, DEVICE_MODIFY_CURRENT); REGISTER_CONSTANT(VIR_DOMAIN_DEVICE_MODIFY_LIVE, DEVICE_MODIFY_LIVE); REGISTER_CONSTANT(VIR_DOMAIN_DEVICE_MODIFY_CONFIG, DEVICE_MODIFY_CONFIG); REGISTER_CONSTANT(VIR_DOMAIN_DEVICE_MODIFY_FORCE, DEVICE_MODIFY_FORCE); REGISTER_CONSTANT(VIR_DOMAIN_MEM_CURRENT, MEM_CURRENT); REGISTER_CONSTANT(VIR_DOMAIN_MEM_LIVE, MEM_LIVE); REGISTER_CONSTANT(VIR_DOMAIN_MEM_CONFIG, MEM_CONFIG); REGISTER_CONSTANT(VIR_DOMAIN_MEM_MAXIMUM, MEM_MAXIMUM); REGISTER_CONSTANT(VIR_DOMAIN_AFFECT_CURRENT, AFFECT_CURRENT); REGISTER_CONSTANT(VIR_DOMAIN_AFFECT_LIVE, AFFECT_LIVE); REGISTER_CONSTANT(VIR_DOMAIN_AFFECT_CONFIG, AFFECT_CONFIG); REGISTER_CONSTANT(VIR_DOMAIN_JOB_NONE, JOB_NONE); REGISTER_CONSTANT(VIR_DOMAIN_JOB_BOUNDED, JOB_BOUNDED); REGISTER_CONSTANT(VIR_DOMAIN_JOB_UNBOUNDED, JOB_UNBOUNDED); REGISTER_CONSTANT(VIR_DOMAIN_JOB_COMPLETED, JOB_COMPLETED); 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(VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED, JOB_STATS_KEEP_COMPLETED); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE, JOB_AUTO_CONVERGE_THROTTLE); 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); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW, JOB_COMPRESSION_OVERFLOW); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_COMPRESSION_PAGES, JOB_COMPRESSION_PAGES); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DATA_PROCESSED, JOB_DATA_PROCESSED); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DATA_REMAINING, JOB_DATA_REMAINING); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DATA_TOTAL, JOB_DATA_TOTAL); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_PROCESSED, JOB_DISK_PROCESSED); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_REMAINING, JOB_DISK_REMAINING); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_TOTAL, JOB_DISK_TOTAL); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_BPS, JOB_DISK_BPS); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DOWNTIME, JOB_DOWNTIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DOWNTIME_NET, JOB_DOWNTIME_NET); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_CONSTANT, JOB_MEMORY_CONSTANT); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_NORMAL, JOB_MEMORY_NORMAL); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES, JOB_MEMORY_NORMAL_BYTES); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_PROCESSED, JOB_MEMORY_PROCESSED); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_MEMORY_REMAINING, JOB_MEMORY_REMAINING); 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_MEMORY_POSTCOPY_REQS, JOB_MEMORY_POSTCOPY_REQS); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_SETUP_TIME, JOB_SETUP_TIME); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_ELAPSED, JOB_TIME_ELAPSED); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_ELAPSED_NET, JOB_TIME_ELAPSED_NET); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_TIME_REMAINING, JOB_TIME_REMAINING); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_OPERATION, JOB_OPERATION); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_SUCCESS, JOB_SUCCESS); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_TEMP_TOTAL, JOB_DISK_TEMP_TOTAL); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_DISK_TEMP_USED, JOB_DISK_TEMP_USED); REGISTER_CONSTANT_STR(VIR_DOMAIN_JOB_ERRMSG, JOB_ERRMSG); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN, BLOCK_JOB_TYPE_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_PULL, BLOCK_JOB_TYPE_PULL); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_COPY, BLOCK_JOB_TYPE_COPY); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT, BLOCK_JOB_TYPE_COMMIT); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT, BLOCK_JOB_TYPE_ACTIVE_COMMIT); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP, BLOCK_JOB_TYPE_BACKUP); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_COMPLETED, BLOCK_JOB_COMPLETED); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_FAILED, BLOCK_JOB_FAILED); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_CANCELED, BLOCK_JOB_CANCELED); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_READY, BLOCK_JOB_READY); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_DELETE, BLOCK_COMMIT_DELETE); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW, BLOCK_COMMIT_SHALLOW); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_ACTIVE, BLOCK_COMMIT_ACTIVE); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_RELATIVE, BLOCK_COMMIT_RELATIVE); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES, BLOCK_COMMIT_BANDWIDTH_BYTES); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_REBOOT, EVENT_ID_REBOOT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_RTC_CHANGE, EVENT_ID_RTC_CHANGE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_WATCHDOG, EVENT_ID_WATCHDOG); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_IO_ERROR, EVENT_ID_IO_ERROR); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_GRAPHICS, EVENT_ID_GRAPHICS); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON, EVENT_ID_IO_ERROR_REASON); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_CONTROL_ERROR, EVENT_ID_CONTROL_ERROR); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BLOCK_JOB, EVENT_ID_BLOCK_JOB); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2, EVENT_ID_BLOCK_JOB_2); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_DISK_CHANGE, EVENT_ID_DISK_CHANGE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_PMSUSPEND, EVENT_ID_PMSUSPEND); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK, EVENT_ID_PMSUSPEND_DISK); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_PMWAKEUP, EVENT_ID_PMWAKEUP); 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_ADDED, EVENT_ID_DEVICE_ADDED); 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_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_ID_BLOCK_THRESHOLD, EVENT_ID_BLOCK_THRESHOLD); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE, EVENT_ID_MEMORY_FAILURE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE, EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_NONE, EVENT_WATCHDOG_NONE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, EVENT_WATCHDOG_PAUSE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_RESET, EVENT_WATCHDOG_RESET); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF, EVENT_WATCHDOG_POWEROFF); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN, EVENT_WATCHDOG_SHUTDOWN); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_DEBUG, EVENT_WATCHDOG_DEBUG); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI, EVENT_WATCHDOG_INJECTNMI); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_IO_ERROR_NONE, EVENT_IO_ERROR_NONE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_IO_ERROR_PAUSE, EVENT_IO_ERROR_PAUSE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_IO_ERROR_REPORT, EVENT_IO_ERROR_REPORT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_CONNECT, EVENT_GRAPHICS_CONNECT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE, EVENT_GRAPHICS_INITIALIZE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT, EVENT_GRAPHICS_DISCONNECT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4, EVENT_GRAPHICS_ADDRESS_IPV4); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6, EVENT_GRAPHICS_ADDRESS_IPV6); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX, EVENT_GRAPHICS_ADDRESS_UNIX); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START, EVENT_DISK_CHANGE_MISSING_ON_START); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START, EVENT_DISK_DROP_MISSING_ON_START); 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); REGISTER_CONSTANT_STR(VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT, MEMORY_SWAP_HARD_LIMIT); REGISTER_CONSTANT_ULL(VIR_DOMAIN_MEMORY_PARAM_UNLIMITED, MEMORY_PARAM_UNLIMITED); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_WEIGHT, BLKIO_WEIGHT); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_WEIGHT, BLKIO_DEVICE_WEIGHT); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_READ_BPS, BLKIO_DEVICE_READ_BPS); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS, BLKIO_DEVICE_READ_IOPS); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS, BLKIO_DEVICE_WRITE_BPS); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS, BLKIO_DEVICE_WRITE_IOPS); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_CPU_SHARES, SCHEDULER_CPU_SHARES); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_VCPU_PERIOD, SCHEDULER_VCPU_PERIOD); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_VCPU_QUOTA, SCHEDULER_VCPU_QUOTA); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD, SCHEDULER_GLOBAL_PERIOD); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA, SCHEDULER_GLOBAL_QUOTA); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_WEIGHT, SCHEDULER_WEIGHT); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_CAP, SCHEDULER_CAP); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_LIMIT, SCHEDULER_LIMIT); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_RESERVATION, SCHEDULER_RESERVATION); REGISTER_CONSTANT_STR(VIR_DOMAIN_SCHEDULER_SHARES, SCHEDULER_SHARES); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_SWAP_IN, MEMORY_STAT_SWAP_IN); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_SWAP_OUT, MEMORY_STAT_SWAP_OUT); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT, MEMORY_STAT_MAJOR_FAULT); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT, MEMORY_STAT_MINOR_FAULT); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_UNUSED, MEMORY_STAT_UNUSED); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_AVAILABLE, MEMORY_STAT_AVAILABLE); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON, MEMORY_STAT_ACTUAL_BALLOON); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_RSS, MEMORY_STAT_RSS); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, MEMORY_STAT_LAST_UPDATE); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_USABLE, MEMORY_STAT_USABLE); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, MEMORY_STAT_DISK_CACHES); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC, MEMORY_STAT_HUGETLB_PGALLOC); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, MEMORY_STAT_HUGETLB_PGFAIL); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, BLOCK_IOTUNE_TOTAL_BYTES_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, BLOCK_IOTUNE_READ_BYTES_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, BLOCK_IOTUNE_WRITE_BYTES_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, BLOCK_IOTUNE_TOTAL_IOPS_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, BLOCK_IOTUNE_READ_IOPS_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, BLOCK_IOTUNE_WRITE_IOPS_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, BLOCK_IOTUNE_READ_BYTES_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, BLOCK_IOTUNE_READ_IOPS_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, BLOCK_IOTUNE_SIZE_IOPS_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, BLOCK_IOTUNE_GROUP_NAME); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH, BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH, BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH, BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH, BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH, BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH, BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_RESIZE_BYTES, BLOCK_RESIZE_BYTES); REGISTER_CONSTANT_STR(VIR_DOMAIN_NUMA_NODESET, NUMA_NODESET); REGISTER_CONSTANT_STR(VIR_DOMAIN_NUMA_MODE, NUMA_MODE); REGISTER_CONSTANT(VIR_DOMAIN_NUMATUNE_MEM_STRICT, NUMATUNE_MEM_STRICT); REGISTER_CONSTANT(VIR_DOMAIN_NUMATUNE_MEM_PREFERRED, NUMATUNE_MEM_PREFERRED); REGISTER_CONSTANT(VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE, NUMATUNE_MEM_INTERLEAVE); REGISTER_CONSTANT(VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE, NUMATUNE_MEM_RESTRICTIVE); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CMT, PERF_PARAM_CMT); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_MBML, PERF_PARAM_MBML); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_MBMT, PERF_PARAM_MBMT); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CACHE_MISSES, PERF_PARAM_CACHE_MISSES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CACHE_REFERENCES, PERF_PARAM_CACHE_REFERENCES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_CYCLES, PERF_PARAM_CPU_CYCLES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_INSTRUCTIONS, PERF_PARAM_INSTRUCTIONS); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_BRANCH_INSTRUCTIONS, PERF_PARAM_BRANCH_INSTRUCTIONS); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_BRANCH_MISSES, PERF_PARAM_BRANCH_MISSES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_BUS_CYCLES, PERF_PARAM_BUS_CYCLES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND, PERF_PARAM_STALLED_CYCLES_FRONTEND); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_STALLED_CYCLES_BACKEND, PERF_PARAM_STALLED_CYCLES_BACKEND); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_REF_CPU_CYCLES, PERF_PARAM_REF_CPU_CYCLES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_CLOCK, PERF_PARAM_CPU_CLOCK); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_TASK_CLOCK, PERF_PARAM_TASK_CLOCK); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS, PERF_PARAM_PAGE_FAULTS); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CONTEXT_SWITCHES, PERF_PARAM_CONTEXT_SWITCHES); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_MIGRATIONS, PERF_PARAM_CPU_MIGRATIONS); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS_MIN, PERF_PARAM_PAGE_FAULTS_MIN); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS_MAJ, PERF_PARAM_PAGE_FAULTS_MAJ); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_ALIGNMENT_FAULTS, PERF_PARAM_ALIGNMENT_FAULTS); REGISTER_CONSTANT_STR(VIR_PERF_PARAM_EMULATION_FAULTS, PERF_PARAM_EMULATION_FAULTS); REGISTER_CONSTANT_STR(VIR_DOMAIN_IOTHREAD_POLL_MAX_NS, IOTHREAD_PARAM_POLL_MAX_NS); REGISTER_CONSTANT_STR(VIR_DOMAIN_IOTHREAD_POLL_GROW, IOTHREAD_PARAM_POLL_GROW); REGISTER_CONSTANT_STR(VIR_DOMAIN_IOTHREAD_POLL_SHRINK, IOTHREAD_PARAM_POLL_SHRINK); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_AVERAGE, BANDWIDTH_IN_AVERAGE); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_PEAK, BANDWIDTH_IN_PEAK); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_BURST, BANDWIDTH_IN_BURST); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_FLOOR, BANDWIDTH_IN_FLOOR); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE, BANDWIDTH_OUT_AVERAGE); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_OUT_PEAK, BANDWIDTH_OUT_PEAK); REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_OUT_BURST, BANDWIDTH_OUT_BURST); REGISTER_CONSTANT(VIR_DOMAIN_VCPU_CURRENT, VCPU_CURRENT); REGISTER_CONSTANT(VIR_DOMAIN_VCPU_LIVE, VCPU_LIVE); REGISTER_CONSTANT(VIR_DOMAIN_VCPU_CONFIG, VCPU_CONFIG); REGISTER_CONSTANT(VIR_DOMAIN_VCPU_MAXIMUM, VCPU_MAXIMUM); REGISTER_CONSTANT(VIR_DOMAIN_VCPU_GUEST, VCPU_GUEST); REGISTER_CONSTANT(VIR_DOMAIN_VCPU_HOTPLUGGABLE, VCPU_HOTPLUGGABLE); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_DEFAULT, SHUTDOWN_DEFAULT); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN, SHUTDOWN_ACPI_POWER_BTN); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_GUEST_AGENT, SHUTDOWN_GUEST_AGENT); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_INITCTL, SHUTDOWN_INITCTL); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_SIGNAL, SHUTDOWN_SIGNAL); REGISTER_CONSTANT(VIR_DOMAIN_SHUTDOWN_PARAVIRT, SHUTDOWN_PARAVIRT); REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_DEFAULT, REBOOT_DEFAULT); REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN, REBOOT_ACPI_POWER_BTN); REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_GUEST_AGENT, REBOOT_GUEST_AGENT); REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_INITCTL, REBOOT_INITCTL); REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_SIGNAL, REBOOT_SIGNAL); REGISTER_CONSTANT(VIR_DOMAIN_REBOOT_PARAVIRT, REBOOT_PARAVIRT); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_NOP, PROCESS_SIGNAL_NOP); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_HUP, PROCESS_SIGNAL_HUP); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_INT, PROCESS_SIGNAL_INT); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_QUIT, PROCESS_SIGNAL_QUIT); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_ILL, PROCESS_SIGNAL_ILL); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_TRAP, PROCESS_SIGNAL_TRAP); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_ABRT, PROCESS_SIGNAL_ABRT); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_BUS, PROCESS_SIGNAL_BUS); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_FPE, PROCESS_SIGNAL_FPE); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_KILL, PROCESS_SIGNAL_KILL); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_USR1, PROCESS_SIGNAL_USR1); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_SEGV, PROCESS_SIGNAL_SEGV); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_USR2, PROCESS_SIGNAL_USR2); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_PIPE, PROCESS_SIGNAL_PIPE); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_ALRM, PROCESS_SIGNAL_ALRM); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_TERM, PROCESS_SIGNAL_TERM); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_STKFLT, PROCESS_SIGNAL_STKFLT); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_CHLD, PROCESS_SIGNAL_CHLD); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_CONT, PROCESS_SIGNAL_CONT); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_STOP, PROCESS_SIGNAL_STOP); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_TSTP, PROCESS_SIGNAL_TSTP); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_TTIN, PROCESS_SIGNAL_TTIN); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_TTOU, PROCESS_SIGNAL_TTOU); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_URG, PROCESS_SIGNAL_URG); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_XCPU, PROCESS_SIGNAL_XCPU); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_XFSZ, PROCESS_SIGNAL_XFSZ); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_VTALRM, PROCESS_SIGNAL_VTALRM); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_PROF, PROCESS_SIGNAL_PROF); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_WINCH, PROCESS_SIGNAL_WINCH); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_POLL, PROCESS_SIGNAL_POLL); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_PWR, PROCESS_SIGNAL_PWR); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_SYS, PROCESS_SIGNAL_SYS); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT0, PROCESS_SIGNAL_RT0); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT1, PROCESS_SIGNAL_RT1); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT2, PROCESS_SIGNAL_RT2); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT3, PROCESS_SIGNAL_RT3); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT4, PROCESS_SIGNAL_RT4); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT5, PROCESS_SIGNAL_RT5); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT6, PROCESS_SIGNAL_RT6); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT7, PROCESS_SIGNAL_RT7); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT8, PROCESS_SIGNAL_RT8); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT9, PROCESS_SIGNAL_RT9); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT10, PROCESS_SIGNAL_RT10); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT11, PROCESS_SIGNAL_RT11); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT12, PROCESS_SIGNAL_RT12); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT13, PROCESS_SIGNAL_RT13); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT14, PROCESS_SIGNAL_RT14); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT15, PROCESS_SIGNAL_RT15); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT16, PROCESS_SIGNAL_RT16); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT17, PROCESS_SIGNAL_RT17); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT18, PROCESS_SIGNAL_RT18); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT19, PROCESS_SIGNAL_RT19); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT20, PROCESS_SIGNAL_RT20); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT21, PROCESS_SIGNAL_RT21); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT22, PROCESS_SIGNAL_RT22); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT23, PROCESS_SIGNAL_RT23); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT24, PROCESS_SIGNAL_RT24); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT25, PROCESS_SIGNAL_RT25); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT26, PROCESS_SIGNAL_RT26); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT27, PROCESS_SIGNAL_RT27); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT28, PROCESS_SIGNAL_RT28); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT29, PROCESS_SIGNAL_RT29); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT30, PROCESS_SIGNAL_RT30); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT31, PROCESS_SIGNAL_RT31); REGISTER_CONSTANT(VIR_DOMAIN_PROCESS_SIGNAL_RT32, PROCESS_SIGNAL_RT32); REGISTER_CONSTANT(VIR_DOMAIN_DESTROY_DEFAULT, DESTROY_DEFAULT); REGISTER_CONSTANT(VIR_DOMAIN_DESTROY_GRACEFUL, DESTROY_GRACEFUL); REGISTER_CONSTANT(VIR_DOMAIN_METADATA_DESCRIPTION, METADATA_DESCRIPTION); REGISTER_CONSTANT(VIR_DOMAIN_METADATA_TITLE, METADATA_TITLE); REGISTER_CONSTANT(VIR_DOMAIN_METADATA_ELEMENT, METADATA_ELEMENT); REGISTER_CONSTANT(VIR_DOMAIN_DISK_ERROR_NONE, DISK_ERROR_NONE); REGISTER_CONSTANT(VIR_DOMAIN_DISK_ERROR_NO_SPACE, DISK_ERROR_NO_SPACE); REGISTER_CONSTANT(VIR_DOMAIN_DISK_ERROR_UNSPEC, DISK_ERROR_UNSPEC); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC, BLOCK_JOB_ABORT_ASYNC); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT, BLOCK_JOB_ABORT_PIVOT); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_SHALLOW, BLOCK_REBASE_SHALLOW); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT, BLOCK_REBASE_REUSE_EXT); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_COPY_RAW, BLOCK_REBASE_COPY_RAW); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_COPY, BLOCK_REBASE_COPY); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_COPY_DEV, BLOCK_REBASE_COPY_DEV); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_RELATIVE, BLOCK_REBASE_RELATIVE); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES, BLOCK_REBASE_BANDWIDTH_BYTES); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_COPY_BANDWIDTH, BLOCK_COPY_BANDWIDTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_COPY_GRANULARITY, BLOCK_COPY_GRANULARITY); REGISTER_CONSTANT_STR(VIR_DOMAIN_BLOCK_COPY_BUF_SIZE, BLOCK_COPY_BUF_SIZE); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COPY_REUSE_EXT, BLOCK_COPY_REUSE_EXT); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COPY_SHALLOW, BLOCK_COPY_SHALLOW); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, BLOCK_COPY_TRANSIENT_JOB); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES, BLOCK_COPY_SYNCHRONOUS_WRITES); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES, BLOCK_JOB_SPEED_BANDWIDTH_BYTES); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, BLOCK_PULL_BANDWIDTH_BYTES); REGISTER_CONSTANT(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, BLOCK_JOB_INFO_BANDWIDTH_BYTES); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_ACTIVE, LIST_ACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_AUTOSTART, LIST_AUTOSTART); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT, LIST_HAS_SNAPSHOT); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_INACTIVE, LIST_INACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE, LIST_MANAGEDSAVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART, LIST_NO_AUTOSTART); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE, LIST_NO_MANAGEDSAVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT, LIST_NO_SNAPSHOT); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_OTHER, LIST_OTHER); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_PAUSED, LIST_PAUSED); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_PERSISTENT, LIST_PERSISTENT); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_RUNNING, LIST_RUNNING); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_SHUTOFF, LIST_SHUTOFF); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_TRANSIENT, LIST_TRANSIENT); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT, LIST_HAS_CHECKPOINT); REGISTER_CONSTANT(VIR_CONNECT_LIST_DOMAINS_NO_CHECKPOINT, LIST_NO_CHECKPOINT); REGISTER_CONSTANT(VIR_DOMAIN_SEND_KEY_MAX_KEYS, SEND_KEY_MAX_KEYS); REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, CORE_DUMP_FORMAT_RAW); REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO, CORE_DUMP_FORMAT_KDUMP_LZO); REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY, CORE_DUMP_FORMAT_KDUMP_SNAPPY); REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB, CORE_DUMP_FORMAT_KDUMP_ZLIB); REGISTER_CONSTANT(VIR_DOMAIN_CORE_DUMP_FORMAT_WIN_DMP, CORE_DUMP_FORMAT_WIN_DMP); 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_IOTHREAD_PERIOD, TUNABLE_CPU_IOTHREAD_PERIOD); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA, TUNABLE_CPU_IOTHREAD_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_CPU_GLOBAL_PERIOD, TUNABLE_CPU_GLOBAL_PERIOD); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA, TUNABLE_CPU_GLOBAL_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); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX, TUNABLE_BLKDEV_READ_BYTES_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX, TUNABLE_BLKDEV_READ_IOPS_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX, TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX, TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX, TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX, TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC, TUNABLE_BLKDEV_SIZE_IOPS_SEC); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME, TUNABLE_BLKDEV_GROUP_NAME); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH, TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH, TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH, TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH, TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH, TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH, TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH); REGISTER_CONSTANT_STR(VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN, TUNABLE_IOTHREADSPIN); REGISTER_CONSTANT(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT, INTERFACE_ADDRESSES_SRC_AGENT); REGISTER_CONSTANT(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE, INTERFACE_ADDRESSES_SRC_LEASE); REGISTER_CONSTANT(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP, INTERFACE_ADDRESSES_SRC_ARP); REGISTER_CONSTANT(VIR_DOMAIN_PASSWORD_ENCRYPTED, PASSWORD_ENCRYPTED); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_UNKNOWN, JOB_OPERATION_UNKNOWN); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_START, JOB_OPERATION_START); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_SAVE, JOB_OPERATION_SAVE); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_RESTORE, JOB_OPERATION_RESTORE); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN, JOB_OPERATION_MIGRATION_IN); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT, JOB_OPERATION_MIGRATION_OUT); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_SNAPSHOT, JOB_OPERATION_SNAPSHOT); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT, JOB_OPERATION_SNAPSHOT_REVERT); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_DUMP, JOB_OPERATION_DUMP); REGISTER_CONSTANT(VIR_DOMAIN_JOB_OPERATION_BACKUP, JOB_OPERATION_BACKUP); REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_POWEROFF, LIFECYCLE_POWEROFF); REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_REBOOT, LIFECYCLE_REBOOT); REGISTER_CONSTANT(VIR_DOMAIN_LIFECYCLE_CRASH, LIFECYCLE_CRASH); 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); REGISTER_CONSTANT(VIR_DOMAIN_SAVE_IMAGE_XML_SECURE, SAVE_IMAGE_XML_SECURE); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT, LAUNCH_SECURITY_SEV_MEASUREMENT); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_API_MAJOR, LAUNCH_SECURITY_SEV_API_MAJOR); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_API_MINOR, LAUNCH_SECURITY_SEV_API_MINOR); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_BUILD_ID, LAUNCH_SECURITY_SEV_BUILD_ID); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_POLICY, LAUNCH_SECURITY_SEV_POLICY); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET, LAUNCH_SECURITY_SEV_SECRET); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_HEADER, LAUNCH_SECURITY_SEV_SECRET_HEADER); REGISTER_CONSTANT_STR(VIR_DOMAIN_LAUNCH_SECURITY_SEV_SECRET_SET_ADDRESS, LAUNCH_SECURITY_SEV_SECRET_SET_ADDRESS); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_USERS, GUEST_INFO_USERS); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_OS, GUEST_INFO_OS); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_TIMEZONE, GUEST_INFO_TIMEZONE); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_HOSTNAME, GUEST_INFO_HOSTNAME); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_FILESYSTEM, GUEST_INFO_FILESYSTEM); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_DISKS, GUEST_INFO_DISKS); REGISTER_CONSTANT(VIR_DOMAIN_GUEST_INFO_INTERFACES, GUEST_INFO_INTERFACES); REGISTER_CONSTANT(VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK, AGENT_RESPONSE_TIMEOUT_BLOCK); REGISTER_CONSTANT(VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_NOWAIT, AGENT_RESPONSE_TIMEOUT_NOWAIT); REGISTER_CONSTANT(VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_DEFAULT, AGENT_RESPONSE_TIMEOUT_DEFAULT); REGISTER_CONSTANT(VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL, BACKUP_BEGIN_REUSE_EXTERNAL); REGISTER_CONSTANT(VIR_DOMAIN_GET_HOSTNAME_AGENT, GET_HOSTNAME_AGENT); REGISTER_CONSTANT(VIR_DOMAIN_GET_HOSTNAME_LEASE, GET_HOSTNAME_LEASE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_IGNORE, EVENT_MEMORY_FAILURE_ACTION_IGNORE); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_INJECT, EVENT_MEMORY_FAILURE_ACTION_INJECT); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_FATAL, EVENT_MEMORY_FAILURE_ACTION_FATAL); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_RESET, EVENT_MEMORY_FAILURE_ACTION_RESET); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_MEMORY_FAILURE_RECIPIENT_HYPERVISOR, EVENT_MEMORY_FAILURE_RECIPIENT_HYPERVISOR); REGISTER_CONSTANT(VIR_DOMAIN_EVENT_MEMORY_FAILURE_RECIPIENT_GUEST, EVENT_MEMORY_FAILURE_RECIPIENT_GUEST); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_FAILURE_ACTION_REQUIRED, MEMORY_FAILURE_ACTION_REQUIRED); REGISTER_CONSTANT(VIR_DOMAIN_MEMORY_FAILURE_RECURSIVE, MEMORY_FAILURE_RECURSIVE); REGISTER_CONSTANT(VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_APPEND, AUTHORIZED_SSH_KEYS_SET_APPEND); REGISTER_CONSTANT(VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_REMOVE, AUTHORIZED_SSH_KEYS_SET_REMOVE); REGISTER_CONSTANT(VIR_DOMAIN_MESSAGE_DEPRECATION, MESSAGE_DEPRECATION); REGISTER_CONSTANT(VIR_DOMAIN_MESSAGE_TAINTING, MESSAGE_TAINTING); REGISTER_CONSTANT(VIR_DOMAIN_DIRTYRATE_UNSTARTED, DIRTYRATE_UNSTARTED); REGISTER_CONSTANT(VIR_DOMAIN_DIRTYRATE_MEASURING, DIRTYRATE_MEASURING); REGISTER_CONSTANT(VIR_DOMAIN_DIRTYRATE_MEASURED, DIRTYRATE_MEASURED); 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); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, DELETE_CHILDREN_ONLY); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, CREATE_REDEFINE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT, CREATE_CURRENT); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, CREATE_NO_METADATA); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_HALT, CREATE_HALT); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, CREATE_DISK_ONLY); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT, CREATE_REUSE_EXT); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, CREATE_QUIESCE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC, CREATE_ATOMIC); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, CREATE_LIVE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, CREATE_VALIDATE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS, LIST_ROOTS); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS, LIST_DESCENDANTS); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_METADATA, LIST_METADATA); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_LEAVES, LIST_LEAVES); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, LIST_NO_LEAVES); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, LIST_NO_METADATA); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, LIST_ACTIVE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE, LIST_INACTIVE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, LIST_EXTERNAL); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL, LIST_INTERNAL); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY, LIST_DISK_ONLY); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL, LIST_TOPOLOGICAL); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING, REVERT_RUNNING); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED, REVERT_PAUSED); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_REVERT_FORCE, REVERT_FORCE); REGISTER_CONSTANT(VIR_DOMAIN_SNAPSHOT_XML_SECURE, XML_SECURE); stash = gv_stashpv( "Sys::Virt::DomainCheckpoint", TRUE ); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN, DELETE_CHILDREN); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY, DELETE_METADATA_ONLY); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY, DELETE_CHILDREN_ONLY); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE, CREATE_REDEFINE); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE, CREATE_QUIESCE); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE_VALIDATE, CREATE_REDEFINE_VALIDATE); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_LIST_ROOTS, LIST_ROOTS); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_LIST_DESCENDANTS, LIST_DESCENDANTS); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_LIST_LEAVES, LIST_LEAVES); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_LIST_NO_LEAVES, LIST_NO_LEAVES); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL, LIST_TOPOLOGICAL); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_XML_SECURE, XML_SECURE); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_XML_SIZE, XML_SIZE); REGISTER_CONSTANT(VIR_DOMAIN_CHECKPOINT_XML_NO_DOMAIN, XML_NO_DOMAIN); stash = gv_stashpv( "Sys::Virt::StoragePool", TRUE ); REGISTER_CONSTANT(VIR_STORAGE_POOL_INACTIVE, STATE_INACTIVE); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILDING, STATE_BUILDING); REGISTER_CONSTANT(VIR_STORAGE_POOL_RUNNING, STATE_RUNNING); REGISTER_CONSTANT(VIR_STORAGE_POOL_DEGRADED, STATE_DEGRADED); REGISTER_CONSTANT(VIR_STORAGE_POOL_INACCESSIBLE, STATE_INACCESSIBLE); REGISTER_CONSTANT(VIR_STORAGE_POOL_DEFINE_VALIDATE, DEFINE_VALIDATE); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILD_NEW, BUILD_NEW); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILD_REPAIR, BUILD_REPAIR); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILD_RESIZE, BUILD_RESIZE); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, BUILD_NO_OVERWRITE); REGISTER_CONSTANT(VIR_STORAGE_POOL_BUILD_OVERWRITE, BUILD_OVERWRITE); REGISTER_CONSTANT(VIR_STORAGE_POOL_CREATE_NORMAL, CREATE_NORMAL); REGISTER_CONSTANT(VIR_STORAGE_POOL_CREATE_WITH_BUILD, CREATE_WITH_BUILD); REGISTER_CONSTANT(VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE, CREATE_WITH_BUILD_OVERWRITE); REGISTER_CONSTANT(VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE, CREATE_WITH_BUILD_NO_OVERWRITE); REGISTER_CONSTANT(VIR_STORAGE_POOL_DELETE_NORMAL, DELETE_NORMAL); REGISTER_CONSTANT(VIR_STORAGE_POOL_DELETE_ZEROED, DELETE_ZEROED); REGISTER_CONSTANT(VIR_STORAGE_XML_INACTIVE, XML_INACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE, LIST_INACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE, LIST_ACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT, LIST_PERSISTENT); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT, LIST_TRANSIENT); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART, LIST_AUTOSTART); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART, LIST_NO_AUTOSTART); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_DIR, LIST_DIR); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_FS, LIST_FS); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_NETFS, LIST_NETFS); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL, LIST_LOGICAL); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_DISK, LIST_DISK); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI, LIST_ISCSI); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_SCSI, LIST_SCSI); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_MPATH, LIST_MPATH); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_RBD, LIST_RBD); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG, LIST_SHEEPDOG); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER, LIST_GLUSTER); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_ZFS, LIST_ZFS); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE, LIST_VSTORAGE); REGISTER_CONSTANT(VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT, LIST_ISCSI_DIRECT); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_ID_REFRESH, EVENT_ID_REFRESH); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_DEFINED, EVENT_DEFINED); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_UNDEFINED, EVENT_UNDEFINED); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_STARTED, EVENT_STARTED); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_STOPPED, EVENT_STOPPED); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_CREATED, EVENT_CREATED); REGISTER_CONSTANT(VIR_STORAGE_POOL_EVENT_DELETED, EVENT_DELETED); stash = gv_stashpv( "Sys::Virt::Network", TRUE ); REGISTER_CONSTANT(VIR_NETWORK_XML_INACTIVE, XML_INACTIVE); REGISTER_CONSTANT(VIR_NETWORK_DEFINE_VALIDATE, DEFINE_VALIDATE); REGISTER_CONSTANT(VIR_NETWORK_CREATE_VALIDATE, CREATE_VALIDATE); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_COMMAND_NONE, UPDATE_COMMAND_NONE); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_COMMAND_MODIFY, UPDATE_COMMAND_MODIFY); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_COMMAND_DELETE, UPDATE_COMMAND_DELETE); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_COMMAND_ADD_LAST, UPDATE_COMMAND_ADD_LAST); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST, UPDATE_COMMAND_ADD_FIRST); REGISTER_CONSTANT(VIR_NETWORK_SECTION_NONE, SECTION_NONE); REGISTER_CONSTANT(VIR_NETWORK_SECTION_BRIDGE, SECTION_BRIDGE); REGISTER_CONSTANT(VIR_NETWORK_SECTION_DOMAIN, SECTION_DOMAIN); REGISTER_CONSTANT(VIR_NETWORK_SECTION_IP, SECTION_IP); REGISTER_CONSTANT(VIR_NETWORK_SECTION_IP_DHCP_HOST, SECTION_IP_DHCP_HOST); REGISTER_CONSTANT(VIR_NETWORK_SECTION_IP_DHCP_RANGE, SECTION_IP_DHCP_RANGE); REGISTER_CONSTANT(VIR_NETWORK_SECTION_FORWARD, SECTION_FORWARD); REGISTER_CONSTANT(VIR_NETWORK_SECTION_FORWARD_INTERFACE, SECTION_FORWARD_INTERFACE); REGISTER_CONSTANT(VIR_NETWORK_SECTION_FORWARD_PF, SECTION_FORWARD_PF); REGISTER_CONSTANT(VIR_NETWORK_SECTION_PORTGROUP, SECTION_PORTGROUP); REGISTER_CONSTANT(VIR_NETWORK_SECTION_DNS_HOST, SECTION_DNS_HOST); REGISTER_CONSTANT(VIR_NETWORK_SECTION_DNS_TXT, SECTION_DNS_TXT); REGISTER_CONSTANT(VIR_NETWORK_SECTION_DNS_SRV, SECTION_DNS_SRV); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_AFFECT_CURRENT, UPDATE_AFFECT_CURRENT); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_AFFECT_LIVE, UPDATE_AFFECT_LIVE); REGISTER_CONSTANT(VIR_NETWORK_UPDATE_AFFECT_CONFIG, UPDATE_AFFECT_CONFIG); REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_ACTIVE, LIST_ACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_INACTIVE, LIST_INACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_AUTOSTART, LIST_AUTOSTART); REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART, LIST_NO_AUTOSTART); REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_PERSISTENT, LIST_PERSISTENT); REGISTER_CONSTANT(VIR_CONNECT_LIST_NETWORKS_TRANSIENT, LIST_TRANSIENT); REGISTER_CONSTANT(VIR_NETWORK_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE); REGISTER_CONSTANT(VIR_NETWORK_EVENT_DEFINED, EVENT_DEFINED); REGISTER_CONSTANT(VIR_NETWORK_EVENT_UNDEFINED, EVENT_UNDEFINED); REGISTER_CONSTANT(VIR_NETWORK_EVENT_STARTED, EVENT_STARTED); REGISTER_CONSTANT(VIR_NETWORK_EVENT_STOPPED, EVENT_STOPPED); stash = gv_stashpv( "Sys::Virt::NetworkPort", TRUE ); REGISTER_CONSTANT(VIR_NETWORK_PORT_CREATE_RECLAIM, CREATE_RECLAIM); REGISTER_CONSTANT(VIR_NETWORK_PORT_CREATE_VALIDATE, CREATE_VALIDATE); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_IN_AVERAGE, BANDWIDTH_IN_AVERAGE); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_IN_BURST, BANDWIDTH_IN_BURST); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_IN_FLOOR, BANDWIDTH_IN_FLOOR); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_IN_PEAK, BANDWIDTH_IN_PEAK); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_OUT_AVERAGE, BANDWIDTH_OUT_AVERAGE); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_OUT_BURST, BANDWIDTH_OUT_BURST); REGISTER_CONSTANT_STR(VIR_NETWORK_PORT_BANDWIDTH_OUT_PEAK, BANDWIDTH_OUT_PEAK); stash = gv_stashpv( "Sys::Virt::Interface", TRUE ); REGISTER_CONSTANT(VIR_INTERFACE_XML_INACTIVE, XML_INACTIVE); REGISTER_CONSTANT(VIR_INTERFACE_DEFINE_VALIDATE, DEFINE_VALIDATE); REGISTER_CONSTANT(VIR_CONNECT_LIST_INTERFACES_ACTIVE, LIST_ACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_INTERFACES_INACTIVE, LIST_INACTIVE); stash = gv_stashpv( "Sys::Virt::NodeDevice", TRUE ); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM, LIST_CAP_SYSTEM); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV, LIST_CAP_PCI_DEV); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV, LIST_CAP_USB_DEV); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE, LIST_CAP_USB_INTERFACE); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET, LIST_CAP_NET); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST, LIST_CAP_SCSI_HOST); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET, LIST_CAP_SCSI_TARGET); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI, LIST_CAP_SCSI); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE, LIST_CAP_STORAGE); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST, LIST_CAP_FC_HOST); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS, LIST_CAP_VPORTS); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC, LIST_CAP_SCSI_GENERIC); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM, LIST_CAP_DRM); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV, LIST_CAP_MDEV); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES, LIST_CAP_MDEV_TYPES); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV, LIST_CAP_CCW_DEV); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV, LIST_CAP_CSS_DEV); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA, LIST_CAP_VDPA); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD, LIST_CAP_AP_CARD); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX, LIST_CAP_AP_MATRIX); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE, LIST_CAP_AP_QUEUE); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPD, LIST_CAP_VPD); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE, LIST_ACTIVE); REGISTER_CONSTANT(VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE, LIST_INACTIVE); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_ID_UPDATE, EVENT_ID_UPDATE); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_CREATED, EVENT_CREATED); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_DELETED, EVENT_DELETED); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_DEFINED, EVENT_DEFINED); REGISTER_CONSTANT(VIR_NODE_DEVICE_EVENT_UNDEFINED, EVENT_UNDEFINED); stash = gv_stashpv( "Sys::Virt::StorageVol", TRUE ); REGISTER_CONSTANT(VIR_STORAGE_VOL_FILE, TYPE_FILE); REGISTER_CONSTANT(VIR_STORAGE_VOL_BLOCK, TYPE_BLOCK); REGISTER_CONSTANT(VIR_STORAGE_VOL_DIR, TYPE_DIR); REGISTER_CONSTANT(VIR_STORAGE_VOL_NETWORK, TYPE_NETWORK); REGISTER_CONSTANT(VIR_STORAGE_VOL_NETDIR, TYPE_NETDIR); REGISTER_CONSTANT(VIR_STORAGE_VOL_PLOOP, TYPE_PLOOP); REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_NORMAL, DELETE_NORMAL); REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_ZEROED, DELETE_ZEROED); REGISTER_CONSTANT(VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS, DELETE_WITH_SNAPSHOTS); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_ZERO, WIPE_ALG_ZERO); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_NNSA, WIPE_ALG_NNSA); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_DOD, WIPE_ALG_DOD); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_BSI, WIPE_ALG_BSI); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_GUTMANN, WIPE_ALG_GUTMANN); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER, WIPE_ALG_SCHNEIER); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7, WIPE_ALG_PFITZNER7); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33, WIPE_ALG_PFITZNER33); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_RANDOM, WIPE_ALG_RANDOM); REGISTER_CONSTANT(VIR_STORAGE_VOL_WIPE_ALG_TRIM, WIPE_ALG_TRIM); REGISTER_CONSTANT(VIR_STORAGE_VOL_RESIZE_ALLOCATE, RESIZE_ALLOCATE); REGISTER_CONSTANT(VIR_STORAGE_VOL_RESIZE_DELTA, RESIZE_DELTA); REGISTER_CONSTANT(VIR_STORAGE_VOL_RESIZE_SHRINK, RESIZE_SHRINK); REGISTER_CONSTANT(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, CREATE_PREALLOC_METADATA); REGISTER_CONSTANT(VIR_STORAGE_VOL_CREATE_REFLINK, CREATE_REFLINK); REGISTER_CONSTANT(VIR_STORAGE_VOL_USE_ALLOCATION, USE_ALLOCATION); REGISTER_CONSTANT(VIR_STORAGE_VOL_GET_PHYSICAL, GET_PHYSICAL); REGISTER_CONSTANT(VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM, VOL_DOWNLOAD_SPARSE_STREAM); REGISTER_CONSTANT(VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM, VOL_UPLOAD_SPARSE_STREAM); stash = gv_stashpv( "Sys::Virt::Secret", TRUE ); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_NONE, USAGE_TYPE_NONE); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_VOLUME, USAGE_TYPE_VOLUME); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_CEPH, USAGE_TYPE_CEPH); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_ISCSI, USAGE_TYPE_ISCSI); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_TLS, USAGE_TYPE_TLS); REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_VTPM, USAGE_TYPE_VTPM); REGISTER_CONSTANT(VIR_SECRET_DEFINE_VALIDATE, DEFINE_VALIDATE); REGISTER_CONSTANT(VIR_CONNECT_LIST_SECRETS_EPHEMERAL, LIST_EPHEMERAL); REGISTER_CONSTANT(VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL, LIST_NO_EPHEMERAL); REGISTER_CONSTANT(VIR_CONNECT_LIST_SECRETS_PRIVATE, LIST_PRIVATE); REGISTER_CONSTANT(VIR_CONNECT_LIST_SECRETS_NO_PRIVATE, LIST_NO_PRIVATE); REGISTER_CONSTANT(VIR_SECRET_EVENT_ID_LIFECYCLE, EVENT_ID_LIFECYCLE); REGISTER_CONSTANT(VIR_SECRET_EVENT_ID_VALUE_CHANGED, EVENT_ID_VALUE_CHANGED); REGISTER_CONSTANT(VIR_SECRET_EVENT_DEFINED, EVENT_DEFINED); REGISTER_CONSTANT(VIR_SECRET_EVENT_UNDEFINED, EVENT_UNDEFINED); stash = gv_stashpv( "Sys::Virt::NWFilter", TRUE ); REGISTER_CONSTANT(VIR_NWFILTER_DEFINE_VALIDATE, DEFINE_VALIDATE); stash = gv_stashpv( "Sys::Virt::NWFilterBinding", TRUE ); REGISTER_CONSTANT(VIR_NWFILTER_BINDING_CREATE_VALIDATE, CREATE_VALIDATE); stash = gv_stashpv( "Sys::Virt::Stream", TRUE ); REGISTER_CONSTANT(VIR_STREAM_NONBLOCK, NONBLOCK); REGISTER_CONSTANT(VIR_STREAM_EVENT_READABLE, EVENT_READABLE); REGISTER_CONSTANT(VIR_STREAM_EVENT_WRITABLE, EVENT_WRITABLE); REGISTER_CONSTANT(VIR_STREAM_EVENT_ERROR, EVENT_ERROR); REGISTER_CONSTANT(VIR_STREAM_EVENT_HANGUP, EVENT_HANGUP); REGISTER_CONSTANT(VIR_STREAM_RECV_STOP_AT_HOLE, RECV_STOP_AT_HOLE); stash = gv_stashpv( "Sys::Virt::Error", TRUE ); REGISTER_CONSTANT(VIR_ERR_NONE, LEVEL_NONE); REGISTER_CONSTANT(VIR_ERR_WARNING, LEVEL_WARNING); REGISTER_CONSTANT(VIR_ERR_ERROR, LEVEL_ERROR); REGISTER_CONSTANT(VIR_FROM_NONE, FROM_NONE); REGISTER_CONSTANT(VIR_FROM_XEN, FROM_XEN); REGISTER_CONSTANT(VIR_FROM_XEND, FROM_XEND); REGISTER_CONSTANT(VIR_FROM_XENSTORE, FROM_XENSTORE); REGISTER_CONSTANT(VIR_FROM_SEXPR, FROM_SEXPR); REGISTER_CONSTANT(VIR_FROM_XML, FROM_XML); REGISTER_CONSTANT(VIR_FROM_DOM, FROM_DOM); REGISTER_CONSTANT(VIR_FROM_RPC, FROM_RPC); REGISTER_CONSTANT(VIR_FROM_PROXY, FROM_PROXY); REGISTER_CONSTANT(VIR_FROM_CONF, FROM_CONF); REGISTER_CONSTANT(VIR_FROM_QEMU, FROM_QEMU); REGISTER_CONSTANT(VIR_FROM_NET, FROM_NET); REGISTER_CONSTANT(VIR_FROM_TEST, FROM_TEST); REGISTER_CONSTANT(VIR_FROM_REMOTE, FROM_REMOTE); REGISTER_CONSTANT(VIR_FROM_OPENVZ, FROM_OPENVZ); REGISTER_CONSTANT(VIR_FROM_XENXM, FROM_XENXM); REGISTER_CONSTANT(VIR_FROM_STATS_LINUX, FROM_STATS_LINUX); REGISTER_CONSTANT(VIR_FROM_LXC, FROM_LXC); REGISTER_CONSTANT(VIR_FROM_STORAGE, FROM_STORAGE); REGISTER_CONSTANT(VIR_FROM_NETWORK, FROM_NETWORK); REGISTER_CONSTANT(VIR_FROM_DOMAIN, FROM_DOMAIN); REGISTER_CONSTANT(VIR_FROM_UML, FROM_UML); REGISTER_CONSTANT(VIR_FROM_NODEDEV, FROM_NODEDEV); REGISTER_CONSTANT(VIR_FROM_XEN_INOTIFY, FROM_XEN_INOTIFY); REGISTER_CONSTANT(VIR_FROM_SECURITY, FROM_SECURITY); REGISTER_CONSTANT(VIR_FROM_VBOX, FROM_VBOX); REGISTER_CONSTANT(VIR_FROM_INTERFACE, FROM_INTERFACE); REGISTER_CONSTANT(VIR_FROM_ONE, FROM_ONE); REGISTER_CONSTANT(VIR_FROM_ESX, FROM_ESX); REGISTER_CONSTANT(VIR_FROM_PHYP, FROM_PHYP); REGISTER_CONSTANT(VIR_FROM_SECRET, FROM_SECRET); REGISTER_CONSTANT(VIR_FROM_CPU, FROM_CPU); REGISTER_CONSTANT(VIR_FROM_XENAPI, FROM_XENAPI); REGISTER_CONSTANT(VIR_FROM_NWFILTER, FROM_NWFILTER); REGISTER_CONSTANT(VIR_FROM_HOOK, FROM_HOOK); REGISTER_CONSTANT(VIR_FROM_DOMAIN_SNAPSHOT, FROM_DOMAIN_SNAPSHOT); REGISTER_CONSTANT(VIR_FROM_AUDIT, FROM_AUDIT); REGISTER_CONSTANT(VIR_FROM_SYSINFO, FROM_SYSINFO); REGISTER_CONSTANT(VIR_FROM_STREAMS, FROM_STREAMS); REGISTER_CONSTANT(VIR_FROM_VMWARE, FROM_VMWARE); REGISTER_CONSTANT(VIR_FROM_EVENT, FROM_EVENT); REGISTER_CONSTANT(VIR_FROM_LIBXL, FROM_LIBXL); REGISTER_CONSTANT(VIR_FROM_LOCKING, FROM_LOCKING); REGISTER_CONSTANT(VIR_FROM_HYPERV, FROM_HYPERV); REGISTER_CONSTANT(VIR_FROM_CAPABILITIES, FROM_CAPABILITIES); REGISTER_CONSTANT(VIR_FROM_AUTH, FROM_AUTH); REGISTER_CONSTANT(VIR_FROM_URI, FROM_URI); REGISTER_CONSTANT(VIR_FROM_DBUS, FROM_DBUS); REGISTER_CONSTANT(VIR_FROM_DEVICE, FROM_DEVICE); REGISTER_CONSTANT(VIR_FROM_PARALLELS, FROM_PARALLELS); REGISTER_CONSTANT(VIR_FROM_SSH, FROM_SSH); REGISTER_CONSTANT(VIR_FROM_LOCKSPACE, FROM_LOCKSPACE); REGISTER_CONSTANT(VIR_FROM_INITCTL, FROM_INITCTL); REGISTER_CONSTANT(VIR_FROM_CGROUP, FROM_CGROUP); REGISTER_CONSTANT(VIR_FROM_IDENTITY, FROM_IDENTITY); REGISTER_CONSTANT(VIR_FROM_ACCESS, FROM_ACCESS); REGISTER_CONSTANT(VIR_FROM_SYSTEMD, FROM_SYSTEMD); REGISTER_CONSTANT(VIR_FROM_BHYVE, FROM_BHYVE); REGISTER_CONSTANT(VIR_FROM_CRYPTO, FROM_CRYPTO); REGISTER_CONSTANT(VIR_FROM_FIREWALL, FROM_FIREWALL); REGISTER_CONSTANT(VIR_FROM_POLKIT, FROM_POLKIT); REGISTER_CONSTANT(VIR_FROM_THREAD, FROM_THREAD); REGISTER_CONSTANT(VIR_FROM_ADMIN, FROM_ADMIN); REGISTER_CONSTANT(VIR_FROM_LOGGING, FROM_LOGGING); REGISTER_CONSTANT(VIR_FROM_XENXL, FROM_XENXL); REGISTER_CONSTANT(VIR_FROM_PERF, FROM_PERF); REGISTER_CONSTANT(VIR_FROM_LIBSSH, FROM_LIBSSH); REGISTER_CONSTANT(VIR_FROM_RESCTRL, FROM_RESCTRL); REGISTER_CONSTANT(VIR_FROM_FIREWALLD, FROM_FIREWALLD); REGISTER_CONSTANT(VIR_FROM_DOMAIN_CHECKPOINT, FROM_DOMAIN_CHECKPOINT); REGISTER_CONSTANT(VIR_FROM_TPM, FROM_TPM); REGISTER_CONSTANT(VIR_FROM_BPF, FROM_BPF); REGISTER_CONSTANT(VIR_FROM_CH, FROM_CH); REGISTER_CONSTANT(VIR_ERR_OK, ERR_OK); REGISTER_CONSTANT(VIR_ERR_INTERNAL_ERROR, ERR_INTERNAL_ERROR); REGISTER_CONSTANT(VIR_ERR_NO_MEMORY, ERR_NO_MEMORY); REGISTER_CONSTANT(VIR_ERR_NO_SUPPORT, ERR_NO_SUPPORT); REGISTER_CONSTANT(VIR_ERR_UNKNOWN_HOST, ERR_UNKNOWN_HOST); REGISTER_CONSTANT(VIR_ERR_NO_CONNECT, ERR_NO_CONNECT); REGISTER_CONSTANT(VIR_ERR_INVALID_CONN, ERR_INVALID_CONN); REGISTER_CONSTANT(VIR_ERR_INVALID_DOMAIN, ERR_INVALID_DOMAIN); REGISTER_CONSTANT(VIR_ERR_INVALID_ARG, ERR_INVALID_ARG); REGISTER_CONSTANT(VIR_ERR_OPERATION_FAILED, ERR_OPERATION_FAILED); REGISTER_CONSTANT(VIR_ERR_GET_FAILED, ERR_GET_FAILED); REGISTER_CONSTANT(VIR_ERR_POST_FAILED, ERR_POST_FAILED); REGISTER_CONSTANT(VIR_ERR_HTTP_ERROR, ERR_HTTP_ERROR); REGISTER_CONSTANT(VIR_ERR_SEXPR_SERIAL, ERR_SEXPR_SERIAL); REGISTER_CONSTANT(VIR_ERR_NO_XEN, ERR_NO_XEN); REGISTER_CONSTANT(VIR_ERR_XEN_CALL, ERR_XEN_CALL); REGISTER_CONSTANT(VIR_ERR_OS_TYPE, ERR_OS_TYPE); REGISTER_CONSTANT(VIR_ERR_NO_KERNEL, ERR_NO_KERNEL); REGISTER_CONSTANT(VIR_ERR_NO_ROOT, ERR_NO_ROOT); REGISTER_CONSTANT(VIR_ERR_NO_SOURCE, ERR_NO_SOURCE); REGISTER_CONSTANT(VIR_ERR_NO_TARGET, ERR_NO_TARGET); REGISTER_CONSTANT(VIR_ERR_NO_NAME, ERR_NO_NAME); REGISTER_CONSTANT(VIR_ERR_NO_OS, ERR_NO_OS); REGISTER_CONSTANT(VIR_ERR_NO_DEVICE, ERR_NO_DEVICE); REGISTER_CONSTANT(VIR_ERR_NO_XENSTORE, ERR_NO_XENSTORE); REGISTER_CONSTANT(VIR_ERR_DRIVER_FULL, ERR_DRIVER_FULL); REGISTER_CONSTANT(VIR_ERR_CALL_FAILED, ERR_CALL_FAILED); REGISTER_CONSTANT(VIR_ERR_XML_ERROR, ERR_XML_ERROR); REGISTER_CONSTANT(VIR_ERR_DOM_EXIST, ERR_DOM_EXIST); REGISTER_CONSTANT(VIR_ERR_OPERATION_DENIED, ERR_OPERATIONED_DENIED); REGISTER_CONSTANT(VIR_ERR_OPEN_FAILED, ERR_OPEN_FAILED); REGISTER_CONSTANT(VIR_ERR_READ_FAILED, ERR_READ_FAILED); REGISTER_CONSTANT(VIR_ERR_PARSE_FAILED, ERR_PARSE_FAILED); REGISTER_CONSTANT(VIR_ERR_CONF_SYNTAX, ERR_CONF_SYNTAX); REGISTER_CONSTANT(VIR_ERR_WRITE_FAILED, ERR_WRITE_FAILED); REGISTER_CONSTANT(VIR_ERR_XML_DETAIL, ERR_XML_DETAIL); REGISTER_CONSTANT(VIR_ERR_INVALID_NETWORK, ERR_INVALID_NETWORK); REGISTER_CONSTANT(VIR_ERR_NETWORK_EXIST, ERR_NETWORK_EXIST); REGISTER_CONSTANT(VIR_ERR_SYSTEM_ERROR, ERR_SYSTEM_ERROR); REGISTER_CONSTANT(VIR_ERR_RPC, ERR_RPC); REGISTER_CONSTANT(VIR_ERR_GNUTLS_ERROR, ERR_GNUTLS_ERROR); REGISTER_CONSTANT(VIR_WAR_NO_NETWORK, WAR_NO_NETWORK); REGISTER_CONSTANT(VIR_ERR_NO_DOMAIN, ERR_NO_DOMAIN); REGISTER_CONSTANT(VIR_ERR_NO_NETWORK, ERR_NO_NETWORK); REGISTER_CONSTANT(VIR_ERR_INVALID_MAC, ERR_INVALID_MAC); REGISTER_CONSTANT(VIR_ERR_AUTH_FAILED, ERR_AUTH_FAILED); REGISTER_CONSTANT(VIR_ERR_INVALID_STORAGE_POOL, ERR_INVALID_STORAGE_POOL); REGISTER_CONSTANT(VIR_ERR_INVALID_STORAGE_VOL, ERR_INVALID_STORAGE_VOL); REGISTER_CONSTANT(VIR_WAR_NO_STORAGE, WAR_NO_STORAGE); REGISTER_CONSTANT(VIR_ERR_NO_STORAGE_POOL, ERR_NO_STORAGE_POOL); REGISTER_CONSTANT(VIR_ERR_NO_STORAGE_VOL, ERR_NO_STORAGE_VOL); REGISTER_CONSTANT(VIR_WAR_NO_NODE, WAR_NO_NODE); REGISTER_CONSTANT(VIR_ERR_INVALID_NODE_DEVICE, ERR_INVALID_NODE_DEVICE); REGISTER_CONSTANT(VIR_ERR_NO_NODE_DEVICE, ERR_NO_NODE_DEVICE); REGISTER_CONSTANT(VIR_ERR_NO_SECURITY_MODEL, ERR_NO_SECURITY_MODEL); REGISTER_CONSTANT(VIR_ERR_OPERATION_INVALID, ERR_OPERATION_INVALID); REGISTER_CONSTANT(VIR_WAR_NO_INTERFACE, WAR_NO_INTERFACE); REGISTER_CONSTANT(VIR_ERR_NO_INTERFACE, ERR_NO_INTERFACE); REGISTER_CONSTANT(VIR_ERR_INVALID_INTERFACE, ERR_INVALID_INTERFACE); REGISTER_CONSTANT(VIR_ERR_MULTIPLE_INTERFACES, ERR_MULTIPLE_INTERFACES); REGISTER_CONSTANT(VIR_WAR_NO_NWFILTER, WAR_NO_NWFILTER); REGISTER_CONSTANT(VIR_ERR_INVALID_NWFILTER, ERR_INVALID_NWFILTER); REGISTER_CONSTANT(VIR_ERR_NO_NWFILTER, ERR_NO_NWFILTER); REGISTER_CONSTANT(VIR_ERR_BUILD_FIREWALL, ERR_BUILD_FIREWALL); REGISTER_CONSTANT(VIR_WAR_NO_SECRET, WAR_NO_SECRET); REGISTER_CONSTANT(VIR_ERR_INVALID_SECRET, ERR_INVALID_SECRET); REGISTER_CONSTANT(VIR_ERR_NO_SECRET, ERR_NO_SECRET); REGISTER_CONSTANT(VIR_ERR_CONFIG_UNSUPPORTED, ERR_CONFIG_UNSUPPORTED); REGISTER_CONSTANT(VIR_ERR_OPERATION_TIMEOUT, ERR_OPERATION_TIMEOUT); REGISTER_CONSTANT(VIR_ERR_MIGRATE_PERSIST_FAILED, ERR_MIGRATE_PERSIST_FAILED); REGISTER_CONSTANT(VIR_ERR_HOOK_SCRIPT_FAILED, ERR_HOOK_SCRIPT_FAILED); REGISTER_CONSTANT(VIR_ERR_INVALID_DOMAIN_SNAPSHOT, ERR_INVALID_DOMAIN_SNAPSHOT); REGISTER_CONSTANT(VIR_ERR_NO_DOMAIN_SNAPSHOT, ERR_NO_DOMAIN_SNAPSHOT); REGISTER_CONSTANT(VIR_ERR_INVALID_STREAM, ERR_INVALID_STREAM); REGISTER_CONSTANT(VIR_ERR_ARGUMENT_UNSUPPORTED, ERR_ARGUMENT_UNSUPPORTED); REGISTER_CONSTANT(VIR_ERR_STORAGE_PROBE_FAILED, ERR_STORAGE_PROBE_FAILED); REGISTER_CONSTANT(VIR_ERR_STORAGE_POOL_BUILT, ERR_STORAGE_POOL_BUILT); REGISTER_CONSTANT(VIR_ERR_SNAPSHOT_REVERT_RISKY, ERR_SNAPSHOT_REVERT_RISKY); REGISTER_CONSTANT(VIR_ERR_OPERATION_ABORTED, ERR_OPERATION_ABORTED); REGISTER_CONSTANT(VIR_ERR_AUTH_CANCELLED, ERR_AUTH_CANCELLED); REGISTER_CONSTANT(VIR_ERR_NO_DOMAIN_METADATA, ERR_NO_DOMAIN_METADATA); REGISTER_CONSTANT(VIR_ERR_MIGRATE_UNSAFE, ERR_MIGRATE_UNSAFE); REGISTER_CONSTANT(VIR_ERR_OVERFLOW, ERR_OVERFLOW); REGISTER_CONSTANT(VIR_ERR_BLOCK_COPY_ACTIVE, ERR_BLOCK_COPY_ACTIVE); REGISTER_CONSTANT(VIR_ERR_AGENT_UNRESPONSIVE, ERR_AGENT_UNRESPONSIVE); REGISTER_CONSTANT(VIR_ERR_OPERATION_UNSUPPORTED, ERR_OPERATION_UNSUPPORTED); REGISTER_CONSTANT(VIR_ERR_SSH, ERR_SSH); REGISTER_CONSTANT(VIR_ERR_RESOURCE_BUSY, ERR_RESOURCE_BUSY); REGISTER_CONSTANT(VIR_ERR_ACCESS_DENIED, ERR_ACCESS_DENIED); REGISTER_CONSTANT(VIR_ERR_DBUS_SERVICE, ERR_DBUS_SERVICE); REGISTER_CONSTANT(VIR_ERR_STORAGE_VOL_EXIST, ERR_STORAGE_VOL_EXIST); REGISTER_CONSTANT(VIR_ERR_CPU_INCOMPATIBLE, ERR_CPU_INCOMPATIBLE); REGISTER_CONSTANT(VIR_ERR_XML_INVALID_SCHEMA, ERR_INVALID_SCHEMA); REGISTER_CONSTANT(VIR_ERR_MIGRATE_FINISH_OK, ERR_MIGRATE_FINISH_OK); REGISTER_CONSTANT(VIR_ERR_AUTH_UNAVAILABLE, ERR_AUTH_UNAVAILABLE); REGISTER_CONSTANT(VIR_ERR_NO_SERVER, ERR_NO_SERVER); REGISTER_CONSTANT(VIR_ERR_NO_CLIENT, ERR_NO_CLIENT); REGISTER_CONSTANT(VIR_ERR_AGENT_UNSYNCED, ERR_AGENT_UNSYNCED); REGISTER_CONSTANT(VIR_ERR_LIBSSH, ERR_LIBSSH); REGISTER_CONSTANT(VIR_ERR_DEVICE_MISSING, ERR_DEVICE_MISSING); REGISTER_CONSTANT(VIR_ERR_INVALID_NWFILTER_BINDING, ERR_INVALID_NWFILTER_BINDING); REGISTER_CONSTANT(VIR_ERR_NO_NWFILTER_BINDING, ERR_NO_NWFILTER_BINDING); REGISTER_CONSTANT(VIR_ERR_INVALID_DOMAIN_CHECKPOINT, ERR_INVALID_DOMAIN_CHECKPOINT); REGISTER_CONSTANT(VIR_ERR_NO_DOMAIN_BACKUP, ERR_NO_DOMAIN_BACKUP); REGISTER_CONSTANT(VIR_ERR_NO_DOMAIN_CHECKPOINT, ERR_NO_DOMAIN_CHECKPOINT); REGISTER_CONSTANT(VIR_ERR_NO_NETWORK_PORT, ERR_NO_NETWORK_PORT); REGISTER_CONSTANT(VIR_ERR_INVALID_NETWORK_PORT, ERR_INVALID_NETWORK_PORT); REGISTER_CONSTANT(VIR_ERR_NETWORK_PORT_EXIST, ERR_NETWORK_PORT_EXIST); REGISTER_CONSTANT(VIR_ERR_NO_HOSTNAME, ERR_NO_HOSTNAME); REGISTER_CONSTANT(VIR_ERR_CHECKPOINT_INCONSISTENT, ERR_CHECKPOINT_INCONSISTENT); REGISTER_CONSTANT(VIR_ERR_MULTIPLE_DOMAINS, ERR_MULTIPLE_DOMAINS); } Sys-Virt-v8.0.0/lib/Sys/Virt000755001750001750 014170317017 16413 5ustar00berrangeberrange000000000000Sys-Virt-v8.0.0/lib/Sys/Virt/Domain.pm000444001750001750 37017714170317017 20374 0ustar00berrangeberrange000000000000# -*- perl -*- # # Copyright (C) 2006 Red Hat # Copyright (C) 2006-2007 Daniel P. Berrange # # This program is free software; You can redistribute it and/or modify # it under either: # # a) the GNU General Public License as published by the Free # Software Foundation; either version 2, or (at your option) any # later version, # # or # # b) the "Artistic License" # # The file "LICENSE" distributed along with this file provides full # details of the terms and conditions of the two licenses. =pod =head1 NAME Sys::Virt::Domain - Represent & manage a libvirt guest domain =head1 DESCRIPTION The C module represents a guest domain managed by the virtual machine monitor. =head1 METHODS =over 4 =cut package Sys::Virt::Domain; use strict; use warnings; sub _new { my $proto = shift; my $class = ref($proto) || $proto; my %params = @_; my $con = exists $params{connection} ? $params{connection} : die "connection parameter is required"; my $self; if (exists $params{name}) { $self = Sys::Virt::Domain::_lookup_by_name($con, $params{name}); } elsif (exists $params{id}) { $self = Sys::Virt::Domain::_lookup_by_id($con, $params{id}); } elsif (exists $params{uuid}) { if (length($params{uuid}) == 16) { $self = Sys::Virt::Domain::_lookup_by_uuid($con, $params{uuid}); } elsif (length($params{uuid}) == 32 || length($params{uuid}) == 36) { $self = Sys::Virt::Domain::_lookup_by_uuid_string($con, $params{uuid}); } else { die "UUID must be either 16 unsigned bytes, or 32/36 hex characters long"; } } elsif (exists $params{xml}) { if ($params{nocreate}) { $self = Sys::Virt::Domain::_define_xml($con, $params{xml}, $params{flags}); } else { if (exists $params{fds}) { $self = Sys::Virt::Domain::_create_with_files($con, $params{xml}, $params{fds}, $params{flags}); } else { $self = Sys::Virt::Domain::_create($con, $params{xml}, $params{flags}); } } } else { die "address, id or uuid parameters are required"; } bless $self, $class; return $self; } =item my $id = $dom->get_id() Returns an integer with a locally unique identifier for the domain. =item my $uuid = $dom->get_uuid() Returns a 16 byte long string containing the raw globally unique identifier (UUID) for the domain. =item my $uuid = $dom->get_uuid_string() Returns a printable string representation of the raw UUID, in the format 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'. =item my $name = $dom->get_name() Returns a string with a locally unique name of the domain =item my $hostname = $dom->get_hostname($flags=0) Returns a string representing the hostname of the guest. C<$flags> can be zero or more of =over 4 =item Sys::Virt::Domain::GET_HOSTNAME_AGENT Report the guest agent hostname =item Sys::Virt::Domain::GET_HOSTNAME_LEASE Report the DHCP lease hostname =back =item my $str = $dom->get_metadata($type, $uri, $flags =0) Returns the metadata element of type C<$type> associated with the domain. If C<$type> is C then the C<$uri> parameter specifies the XML namespace to retrieve, otherwise C<$uri> should be C. The optional C<$flags> parameter defaults to zero. =item $dom->set_metadata($type, $val, $key, $uri, $flags=0) Sets the metadata element of type C<$type> to hold the value C<$val>. If C<$type> is C then the C<$key> and C<$uri> elements specify an XML namespace to use, otherwise they should both be C. The optional C<$flags> parameter defaults to zero. =item $dom->is_active() Returns a true value if the domain is currently running =item $dom->is_persistent() Returns a true value if the domain has a persistent configuration file defined =item $dom->is_updated() Returns a true value if the domain is running and has a persistent configuration file defined that is out of date compared to the current live config. =item my $xml = $dom->get_xml_description($flags=0) Returns an XML document containing a complete description of the domain's configuration. The optional $flags parameter controls generation of the XML document, defaulting to 0 if omitted. It can be one or more of the XML DUMP constants listed later in this document. =item my $type = $dom->get_os_type() Returns a string containing the name of the OS type running within the domain. =item $dom->create($flags) Start a domain whose configuration was previously defined using the C method in L. The C<$flags> parameter accepts one of the DOMAIN CREATION constants documented later, and defaults to 0 if omitted. =item $dom->create_with_files($fds, $flags) Start a domain whose configuration was previously defined using the C method in L. The C<$fds> parameter is an array of UNIX file descriptors which will be passed to the init process of the container. This is only supported with container based virtualization.The C<$flags> parameter accepts one of the DOMAIN CREATION constants documented later, and defaults to 0 if omitted. =item $dom->undefine() Remove the configuration associated with a domain previously defined with the C method in L. If the domain is running, you probably want to use the C or C methods instead. =item $dom->suspend() Temporarily stop execution of the domain, allowing later continuation by calling the C method. =item $dom->resume() Resume execution of a domain previously halted with the C method. =item $dom->pm_wakeup() Wakeup the guest from power management suspend state =item $dom->pm_suspend_for_duration($target, $duration, $flags=0) Tells the guest OS to enter the power management suspend state identified by C<$target>. The C<$target> parameter should be one of the NODE SUSPEND CONTANTS listed in C. The C<$duration> specifies when the guest should automatically wakeup. The C<$flags> parameter is optional and defaults to zero. =item $dom->save($filename) Take a snapshot of the domain's state and save the information to the file named in the C<$filename> parameter. The domain can later be restored from this file with the C method on the L object. =item $dom->managed_save($flags=0) Take a snapshot of the domain's state and save the information to a managed save location. The domain will be automatically restored with this state when it is next started. The C<$flags> parameter is unused and defaults to zero. =item $bool = $dom->has_managed_save_image($flags=0) Return a non-zero value if the domain has a managed save image that will be used at next start. The C<$flags> parameter is unused and defaults to zero. =item $dom->managed_save_remove($flags=0) Remove the current managed save image, causing the guest to perform a full boot next time it is started. The C<$flags> parameter is unused and defaults to zero. =item $dom->managed_save_define_xml($xml, $flags=0) Update the XML of the managed save image to C<$xml>. The C<$flags> parameter is unused and defaults to zero. =item $xml = $dom->managed_save_get_xml_description($flags=0) Get the XML in the managed save image. The C<$flags> parameter accepts the following constants =over 4 =item Sys::Virt::Domain::SAVE_IMAGE_XML_SECURE Include security sensitive information in the XML dump, such as passwords. =back =item $dom->core_dump($filename[, $flags]) Trigger a core dump of the guest virtual machine, saving its memory image to C<$filename> so it can be analysed by tools such as C. The optional C<$flags> flags parameter is currently unused and if omitted will default to 0. =item $dom->core_dump_format($filename, $format, [, $flags]) Trigger a core dump of the guest virtual machine, saving its memory image to C<$filename> so it can be analysed by tools such as C. The C<$format> parameter is one of the core dump format constants. The optional C<$flags> flags parameter is currently unused and if omitted will default to 0. =over 4 =item Sys::Virt::Domain::CORE_DUMP_FORMAT_RAW The raw ELF format =item Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_ZLIB The zlib compressed ELF format =item Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_SNAPPY The snappy compressed ELF format =item Sys::Virt::Domain::CORE_DUMP_FORMAT_KDUMP_LZO The lzo compressed ELF format =item Sys::Virt::Domain::CORE_DUMP_FORMAT_WIN_DMP The Windows dump format =back =item $dom->destroy() Immediately poweroff the machine. This is equivalent to removing the power plug. The guest OS is given no time to cleanup / save state. For a clean poweroff sequence, use the C method instead. =item my $info = $dom->get_info() Returns a hash reference summarising the execution state of the domain. The elements of the hash are as follows: =over 4 =item maxMem The maximum memory allowed for this domain, in kilobytes =item memory The current memory allocated to the domain in kilobytes =item cpuTime The amount of CPU time used by the domain =item nrVirtCpu The current number of virtual CPUs enabled in the domain =item state The execution state of the machine, which will be one of the constants &Sys::Virt::Domain::STATE_*. =back =item my ($state, $reason) = $dom->get_state() Returns an array whose values specify the current state of the guest, and the reason for it being in that state. The C<$state> values are the same as for the C API, and the C<$reason> values come from: =over 4 =item Sys::Virt::Domain::STATE_CRASHED_UNKNOWN It is not known why the domain has crashed =item Sys::Virt::Domain::STATE_CRASHED_PANICKED The domain has crashed due to a kernel panic =item Sys::Virt::Domain::STATE_NOSTATE_UNKNOWN It is not known why the domain has no state =item Sys::Virt::Domain::STATE_PAUSED_DUMP The guest is paused due to a core dump operation =item Sys::Virt::Domain::STATE_PAUSED_FROM_SNAPSHOT The guest is paused due to a snapshot =item Sys::Virt::Domain::STATE_PAUSED_IOERROR The guest is paused due to an I/O error =item Sys::Virt::Domain::STATE_PAUSED_MIGRATION The guest is paused due to migration =item Sys::Virt::Domain::STATE_PAUSED_SAVE The guest is paused due to a save operation =item Sys::Virt::Domain::STATE_PAUSED_UNKNOWN It is not known why the domain has paused =item Sys::Virt::Domain::STATE_PAUSED_USER The guest is paused at admin request =item Sys::Virt::Domain::STATE_PAUSED_WATCHDOG The guest is paused due to the watchdog =item Sys::Virt::Domain::STATE_PAUSED_SHUTTING_DOWN The guest is paused while domain shutdown takes place =item Sys::Virt::Domain::STATE_PAUSED_SNAPSHOT The guest is paused while a snapshot takes place =item Sys::Virt::Domain::STATE_PAUSED_CRASHED The guest is paused due to a kernel panic =item Sys::Virt::Domain::STATE_PAUSED_STARTING_UP The guest is paused as it is being started up. =item Sys::Virt::Domain::STATE_PAUSED_POSTCOPY The guest is paused as post-copy migration is taking place =item Sys::Virt::Domain::STATE_PAUSED_POSTCOPY_FAILED The guest is paused as post-copy migration failed =item Sys::Virt::Domain::STATE_RUNNING_BOOTED The guest is running after being booted =item Sys::Virt::Domain::STATE_RUNNING_FROM_SNAPSHOT The guest is running after restore from snapshot =item Sys::Virt::Domain::STATE_RUNNING_MIGRATED The guest is running after migration =item Sys::Virt::Domain::STATE_RUNNING_MIGRATION_CANCELED The guest is running after migration abort =item Sys::Virt::Domain::STATE_RUNNING_RESTORED The guest is running after restore from file =item Sys::Virt::Domain::STATE_RUNNING_SAVE_CANCELED The guest is running after save cancel =item Sys::Virt::Domain::STATE_RUNNING_UNKNOWN It is not known why the domain has started =item Sys::Virt::Domain::STATE_RUNNING_UNPAUSED The guest is running after a resume =item Sys::Virt::Domain::STATE_RUNNING_WAKEUP The guest is running after wakeup from power management suspend =item Sys::Virt::Domain::STATE_RUNNING_CRASHED The guest was restarted after crashing =item Sys::Virt::Domain::STATE_RUNNING_POSTCOPY The guest is running but post-copy is taking place =item Sys::Virt::Domain::STATE_BLOCKED_UNKNOWN The guest is blocked for an unknown reason =item Sys::Virt::Domain::STATE_SHUTDOWN_UNKNOWN It is not known why the domain has shutdown =item Sys::Virt::Domain::STATE_SHUTDOWN_USER The guest is shutdown due to admin request =item Sys::Virt::Domain::STATE_SHUTOFF_CRASHED The guest is shutoff after a crash =item Sys::Virt::Domain::STATE_SHUTOFF_DESTROYED The guest is shutoff after being destroyed =item Sys::Virt::Domain::STATE_SHUTOFF_FAILED The guest is shutoff due to a virtualization failure =item Sys::Virt::Domain::STATE_SHUTOFF_FROM_SNAPSHOT The guest is shutoff after a snapshot =item Sys::Virt::Domain::STATE_SHUTOFF_MIGRATED The guest is shutoff after migration =item Sys::Virt::Domain::STATE_SHUTOFF_SAVED The guest is shutoff after a save =item Sys::Virt::Domain::STATE_SHUTOFF_SHUTDOWN The guest is shutoff due to controlled shutdown =item Sys::Virt::Domain::STATE_SHUTOFF_UNKNOWN It is not known why the domain has shutoff =item Sys::Virt::Domain::STATE_SHUTOFF_DAEMON The daemon stopped the guest due to a failure =item Sys::Virt::Domain::STATE_PMSUSPENDED_UNKNOWN It is not known why the domain was suspended to RAM =item Sys::Virt::Domain::STATE_PMSUSPENDED_DISK_UNKNOWN It is not known why the domain was suspended to disk =back =item my $info = $dom->get_control_info($flags=0) Returns a hash reference providing information about the control channel. The returned keys in the hash are =over 4 =item C One of the CONTROL INFO constants listed later =item C
Currently unused, always 0. =item C The elapsed time since the control channel entered the current state. =back =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. 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); Set the current time of the guest, in seconds and nanoseconds. The C<$flags> parameter accepts one of =over 4 =item C Re-sync domain time from domain's RTC. =back =item $dom->set_user_password($username, $password, $flags=0); Update the password for account C<$username> to be C<$password>. C<$password> is the clear-text password string unless the PASSWORD_ENCRYPTED flag is set. =over 4 =item C The C<$password> is encrypted with the password scheme required by the guest OS. =back =item $dom->rename($newname, $flags=0) Change the name of an inactive guest to be C<$newname>. The C<$flags> parameter is currently unused and defaults to zero. =item my @errs = $dom->get_disk_errors($flags=0) Returns a list of all disk errors that have occurred on the backing store for the guest's virtual disks. The returned array elements are hash references, containing two keys =over 4 =item C The path of the disk with an error =item C The error type =back =item $dom->send_key($keycodeset, $holdtime, \@keycodes, $flags=0) Sends a sequence of keycodes to the guest domain. The C<$keycodeset> should be one of the constants listed later in the KEYCODE SET section. C<$holdtiem> is the duration, in milliseconds, to keep the key pressed before releasing it and sending the next keycode. C<@keycodes> is an array reference containing the list of keycodes to send to the guest. The elements in the array should be keycode values from the specified keycode set. C<$flags> is currently unused. =item my $info = $dom->get_block_info($dev, $flags=0) Returns a hash reference summarising the disk usage of the host backing store for a guest block device. The C<$dev> parameter should be the path to the backing store on the host. C<$flags> is currently unused and defaults to 0 if omitted. The returned hash contains the following elements =over 4 =item capacity Logical size in bytes of the block device backing image * =item allocation Highest allocated extent in bytes of the block device backing image =item physical Physical size in bytes of the container of the backing image =back =item $dom->set_max_memory($mem) Set the maximum memory for the domain to the value C<$mem>. The value of the C<$mem> parameter is specified in kilobytes. =item $mem = $dom->get_max_memory() Returns the current maximum memory allowed for this domain in kilobytes. =item $dom->set_memory($mem, $flags) Set the current memory for the domain to the value C<$mem>. The value of the C<$mem> parameter is specified in kilobytes. This must be less than, or equal to the domain's max memory limit. The C<$flags> parameter can control whether the update affects the live guest, or inactive config, defaulting to modifying the current state. =item $dom->set_memory_stats_period($period, $flags) Set the period on which guests memory stats are refreshed, with C<$period> being a value in seconds. The C<$flags> parameter is currently unused. =item $dom->shutdown() Request that the guest OS perform a graceful shutdown and poweroff. This usually requires some form of cooperation from the guest operating system, such as responding to an ACPI signal, or a guest agent process. For an immediate, forceful poweroff, use the C method instead. =item $dom->reboot([$flags]) Request that the guest OS perform a graceful shutdown and optionally restart. The optional C<$flags> parameter is currently unused and if omitted defaults to zero. =item $dom->reset([$flags]) Perform a hardware reset of the virtual machine. The guest OS is given no opportunity to shutdown gracefully. The optional C<$flags> parameter is currently unused and if omitted defaults to zero. =item $dom->get_max_vcpus() Return the maximum number of vcpus that are configured for the domain =item $dom->attach_device($xml[, $flags]) Hotplug a new device whose configuration is given by C<$xml>, to the running guest. The optional <$flags> parameter defaults to 0, but can accept one of the device hotplug flags described later. =item $dom->detach_device($xml[, $flags]) Hotunplug an existing device whose configuration is given by C<$xml>, from the running guest. The optional <$flags> parameter defaults to 0, but can accept one of the device hotplug flags described later. =item $dom->detach_device_alias($alias[, $flags]) Hotunplug an existing device which is identified by C<$alias>. The optional <$flags> parameter defaults to 0, but can accept one of the device hotplug flags described later. =item $dom->update_device($xml[, $flags]) Update the configuration of an existing device. The new configuration is given by C<$xml>. The optional <$flags> parameter defaults to 0 but can accept one of the device hotplug flags described later. =item $data = $dom->block_peek($path, $offset, $size[, $flags]) Peek into the guest disk C<$path>, at byte C<$offset> capturing C<$size> bytes of data. The returned scalar may contain embedded NULLs. The optional C<$flags> parameter is currently unused and if omitted defaults to zero. =item $data = $dom->memory_peek($offset, $size[, $flags]) Peek into the guest memory at byte C<$offset> virtual address, capturing C<$size> bytes of memory. The return scalar may contain embedded NULLs. The optional C<$flags> parameter is currently unused and if omitted defaults to zero. =item $flag = $dom->get_autostart(); Return a true value if the guest domain is configured to automatically start upon boot. Return false, otherwise =item $dom->set_autostart($flag) Set the state of the autostart flag, which determines whether the guest will automatically start upon boot of the host OS =item $dom->set_vcpus($count, [$flags]) Set the number of virtual CPUs in the guest VM to C<$count>. The optional C<$flags> parameter can be used to control whether the setting changes the live config or inactive config. =item $dom->set_vcpu($cpumap, $state, [$flags]) Set the state of the CPUs in C<$cpumap> to C<$state>. The C<$flags> parameter defaults to zero if not present. =item $count = $dom->get_vcpus([$flags]) Get the number of virtual CPUs in the guest VM. The optional C<$flags> parameter can be used to control whether to query the setting of the live config or inactive config. =item $dom->set_guest_vcpus($cpumap, $state, [$flags=0]) Set the online status of the guest OS CPUs. The C<$cpumap> parameter describes the set of CPUs to modify (eg "0-3,^1"). C<$state> is either B<1> to set the CPUs online, or B<0> to set them offline. The C<$flags> parameter is currently unused and defaults to 0. =item $info $dom->get_guest_vcpus([$flags=0]) Query information about the guest OS CPUs. The returned data is a hash reference with the following keys. =over 4 =item B String containing bitmap representing CPU ids reported currently known to the guest. =item B String containing bitmap representing CPU ids that are currently online in the guest. =item B String containing bitmap representing CPU ids that can be offlined in the guest. =back The C<$flags> parameter is currently unused and defaults to 0. =item $type = $dom->get_scheduler_type() Return the scheduler type for the guest domain =item $stats = $dom->block_stats($path) Fetch the current I/O statistics for the block device given by C<$path>. The returned hash reference contains keys for =over 4 =item C Number of read requests =item C Number of bytes read =item C Number of write requests =item C Number of bytes written =item C Some kind of error count =back =item my $params = $dom->get_scheduler_parameters($flags=0) Return the set of scheduler tunable parameters for the guest, as a hash reference. The precise set of keys in the hash are specific to the hypervisor. =item $dom->set_scheduler_parameters($params, $flags=0) Update the set of scheduler tunable parameters. The value names for tunables vary, and can be discovered using the C call =item my $params = $dom->get_memory_parameters($flags=0) Return a hash reference containing the set of memory tunable parameters for the guest. The keys in the hash are one of the constants MEMORY PARAMETERS described later. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item $dom->set_memory_parameters($params, $flags=0) Update the memory tunable parameters for the guest. The C<$params> should be a hash reference whose keys are one of the MEMORY PARAMETERS constants. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item my $params = $dom->get_blkio_parameters($flags=0) Return a hash reference containing the set of blkio tunable parameters for the guest. The keys in the hash are one of the constants BLKIO PARAMETERS described later. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item $dom->set_blkio_parameters($params, $flags=0) Update the blkio tunable parameters for the guest. The C<$params> should be a hash reference whose keys are one of the BLKIO PARAMETERS constants. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item $stats = $dom->get_block_iotune($disk, $flags=0) Return a hash reference containing the set of blkio tunable parameters for the guest disk C<$disk>. The keys in the hash are one of the constants BLOCK IOTUNE PARAMETERS described later. =item $dom->set_block_iotune($disk, $params, $flags=0); Update the blkio tunable parameters for the guest disk C<$disk>. The C<$params> should be a hash reference whose keys are one of the BLOCK IOTUNE PARAMETERS constants. =item my $params = $dom->get_interface_parameters($intf, $flags=0) Return a hash reference containing the set of interface tunable parameters for the guest. The keys in the hash are one of the constants INTERFACE PARAMETERS described later. =item $dom->set_interface_parameters($intf, $params, $flags=0) Update the interface tunable parameters for the guest. The C<$params> should be a hash reference whose keys are one of the INTERFACE PARAMETERS constants. =item my $params = $dom->get_numa_parameters($flags=0) Return a hash reference containing the set of numa tunable parameters for the guest. The keys in the hash are one of the constants NUMA PARAMETERS described later. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item $dom->set_numa_parameters($params, $flags=0) Update the numa tunable parameters for the guest. The C<$params> should be a hash reference whose keys are one of the NUMA PARAMETERS constants. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item my $params = $dom->get_perf_events($flags=0) Return a hash reference containing the set of performance events that are available for the guest. The keys in the hash are one of the constants PERF EVENTS described later. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item $dom->set_perf_events($params, $flags=0) Update the enabled state for performance events for the guest. The C<$params> should be a hash reference whose keys are one of the PERF EVENTS constants. The C<$flags> parameter accepts one or more the CONFIG OPTION constants documented later, and defaults to 0 if omitted. =item $dom->block_resize($disk, $newsize, $flags=0) Resize the disk C<$disk> to have new size C<$newsize> KB. If the disk is backed by a special image format, the actual resize is done by the hypervisor. If the disk is backed by a raw file, or block device, the resize must be done prior to invoking this API call, and it merely updates the hypervisor's view of the disk size. The following flags may be used =over 4 =item Sys::Virt::Domain::BLOCK_RESIZE_BYTES Treat C<$newsize> as if it were in bytes, rather than KB. =back =item $dom->interface_stats($path) Fetch the current I/O statistics for the block device given by C<$path>. The returned hash containins keys for =over 4 =item C Total bytes received =item C Total packets received =item C Total packets received with errors =item C Total packets drop at reception =item C Total bytes transmitted =item C Total packets transmitted =item C Total packets transmitted with errors =item C Total packets dropped at transmission. =back =item $dom->memory_stats($flags=0) Fetch the current memory statistics for the guest domain. The C<$flags> parameter is currently unused and can be omitted. The returned hash containins keys for =over 4 =item C Data read from swap space =item C Data written to swap space =item C Page fault involving disk I/O =item C Page fault not involving disk I/O =item C Memory not used by the system =item C Total memory seen by guest =item C Resident set size. Size of memory resident in host RAM. =back =item $info = $dom->get_security_label() Fetch information about the security label assigned to the guest domain. The returned hash reference has two keys, C gives the name of the security model in effect (eg C), while C