Merge pull request #49 from digitalocean/geoff/generate-lv-bindings

Geoff/generate lv bindings
This commit is contained in:
Geoff Hickey 2017-11-17 14:02:45 -05:00 committed by GitHub
commit 7c0f66a1e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 21528 additions and 904 deletions

View File

@ -4,15 +4,16 @@ dist: trusty
sudo: require sudo: require
go: go:
- 1.7 - 1.9
env: env:
- LIBVIRT=1.2.2 EXT=gz - LIBVIRT=1.2.12 EXT=gz
- LIBVIRT=2.3.0 EXT=xz - LIBVIRT=2.3.0 EXT=xz
- LIBVIRT=3.1.0 EXT=xz - LIBVIRT=3.1.0 EXT=xz
before_install: before_install:
- go get github.com/golang/lint/golint - go get github.com/golang/lint/golint
- go get golang.org/x/tools/cmd/goyacc
install: install:
# credit here goes to the go-libvirt authors, # credit here goes to the go-libvirt authors,
@ -44,6 +45,7 @@ before_script:
script: script:
- ./scripts/licensecheck.sh - ./scripts/licensecheck.sh
- LIBVIRT_SOURCE=/usr/src/libvirt-${LIBVIRT} go generate ./...
- go build ./... - go build ./...
- golint -set_exit_status ./... - golint -set_exit_status ./...
- go vet ./... - go vet ./...

View File

@ -16,3 +16,4 @@ Michael Koppmann <me@mkoppmann.at>
Simarpreet Singh <simar@linux.com> Simarpreet Singh <simar@linux.com>
Alexander Polyakov <apolyakov@beget.com> Alexander Polyakov <apolyakov@beget.com>
Amanda Andrade <amanda.andrade@serpro.gov.br> Amanda Andrade <amanda.andrade@serpro.gov.br>
Geoff Hickey <ghickey@digitalocean.com>

View File

@ -8,9 +8,15 @@ Libvirt's RPC interface, as documented [here](https://libvirt.org/internals/rpc.
Connections to the libvirt server may be local, or remote. RPC packets are encoded Connections to the libvirt server may be local, or remote. RPC packets are encoded
using the XDR standard as defined by [RFC 4506](https://tools.ietf.org/html/rfc4506.html). using the XDR standard as defined by [RFC 4506](https://tools.ietf.org/html/rfc4506.html).
This should be considered a work in progress. Most functionaly provided by the C Libvirt's RPC interface is quite extensive, and changes from one version to the next, so
bindings have not yet made their way into this library. [Pull requests are welcome](https://github.com/digitalocean/go-libvirt/blob/master/CONTRIBUTING.md)! this project uses a code generator to build the go bindings. The code generator should
The definition of the RPC protocol is in the libvirt source tree under [src/rpc/virnetprotocol.x](https://github.com/libvirt/libvirt/blob/master/src/rpc/virnetprotocol.x). be run whenever you want to build go-libvirt for a new version of libvirt. To do this,
you'll need to set an environment variable `LIBVIRT_SOURCE` to the directory containing
the untarred libvirt sources, and then run `go generate ./...` from the go-libvirt directory.
The code generator consumes [src/remote/remote_protocol.x](https://github.com/libvirt/libvirt/blob/master/src/remote/remote_protocol.x)
and produces go bindings for all the remote procedures defined there.
[Pull requests are welcome](https://github.com/digitalocean/go-libvirt/blob/master/CONTRIBUTING.md)!
Feel free to join us in [`#go-qemu` on freenode](https://webchat.freenode.net/) Feel free to join us in [`#go-qemu` on freenode](https://webchat.freenode.net/)
if you'd like to discuss the project. if you'd like to discuss the project.

View File

@ -0,0 +1,937 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by internal/lvgen/generate.go. DO NOT EDIT.
//
// To regenerate, run 'go generate' in internal/lvgen.
//
// Package constants contains libvirt procedure identifiers and other enums and
// constants.
package constants
// These are libvirt procedure numbers which correspond to each respective
// API call between remote_internal driver and libvirtd. Each procedure is
// identified by a unique number which *may change in any future libvirt
// update*.
//
// Examples:
// REMOTE_PROC_CONNECT_OPEN = 1
// REMOTE_PROC_DOMAIN_DEFINE_XML = 11
// REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
const (
// From enums:
// AuthNone is libvirt's REMOTE_AUTH_NONE
AuthNone = 0
// AuthSasl is libvirt's REMOTE_AUTH_SASL
AuthSasl = 1
// AuthPolkit is libvirt's REMOTE_AUTH_POLKIT
AuthPolkit = 2
// ProcConnectOpen is libvirt's REMOTE_PROC_CONNECT_OPEN
ProcConnectOpen = 1
// ProcConnectClose is libvirt's REMOTE_PROC_CONNECT_CLOSE
ProcConnectClose = 2
// ProcConnectGetType is libvirt's REMOTE_PROC_CONNECT_GET_TYPE
ProcConnectGetType = 3
// ProcConnectGetVersion is libvirt's REMOTE_PROC_CONNECT_GET_VERSION
ProcConnectGetVersion = 4
// ProcConnectGetMaxVcpus is libvirt's REMOTE_PROC_CONNECT_GET_MAX_VCPUS
ProcConnectGetMaxVcpus = 5
// ProcNodeGetInfo is libvirt's REMOTE_PROC_NODE_GET_INFO
ProcNodeGetInfo = 6
// ProcConnectGetCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_CAPABILITIES
ProcConnectGetCapabilities = 7
// ProcDomainAttachDevice is libvirt's REMOTE_PROC_DOMAIN_ATTACH_DEVICE
ProcDomainAttachDevice = 8
// ProcDomainCreate is libvirt's REMOTE_PROC_DOMAIN_CREATE
ProcDomainCreate = 9
// ProcDomainCreateXML is libvirt's REMOTE_PROC_DOMAIN_CREATE_XML
ProcDomainCreateXML = 10
// ProcDomainDefineXML is libvirt's REMOTE_PROC_DOMAIN_DEFINE_XML
ProcDomainDefineXML = 11
// ProcDomainDestroy is libvirt's REMOTE_PROC_DOMAIN_DESTROY
ProcDomainDestroy = 12
// ProcDomainDetachDevice is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE
ProcDomainDetachDevice = 13
// ProcDomainGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_GET_XML_DESC
ProcDomainGetXMLDesc = 14
// ProcDomainGetAutostart is libvirt's REMOTE_PROC_DOMAIN_GET_AUTOSTART
ProcDomainGetAutostart = 15
// ProcDomainGetInfo is libvirt's REMOTE_PROC_DOMAIN_GET_INFO
ProcDomainGetInfo = 16
// ProcDomainGetMaxMemory is libvirt's REMOTE_PROC_DOMAIN_GET_MAX_MEMORY
ProcDomainGetMaxMemory = 17
// ProcDomainGetMaxVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_MAX_VCPUS
ProcDomainGetMaxVcpus = 18
// ProcDomainGetOsType is libvirt's REMOTE_PROC_DOMAIN_GET_OS_TYPE
ProcDomainGetOsType = 19
// ProcDomainGetVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_VCPUS
ProcDomainGetVcpus = 20
// ProcConnectListDefinedDomains is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_DOMAINS
ProcConnectListDefinedDomains = 21
// ProcDomainLookupByID is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_ID
ProcDomainLookupByID = 22
// ProcDomainLookupByName is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME
ProcDomainLookupByName = 23
// ProcDomainLookupByUUID is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID
ProcDomainLookupByUUID = 24
// ProcConnectNumOfDefinedDomains is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_DOMAINS
ProcConnectNumOfDefinedDomains = 25
// ProcDomainPinVcpu is libvirt's REMOTE_PROC_DOMAIN_PIN_VCPU
ProcDomainPinVcpu = 26
// ProcDomainReboot is libvirt's REMOTE_PROC_DOMAIN_REBOOT
ProcDomainReboot = 27
// ProcDomainResume is libvirt's REMOTE_PROC_DOMAIN_RESUME
ProcDomainResume = 28
// ProcDomainSetAutostart is libvirt's REMOTE_PROC_DOMAIN_SET_AUTOSTART
ProcDomainSetAutostart = 29
// ProcDomainSetMaxMemory is libvirt's REMOTE_PROC_DOMAIN_SET_MAX_MEMORY
ProcDomainSetMaxMemory = 30
// ProcDomainSetMemory is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY
ProcDomainSetMemory = 31
// ProcDomainSetVcpus is libvirt's REMOTE_PROC_DOMAIN_SET_VCPUS
ProcDomainSetVcpus = 32
// ProcDomainShutdown is libvirt's REMOTE_PROC_DOMAIN_SHUTDOWN
ProcDomainShutdown = 33
// ProcDomainSuspend is libvirt's REMOTE_PROC_DOMAIN_SUSPEND
ProcDomainSuspend = 34
// ProcDomainUndefine is libvirt's REMOTE_PROC_DOMAIN_UNDEFINE
ProcDomainUndefine = 35
// ProcConnectListDefinedNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_NETWORKS
ProcConnectListDefinedNetworks = 36
// ProcConnectListDomains is libvirt's REMOTE_PROC_CONNECT_LIST_DOMAINS
ProcConnectListDomains = 37
// ProcConnectListNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_NETWORKS
ProcConnectListNetworks = 38
// ProcNetworkCreate is libvirt's REMOTE_PROC_NETWORK_CREATE
ProcNetworkCreate = 39
// ProcNetworkCreateXML is libvirt's REMOTE_PROC_NETWORK_CREATE_XML
ProcNetworkCreateXML = 40
// ProcNetworkDefineXML is libvirt's REMOTE_PROC_NETWORK_DEFINE_XML
ProcNetworkDefineXML = 41
// ProcNetworkDestroy is libvirt's REMOTE_PROC_NETWORK_DESTROY
ProcNetworkDestroy = 42
// ProcNetworkGetXMLDesc is libvirt's REMOTE_PROC_NETWORK_GET_XML_DESC
ProcNetworkGetXMLDesc = 43
// ProcNetworkGetAutostart is libvirt's REMOTE_PROC_NETWORK_GET_AUTOSTART
ProcNetworkGetAutostart = 44
// ProcNetworkGetBridgeName is libvirt's REMOTE_PROC_NETWORK_GET_BRIDGE_NAME
ProcNetworkGetBridgeName = 45
// ProcNetworkLookupByName is libvirt's REMOTE_PROC_NETWORK_LOOKUP_BY_NAME
ProcNetworkLookupByName = 46
// ProcNetworkLookupByUUID is libvirt's REMOTE_PROC_NETWORK_LOOKUP_BY_UUID
ProcNetworkLookupByUUID = 47
// ProcNetworkSetAutostart is libvirt's REMOTE_PROC_NETWORK_SET_AUTOSTART
ProcNetworkSetAutostart = 48
// ProcNetworkUndefine is libvirt's REMOTE_PROC_NETWORK_UNDEFINE
ProcNetworkUndefine = 49
// ProcConnectNumOfDefinedNetworks is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_NETWORKS
ProcConnectNumOfDefinedNetworks = 50
// ProcConnectNumOfDomains is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DOMAINS
ProcConnectNumOfDomains = 51
// ProcConnectNumOfNetworks is libvirt's REMOTE_PROC_CONNECT_NUM_OF_NETWORKS
ProcConnectNumOfNetworks = 52
// ProcDomainCoreDump is libvirt's REMOTE_PROC_DOMAIN_CORE_DUMP
ProcDomainCoreDump = 53
// ProcDomainRestore is libvirt's REMOTE_PROC_DOMAIN_RESTORE
ProcDomainRestore = 54
// ProcDomainSave is libvirt's REMOTE_PROC_DOMAIN_SAVE
ProcDomainSave = 55
// ProcDomainGetSchedulerType is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE
ProcDomainGetSchedulerType = 56
// ProcDomainGetSchedulerParameters is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS
ProcDomainGetSchedulerParameters = 57
// ProcDomainSetSchedulerParameters is libvirt's REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS
ProcDomainSetSchedulerParameters = 58
// ProcConnectGetHostname is libvirt's REMOTE_PROC_CONNECT_GET_HOSTNAME
ProcConnectGetHostname = 59
// ProcConnectSupportsFeature is libvirt's REMOTE_PROC_CONNECT_SUPPORTS_FEATURE
ProcConnectSupportsFeature = 60
// ProcDomainMigratePrepare is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE
ProcDomainMigratePrepare = 61
// ProcDomainMigratePerform is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM
ProcDomainMigratePerform = 62
// ProcDomainMigrateFinish is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH
ProcDomainMigrateFinish = 63
// ProcDomainBlockStats is libvirt's REMOTE_PROC_DOMAIN_BLOCK_STATS
ProcDomainBlockStats = 64
// ProcDomainInterfaceStats is libvirt's REMOTE_PROC_DOMAIN_INTERFACE_STATS
ProcDomainInterfaceStats = 65
// ProcAuthList is libvirt's REMOTE_PROC_AUTH_LIST
ProcAuthList = 66
// ProcAuthSaslInit is libvirt's REMOTE_PROC_AUTH_SASL_INIT
ProcAuthSaslInit = 67
// ProcAuthSaslStart is libvirt's REMOTE_PROC_AUTH_SASL_START
ProcAuthSaslStart = 68
// ProcAuthSaslStep is libvirt's REMOTE_PROC_AUTH_SASL_STEP
ProcAuthSaslStep = 69
// ProcAuthPolkit is libvirt's REMOTE_PROC_AUTH_POLKIT
ProcAuthPolkit = 70
// ProcConnectNumOfStoragePools is libvirt's REMOTE_PROC_CONNECT_NUM_OF_STORAGE_POOLS
ProcConnectNumOfStoragePools = 71
// ProcConnectListStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_STORAGE_POOLS
ProcConnectListStoragePools = 72
// ProcConnectNumOfDefinedStoragePools is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_STORAGE_POOLS
ProcConnectNumOfDefinedStoragePools = 73
// ProcConnectListDefinedStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_STORAGE_POOLS
ProcConnectListDefinedStoragePools = 74
// ProcConnectFindStoragePoolSources is libvirt's REMOTE_PROC_CONNECT_FIND_STORAGE_POOL_SOURCES
ProcConnectFindStoragePoolSources = 75
// ProcStoragePoolCreateXML is libvirt's REMOTE_PROC_STORAGE_POOL_CREATE_XML
ProcStoragePoolCreateXML = 76
// ProcStoragePoolDefineXML is libvirt's REMOTE_PROC_STORAGE_POOL_DEFINE_XML
ProcStoragePoolDefineXML = 77
// ProcStoragePoolCreate is libvirt's REMOTE_PROC_STORAGE_POOL_CREATE
ProcStoragePoolCreate = 78
// ProcStoragePoolBuild is libvirt's REMOTE_PROC_STORAGE_POOL_BUILD
ProcStoragePoolBuild = 79
// ProcStoragePoolDestroy is libvirt's REMOTE_PROC_STORAGE_POOL_DESTROY
ProcStoragePoolDestroy = 80
// ProcStoragePoolDelete is libvirt's REMOTE_PROC_STORAGE_POOL_DELETE
ProcStoragePoolDelete = 81
// ProcStoragePoolUndefine is libvirt's REMOTE_PROC_STORAGE_POOL_UNDEFINE
ProcStoragePoolUndefine = 82
// ProcStoragePoolRefresh is libvirt's REMOTE_PROC_STORAGE_POOL_REFRESH
ProcStoragePoolRefresh = 83
// ProcStoragePoolLookupByName is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME
ProcStoragePoolLookupByName = 84
// ProcStoragePoolLookupByUUID is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID
ProcStoragePoolLookupByUUID = 85
// ProcStoragePoolLookupByVolume is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME
ProcStoragePoolLookupByVolume = 86
// ProcStoragePoolGetInfo is libvirt's REMOTE_PROC_STORAGE_POOL_GET_INFO
ProcStoragePoolGetInfo = 87
// ProcStoragePoolGetXMLDesc is libvirt's REMOTE_PROC_STORAGE_POOL_GET_XML_DESC
ProcStoragePoolGetXMLDesc = 88
// ProcStoragePoolGetAutostart is libvirt's REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART
ProcStoragePoolGetAutostart = 89
// ProcStoragePoolSetAutostart is libvirt's REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART
ProcStoragePoolSetAutostart = 90
// ProcStoragePoolNumOfVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES
ProcStoragePoolNumOfVolumes = 91
// ProcStoragePoolListVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES
ProcStoragePoolListVolumes = 92
// ProcStorageVolCreateXML is libvirt's REMOTE_PROC_STORAGE_VOL_CREATE_XML
ProcStorageVolCreateXML = 93
// ProcStorageVolDelete is libvirt's REMOTE_PROC_STORAGE_VOL_DELETE
ProcStorageVolDelete = 94
// ProcStorageVolLookupByName is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME
ProcStorageVolLookupByName = 95
// ProcStorageVolLookupByKey is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY
ProcStorageVolLookupByKey = 96
// ProcStorageVolLookupByPath is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH
ProcStorageVolLookupByPath = 97
// ProcStorageVolGetInfo is libvirt's REMOTE_PROC_STORAGE_VOL_GET_INFO
ProcStorageVolGetInfo = 98
// ProcStorageVolGetXMLDesc is libvirt's REMOTE_PROC_STORAGE_VOL_GET_XML_DESC
ProcStorageVolGetXMLDesc = 99
// ProcStorageVolGetPath is libvirt's REMOTE_PROC_STORAGE_VOL_GET_PATH
ProcStorageVolGetPath = 100
// ProcNodeGetCellsFreeMemory is libvirt's REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY
ProcNodeGetCellsFreeMemory = 101
// ProcNodeGetFreeMemory is libvirt's REMOTE_PROC_NODE_GET_FREE_MEMORY
ProcNodeGetFreeMemory = 102
// ProcDomainBlockPeek is libvirt's REMOTE_PROC_DOMAIN_BLOCK_PEEK
ProcDomainBlockPeek = 103
// ProcDomainMemoryPeek is libvirt's REMOTE_PROC_DOMAIN_MEMORY_PEEK
ProcDomainMemoryPeek = 104
// ProcConnectDomainEventRegister is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER
ProcConnectDomainEventRegister = 105
// ProcConnectDomainEventDeregister is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER
ProcConnectDomainEventDeregister = 106
// ProcDomainEventLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE
ProcDomainEventLifecycle = 107
// ProcDomainMigratePrepare2 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2
ProcDomainMigratePrepare2 = 108
// ProcDomainMigrateFinish2 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH2
ProcDomainMigrateFinish2 = 109
// ProcConnectGetUri is libvirt's REMOTE_PROC_CONNECT_GET_URI
ProcConnectGetUri = 110
// ProcNodeNumOfDevices is libvirt's REMOTE_PROC_NODE_NUM_OF_DEVICES
ProcNodeNumOfDevices = 111
// ProcNodeListDevices is libvirt's REMOTE_PROC_NODE_LIST_DEVICES
ProcNodeListDevices = 112
// ProcNodeDeviceLookupByName is libvirt's REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME
ProcNodeDeviceLookupByName = 113
// ProcNodeDeviceGetXMLDesc is libvirt's REMOTE_PROC_NODE_DEVICE_GET_XML_DESC
ProcNodeDeviceGetXMLDesc = 114
// ProcNodeDeviceGetParent is libvirt's REMOTE_PROC_NODE_DEVICE_GET_PARENT
ProcNodeDeviceGetParent = 115
// ProcNodeDeviceNumOfCaps is libvirt's REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS
ProcNodeDeviceNumOfCaps = 116
// ProcNodeDeviceListCaps is libvirt's REMOTE_PROC_NODE_DEVICE_LIST_CAPS
ProcNodeDeviceListCaps = 117
// ProcNodeDeviceDettach is libvirt's REMOTE_PROC_NODE_DEVICE_DETTACH
ProcNodeDeviceDettach = 118
// ProcNodeDeviceReAttach is libvirt's REMOTE_PROC_NODE_DEVICE_RE_ATTACH
ProcNodeDeviceReAttach = 119
// ProcNodeDeviceReset is libvirt's REMOTE_PROC_NODE_DEVICE_RESET
ProcNodeDeviceReset = 120
// ProcDomainGetSecurityLabel is libvirt's REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL
ProcDomainGetSecurityLabel = 121
// ProcNodeGetSecurityModel is libvirt's REMOTE_PROC_NODE_GET_SECURITY_MODEL
ProcNodeGetSecurityModel = 122
// ProcNodeDeviceCreateXML is libvirt's REMOTE_PROC_NODE_DEVICE_CREATE_XML
ProcNodeDeviceCreateXML = 123
// ProcNodeDeviceDestroy is libvirt's REMOTE_PROC_NODE_DEVICE_DESTROY
ProcNodeDeviceDestroy = 124
// ProcStorageVolCreateXMLFrom is libvirt's REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM
ProcStorageVolCreateXMLFrom = 125
// ProcConnectNumOfInterfaces is libvirt's REMOTE_PROC_CONNECT_NUM_OF_INTERFACES
ProcConnectNumOfInterfaces = 126
// ProcConnectListInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_INTERFACES
ProcConnectListInterfaces = 127
// ProcInterfaceLookupByName is libvirt's REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME
ProcInterfaceLookupByName = 128
// ProcInterfaceLookupByMacString is libvirt's REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING
ProcInterfaceLookupByMacString = 129
// ProcInterfaceGetXMLDesc is libvirt's REMOTE_PROC_INTERFACE_GET_XML_DESC
ProcInterfaceGetXMLDesc = 130
// ProcInterfaceDefineXML is libvirt's REMOTE_PROC_INTERFACE_DEFINE_XML
ProcInterfaceDefineXML = 131
// ProcInterfaceUndefine is libvirt's REMOTE_PROC_INTERFACE_UNDEFINE
ProcInterfaceUndefine = 132
// ProcInterfaceCreate is libvirt's REMOTE_PROC_INTERFACE_CREATE
ProcInterfaceCreate = 133
// ProcInterfaceDestroy is libvirt's REMOTE_PROC_INTERFACE_DESTROY
ProcInterfaceDestroy = 134
// ProcConnectDomainXMLFromNative is libvirt's REMOTE_PROC_CONNECT_DOMAIN_XML_FROM_NATIVE
ProcConnectDomainXMLFromNative = 135
// ProcConnectDomainXMLToNative is libvirt's REMOTE_PROC_CONNECT_DOMAIN_XML_TO_NATIVE
ProcConnectDomainXMLToNative = 136
// ProcConnectNumOfDefinedInterfaces is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_INTERFACES
ProcConnectNumOfDefinedInterfaces = 137
// ProcConnectListDefinedInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_INTERFACES
ProcConnectListDefinedInterfaces = 138
// ProcConnectNumOfSecrets is libvirt's REMOTE_PROC_CONNECT_NUM_OF_SECRETS
ProcConnectNumOfSecrets = 139
// ProcConnectListSecrets is libvirt's REMOTE_PROC_CONNECT_LIST_SECRETS
ProcConnectListSecrets = 140
// ProcSecretLookupByUUID is libvirt's REMOTE_PROC_SECRET_LOOKUP_BY_UUID
ProcSecretLookupByUUID = 141
// ProcSecretDefineXML is libvirt's REMOTE_PROC_SECRET_DEFINE_XML
ProcSecretDefineXML = 142
// ProcSecretGetXMLDesc is libvirt's REMOTE_PROC_SECRET_GET_XML_DESC
ProcSecretGetXMLDesc = 143
// ProcSecretSetValue is libvirt's REMOTE_PROC_SECRET_SET_VALUE
ProcSecretSetValue = 144
// ProcSecretGetValue is libvirt's REMOTE_PROC_SECRET_GET_VALUE
ProcSecretGetValue = 145
// ProcSecretUndefine is libvirt's REMOTE_PROC_SECRET_UNDEFINE
ProcSecretUndefine = 146
// ProcSecretLookupByUsage is libvirt's REMOTE_PROC_SECRET_LOOKUP_BY_USAGE
ProcSecretLookupByUsage = 147
// ProcDomainMigratePrepareTunnel is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL
ProcDomainMigratePrepareTunnel = 148
// ProcConnectIsSecure is libvirt's REMOTE_PROC_CONNECT_IS_SECURE
ProcConnectIsSecure = 149
// ProcDomainIsActive is libvirt's REMOTE_PROC_DOMAIN_IS_ACTIVE
ProcDomainIsActive = 150
// ProcDomainIsPersistent is libvirt's REMOTE_PROC_DOMAIN_IS_PERSISTENT
ProcDomainIsPersistent = 151
// ProcNetworkIsActive is libvirt's REMOTE_PROC_NETWORK_IS_ACTIVE
ProcNetworkIsActive = 152
// ProcNetworkIsPersistent is libvirt's REMOTE_PROC_NETWORK_IS_PERSISTENT
ProcNetworkIsPersistent = 153
// ProcStoragePoolIsActive is libvirt's REMOTE_PROC_STORAGE_POOL_IS_ACTIVE
ProcStoragePoolIsActive = 154
// ProcStoragePoolIsPersistent is libvirt's REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT
ProcStoragePoolIsPersistent = 155
// ProcInterfaceIsActive is libvirt's REMOTE_PROC_INTERFACE_IS_ACTIVE
ProcInterfaceIsActive = 156
// ProcConnectGetLibVersion is libvirt's REMOTE_PROC_CONNECT_GET_LIB_VERSION
ProcConnectGetLibVersion = 157
// ProcConnectCompareCPU is libvirt's REMOTE_PROC_CONNECT_COMPARE_CPU
ProcConnectCompareCPU = 158
// ProcDomainMemoryStats is libvirt's REMOTE_PROC_DOMAIN_MEMORY_STATS
ProcDomainMemoryStats = 159
// ProcDomainAttachDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS
ProcDomainAttachDeviceFlags = 160
// ProcDomainDetachDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS
ProcDomainDetachDeviceFlags = 161
// ProcConnectBaselineCPU is libvirt's REMOTE_PROC_CONNECT_BASELINE_CPU
ProcConnectBaselineCPU = 162
// ProcDomainGetJobInfo is libvirt's REMOTE_PROC_DOMAIN_GET_JOB_INFO
ProcDomainGetJobInfo = 163
// ProcDomainAbortJob is libvirt's REMOTE_PROC_DOMAIN_ABORT_JOB
ProcDomainAbortJob = 164
// ProcStorageVolWipe is libvirt's REMOTE_PROC_STORAGE_VOL_WIPE
ProcStorageVolWipe = 165
// ProcDomainMigrateSetMaxDowntime is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME
ProcDomainMigrateSetMaxDowntime = 166
// ProcConnectDomainEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY
ProcConnectDomainEventRegisterAny = 167
// ProcConnectDomainEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER_ANY
ProcConnectDomainEventDeregisterAny = 168
// ProcDomainEventReboot is libvirt's REMOTE_PROC_DOMAIN_EVENT_REBOOT
ProcDomainEventReboot = 169
// ProcDomainEventRtcChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE
ProcDomainEventRtcChange = 170
// ProcDomainEventWatchdog is libvirt's REMOTE_PROC_DOMAIN_EVENT_WATCHDOG
ProcDomainEventWatchdog = 171
// ProcDomainEventIOError is libvirt's REMOTE_PROC_DOMAIN_EVENT_IO_ERROR
ProcDomainEventIOError = 172
// ProcDomainEventGraphics is libvirt's REMOTE_PROC_DOMAIN_EVENT_GRAPHICS
ProcDomainEventGraphics = 173
// ProcDomainUpdateDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS
ProcDomainUpdateDeviceFlags = 174
// ProcNwfilterLookupByName is libvirt's REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME
ProcNwfilterLookupByName = 175
// ProcNwfilterLookupByUUID is libvirt's REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID
ProcNwfilterLookupByUUID = 176
// ProcNwfilterGetXMLDesc is libvirt's REMOTE_PROC_NWFILTER_GET_XML_DESC
ProcNwfilterGetXMLDesc = 177
// ProcConnectNumOfNwfilters is libvirt's REMOTE_PROC_CONNECT_NUM_OF_NWFILTERS
ProcConnectNumOfNwfilters = 178
// ProcConnectListNwfilters is libvirt's REMOTE_PROC_CONNECT_LIST_NWFILTERS
ProcConnectListNwfilters = 179
// ProcNwfilterDefineXML is libvirt's REMOTE_PROC_NWFILTER_DEFINE_XML
ProcNwfilterDefineXML = 180
// ProcNwfilterUndefine is libvirt's REMOTE_PROC_NWFILTER_UNDEFINE
ProcNwfilterUndefine = 181
// ProcDomainManagedSave is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE
ProcDomainManagedSave = 182
// ProcDomainHasManagedSaveImage is libvirt's REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE
ProcDomainHasManagedSaveImage = 183
// ProcDomainManagedSaveRemove is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE
ProcDomainManagedSaveRemove = 184
// ProcDomainSnapshotCreateXML is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML
ProcDomainSnapshotCreateXML = 185
// ProcDomainSnapshotGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC
ProcDomainSnapshotGetXMLDesc = 186
// ProcDomainSnapshotNum is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_NUM
ProcDomainSnapshotNum = 187
// ProcDomainSnapshotListNames is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES
ProcDomainSnapshotListNames = 188
// ProcDomainSnapshotLookupByName is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME
ProcDomainSnapshotLookupByName = 189
// ProcDomainHasCurrentSnapshot is libvirt's REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT
ProcDomainHasCurrentSnapshot = 190
// ProcDomainSnapshotCurrent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT
ProcDomainSnapshotCurrent = 191
// ProcDomainRevertToSnapshot is libvirt's REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT
ProcDomainRevertToSnapshot = 192
// ProcDomainSnapshotDelete is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE
ProcDomainSnapshotDelete = 193
// ProcDomainGetBlockInfo is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_INFO
ProcDomainGetBlockInfo = 194
// ProcDomainEventIOErrorReason is libvirt's REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON
ProcDomainEventIOErrorReason = 195
// ProcDomainCreateWithFlags is libvirt's REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS
ProcDomainCreateWithFlags = 196
// ProcDomainSetMemoryParameters is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS
ProcDomainSetMemoryParameters = 197
// ProcDomainGetMemoryParameters is libvirt's REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS
ProcDomainGetMemoryParameters = 198
// ProcDomainSetVcpusFlags is libvirt's REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS
ProcDomainSetVcpusFlags = 199
// ProcDomainGetVcpusFlags is libvirt's REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS
ProcDomainGetVcpusFlags = 200
// ProcDomainOpenConsole is libvirt's REMOTE_PROC_DOMAIN_OPEN_CONSOLE
ProcDomainOpenConsole = 201
// ProcDomainIsUpdated is libvirt's REMOTE_PROC_DOMAIN_IS_UPDATED
ProcDomainIsUpdated = 202
// ProcConnectGetSysinfo is libvirt's REMOTE_PROC_CONNECT_GET_SYSINFO
ProcConnectGetSysinfo = 203
// ProcDomainSetMemoryFlags is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS
ProcDomainSetMemoryFlags = 204
// ProcDomainSetBlkioParameters is libvirt's REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS
ProcDomainSetBlkioParameters = 205
// ProcDomainGetBlkioParameters is libvirt's REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS
ProcDomainGetBlkioParameters = 206
// ProcDomainMigrateSetMaxSpeed is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED
ProcDomainMigrateSetMaxSpeed = 207
// ProcStorageVolUpload is libvirt's REMOTE_PROC_STORAGE_VOL_UPLOAD
ProcStorageVolUpload = 208
// ProcStorageVolDownload is libvirt's REMOTE_PROC_STORAGE_VOL_DOWNLOAD
ProcStorageVolDownload = 209
// ProcDomainInjectNmi is libvirt's REMOTE_PROC_DOMAIN_INJECT_NMI
ProcDomainInjectNmi = 210
// ProcDomainScreenshot is libvirt's REMOTE_PROC_DOMAIN_SCREENSHOT
ProcDomainScreenshot = 211
// ProcDomainGetState is libvirt's REMOTE_PROC_DOMAIN_GET_STATE
ProcDomainGetState = 212
// ProcDomainMigrateBegin3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3
ProcDomainMigrateBegin3 = 213
// ProcDomainMigratePrepare3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3
ProcDomainMigratePrepare3 = 214
// ProcDomainMigratePrepareTunnel3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3
ProcDomainMigratePrepareTunnel3 = 215
// ProcDomainMigratePerform3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3
ProcDomainMigratePerform3 = 216
// ProcDomainMigrateFinish3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH3
ProcDomainMigrateFinish3 = 217
// ProcDomainMigrateConfirm3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3
ProcDomainMigrateConfirm3 = 218
// ProcDomainSetSchedulerParametersFlags is libvirt's REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS
ProcDomainSetSchedulerParametersFlags = 219
// ProcInterfaceChangeBegin is libvirt's REMOTE_PROC_INTERFACE_CHANGE_BEGIN
ProcInterfaceChangeBegin = 220
// ProcInterfaceChangeCommit is libvirt's REMOTE_PROC_INTERFACE_CHANGE_COMMIT
ProcInterfaceChangeCommit = 221
// ProcInterfaceChangeRollback is libvirt's REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK
ProcInterfaceChangeRollback = 222
// ProcDomainGetSchedulerParametersFlags is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS
ProcDomainGetSchedulerParametersFlags = 223
// ProcDomainEventControlError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR
ProcDomainEventControlError = 224
// ProcDomainPinVcpuFlags is libvirt's REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS
ProcDomainPinVcpuFlags = 225
// ProcDomainSendKey is libvirt's REMOTE_PROC_DOMAIN_SEND_KEY
ProcDomainSendKey = 226
// ProcNodeGetCPUStats is libvirt's REMOTE_PROC_NODE_GET_CPU_STATS
ProcNodeGetCPUStats = 227
// ProcNodeGetMemoryStats is libvirt's REMOTE_PROC_NODE_GET_MEMORY_STATS
ProcNodeGetMemoryStats = 228
// ProcDomainGetControlInfo is libvirt's REMOTE_PROC_DOMAIN_GET_CONTROL_INFO
ProcDomainGetControlInfo = 229
// ProcDomainGetVcpuPinInfo is libvirt's REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO
ProcDomainGetVcpuPinInfo = 230
// ProcDomainUndefineFlags is libvirt's REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS
ProcDomainUndefineFlags = 231
// ProcDomainSaveFlags is libvirt's REMOTE_PROC_DOMAIN_SAVE_FLAGS
ProcDomainSaveFlags = 232
// ProcDomainRestoreFlags is libvirt's REMOTE_PROC_DOMAIN_RESTORE_FLAGS
ProcDomainRestoreFlags = 233
// ProcDomainDestroyFlags is libvirt's REMOTE_PROC_DOMAIN_DESTROY_FLAGS
ProcDomainDestroyFlags = 234
// ProcDomainSaveImageGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC
ProcDomainSaveImageGetXMLDesc = 235
// ProcDomainSaveImageDefineXML is libvirt's REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML
ProcDomainSaveImageDefineXML = 236
// ProcDomainBlockJobAbort is libvirt's REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT
ProcDomainBlockJobAbort = 237
// ProcDomainGetBlockJobInfo is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO
ProcDomainGetBlockJobInfo = 238
// ProcDomainBlockJobSetSpeed is libvirt's REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED
ProcDomainBlockJobSetSpeed = 239
// ProcDomainBlockPull is libvirt's REMOTE_PROC_DOMAIN_BLOCK_PULL
ProcDomainBlockPull = 240
// ProcDomainEventBlockJob is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB
ProcDomainEventBlockJob = 241
// ProcDomainMigrateGetMaxSpeed is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED
ProcDomainMigrateGetMaxSpeed = 242
// ProcDomainBlockStatsFlags is libvirt's REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS
ProcDomainBlockStatsFlags = 243
// ProcDomainSnapshotGetParent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT
ProcDomainSnapshotGetParent = 244
// ProcDomainReset is libvirt's REMOTE_PROC_DOMAIN_RESET
ProcDomainReset = 245
// ProcDomainSnapshotNumChildren is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_NUM_CHILDREN
ProcDomainSnapshotNumChildren = 246
// ProcDomainSnapshotListChildrenNames is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES
ProcDomainSnapshotListChildrenNames = 247
// ProcDomainEventDiskChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE
ProcDomainEventDiskChange = 248
// ProcDomainOpenGraphics is libvirt's REMOTE_PROC_DOMAIN_OPEN_GRAPHICS
ProcDomainOpenGraphics = 249
// ProcNodeSuspendForDuration is libvirt's REMOTE_PROC_NODE_SUSPEND_FOR_DURATION
ProcNodeSuspendForDuration = 250
// ProcDomainBlockResize is libvirt's REMOTE_PROC_DOMAIN_BLOCK_RESIZE
ProcDomainBlockResize = 251
// ProcDomainSetBlockIOTune is libvirt's REMOTE_PROC_DOMAIN_SET_BLOCK_IO_TUNE
ProcDomainSetBlockIOTune = 252
// ProcDomainGetBlockIOTune is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_IO_TUNE
ProcDomainGetBlockIOTune = 253
// ProcDomainSetNumaParameters is libvirt's REMOTE_PROC_DOMAIN_SET_NUMA_PARAMETERS
ProcDomainSetNumaParameters = 254
// ProcDomainGetNumaParameters is libvirt's REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS
ProcDomainGetNumaParameters = 255
// ProcDomainSetInterfaceParameters is libvirt's REMOTE_PROC_DOMAIN_SET_INTERFACE_PARAMETERS
ProcDomainSetInterfaceParameters = 256
// ProcDomainGetInterfaceParameters is libvirt's REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS
ProcDomainGetInterfaceParameters = 257
// ProcDomainShutdownFlags is libvirt's REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS
ProcDomainShutdownFlags = 258
// ProcStorageVolWipePattern is libvirt's REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN
ProcStorageVolWipePattern = 259
// ProcStorageVolResize is libvirt's REMOTE_PROC_STORAGE_VOL_RESIZE
ProcStorageVolResize = 260
// ProcDomainPmSuspendForDuration is libvirt's REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION
ProcDomainPmSuspendForDuration = 261
// ProcDomainGetCPUStats is libvirt's REMOTE_PROC_DOMAIN_GET_CPU_STATS
ProcDomainGetCPUStats = 262
// ProcDomainGetDiskErrors is libvirt's REMOTE_PROC_DOMAIN_GET_DISK_ERRORS
ProcDomainGetDiskErrors = 263
// ProcDomainSetMetadata is libvirt's REMOTE_PROC_DOMAIN_SET_METADATA
ProcDomainSetMetadata = 264
// ProcDomainGetMetadata is libvirt's REMOTE_PROC_DOMAIN_GET_METADATA
ProcDomainGetMetadata = 265
// ProcDomainBlockRebase is libvirt's REMOTE_PROC_DOMAIN_BLOCK_REBASE
ProcDomainBlockRebase = 266
// ProcDomainPmWakeup is libvirt's REMOTE_PROC_DOMAIN_PM_WAKEUP
ProcDomainPmWakeup = 267
// ProcDomainEventTrayChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE
ProcDomainEventTrayChange = 268
// ProcDomainEventPmwakeup is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP
ProcDomainEventPmwakeup = 269
// ProcDomainEventPmsuspend is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND
ProcDomainEventPmsuspend = 270
// ProcDomainSnapshotIsCurrent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT
ProcDomainSnapshotIsCurrent = 271
// ProcDomainSnapshotHasMetadata is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA
ProcDomainSnapshotHasMetadata = 272
// ProcConnectListAllDomains is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS
ProcConnectListAllDomains = 273
// ProcDomainListAllSnapshots is libvirt's REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS
ProcDomainListAllSnapshots = 274
// ProcDomainSnapshotListAllChildren is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN
ProcDomainSnapshotListAllChildren = 275
// ProcDomainEventBalloonChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE
ProcDomainEventBalloonChange = 276
// ProcDomainGetHostname is libvirt's REMOTE_PROC_DOMAIN_GET_HOSTNAME
ProcDomainGetHostname = 277
// ProcDomainGetSecurityLabelList is libvirt's REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST
ProcDomainGetSecurityLabelList = 278
// ProcDomainPinEmulator is libvirt's REMOTE_PROC_DOMAIN_PIN_EMULATOR
ProcDomainPinEmulator = 279
// ProcDomainGetEmulatorPinInfo is libvirt's REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO
ProcDomainGetEmulatorPinInfo = 280
// ProcConnectListAllStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS
ProcConnectListAllStoragePools = 281
// ProcStoragePoolListAllVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES
ProcStoragePoolListAllVolumes = 282
// ProcConnectListAllNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS
ProcConnectListAllNetworks = 283
// ProcConnectListAllInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES
ProcConnectListAllInterfaces = 284
// ProcConnectListAllNodeDevices is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES
ProcConnectListAllNodeDevices = 285
// ProcConnectListAllNwfilters is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS
ProcConnectListAllNwfilters = 286
// ProcConnectListAllSecrets is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_SECRETS
ProcConnectListAllSecrets = 287
// ProcNodeSetMemoryParameters is libvirt's REMOTE_PROC_NODE_SET_MEMORY_PARAMETERS
ProcNodeSetMemoryParameters = 288
// ProcNodeGetMemoryParameters is libvirt's REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS
ProcNodeGetMemoryParameters = 289
// ProcDomainBlockCommit is libvirt's REMOTE_PROC_DOMAIN_BLOCK_COMMIT
ProcDomainBlockCommit = 290
// ProcNetworkUpdate is libvirt's REMOTE_PROC_NETWORK_UPDATE
ProcNetworkUpdate = 291
// ProcDomainEventPmsuspendDisk is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK
ProcDomainEventPmsuspendDisk = 292
// ProcNodeGetCPUMap is libvirt's REMOTE_PROC_NODE_GET_CPU_MAP
ProcNodeGetCPUMap = 293
// ProcDomainFstrim is libvirt's REMOTE_PROC_DOMAIN_FSTRIM
ProcDomainFstrim = 294
// ProcDomainSendProcessSignal is libvirt's REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL
ProcDomainSendProcessSignal = 295
// ProcDomainOpenChannel is libvirt's REMOTE_PROC_DOMAIN_OPEN_CHANNEL
ProcDomainOpenChannel = 296
// ProcNodeDeviceLookupScsiHostByWwn is libvirt's REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN
ProcNodeDeviceLookupScsiHostByWwn = 297
// ProcDomainGetJobStats is libvirt's REMOTE_PROC_DOMAIN_GET_JOB_STATS
ProcDomainGetJobStats = 298
// ProcDomainMigrateGetCompressionCache is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE
ProcDomainMigrateGetCompressionCache = 299
// ProcDomainMigrateSetCompressionCache is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE
ProcDomainMigrateSetCompressionCache = 300
// ProcNodeDeviceDetachFlags is libvirt's REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS
ProcNodeDeviceDetachFlags = 301
// ProcDomainMigrateBegin3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS
ProcDomainMigrateBegin3Params = 302
// ProcDomainMigratePrepare3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS
ProcDomainMigratePrepare3Params = 303
// ProcDomainMigratePrepareTunnel3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS
ProcDomainMigratePrepareTunnel3Params = 304
// ProcDomainMigratePerform3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS
ProcDomainMigratePerform3Params = 305
// ProcDomainMigrateFinish3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS
ProcDomainMigrateFinish3Params = 306
// ProcDomainMigrateConfirm3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS
ProcDomainMigrateConfirm3Params = 307
// ProcDomainSetMemoryStatsPeriod is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_STATS_PERIOD
ProcDomainSetMemoryStatsPeriod = 308
// ProcDomainCreateXMLWithFiles is libvirt's REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES
ProcDomainCreateXMLWithFiles = 309
// ProcDomainCreateWithFiles is libvirt's REMOTE_PROC_DOMAIN_CREATE_WITH_FILES
ProcDomainCreateWithFiles = 310
// ProcDomainEventDeviceRemoved is libvirt's REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED
ProcDomainEventDeviceRemoved = 311
// ProcConnectGetCPUModelNames is libvirt's REMOTE_PROC_CONNECT_GET_CPU_MODEL_NAMES
ProcConnectGetCPUModelNames = 312
// ProcConnectNetworkEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY
ProcConnectNetworkEventRegisterAny = 313
// ProcConnectNetworkEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_NETWORK_EVENT_DEREGISTER_ANY
ProcConnectNetworkEventDeregisterAny = 314
// ProcNetworkEventLifecycle is libvirt's REMOTE_PROC_NETWORK_EVENT_LIFECYCLE
ProcNetworkEventLifecycle = 315
// ProcConnectDomainEventCallbackRegisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY
ProcConnectDomainEventCallbackRegisterAny = 316
// ProcConnectDomainEventCallbackDeregisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY
ProcConnectDomainEventCallbackDeregisterAny = 317
// ProcDomainEventCallbackLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE
ProcDomainEventCallbackLifecycle = 318
// ProcDomainEventCallbackReboot is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT
ProcDomainEventCallbackReboot = 319
// ProcDomainEventCallbackRtcChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE
ProcDomainEventCallbackRtcChange = 320
// ProcDomainEventCallbackWatchdog is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG
ProcDomainEventCallbackWatchdog = 321
// ProcDomainEventCallbackIOError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR
ProcDomainEventCallbackIOError = 322
// ProcDomainEventCallbackGraphics is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS
ProcDomainEventCallbackGraphics = 323
// ProcDomainEventCallbackIOErrorReason is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON
ProcDomainEventCallbackIOErrorReason = 324
// ProcDomainEventCallbackControlError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR
ProcDomainEventCallbackControlError = 325
// ProcDomainEventCallbackBlockJob is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB
ProcDomainEventCallbackBlockJob = 326
// ProcDomainEventCallbackDiskChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE
ProcDomainEventCallbackDiskChange = 327
// ProcDomainEventCallbackTrayChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE
ProcDomainEventCallbackTrayChange = 328
// ProcDomainEventCallbackPmwakeup is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP
ProcDomainEventCallbackPmwakeup = 329
// ProcDomainEventCallbackPmsuspend is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND
ProcDomainEventCallbackPmsuspend = 330
// ProcDomainEventCallbackBalloonChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE
ProcDomainEventCallbackBalloonChange = 331
// ProcDomainEventCallbackPmsuspendDisk is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK
ProcDomainEventCallbackPmsuspendDisk = 332
// ProcDomainEventCallbackDeviceRemoved is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED
ProcDomainEventCallbackDeviceRemoved = 333
// ProcDomainCoreDumpWithFormat is libvirt's REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT
ProcDomainCoreDumpWithFormat = 334
// ProcDomainFsfreeze is libvirt's REMOTE_PROC_DOMAIN_FSFREEZE
ProcDomainFsfreeze = 335
// ProcDomainFsthaw is libvirt's REMOTE_PROC_DOMAIN_FSTHAW
ProcDomainFsthaw = 336
// ProcDomainGetTime is libvirt's REMOTE_PROC_DOMAIN_GET_TIME
ProcDomainGetTime = 337
// ProcDomainSetTime is libvirt's REMOTE_PROC_DOMAIN_SET_TIME
ProcDomainSetTime = 338
// ProcDomainEventBlockJob2 is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2
ProcDomainEventBlockJob2 = 339
// ProcNodeGetFreePages is libvirt's REMOTE_PROC_NODE_GET_FREE_PAGES
ProcNodeGetFreePages = 340
// ProcNetworkGetDhcpLeases is libvirt's REMOTE_PROC_NETWORK_GET_DHCP_LEASES
ProcNetworkGetDhcpLeases = 341
// ProcConnectGetDomainCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES
ProcConnectGetDomainCapabilities = 342
// ProcDomainOpenGraphicsFd is libvirt's REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD
ProcDomainOpenGraphicsFd = 343
// ProcConnectGetAllDomainStats is libvirt's REMOTE_PROC_CONNECT_GET_ALL_DOMAIN_STATS
ProcConnectGetAllDomainStats = 344
// ProcDomainBlockCopy is libvirt's REMOTE_PROC_DOMAIN_BLOCK_COPY
ProcDomainBlockCopy = 345
// ProcDomainEventCallbackTunable is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE
ProcDomainEventCallbackTunable = 346
// ProcNodeAllocPages is libvirt's REMOTE_PROC_NODE_ALLOC_PAGES
ProcNodeAllocPages = 347
// ProcDomainEventCallbackAgentLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_LIFECYCLE
ProcDomainEventCallbackAgentLifecycle = 348
// ProcDomainGetFsinfo is libvirt's REMOTE_PROC_DOMAIN_GET_FSINFO
ProcDomainGetFsinfo = 349
// ProcDomainDefineXMLFlags is libvirt's REMOTE_PROC_DOMAIN_DEFINE_XML_FLAGS
ProcDomainDefineXMLFlags = 350
// ProcDomainGetIothreadInfo is libvirt's REMOTE_PROC_DOMAIN_GET_IOTHREAD_INFO
ProcDomainGetIothreadInfo = 351
// ProcDomainPinIothread is libvirt's REMOTE_PROC_DOMAIN_PIN_IOTHREAD
ProcDomainPinIothread = 352
// ProcDomainInterfaceAddresses is libvirt's REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES
ProcDomainInterfaceAddresses = 353
// ProcDomainEventCallbackDeviceAdded is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED
ProcDomainEventCallbackDeviceAdded = 354
// ProcDomainAddIothread is libvirt's REMOTE_PROC_DOMAIN_ADD_IOTHREAD
ProcDomainAddIothread = 355
// ProcDomainDelIothread is libvirt's REMOTE_PROC_DOMAIN_DEL_IOTHREAD
ProcDomainDelIothread = 356
// ProcDomainSetUserPassword is libvirt's REMOTE_PROC_DOMAIN_SET_USER_PASSWORD
ProcDomainSetUserPassword = 357
// ProcDomainRename is libvirt's REMOTE_PROC_DOMAIN_RENAME
ProcDomainRename = 358
// ProcDomainEventCallbackMigrationIteration is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRATION_ITERATION
ProcDomainEventCallbackMigrationIteration = 359
// ProcConnectRegisterCloseCallback is libvirt's REMOTE_PROC_CONNECT_REGISTER_CLOSE_CALLBACK
ProcConnectRegisterCloseCallback = 360
// ProcConnectUnregisterCloseCallback is libvirt's REMOTE_PROC_CONNECT_UNREGISTER_CLOSE_CALLBACK
ProcConnectUnregisterCloseCallback = 361
// ProcConnectEventConnectionClosed is libvirt's REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED
ProcConnectEventConnectionClosed = 362
// ProcDomainEventCallbackJobCompleted is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED
ProcDomainEventCallbackJobCompleted = 363
// ProcDomainMigrateStartPostCopy is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY
ProcDomainMigrateStartPostCopy = 364
// ProcDomainGetPerfEvents is libvirt's REMOTE_PROC_DOMAIN_GET_PERF_EVENTS
ProcDomainGetPerfEvents = 365
// ProcDomainSetPerfEvents is libvirt's REMOTE_PROC_DOMAIN_SET_PERF_EVENTS
ProcDomainSetPerfEvents = 366
// ProcDomainEventCallbackDeviceRemovalFailed is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVAL_FAILED
ProcDomainEventCallbackDeviceRemovalFailed = 367
// ProcConnectStoragePoolEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_REGISTER_ANY
ProcConnectStoragePoolEventRegisterAny = 368
// ProcConnectStoragePoolEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY
ProcConnectStoragePoolEventDeregisterAny = 369
// ProcStoragePoolEventLifecycle is libvirt's REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE
ProcStoragePoolEventLifecycle = 370
// ProcDomainGetGuestVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS
ProcDomainGetGuestVcpus = 371
// ProcDomainSetGuestVcpus is libvirt's REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS
ProcDomainSetGuestVcpus = 372
// ProcStoragePoolEventRefresh is libvirt's REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH
ProcStoragePoolEventRefresh = 373
// ProcConnectNodeDeviceEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_REGISTER_ANY
ProcConnectNodeDeviceEventRegisterAny = 374
// ProcConnectNodeDeviceEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_DEREGISTER_ANY
ProcConnectNodeDeviceEventDeregisterAny = 375
// ProcNodeDeviceEventLifecycle is libvirt's REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE
ProcNodeDeviceEventLifecycle = 376
// ProcNodeDeviceEventUpdate is libvirt's REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE
ProcNodeDeviceEventUpdate = 377
// ProcStorageVolGetInfoFlags is libvirt's REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS
ProcStorageVolGetInfoFlags = 378
// ProcDomainEventCallbackMetadataChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE
ProcDomainEventCallbackMetadataChange = 379
// ProcConnectSecretEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_SECRET_EVENT_REGISTER_ANY
ProcConnectSecretEventRegisterAny = 380
// ProcConnectSecretEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY
ProcConnectSecretEventDeregisterAny = 381
// ProcSecretEventLifecycle is libvirt's REMOTE_PROC_SECRET_EVENT_LIFECYCLE
ProcSecretEventLifecycle = 382
// ProcSecretEventValueChanged is libvirt's REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED
ProcSecretEventValueChanged = 383
// ProcDomainSetVcpu is libvirt's REMOTE_PROC_DOMAIN_SET_VCPU
ProcDomainSetVcpu = 384
// ProcDomainEventBlockThreshold is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD
ProcDomainEventBlockThreshold = 385
// ProcDomainSetBlockThreshold is libvirt's REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD
ProcDomainSetBlockThreshold = 386
// ProcDomainMigrateGetMaxDowntime is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME
ProcDomainMigrateGetMaxDowntime = 387
// ProcDomainManagedSaveGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC
ProcDomainManagedSaveGetXMLDesc = 388
// ProcDomainManagedSaveDefineXML is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML
ProcDomainManagedSaveDefineXML = 389
// ProcDomainSetLifecycleAction is libvirt's REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION
ProcDomainSetLifecycleAction = 390
// From consts:
// StringMax is libvirt's REMOTE_STRING_MAX
StringMax = 4194304
// DomainListMax is libvirt's REMOTE_DOMAIN_LIST_MAX
DomainListMax = 16384
// CpumapMax is libvirt's REMOTE_CPUMAP_MAX
CpumapMax = 2048
// VcpuinfoMax is libvirt's REMOTE_VCPUINFO_MAX
VcpuinfoMax = 16384
// CpumapsMax is libvirt's REMOTE_CPUMAPS_MAX
CpumapsMax = 8388608
// IothreadInfoMax is libvirt's REMOTE_IOTHREAD_INFO_MAX
IothreadInfoMax = 16384
// MigrateCookieMax is libvirt's REMOTE_MIGRATE_COOKIE_MAX
MigrateCookieMax = 4194304
// NetworkListMax is libvirt's REMOTE_NETWORK_LIST_MAX
NetworkListMax = 16384
// InterfaceListMax is libvirt's REMOTE_INTERFACE_LIST_MAX
InterfaceListMax = 16384
// StoragePoolListMax is libvirt's REMOTE_STORAGE_POOL_LIST_MAX
StoragePoolListMax = 16384
// StorageVolListMax is libvirt's REMOTE_STORAGE_VOL_LIST_MAX
StorageVolListMax = 16384
// NodeDeviceListMax is libvirt's REMOTE_NODE_DEVICE_LIST_MAX
NodeDeviceListMax = 65536
// NodeDeviceCapsListMax is libvirt's REMOTE_NODE_DEVICE_CAPS_LIST_MAX
NodeDeviceCapsListMax = 65536
// NwfilterListMax is libvirt's REMOTE_NWFILTER_LIST_MAX
NwfilterListMax = 16384
// DomainSchedulerParametersMax is libvirt's REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX
DomainSchedulerParametersMax = 16
// DomainBlkioParametersMax is libvirt's REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX
DomainBlkioParametersMax = 16
// DomainMemoryParametersMax is libvirt's REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX
DomainMemoryParametersMax = 16
// DomainBlockIOTuneParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX
DomainBlockIOTuneParametersMax = 32
// DomainNumaParametersMax is libvirt's REMOTE_DOMAIN_NUMA_PARAMETERS_MAX
DomainNumaParametersMax = 16
// DomainPerfEventsMax is libvirt's REMOTE_DOMAIN_PERF_EVENTS_MAX
DomainPerfEventsMax = 64
// DomainBlockCopyParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_COPY_PARAMETERS_MAX
DomainBlockCopyParametersMax = 16
// NodeCPUStatsMax is libvirt's REMOTE_NODE_CPU_STATS_MAX
NodeCPUStatsMax = 16
// NodeMemoryStatsMax is libvirt's REMOTE_NODE_MEMORY_STATS_MAX
NodeMemoryStatsMax = 16
// DomainBlockStatsParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX
DomainBlockStatsParametersMax = 16
// NodeMaxCells is libvirt's REMOTE_NODE_MAX_CELLS
NodeMaxCells = 1024
// AuthSaslDataMax is libvirt's REMOTE_AUTH_SASL_DATA_MAX
AuthSaslDataMax = 65536
// AuthTypeListMax is libvirt's REMOTE_AUTH_TYPE_LIST_MAX
AuthTypeListMax = 20
// DomainMemoryStatsMax is libvirt's REMOTE_DOMAIN_MEMORY_STATS_MAX
DomainMemoryStatsMax = 1024
// DomainSnapshotListMax is libvirt's REMOTE_DOMAIN_SNAPSHOT_LIST_MAX
DomainSnapshotListMax = 16384
// DomainBlockPeekBufferMax is libvirt's REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX
DomainBlockPeekBufferMax = 4194304
// DomainMemoryPeekBufferMax is libvirt's REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX
DomainMemoryPeekBufferMax = 4194304
// SecurityLabelListMax is libvirt's REMOTE_SECURITY_LABEL_LIST_MAX
SecurityLabelListMax = 64
// SecretValueMax is libvirt's REMOTE_SECRET_VALUE_MAX
SecretValueMax = 65536
// SecretListMax is libvirt's REMOTE_SECRET_LIST_MAX
SecretListMax = 16384
// CPUBaselineMax is libvirt's REMOTE_CPU_BASELINE_MAX
CPUBaselineMax = 256
// DomainSendKeyMax is libvirt's REMOTE_DOMAIN_SEND_KEY_MAX
DomainSendKeyMax = 16
// DomainInterfaceParametersMax is libvirt's REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX
DomainInterfaceParametersMax = 16
// DomainGetCPUStatsNcpusMax is libvirt's REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX
DomainGetCPUStatsNcpusMax = 128
// DomainGetCPUStatsMax is libvirt's REMOTE_DOMAIN_GET_CPU_STATS_MAX
DomainGetCPUStatsMax = 2048
// DomainDiskErrorsMax is libvirt's REMOTE_DOMAIN_DISK_ERRORS_MAX
DomainDiskErrorsMax = 256
// NodeMemoryParametersMax is libvirt's REMOTE_NODE_MEMORY_PARAMETERS_MAX
NodeMemoryParametersMax = 64
// DomainMigrateParamListMax is libvirt's REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX
DomainMigrateParamListMax = 64
// DomainJobStatsMax is libvirt's REMOTE_DOMAIN_JOB_STATS_MAX
DomainJobStatsMax = 64
// ConnectCPUModelsMax is libvirt's REMOTE_CONNECT_CPU_MODELS_MAX
ConnectCPUModelsMax = 8192
// DomainFsfreezeMountpointsMax is libvirt's REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX
DomainFsfreezeMountpointsMax = 256
// NetworkDhcpLeasesMax is libvirt's REMOTE_NETWORK_DHCP_LEASES_MAX
NetworkDhcpLeasesMax = 65536
// ConnectGetAllDomainStatsMax is libvirt's REMOTE_CONNECT_GET_ALL_DOMAIN_STATS_MAX
ConnectGetAllDomainStatsMax = 262144
// DomainEventTunableMax is libvirt's REMOTE_DOMAIN_EVENT_TUNABLE_MAX
DomainEventTunableMax = 2048
// DomainFsinfoMax is libvirt's REMOTE_DOMAIN_FSINFO_MAX
DomainFsinfoMax = 256
// DomainFsinfoDisksMax is libvirt's REMOTE_DOMAIN_FSINFO_DISKS_MAX
DomainFsinfoDisksMax = 256
// DomainInterfaceMax is libvirt's REMOTE_DOMAIN_INTERFACE_MAX
DomainInterfaceMax = 2048
// DomainIPAddrMax is libvirt's REMOTE_DOMAIN_IP_ADDR_MAX
DomainIPAddrMax = 2048
// DomainGuestVcpuParamsMax is libvirt's REMOTE_DOMAIN_GUEST_VCPU_PARAMS_MAX
DomainGuestVcpuParamsMax = 64
// DomainEventGraphicsIdentityMax is libvirt's REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX
DomainEventGraphicsIdentityMax = 20
// Program is libvirt's REMOTE_PROGRAM
Program = 0x20008086
// ProtocolVersion is libvirt's REMOTE_PROTOCOL_VERSION
ProtocolVersion = 1
)

View File

@ -12,57 +12,18 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Package constants provides shared data for the libvirt package. // Package constants provides shared data for the libvirt package. This file
// includes only things not generated automatically by the parser that runs on
// libvirt's remote_protocol.x file - see constants.gen.go for the generated
// definitions.
package constants package constants
// protocol procedure numbers // qemu constants
const ( const (
ProgramVersion = 1
ProgramRemote = 0x20008086
ProgramQEMU = 0x20008087 ProgramQEMU = 0x20008087
ProgramKeepAlive = 0x6b656570 ProgramKeepAlive = 0x6b656570
) )
// libvirt procedure identifiers
// These are libvirt procedure numbers which correspond to each respective
// API call between remote_internal driver and libvirtd. Although stable.
// Each call is identified by a unique number which *may change at any time*.
//
// Examples:
// REMOTE_PROC_CONNECT_OPEN = 1
// REMOTE_PROC_DOMAIN_DEFINE_XML = 11
// REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
//
// See:
// https://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=src/remote/remote_protocol.x;hb=HEAD
const (
ProcConnectOpen = 1
ProcConnectClose = 2
ProcConnectGetCapabilties = 7
ProcDomainGetXMLDesc = 14
ProcDomainLookupByName = 23
ProcDomainReboot = 27
ProcAuthList = 66
ProcStoragePoolRefresh = 83
ProcStoragePoolLookupByName = 84
ProcConnectGetLibVersion = 157
ProcDomainMemoryStats = 159
ProcDomainCreateWithFlags = 196
ProcDomainMigrateSetMaxSpeed = 207
ProcDomainGetState = 212
ProcDomainUndefineFlags = 231
ProcDomainDestroyFlags = 234
ProcDomainReset = 245
ProcDomainSetBlockIOTune = 252
ProcDomainGetBlockIOTune = 253
ProcDomainShutdownFlags = 258
ProcConnectListAllDomains = 273
ProcConnectListAllStoragePools = 281
ProcConnectListAllSecrets = 287
ProcMigratePerformParams = 305
ProcDomainDefineXMLFlags = 350
)
// qemu procedure identifiers // qemu procedure identifiers
const ( const (
QEMUDomainMonitor = 1 QEMUDomainMonitor = 1

View File

@ -0,0 +1,44 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by internal/lvgen/generate.go. DO NOT EDIT.
//
// To regenerate, run 'go generate' in internal/lvgen.
//
// Package constants contains libvirt procedure identifiers and other enums and
// constants.
package constants
// These are libvirt procedure numbers which correspond to each respective
// API call between remote_internal driver and libvirtd. Each procedure is
// identified by a unique number which *may change in any future libvirt
// update*.
//
// Examples:
// REMOTE_PROC_CONNECT_OPEN = 1
// REMOTE_PROC_DOMAIN_DEFINE_XML = 11
// REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED = 207,
const (
// From enums:
{{range .EnumVals}} // {{.Name}} is libvirt's {{.LVName}}
{{.Name}} = {{.Val}}
{{end}}
// From consts:
{{range .Consts}} // {{.Name}} is libvirt's {{.LVName}}
{{.Name}} = {{.Val}}
{{end -}}
)

View File

@ -0,0 +1,45 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/digitalocean/go-libvirt/internal/lvgen"
)
const protoPath = "src/remote/remote_protocol.x"
func main() {
lvPath := os.Getenv("LIBVIRT_SOURCE")
if lvPath == "" {
fmt.Println("set $LIBVIRT_SOURCE to point to the root of the libvirt sources and retry")
os.Exit(1)
}
lvFile := filepath.Join(lvPath, protoPath)
rdr, err := os.Open(lvFile)
if err != nil {
fmt.Printf("failed to open protocol file at %v: %v\n", lvFile, err)
os.Exit(1)
}
defer rdr.Close()
if err = lvgen.Generate(rdr); err != nil {
fmt.Println("go-libvirt code generator failed:", err)
os.Exit(1)
}
}

596
internal/lvgen/generate.go Normal file
View File

@ -0,0 +1,596 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package lvgen
import (
"fmt"
"io"
"os"
"strconv"
"strings"
"text/template"
"unicode"
"unicode/utf8"
)
// If you're making changes to the generator, or troubleshooting the generated
// code, the docs for sunrpc and xdr (the line encoding) are helpful:
// https://docs.oracle.com/cd/E26502_01/html/E35597/
// ConstItem stores an const's symbol and value from the parser. This struct is
// also used for enums.
type ConstItem struct {
Name string
LVName string
Val string
}
// Generator holds all the information parsed out of the protocol file.
type Generator struct {
// Enums holds the enum declarations. The type of enums is always int32.
Enums []Decl
// EnumVals holds the list of enum values found by the parser. In sunrpc as
// in go, these are not separately namespaced.
EnumVals []ConstItem
// Consts holds all the const items found by the parser.
Consts []ConstItem
// Structs holds a list of all the structs found by the parser
Structs []Structure
// StructMap is a map of the structs we find for quick searching.
StructMap map[string]int
// Typedefs holds all the type definitions from 'typedef ...' lines.
Typedefs []Typedef
// Unions holds all the discriminated unions.
Unions []Union
// UnionMap is a map of the unions we find for quick searching.
UnionMap map[string]int
// Procs holds all the discovered libvirt procedures.
Procs []Proc
}
// Gen accumulates items as the parser runs, and is then used to produce the
// output.
var Gen Generator
// CurrentEnumVal is the auto-incrementing value assigned to enums that aren't
// explicitly given a value.
var CurrentEnumVal int64
// goEquivTypes maps the basic types defined in the rpc spec to their golang
// equivalents.
var goEquivTypes = map[string]string{
// Some of the identifiers in the rpc specification are reserved words or
// pre-existing types in go. This renames them to something safe.
"type": "lvtype",
"error": "lverror",
"nil": "lvnil",
// The libvirt spec uses this NonnullString type, which is a string with a
// specified maximum length. This makes the go code more confusing, and
// we're not enforcing the limit anyway, so collapse it here. This also
// requires us to ditch the typedef that would otherwise be generated.
"NonnullString": "string",
// remote_string gets renamed "String" by the generator, so here we'll
// rename that to OptString - these are optional strings, and can be "null".
"String": "OptString",
// TODO: Get rid of these. They're only needed because we lose information
// that the parser has (the parser knows it has emitted a go type), and then
// we capitalize types to make them public.
"Int": "int",
"Uint": "uint",
"Int8": "int8",
"Uint8": "uint8",
"Int16": "int16",
"Uint16": "uint16",
"Int32": "int32",
"Uint32": "uint32",
"Int64": "int64",
"Uint64": "uint64",
"Float32": "float32",
"Float64": "float64",
"Bool": "bool",
"Byte": "byte",
}
// These defines are from libvirt-common.h. They should be fetched from there,
// but for now they're hardcoded here. (These are the discriminant values for
// TypedParams.)
var lvTypedParams = map[string]uint32{
"VIR_TYPED_PARAM_INT": 1,
"VIR_TYPED_PARAM_UINT": 2,
"VIR_TYPED_PARAM_LLONG": 3,
"VIR_TYPED_PARAM_ULLONG": 4,
"VIR_TYPED_PARAM_DOUBLE": 5,
"VIR_TYPED_PARAM_BOOLEAN": 6,
"VIR_TYPED_PARAM_STRING": 7,
}
// Decl records a declaration, like 'int x' or 'remote_nonnull_string str'
type Decl struct {
Name, LVName, Type string
}
// Structure records the name and members of a struct definition.
type Structure struct {
Name string
LVName string
Members []Decl
}
// Typedef holds the name and underlying type for a typedef.
type Typedef struct {
Decl
}
// Union holds a "discriminated union", which consists of a discriminant, which
// tells you what kind of thing you're looking at, and a number of encodings.
type Union struct {
Name string
DiscriminantType string
Cases []Case
}
// Case holds a single case of a discriminated union.
type Case struct {
CaseName string
DiscriminantVal string
Decl
}
// Proc holds information about a libvirt procedure the parser has found.
type Proc struct {
Num int64 // The libvirt procedure number.
Name string // The name of the go func.
LVName string // The name of the libvirt proc this wraps.
Args []Decl // The contents of the args struct for this procedure.
Ret []Decl // The contents of the ret struct for this procedure.
ArgsStruct string // The name of the args struct for this procedure.
RetStruct string // The name of the ret struct for this procedure.
}
type structStack []*Structure
// CurrentStruct will point to a struct record if we're in a struct declaration.
// When the parser adds a declaration, it will be added to the open struct if
// there is one.
var CurrentStruct structStack
// Since it's possible to have an embedded struct definition, this implements
// a stack to keep track of the current structure.
func (s *structStack) empty() bool {
return len(*s) == 0
}
func (s *structStack) push(st *Structure) {
*s = append(*s, st)
}
func (s *structStack) pop() *Structure {
if s.empty() {
return nil
}
st := (*s)[len(*s)-1]
*s = (*s)[:len(*s)-1]
return st
}
func (s *structStack) peek() *Structure {
if s.empty() {
return nil
}
return (*s)[len(*s)-1]
}
// CurrentTypedef will point to a typedef record if we're parsing one. Typedefs
// can define a struct or union type, but the preferred for is struct xxx{...},
// so we may never see the typedef form in practice.
var CurrentTypedef *Typedef
// CurrentUnion holds the current discriminated union record.
var CurrentUnion *Union
// CurrentCase holds the current case record while the parser is in a union and
// a case statement.
var CurrentCase *Case
// Generate will output go bindings for libvirt. The lvPath parameter should be
// the path to the root of the libvirt source directory to use for the
// generation.
func Generate(proto io.Reader) error {
Gen.StructMap = make(map[string]int)
Gen.UnionMap = make(map[string]int)
lexer, err := NewLexer(proto)
if err != nil {
return err
}
go lexer.Run()
parser := yyNewParser()
yyErrorVerbose = true
// Turn this on if you're debugging.
// yyDebug = 3
rv := parser.Parse(lexer)
if rv != 0 {
return fmt.Errorf("failed to parse libvirt protocol: %v", rv)
}
// When parsing is done, we can link the procedures we've found to their
// argument types.
procLink()
// Generate and write the output.
constFile, err := os.Create("../constants/constants.gen.go")
if err != nil {
return err
}
defer constFile.Close()
procFile, err := os.Create("../../libvirt.gen.go")
if err != nil {
return err
}
defer procFile.Close()
err = genGo(constFile, procFile)
return err
}
// genGo is called when the parsing is done; it generates the golang output
// files using templates.
func genGo(constFile, procFile io.Writer) error {
t, err := template.ParseFiles("constants.tmpl")
if err != nil {
return err
}
if err = t.Execute(constFile, Gen); err != nil {
return err
}
t, err = template.ParseFiles("procedures.tmpl")
if err != nil {
return err
}
return t.Execute(procFile, Gen)
}
// constNameTransform changes an upcased, snake-style name like
// REMOTE_PROTOCOL_VERSION to a comfortable Go name like ProtocolVersion. It
// also tries to upcase abbreviations so a name like DOMAIN_GET_XML becomes
// DomainGetXML, not DomainGetXml.
func constNameTransform(name string) string {
decamelize := strings.ContainsRune(name, '_')
nn := strings.TrimPrefix(name, "REMOTE_")
if decamelize {
nn = fromSnakeToCamel(nn)
}
nn = fixAbbrevs(nn)
return nn
}
func identifierTransform(name string) string {
decamelize := strings.ContainsRune(name, '_')
nn := strings.TrimPrefix(name, "remote_")
if decamelize {
nn = fromSnakeToCamel(nn)
} else {
nn = publicize(nn)
}
nn = fixAbbrevs(nn)
nn = checkIdentifier(nn)
return nn
}
func typeTransform(name string) string {
nn := strings.TrimLeft(name, "*[]")
diff := len(name) - len(nn)
nn = identifierTransform(nn)
return name[0:diff] + nn
}
func publicize(name string) string {
if len(name) <= 0 {
return name
}
r, n := utf8.DecodeRuneInString(name)
name = string(unicode.ToUpper(r)) + name[n:]
return name
}
// fromSnakeToCamel transmutes a snake-cased string to a camel-cased one. All
// runes that follow an underscore are up-cased, and the underscores themselves
// are omitted.
//
// ex: "PROC_DOMAIN_GET_METADATA" -> "ProcDomainGetMetadata"
func fromSnakeToCamel(s string) string {
buf := make([]rune, 0, len(s))
// Start rune will be upper case - we generate all public symbols.
hump := true
for _, r := range s {
if r == '_' {
hump = true
} else {
var transform func(rune) rune
if hump == true {
transform = unicode.ToUpper
} else {
transform = unicode.ToLower
}
buf = append(buf, transform(r))
hump = false
}
}
return string(buf)
}
// abbrevs is a list of abbreviations which should be all upper-case in a name.
// (This is really just to keep the go linters happy and to produce names that
// are intuitive to a go developer.)
var abbrevs = []string{"Xml", "Io", "Uuid", "Cpu", "Id", "Ip"}
// fixAbbrevs up-cases all instances of anything in the 'abbrevs' array. This
// would be a simple matter, but we don't want to upcase an abbreviation if it's
// actually part of a larger word, so it's not so simple.
func fixAbbrevs(s string) string {
for _, a := range abbrevs {
for loc := 0; ; {
loc = strings.Index(s[loc:], a)
if loc == -1 {
break
}
r := 'A'
if len(a) < len(s[loc:]) {
r, _ = utf8.DecodeRune([]byte(s[loc+len(a):]))
}
if unicode.IsLower(r) == false {
s = s[:loc] + strings.Replace(s[loc:], a, strings.ToUpper(a), 1)
}
loc++
}
}
return s
}
// procLink associates a libvirt procedure with the types that are its arguments
// and return values, filling out those fields in the procedure struct. These
// types are extracted by iterating through the argument and return structures
// defined in the protocol file. If one or both of these structs is not defined
// then either the args or return values are empty.
func procLink() {
for ix, proc := range Gen.Procs {
argsName := proc.Name + "Args"
retName := proc.Name + "Ret"
argsIx, hasArgs := Gen.StructMap[argsName]
retIx, hasRet := Gen.StructMap[retName]
if hasArgs {
argsStruct := Gen.Structs[argsIx]
Gen.Procs[ix].ArgsStruct = argsStruct.Name
Gen.Procs[ix].Args = argsStruct.Members
}
if hasRet {
retStruct := Gen.Structs[retIx]
Gen.Procs[ix].RetStruct = retStruct.Name
Gen.Procs[ix].Ret = retStruct.Members
}
}
}
//---------------------------------------------------------------------------
// Routines called by the parser's actions.
//---------------------------------------------------------------------------
// StartEnum is called when the parser has found a valid enum.
func StartEnum(name string) {
// Enums are always signed 32-bit integers.
goname := identifierTransform(name)
Gen.Enums = append(Gen.Enums, Decl{goname, name, "int32"})
// Set the automatic value var to -1; it will be incremented before being
// assigned to an enum value.
CurrentEnumVal = -1
}
// AddEnumVal will add a new enum value to the list.
func AddEnumVal(name, val string) error {
ev, err := parseNumber(val)
if err != nil {
return fmt.Errorf("invalid enum value %v = %v", name, val)
}
return addEnumVal(name, ev)
}
// AddEnumAutoVal adds an enum to the list, using the automatically-incremented
// value. This is called when the parser finds an enum definition without an
// explicit value.
func AddEnumAutoVal(name string) error {
CurrentEnumVal++
return addEnumVal(name, CurrentEnumVal)
}
func addEnumVal(name string, val int64) error {
goname := constNameTransform(name)
Gen.EnumVals = append(Gen.EnumVals, ConstItem{goname, name, fmt.Sprintf("%d", val)})
CurrentEnumVal = val
addProc(goname, name, val)
return nil
}
// AddConst adds a new constant to the parser's list.
func AddConst(name, val string) error {
_, err := parseNumber(val)
if err != nil {
return fmt.Errorf("invalid const value %v = %v", name, val)
}
goname := constNameTransform(name)
Gen.Consts = append(Gen.Consts, ConstItem{goname, name, val})
return nil
}
// addProc checks an enum value to see if it's a procedure number. If so, we
// add the procedure to our list for later generation.
func addProc(goname, lvname string, val int64) {
if !strings.HasPrefix(goname, "Proc") {
return
}
goname = goname[4:]
proc := &Proc{Num: val, Name: goname, LVName: lvname}
Gen.Procs = append(Gen.Procs, *proc)
}
// parseNumber makes sure that a parsed numerical value can be parsed to a 64-
// bit integer.
func parseNumber(val string) (int64, error) {
base := 10
if strings.HasPrefix(val, "0x") {
base = 16
val = val[2:]
}
n, err := strconv.ParseInt(val, base, 64)
return n, err
}
// StartStruct is called from the parser when a struct definition is found, but
// before the member declarations are processed.
func StartStruct(name string) {
goname := identifierTransform(name)
CurrentStruct.push(&Structure{Name: goname, LVName: name})
}
// AddStruct is called when the parser has finished parsing a struct. It adds
// the now-complete struct definition to the generator's list.
func AddStruct() {
st := *CurrentStruct.pop()
Gen.StructMap[st.Name] = len(Gen.Structs)
Gen.Structs = append(Gen.Structs, st)
}
// StartTypedef is called when the parser finds a typedef.
func StartTypedef() {
CurrentTypedef = &Typedef{}
}
// StartUnion is called by the parser when it finds a union declaraion.
func StartUnion(name string) {
name = identifierTransform(name)
CurrentUnion = &Union{Name: name}
}
// AddUnion is called by the parser when it has finished processing a union
// type. It adds the union to the generator's list and clears the CurrentUnion
// pointer. We handle unions by declaring an interface for the union type, and
// adding methods to each of the cases so that they satisfy the interface.
func AddUnion() {
Gen.UnionMap[CurrentUnion.Name] = len(Gen.Unions)
Gen.Unions = append(Gen.Unions, *CurrentUnion)
CurrentUnion = nil
}
// StartCase is called when the parser finds a case statement within a union.
func StartCase(dvalue string) {
// In libvirt, the discriminant values are all C pre- processor definitions.
// Since we don't run the C pre-processor on the protocol file, they're
// still just names when we get them - we don't actually have their integer
// values. We'll use the strings to build the type names, although this is
// brittle, because we're defining a type for each of the case values, and
// that type needs a name.
caseName := dvalue
if ix := strings.LastIndexByte(caseName, '_'); ix != -1 {
caseName = caseName[ix+1:]
}
caseName = fromSnakeToCamel(caseName)
dv, ok := lvTypedParams[dvalue]
if ok {
dvalue = strconv.FormatUint(uint64(dv), 10)
}
CurrentCase = &Case{CaseName: caseName, DiscriminantVal: dvalue}
}
// AddCase is called when the parser finishes parsing a case.
func AddCase() {
CurrentUnion.Cases = append(CurrentUnion.Cases, *CurrentCase)
CurrentCase = nil
}
// AddDeclaration is called by the parser when it find a declaration (int x).
// The declaration will be added to any open container (such as a struct, if the
// parser is working through a struct definition.)
func AddDeclaration(identifier, itype string) {
// fmt.Println("adding", identifier, itype)
// If the name is a reserved word, transform it so it isn't.
goidentifier := identifierTransform(identifier)
itype = typeTransform(itype)
decl := Decl{Name: goidentifier, LVName: identifier, Type: itype}
if !CurrentStruct.empty() {
st := CurrentStruct.peek()
st.Members = append(st.Members, decl)
} else if CurrentTypedef != nil {
CurrentTypedef.Name = goidentifier
CurrentTypedef.LVName = identifier
CurrentTypedef.Type = itype
if goidentifier != "string" {
// Omit recursive typedefs. These happen because we're massaging
// some of the type names.
Gen.Typedefs = append(Gen.Typedefs, *CurrentTypedef)
}
CurrentTypedef = nil
} else if CurrentCase != nil {
CurrentCase.Name = goidentifier
CurrentCase.Type = itype
} else if CurrentUnion != nil {
CurrentUnion.DiscriminantType = itype
}
}
// AddFixedArray is called by the parser to add a fixed-length array to the
// current container (struct, union, etc). Fixed-length arrays are not length-
// prefixed.
func AddFixedArray(identifier, itype, len string) {
atype := fmt.Sprintf("[%v]%v", len, itype)
AddDeclaration(identifier, atype)
}
// AddVariableArray is called by the parser to add a variable-length array.
// Variable-length arrays are prefixed with a 32-bit unsigned length, and may
// also have a maximum length specified.
func AddVariableArray(identifier, itype, len string) {
// This code ignores the length restriction (array<MAXLEN>), so as of now we
// can't check to make sure that we're not exceeding that restriction when
// we fill in message buffers. That may not matter, if libvirt's checking is
// careful enough.
atype := "[]" + itype
// Handle strings specially. In the rpcgen definition a string is specified
// as a variable-length array, either with or without a max length. We want
// these to be go strings, so we'll just remove the array specifier.
if itype == "string" {
atype = itype
}
AddDeclaration(identifier, atype)
}
func checkIdentifier(i string) string {
nn, reserved := goEquivTypes[i]
if reserved {
return nn
}
return i
}
// GetUnion returns the type information for a union. If the provided type name
// isn't a union, this will return a zero-value Union type.
func (decl *Decl) GetUnion() Union {
ix, ok := Gen.UnionMap[decl.Type]
if ok {
return Gen.Unions[ix]
}
return Union{}
}

29
internal/lvgen/lv-gen.go Normal file
View File

@ -0,0 +1,29 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package lvgen contains the instructions for regenerating the libvirt
// bindings. We do this by parsing the remote_protocol.x file included in the
// libvirt sources. Bindings will be generated if you run `go generate` in this
// directory.
package lvgen
// Before running `go generate`:
// 1) Make sure goyacc is installed from golang.org/x/tools (you can use this
// command: `go get golang.org/x/tools/...`)
// 2) Set the environment variable LIBVIRT_SOURCE to point to the top level
// directory containing the version of libvirt for which you want to generate
// bindings.
//go:generate goyacc sunrpc.y
//go:generate go run gen/main.go

334
internal/lvgen/lvlexer.go Normal file
View File

@ -0,0 +1,334 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package lvgen
import (
"fmt"
"io"
"io/ioutil"
"strings"
"unicode"
"unicode/utf8"
)
// eof is returned by the lexer when there's no more input.
const eof = -1
// oneRuneTokens lists the runes the lexer will consider to be tokens when it
// finds them. These are returned to the parser using the integer value of their
// runes.
var oneRuneTokens = `{}[]<>(),=;:*`
var keywords = map[string]int{
"hyper": HYPER,
"int": INT,
"short": SHORT,
"char": CHAR,
"bool": BOOL,
"case": CASE,
"const": CONST,
"default": DEFAULT,
"double": DOUBLE,
"enum": ENUM,
"float": FLOAT,
"opaque": OPAQUE,
"string": STRING,
"struct": STRUCT,
"switch": SWITCH,
"typedef": TYPEDEF,
"union": UNION,
"unsigned": UNSIGNED,
"void": VOID,
"program": PROGRAM,
"version": VERSION,
}
// item is a lexeme, or what the lexer returns to the parser.
type item struct {
typ int
val string
line, column int
}
// String will display lexer items for humans to debug. There are some
// calculations here due to the way goyacc arranges token values; see the
// generated file y.go for an idea what's going on here, but the basic idea is
// that the lower token type values are reserved for single-rune tokens, which
// the lexer reports using the value of the rune itself. Everything else is
// allocated a range of type value up above all the possible single-rune values.
func (i item) String() string {
tokType := i.typ
if tokType >= yyPrivate {
if tokType < yyPrivate+len(yyTok2) {
tokType = yyTok2[tokType-yyPrivate]
}
}
rv := fmt.Sprintf("%s %q %d:%d", yyTokname(tokType), i.val, i.line, i.column)
return rv
}
// Lexer stores the state of this lexer.
type Lexer struct {
input string // the string we're scanning.
start int // start position of the item.
pos int // current position in the input.
line int // the current line (for error reporting).
column int // current position within the current line.
width int // width of the last rune scanned.
items chan item // channel of scanned lexer items (lexemes).
lastItem item // The last item the lexer handed the parser
}
// NewLexer will return a new lexer for the passed-in reader.
func NewLexer(rdr io.Reader) (*Lexer, error) {
l := &Lexer{}
b, err := ioutil.ReadAll(rdr)
if err != nil {
return nil, err
}
l.input = string(b)
l.items = make(chan item)
return l, nil
}
// Run starts the lexer, and should be called in a goroutine.
func (l *Lexer) Run() {
for state := lexText; state != nil; {
state = state(l)
}
close(l.items)
}
// emit returns a token to the parser.
func (l *Lexer) emit(t int) {
l.items <- item{t, l.input[l.start:l.pos], l.line, l.column}
l.start = l.pos
}
// Lex gets the next token.
func (l *Lexer) Lex(st *yySymType) int {
s := <-l.items
l.lastItem = s
st.val = s.val
return int(s.typ)
}
// Error is called by the parser when it finds a problem.
func (l *Lexer) Error(s string) {
fmt.Printf("parse error at %d:%d: %v\n", l.lastItem.line+1, l.lastItem.column+1, s)
fmt.Printf("error at %q\n", l.lastItem.val)
}
// errorf is used by the lexer to report errors. It inserts an ERROR token into
// the items channel, and sets the state to nil, which stops the lexer's state
// machine.
func (l *Lexer) errorf(format string, args ...interface{}) stateFn {
l.items <- item{ERROR, fmt.Sprintf(format, args), l.line, l.column}
return nil
}
// next returns the rune at the current location, and advances to the next rune
// in the input.
func (l *Lexer) next() (r rune) {
if l.pos >= len(l.input) {
l.width = 0
return eof
}
r, l.width = utf8.DecodeRuneInString(l.input[l.pos:])
l.pos += l.width
l.column++
if r == '\n' {
l.line++
l.column = 0
}
return r
}
// ignore discards the current text from start to pos.
func (l *Lexer) ignore() {
l.start = l.pos
}
// backup moves back one character, but can only be called once per next() call.
func (l *Lexer) backup() {
l.pos -= l.width
if l.column > 0 {
l.column--
} else {
l.line--
}
l.width = 0
}
// peek looks ahead at the next rune in the stream without consuming it.
func (l *Lexer) peek() rune {
r := l.next()
l.backup()
return r
}
// accept will advance to the next rune if it's contained in the string of valid
// runes passed in by the caller.
func (l *Lexer) accept(valid string) bool {
if strings.IndexRune(valid, l.next()) >= 0 {
return true
}
l.backup()
return false
}
// acceptRun advances over a number of valid runes, stopping as soon as it hits
// one not on the list.
func (l *Lexer) acceptRun(valid string) {
for strings.IndexRune(valid, l.next()) >= 0 {
}
l.backup()
}
// keyword checks whether the current lexeme is a keyword or not. If so it
// returns the keyword's token id, otherwise it returns IDENTIFIER.
func (l *Lexer) keyword() int {
ident := l.input[l.start:l.pos]
tok, ok := keywords[ident]
if ok == true {
return int(tok)
}
return IDENTIFIER
}
// oneRuneToken determines whether a rune is a token. If so it returns the token
// id and true, otherwise it returns false.
func (l *Lexer) oneRuneToken(r rune) (int, bool) {
if strings.IndexRune(oneRuneTokens, r) >= 0 {
return int(r), true
}
return 0, false
}
// State functions
type stateFn func(*Lexer) stateFn
// lexText is the master lex routine. The lexer is started in this state.
func lexText(l *Lexer) stateFn {
for {
if strings.HasPrefix(l.input[l.pos:], "/*") {
return lexBlockComment
}
r := l.next()
if r == eof {
break
}
if unicode.IsSpace(r) {
l.ignore()
return lexText
}
if l.column == 1 && r == '%' {
l.backup()
return lexDirective
}
if unicode.IsLetter(r) {
l.backup()
return lexIdent
}
if unicode.IsNumber(r) || r == '-' {
l.backup()
return lexNumber
}
if t, isToken := l.oneRuneToken(r); isToken == true {
l.emit(t)
}
}
return nil
}
// lexBlockComment is used when we find a comment marker '/*' in the input.
func lexBlockComment(l *Lexer) stateFn {
for {
if strings.HasPrefix(l.input[l.pos:], "*/") {
// Found the end. Advance past the '*/' and discard the comment body.
l.next()
l.next()
l.ignore()
return lexText
}
if l.next() == eof {
return l.errorf("unterminated block comment")
}
}
}
// lexIdent handles identifiers.
func lexIdent(l *Lexer) stateFn {
for {
r := l.next()
if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {
continue
}
l.backup()
break
}
// We may have a keyword, so check for that before emitting.
l.emit(l.keyword())
return lexText
}
// lexNumber handles decimal and hexadecimal numbers. Decimal numbers may begin
// with a '-'; hex numbers begin with '0x' and do not accept leading '-'.
func lexNumber(l *Lexer) stateFn {
// Leading '-' is ok
digits := "0123456789"
neg := l.accept("-")
if !neg {
// allow '0x' for hex numbers, as long as there's not a leading '-'.
r := l.peek()
if r == '0' {
l.next()
if l.accept("x") {
digits = "0123456789ABCDEFabcdef"
}
}
}
// followed by any number of digits
l.acceptRun(digits)
r := l.peek()
if unicode.IsLetter(r) {
l.next()
return l.errorf("invalid number: %q", l.input[l.start:l.pos])
}
l.emit(CONSTANT)
return lexText
}
// lexDirective handles lines beginning with '%'. These are used to emit C code
// directly to the output file. For now we're ignoring them, but some of the
// constants in the protocol file do depend on values from #included header
// files, so that may need to change.
func lexDirective(l *Lexer) stateFn {
for {
r := l.next()
if r == '\n' {
l.ignore()
return lexText
}
if r == eof {
return l.errorf("unterminated directive")
}
}
}

View File

@ -0,0 +1,171 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by internal/lvgen/generate.go. DO NOT EDIT.
//
// To regenerate, run 'go generate' in internal/lvgen.
//
package libvirt
import (
"bytes"
"fmt"
"github.com/davecgh/go-xdr/xdr2"
"github.com/digitalocean/go-libvirt/internal/constants"
)
const (
VirUUIDBuflen = 16
)
//
// Typedefs:
//
{{range .Typedefs}}// {{.Name}} is libvirt's {{.LVName}}
type {{.Name}} {{.Type}}
{{end}}
//
// Enums:
//
{{range .Enums}}// {{.Name}} is libvirt's {{.LVName}}
type {{.Name}} {{.Type}}
{{end}}
//
// Structs:
//
{{range .Structs}}// {{.Name}} is libvirt's {{.LVName}}
type {{.Name}} struct {
{{range .Members}} {{.Name}} {{.Type}}
{{end -}}
}
{{end}}
{{range .Unions}}// {{.Name}} is a discriminated union.
type {{.Name}} interface {
Get() interface{}
{{end -}}
}
{{range .Unions}}{{$uname := .Name}}{{range .Cases}}{{$casetype := printf "%v%v" $uname .CaseName}}
// {{$casetype}} is one of the possible values of the {{$uname}} union.
type {{$casetype}} struct {
DVal uint32
{{.Name}} {{.Type}}
}
// New{{$casetype}} creates a discriminated union value satisfying
// the {{$uname}} interface.
func New{{$casetype}}(v {{.Type}}) *{{$casetype}} {
return &{{$casetype}}{DVal: {{.DiscriminantVal}}, {{.Name}}: v}
}
func decode{{$casetype}}(dec *xdr.Decoder) (*{{$casetype}}, error) {
var v {{.Type}}
_, err := dec.Decode(&v)
if err != nil {
return nil, err
}
return New{{$casetype}}(v), nil
}
// Get satisfies the {{$uname}} interface.
func (c *{{$casetype}}) Get() interface{} { return c.{{.Name}} }
{{end}}
func decode{{.Name}}(dec *xdr.Decoder) ({{.Name}}, error) {
discriminant, _, err := dec.DecodeInt()
if err != nil {
return nil, err
}
var caseval {{.Name}}
switch discriminant {
{{range .Cases}}{{$casetype := printf "%v%v" $uname .CaseName}} case {{.DiscriminantVal}}:
caseval, err = decode{{$casetype}}(dec)
{{end}}
default:
err = fmt.Errorf("invalid parameter type %v", discriminant)
}
return caseval, err
}
{{- end}}
// TODO: Generate these.
func decodeTypedParam(dec *xdr.Decoder) (*TypedParam, error) {
name, _, err := dec.DecodeString()
if err != nil {
return nil, err
}
val, err := decodeTypedParamValue(dec)
return &TypedParam{name, val}, nil
}
func decodeTypedParams(dec *xdr.Decoder) ([]TypedParam, error) {
count, _, err := dec.DecodeInt()
if err != nil {
return nil, err
}
params := make([]TypedParam, count)
for ix := int32(0); ix < count; ix++ {
p, err := decodeTypedParam(dec)
if err != nil {
return nil, err
}
params[ix] = *p
}
return params, nil
}
{{range .Procs}}
// {{.Name}} is the go wrapper for {{.LVName}}.
func (l *Libvirt) {{.Name}}({{range $ix, $arg := .Args}}{{if $ix}}, {{end}}{{.Name}} {{.Type}}{{end}}) ({{range .Ret}}r{{.Name}} {{.Type}}, {{end}}err error) {
var buf bytes.Buffer
{{if .ArgsStruct}}
args := {{.ArgsStruct}} {
{{range .Args}} {{.Name}}: {{.Name}},
{{end}} }
buf, err = encode(&args)
if err != nil {
return
}
{{end}}
var resp <-chan response
resp, err = l.request({{.Num}}, constants.Program, &buf)
if err != nil {
return
}
r := <-resp
if r.Status != StatusOK {
err = decodeError(r.Payload)
return
}
{{if .RetStruct}}
// Return value unmarshaling
rdr := bytes.NewReader(r.Payload)
dec := xdr.NewDecoder(rdr)
{{range .Ret}} // {{.Name}}: {{.Type}}
{{if eq .Type "[]TypedParam"}} r{{.Name}}, err = decodeTypedParams(dec)
if err != nil {
fmt.Println("error decoding typedparams")
return
}
{{else}} _, err = dec.Decode(&r{{.Name}})
if err != nil {
return
}
{{end}}{{end}}{{end}}
return
}
{{end}}

259
internal/lvgen/sunrpc.y Normal file
View File

@ -0,0 +1,259 @@
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// The generated code notice below is output to the generated file. *This* file,
// (sunrpc.y) is the yacc grammar for the sunrpc protocol language, and is *not*
// generated.
%{
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by goyacc. DO NOT EDIT.
//
// To regenerate, run 'go generate' in internal/lvgen.
//
package lvgen
import (
//"fmt"
)
%}
// SymType
%union{
val string
}
// XDR tokens:
%token BOOL CASE CONST DEFAULT DOUBLE ENUM FLOAT OPAQUE STRING STRUCT
%token SWITCH TYPEDEF UNION UNSIGNED VOID HYPER INT SHORT CHAR
%token IDENTIFIER CONSTANT ERROR
// RPCL additional tokens:
%token PROGRAM VERSION
%%
specification
: definition_list
;
value
: IDENTIFIER
| CONSTANT
;
definition_list
: definition ';'
| definition ';' definition_list
;
definition
: enum_definition
| const_definition
| typedef_definition
| struct_definition
| union_definition
| program_definition
;
enum_definition
: ENUM enum_ident '{' enum_value_list '}' { StartEnum($2.val) }
;
enum_value_list
: enum_value
| enum_value ',' enum_value_list
;
enum_value
: enum_value_ident {
err := AddEnumAutoVal($1.val)
if err != nil {
yylex.Error(err.Error())
return 1
}
}
| enum_value_ident '=' value {
err := AddEnumVal($1.val, $3.val)
if err != nil {
yylex.Error(err.Error())
return 1
}
}
;
enum_ident
: IDENTIFIER
;
enum_value_ident
: IDENTIFIER
;
// Ignore consts that are set to IDENTIFIERs - this isn't allowed by the spec,
// but occurs in the file because libvirt runs the pre-processor on the protocol
// file, and it handles replacing the identifier with it's #defined value.
const_definition
: CONST const_ident '=' IDENTIFIER
| CONST const_ident '=' CONSTANT {
err := AddConst($2.val, $4.val)
if err != nil {
yylex.Error(err.Error())
return 1
}
}
;
const_ident
: IDENTIFIER
;
typedef_definition
: TYPEDEF {StartTypedef()} declaration
;
declaration
: simple_declaration
| fixed_array_declaration
| variable_array_declaration
| pointer_declaration
;
simple_declaration
: type_specifier variable_ident {AddDeclaration($2.val, $1.val)}
;
type_specifier
: int_spec
| UNSIGNED int_spec {$$.val = "u"+$2.val}
| FLOAT {$$.val = "float32"}
| DOUBLE {$$.val = "float64"}
| BOOL {$$.val = "bool"}
| STRING {$$.val = "string"}
| OPAQUE {$$.val = "byte"}
| enum_definition
| struct_definition
| union_definition
| IDENTIFIER
;
int_spec
: HYPER {$$.val = "int64"}
| INT {$$.val = "int32"}
| SHORT {$$.val = "int16"}
| CHAR {$$.val = "int8"}
;
variable_ident
: IDENTIFIER
;
fixed_array_declaration
: type_specifier variable_ident '[' value ']' { AddFixedArray($2.val, $1.val, $4.val) }
;
variable_array_declaration
: type_specifier variable_ident '<' value '>' { AddVariableArray($2.val, $1.val, $4.val) }
| type_specifier variable_ident '<' '>' { AddVariableArray($2.val, $1.val, "") }
;
// while pointer_declarations may look like their familiar c-equivalents, in the
// XDR language they actually declare "Optional-data". The simplest
// representation to use for these is a variable-length array with a size of 1.
// See the XDR spec for a more complete explanation of this.
pointer_declaration
: type_specifier '*' variable_ident { AddVariableArray($3.val, $1.val, "1") }
;
struct_definition
: STRUCT struct_ident '{' {StartStruct($2.val)} declaration_list '}' { AddStruct() }
;
struct_ident
: IDENTIFIER
;
declaration_list
: declaration ';'
| declaration ';' declaration_list
;
union_definition
: UNION union_ident {StartUnion($2.val)} SWITCH '(' simple_declaration ')' '{' case_list '}' {AddUnion()}
;
union_ident
: IDENTIFIER
;
case_list
: case ';'
| case ';' case_list
;
case
: CASE value {StartCase($2.val)} ':' declaration {AddCase()}
| DEFAULT {StartCase("default")} ':' declaration {AddCase()}
;
program_definition
: PROGRAM program_ident '{' version_list '}' '=' value
;
program_ident
: IDENTIFIER
;
version_list
: version ';'
| version ';' version_list
;
version
: VERSION version_ident '{' procedure_list '}' '=' value ';'
;
version_ident
: IDENTIFIER
;
procedure_list
: procedure ';'
| procedure ';' procedure_list
;
procedure
: type_specifier procedure_ident '(' type_specifier ')' '=' value ';'
;
procedure_ident
: IDENTIFIER
;
%%

768
internal/lvgen/y.go Normal file
View File

@ -0,0 +1,768 @@
//line sunrpc.y:20
// Copyright 2017 The go-libvirt Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by goyacc. DO NOT EDIT.
//
// To regenerate, run 'go generate' in internal/lvgen.
//
package lvgen
import __yyfmt__ "fmt"
//line sunrpc.y:40
import (
//"fmt"
)
//line sunrpc.y:49
type yySymType struct {
yys int
val string
}
const BOOL = 57346
const CASE = 57347
const CONST = 57348
const DEFAULT = 57349
const DOUBLE = 57350
const ENUM = 57351
const FLOAT = 57352
const OPAQUE = 57353
const STRING = 57354
const STRUCT = 57355
const SWITCH = 57356
const TYPEDEF = 57357
const UNION = 57358
const UNSIGNED = 57359
const VOID = 57360
const HYPER = 57361
const INT = 57362
const SHORT = 57363
const CHAR = 57364
const IDENTIFIER = 57365
const CONSTANT = 57366
const ERROR = 57367
const PROGRAM = 57368
const VERSION = 57369
var yyToknames = [...]string{
"$end",
"error",
"$unk",
"BOOL",
"CASE",
"CONST",
"DEFAULT",
"DOUBLE",
"ENUM",
"FLOAT",
"OPAQUE",
"STRING",
"STRUCT",
"SWITCH",
"TYPEDEF",
"UNION",
"UNSIGNED",
"VOID",
"HYPER",
"INT",
"SHORT",
"CHAR",
"IDENTIFIER",
"CONSTANT",
"ERROR",
"PROGRAM",
"VERSION",
"';'",
"'{'",
"'}'",
"','",
"'='",
"'['",
"']'",
"'<'",
"'>'",
"'*'",
"'('",
"')'",
"':'",
}
var yyStatenames = [...]string{}
const yyEofCode = 1
const yyErrCode = 2
const yyInitialStackSize = 16
//line sunrpc.y:259
//line yacctab:1
var yyExca = [...]int{
-1, 1,
1, -1,
-2, 0,
}
const yyPrivate = 57344
const yyLast = 148
var yyAct = [...]int{
84, 77, 36, 111, 103, 76, 61, 67, 32, 129,
55, 126, 128, 100, 37, 117, 85, 86, 78, 63,
98, 97, 73, 31, 74, 69, 131, 115, 71, 89,
41, 94, 72, 62, 40, 10, 39, 43, 42, 13,
30, 118, 14, 38, 107, 48, 49, 50, 51, 47,
90, 11, 79, 64, 10, 70, 106, 96, 13, 54,
12, 14, 52, 29, 134, 127, 119, 108, 91, 75,
80, 15, 16, 110, 87, 88, 85, 86, 59, 60,
63, 93, 83, 48, 49, 50, 51, 92, 95, 58,
82, 27, 25, 23, 20, 102, 18, 99, 2, 105,
101, 46, 8, 66, 45, 7, 109, 44, 4, 104,
113, 105, 114, 116, 120, 28, 122, 81, 8, 68,
123, 7, 26, 124, 4, 121, 125, 112, 130, 53,
24, 132, 133, 65, 22, 35, 34, 33, 21, 19,
57, 56, 17, 9, 6, 5, 3, 1,
}
var yyPact = [...]int{
45, -1000, -1000, 44, -1000, -1000, -1000, -1000, -1000, -1000,
73, 71, -1000, 70, 69, 68, 45, 34, -1000, 8,
-1000, 26, 33, -1000, -1000, -1000, 30, -1000, -1000, 66,
55, -1000, -1000, -1000, -1000, -1000, -4, -1000, 64, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, 89, -2, 25, -3, 0, -1000, -1000,
-1000, -11, 57, -1000, -1000, 26, -20, 22, 42, 67,
-1000, 66, 53, 53, -7, -1000, 20, 40, 26, -1,
-2, 28, -1000, -1000, -1000, -1000, -1000, -13, -16, -1000,
-1000, 26, -26, 57, 53, -1000, 26, -1000, -1000, -1000,
27, -1000, -1000, 14, 39, 50, 105, -5, 26, -23,
-1000, 11, 38, 53, -1000, 53, -1000, 26, -1000, 105,
-1000, -29, 37, -27, -1000, -31, 26, -1000, -6, 26,
-1000, 53, -1000, 36, -1000,
}
var yyPgo = [...]int{
0, 147, 98, 0, 146, 107, 145, 144, 104, 101,
143, 142, 10, 141, 140, 139, 138, 1, 8, 137,
136, 135, 2, 6, 14, 134, 133, 5, 130, 129,
3, 127, 126, 125, 122, 7, 119, 117, 4, 109,
106,
}
var yyR1 = [...]int{
0, 1, 3, 3, 2, 2, 4, 4, 4, 4,
4, 4, 5, 12, 12, 13, 13, 11, 14, 6,
6, 15, 16, 7, 17, 17, 17, 17, 18, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
24, 24, 24, 24, 23, 19, 20, 20, 21, 26,
8, 25, 27, 27, 29, 9, 28, 30, 30, 32,
31, 33, 31, 10, 34, 35, 35, 36, 37, 38,
38, 39, 40,
}
var yyR2 = [...]int{
0, 1, 1, 1, 2, 3, 1, 1, 1, 1,
1, 1, 5, 1, 3, 1, 3, 1, 1, 4,
4, 1, 0, 3, 1, 1, 1, 1, 2, 1,
2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 5, 5, 4, 3, 0,
6, 1, 2, 3, 0, 10, 1, 2, 3, 0,
5, 0, 4, 7, 1, 2, 3, 8, 1, 2,
3, 8, 1,
}
var yyChk = [...]int{
-1000, -1, -2, -4, -5, -6, -7, -8, -9, -10,
9, 6, 15, 13, 16, 26, 28, -11, 23, -15,
23, -16, -25, 23, -28, 23, -34, 23, -2, 29,
32, -17, -18, -19, -20, -21, -22, -24, 17, 10,
8, 4, 12, 11, -5, -8, -9, 23, 19, 20,
21, 22, 29, -29, 29, -12, -13, -14, 23, 23,
24, -23, 37, 23, -24, -26, 14, -35, -36, 27,
30, 31, 32, 33, 35, -23, -27, -17, 38, 30,
28, -37, 23, -12, -3, 23, 24, -3, -3, 36,
30, 28, -18, -22, 32, -35, 29, 34, 36, -27,
39, -23, -3, -38, -39, -22, 29, 30, 28, -40,
23, -30, -31, 5, 7, 32, -38, 38, 30, 28,
-3, -33, -3, -22, -30, -32, 40, 28, 39, 40,
-17, 32, -17, -3, 28,
}
var yyDef = [...]int{
0, -2, 1, 0, 6, 7, 8, 9, 10, 11,
0, 0, 22, 0, 0, 0, 4, 0, 17, 0,
21, 0, 0, 51, 54, 56, 0, 64, 5, 0,
0, 23, 24, 25, 26, 27, 0, 29, 0, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 49, 0, 0, 0, 13, 15, 18, 19,
20, 28, 0, 44, 30, 0, 0, 0, 0, 0,
12, 0, 0, 0, 0, 48, 0, 0, 0, 0,
65, 0, 68, 14, 16, 2, 3, 0, 0, 47,
50, 52, 0, 0, 0, 66, 0, 45, 46, 53,
0, 28, 63, 0, 0, 0, 0, 0, 69, 0,
72, 0, 0, 0, 61, 0, 70, 0, 55, 57,
59, 0, 0, 0, 58, 0, 0, 67, 0, 0,
62, 0, 60, 0, 71,
}
var yyTok1 = [...]int{
1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
38, 39, 37, 3, 31, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 40, 28,
35, 32, 36, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 33, 3, 34, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 29, 3, 30,
}
var yyTok2 = [...]int{
2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27,
}
var yyTok3 = [...]int{
0,
}
var yyErrorMessages = [...]struct {
state int
token int
msg string
}{}
//line yaccpar:1
/* parser for yacc output */
var (
yyDebug = 0
yyErrorVerbose = false
)
type yyLexer interface {
Lex(lval *yySymType) int
Error(s string)
}
type yyParser interface {
Parse(yyLexer) int
Lookahead() int
}
type yyParserImpl struct {
lval yySymType
stack [yyInitialStackSize]yySymType
char int
}
func (p *yyParserImpl) Lookahead() int {
return p.char
}
func yyNewParser() yyParser {
return &yyParserImpl{}
}
const yyFlag = -1000
func yyTokname(c int) string {
if c >= 1 && c-1 < len(yyToknames) {
if yyToknames[c-1] != "" {
return yyToknames[c-1]
}
}
return __yyfmt__.Sprintf("tok-%v", c)
}
func yyStatname(s int) string {
if s >= 0 && s < len(yyStatenames) {
if yyStatenames[s] != "" {
return yyStatenames[s]
}
}
return __yyfmt__.Sprintf("state-%v", s)
}
func yyErrorMessage(state, lookAhead int) string {
const TOKSTART = 4
if !yyErrorVerbose {
return "syntax error"
}
for _, e := range yyErrorMessages {
if e.state == state && e.token == lookAhead {
return "syntax error: " + e.msg
}
}
res := "syntax error: unexpected " + yyTokname(lookAhead)
// To match Bison, suggest at most four expected tokens.
expected := make([]int, 0, 4)
// Look for shiftable tokens.
base := yyPact[state]
for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {
if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {
if len(expected) == cap(expected) {
return res
}
expected = append(expected, tok)
}
}
if yyDef[state] == -2 {
i := 0
for yyExca[i] != -1 || yyExca[i+1] != state {
i += 2
}
// Look for tokens that we accept or reduce.
for i += 2; yyExca[i] >= 0; i += 2 {
tok := yyExca[i]
if tok < TOKSTART || yyExca[i+1] == 0 {
continue
}
if len(expected) == cap(expected) {
return res
}
expected = append(expected, tok)
}
// If the default action is to accept or reduce, give up.
if yyExca[i+1] != 0 {
return res
}
}
for i, tok := range expected {
if i == 0 {
res += ", expecting "
} else {
res += " or "
}
res += yyTokname(tok)
}
return res
}
func yylex1(lex yyLexer, lval *yySymType) (char, token int) {
token = 0
char = lex.Lex(lval)
if char <= 0 {
token = yyTok1[0]
goto out
}
if char < len(yyTok1) {
token = yyTok1[char]
goto out
}
if char >= yyPrivate {
if char < yyPrivate+len(yyTok2) {
token = yyTok2[char-yyPrivate]
goto out
}
}
for i := 0; i < len(yyTok3); i += 2 {
token = yyTok3[i+0]
if token == char {
token = yyTok3[i+1]
goto out
}
}
out:
if token == 0 {
token = yyTok2[1] /* unknown char */
}
if yyDebug >= 3 {
__yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))
}
return char, token
}
func yyParse(yylex yyLexer) int {
return yyNewParser().Parse(yylex)
}
func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int {
var yyn int
var yyVAL yySymType
var yyDollar []yySymType
_ = yyDollar // silence set and not used
yyS := yyrcvr.stack[:]
Nerrs := 0 /* number of errors */
Errflag := 0 /* error recovery flag */
yystate := 0
yyrcvr.char = -1
yytoken := -1 // yyrcvr.char translated into internal numbering
defer func() {
// Make sure we report no lookahead when not parsing.
yystate = -1
yyrcvr.char = -1
yytoken = -1
}()
yyp := -1
goto yystack
ret0:
return 0
ret1:
return 1
yystack:
/* put a state and value onto the stack */
if yyDebug >= 4 {
__yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate))
}
yyp++
if yyp >= len(yyS) {
nyys := make([]yySymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
}
yyS[yyp] = yyVAL
yyS[yyp].yys = yystate
yynewstate:
yyn = yyPact[yystate]
if yyn <= yyFlag {
goto yydefault /* simple state */
}
if yyrcvr.char < 0 {
yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)
}
yyn += yytoken
if yyn < 0 || yyn >= yyLast {
goto yydefault
}
yyn = yyAct[yyn]
if yyChk[yyn] == yytoken { /* valid shift */
yyrcvr.char = -1
yytoken = -1
yyVAL = yyrcvr.lval
yystate = yyn
if Errflag > 0 {
Errflag--
}
goto yystack
}
yydefault:
/* default state action */
yyn = yyDef[yystate]
if yyn == -2 {
if yyrcvr.char < 0 {
yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)
}
/* look through exception table */
xi := 0
for {
if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {
break
}
xi += 2
}
for xi += 2; ; xi += 2 {
yyn = yyExca[xi+0]
if yyn < 0 || yyn == yytoken {
break
}
}
yyn = yyExca[xi+1]
if yyn < 0 {
goto ret0
}
}
if yyn == 0 {
/* error ... attempt to resume parsing */
switch Errflag {
case 0: /* brand new error */
yylex.Error(yyErrorMessage(yystate, yytoken))
Nerrs++
if yyDebug >= 1 {
__yyfmt__.Printf("%s", yyStatname(yystate))
__yyfmt__.Printf(" saw %s\n", yyTokname(yytoken))
}
fallthrough
case 1, 2: /* incompletely recovered error ... try again */
Errflag = 3
/* find a state where "error" is a legal shift action */
for yyp >= 0 {
yyn = yyPact[yyS[yyp].yys] + yyErrCode
if yyn >= 0 && yyn < yyLast {
yystate = yyAct[yyn] /* simulate a shift of "error" */
if yyChk[yystate] == yyErrCode {
goto yystack
}
}
/* the current p has no shift on "error", pop stack */
if yyDebug >= 2 {
__yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)
}
yyp--
}
/* there is no state on the stack with an error shift ... abort */
goto ret1
case 3: /* no shift yet; clobber input char */
if yyDebug >= 2 {
__yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken))
}
if yytoken == yyEofCode {
goto ret1
}
yyrcvr.char = -1
yytoken = -1
goto yynewstate /* try again in the same state */
}
}
/* reduction by production yyn */
if yyDebug >= 2 {
__yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))
}
yynt := yyn
yypt := yyp
_ = yypt // guard against "declared and not used"
yyp -= yyR2[yyn]
// yyp is now the index of $0. Perform the default action. Iff the
// reduced production is ε, $1 is possibly out of range.
if yyp+1 >= len(yyS) {
nyys := make([]yySymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
}
yyVAL = yyS[yyp+1]
/* consult goto table to find next state */
yyn = yyR1[yyn]
yyg := yyPgo[yyn]
yyj := yyg + yyS[yyp].yys + 1
if yyj >= yyLast {
yystate = yyAct[yyg]
} else {
yystate = yyAct[yyj]
if yyChk[yystate] != -yyn {
yystate = yyAct[yyg]
}
}
// dummy call; replaced with literal code
switch yynt {
case 12:
yyDollar = yyS[yypt-5 : yypt+1]
//line sunrpc.y:86
{
StartEnum(yyDollar[2].val)
}
case 15:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:95
{
err := AddEnumAutoVal(yyDollar[1].val)
if err != nil {
yylex.Error(err.Error())
return 1
}
}
case 16:
yyDollar = yyS[yypt-3 : yypt+1]
//line sunrpc.y:102
{
err := AddEnumVal(yyDollar[1].val, yyDollar[3].val)
if err != nil {
yylex.Error(err.Error())
return 1
}
}
case 20:
yyDollar = yyS[yypt-4 : yypt+1]
//line sunrpc.y:124
{
err := AddConst(yyDollar[2].val, yyDollar[4].val)
if err != nil {
yylex.Error(err.Error())
return 1
}
}
case 22:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:138
{
StartTypedef()
}
case 28:
yyDollar = yyS[yypt-2 : yypt+1]
//line sunrpc.y:149
{
AddDeclaration(yyDollar[2].val, yyDollar[1].val)
}
case 30:
yyDollar = yyS[yypt-2 : yypt+1]
//line sunrpc.y:154
{
yyVAL.val = "u" + yyDollar[2].val
}
case 31:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:155
{
yyVAL.val = "float32"
}
case 32:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:156
{
yyVAL.val = "float64"
}
case 33:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:157
{
yyVAL.val = "bool"
}
case 34:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:158
{
yyVAL.val = "string"
}
case 35:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:159
{
yyVAL.val = "byte"
}
case 40:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:167
{
yyVAL.val = "int64"
}
case 41:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:168
{
yyVAL.val = "int32"
}
case 42:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:169
{
yyVAL.val = "int16"
}
case 43:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:170
{
yyVAL.val = "int8"
}
case 45:
yyDollar = yyS[yypt-5 : yypt+1]
//line sunrpc.y:178
{
AddFixedArray(yyDollar[2].val, yyDollar[1].val, yyDollar[4].val)
}
case 46:
yyDollar = yyS[yypt-5 : yypt+1]
//line sunrpc.y:182
{
AddVariableArray(yyDollar[2].val, yyDollar[1].val, yyDollar[4].val)
}
case 47:
yyDollar = yyS[yypt-4 : yypt+1]
//line sunrpc.y:183
{
AddVariableArray(yyDollar[2].val, yyDollar[1].val, "")
}
case 48:
yyDollar = yyS[yypt-3 : yypt+1]
//line sunrpc.y:191
{
AddVariableArray(yyDollar[3].val, yyDollar[1].val, "1")
}
case 49:
yyDollar = yyS[yypt-3 : yypt+1]
//line sunrpc.y:195
{
StartStruct(yyDollar[2].val)
}
case 50:
yyDollar = yyS[yypt-6 : yypt+1]
//line sunrpc.y:195
{
AddStruct()
}
case 54:
yyDollar = yyS[yypt-2 : yypt+1]
//line sunrpc.y:208
{
StartUnion(yyDollar[2].val)
}
case 55:
yyDollar = yyS[yypt-10 : yypt+1]
//line sunrpc.y:208
{
AddUnion()
}
case 59:
yyDollar = yyS[yypt-2 : yypt+1]
//line sunrpc.y:221
{
StartCase(yyDollar[2].val)
}
case 60:
yyDollar = yyS[yypt-5 : yypt+1]
//line sunrpc.y:221
{
AddCase()
}
case 61:
yyDollar = yyS[yypt-1 : yypt+1]
//line sunrpc.y:222
{
StartCase("default")
}
case 62:
yyDollar = yyS[yypt-4 : yypt+1]
//line sunrpc.y:222
{
AddCase()
}
}
goto yystack /* stack new state and value */
}

1195
internal/lvgen/y.output Normal file

File diff suppressed because it is too large Load Diff

17020
libvirt.gen.go Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -94,7 +94,7 @@ func TestSecretsIntegration(t *testing.T) {
s := secrets[0] s := secrets[0]
wantType := SecretUsageTypeVolume wantType := SecretUsageTypeVolume
if s.UsageType != wantType { if s.UsageType != int32(wantType) {
t.Errorf("expected usage type: %d, got %d", wantType, s.UsageType) t.Errorf("expected usage type: %d, got %d", wantType, s.UsageType)
} }
@ -201,7 +201,12 @@ func TestStoragePoolRefreshIntegration(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
err := l.StoragePoolRefresh("test") pool, err := l.StoragePool("test")
if err != nil {
t.Error(err)
}
err = l.StoragePoolRefresh(pool, 0)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
@ -215,7 +220,12 @@ func TestStoragePoolRefreshInvalidIntegration(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
err := l.StoragePoolRefresh("test-does-not-exist") pool, err := l.StoragePool("test-does-not-exist")
if err == nil {
t.Error(err)
}
err = l.StoragePoolRefresh(pool, 0)
if err == nil { if err == nil {
t.Error("expected non-existent storage pool to fail refresh") t.Error("expected non-existent storage pool to fail refresh")
} }

View File

@ -107,7 +107,7 @@ func TestDomains(t *testing.T) {
for i, d := range domains { for i, d := range domains {
wantID := i + 1 wantID := i + 1
if d.ID != wantID { if d.ID != int32(wantID) {
t.Errorf("expected domain ID %q, got %q", wantID, d.ID) t.Errorf("expected domain ID %q, got %q", wantID, d.ID)
} }
@ -148,17 +148,27 @@ func TestDomainMemoryStats(t *testing.T) {
}, },
} }
gotDomainMemoryStats, err := l.DomainMemoryStats("test") d, err := l.lookup("test")
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
gotDomainMemoryStats, err := l.DomainMemoryStats(d, 8, 0)
if err != nil {
t.Error(err)
}
t.Log(gotDomainMemoryStats)
if len(gotDomainMemoryStats) == 0 {
t.Error("No memory stats returned!")
}
for i := range wantDomainMemoryStats { for i := range wantDomainMemoryStats {
if wantDomainMemoryStats[i] != gotDomainMemoryStats[i] { if wantDomainMemoryStats[i] != gotDomainMemoryStats[i] {
t.Errorf("expected domain memory stat %v, got %v", wantDomainMemoryStats[i], gotDomainMemoryStats[i]) t.Errorf("expected domain memory stat %v, got %v", wantDomainMemoryStats[i], gotDomainMemoryStats[i])
} }
} }
} }
func TestEvents(t *testing.T) { func TestEvents(t *testing.T) {
@ -265,7 +275,7 @@ func TestSecrets(t *testing.T) {
} }
s := secrets[0] s := secrets[0]
wantType := SecretUsageTypeVolume wantType := int32(SecretUsageTypeVolume)
if s.UsageType != wantType { if s.UsageType != wantType {
t.Errorf("expected usage type %d, got %d", wantType, s.UsageType) t.Errorf("expected usage type %d, got %d", wantType, s.UsageType)
} }
@ -347,7 +357,11 @@ func TestStoragePoolRefresh(t *testing.T) {
conn := libvirttest.New() conn := libvirttest.New()
l := New(conn) l := New(conn)
err := l.StoragePoolRefresh("default") pool, err := l.StoragePool("default")
if err != nil {
t.Error(err)
}
err = l.StoragePoolRefresh(pool, 0)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
@ -403,8 +417,12 @@ func TestDomainCreateWithFlags(t *testing.T) {
conn := libvirttest.New() conn := libvirttest.New()
l := New(conn) l := New(conn)
var flags DomainCreateFlags d, err := l.lookup("test")
if err := l.DomainCreateWithFlags("test", flags); err != nil { if err != nil {
t.Fatalf("failed to lookup domain: %v", err)
}
var flags uint32
if _, err := l.DomainCreateWithFlags(d, flags); err != nil {
t.Fatalf("unexpected create error: %v", err) t.Fatalf("unexpected create error: %v", err)
} }
} }

View File

@ -563,7 +563,7 @@ func (m *MockLibvirt) handle(conn net.Conn) {
proc := binary.BigEndian.Uint32(buf[12:16]) proc := binary.BigEndian.Uint32(buf[12:16])
switch prog { switch prog {
case constants.ProgramRemote: case constants.Program:
m.handleRemote(proc, conn) m.handleRemote(proc, conn)
case constants.ProgramQEMU: case constants.ProgramQEMU:
m.handleQEMU(proc, conn) m.handleQEMU(proc, conn)
@ -599,7 +599,7 @@ func (m *MockLibvirt) handleRemote(procedure uint32, conn net.Conn) {
conn.Write(m.reply(testDomainMemoryStatsReply)) conn.Write(m.reply(testDomainMemoryStatsReply))
case constants.ProcDomainMigrateSetMaxSpeed: case constants.ProcDomainMigrateSetMaxSpeed:
conn.Write(m.reply(testSetSpeedReply)) conn.Write(m.reply(testSetSpeedReply))
case constants.ProcMigratePerformParams: case constants.ProcDomainMigratePerform3Params:
conn.Write(m.reply(testMigrateReply)) conn.Write(m.reply(testMigrateReply))
case constants.ProcDomainUndefineFlags: case constants.ProcDomainUndefineFlags:
conn.Write(m.reply(testUndefineReply)) conn.Write(m.reply(testUndefineReply))

8
rpc.go
View File

@ -131,7 +131,7 @@ func (l *Libvirt) connect() error {
// libvirt requires that we call auth-list prior to connecting, // libvirt requires that we call auth-list prior to connecting,
// event when no authentication is used. // event when no authentication is used.
resp, err := l.request(constants.ProcAuthList, constants.ProgramRemote, &buf) resp, err := l.request(constants.ProcAuthList, constants.Program, &buf)
if err != nil { if err != nil {
return err return err
} }
@ -141,7 +141,7 @@ func (l *Libvirt) connect() error {
return decodeError(r.Payload) return decodeError(r.Payload)
} }
resp, err = l.request(constants.ProcConnectOpen, constants.ProgramRemote, &buf) resp, err = l.request(constants.ProcConnectOpen, constants.Program, &buf)
if err != nil { if err != nil {
return err return err
} }
@ -155,7 +155,7 @@ func (l *Libvirt) connect() error {
} }
func (l *Libvirt) disconnect() error { func (l *Libvirt) disconnect() error {
resp, err := l.request(constants.ProcConnectClose, constants.ProgramRemote, nil) resp, err := l.request(constants.ProcConnectClose, constants.Program, nil)
if err != nil { if err != nil {
return err return err
} }
@ -329,7 +329,7 @@ func (l *Libvirt) request(proc uint32, program uint32, payload *bytes.Buffer) (<
Len: uint32(size), Len: uint32(size),
Header: header{ Header: header{
Program: program, Program: program,
Version: constants.ProgramVersion, Version: constants.ProtocolVersion,
Procedure: proc, Procedure: proc,
Type: Call, Type: Call,
Serial: serial, Serial: serial,

View File

@ -106,7 +106,7 @@ var (
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
} }
testDomain = Domain{ testDomain = &NonnullDomain{
Name: "test-domain", Name: "test-domain",
UUID: testUUID, UUID: testUUID,
ID: 1, ID: 1,
@ -120,12 +120,12 @@ func TestExtractHeader(t *testing.T) {
t.Error(err) t.Error(err)
} }
if h.Program != constants.ProgramRemote { if h.Program != constants.Program {
t.Errorf("expected Program %q, got %q", constants.ProgramRemote, h.Program) t.Errorf("expected Program %q, got %q", constants.Program, h.Program)
} }
if h.Version != constants.ProgramVersion { if h.Version != constants.ProtocolVersion {
t.Errorf("expected version %q, got %q", constants.ProgramVersion, h.Version) t.Errorf("expected version %q, got %q", constants.ProtocolVersion, h.Version)
} }
if h.Procedure != constants.ProcConnectOpen { if h.Procedure != constants.ProcConnectOpen {
@ -177,7 +177,7 @@ func TestDecodeEvent(t *testing.T) {
t.Errorf("expected uuid:\t%x, got\n\t\t\t%x", expUUID, e.Domain.UUID) t.Errorf("expected uuid:\t%x, got\n\t\t\t%x", expUUID, e.Domain.UUID)
} }
expID := 14 expID := int32(14)
if e.Domain.ID != expID { if e.Domain.ID != expID {
t.Errorf("expected id %d, got %d", expID, e.Domain.ID) t.Errorf("expected id %d, got %d", expID, e.Domain.ID)
} }
@ -340,10 +340,6 @@ func TestLookup(t *testing.T) {
t.Error(err) t.Error(err)
} }
if d == nil {
t.Error("nil domain returned")
}
if d.Name != name { if d.Name != name {
t.Errorf("expected domain %s, got %s", name, d.Name) t.Errorf("expected domain %s, got %s", name, d.Name)
} }

View File

@ -3,9 +3,9 @@
# Verify that the correct license block is present in all Go source # Verify that the correct license block is present in all Go source
# files. # files.
read -r -d '' EXPECTED <<EndOfLicense read -r -d '' EXPECTED <<EndOfLicense
// Copyright 2016 The go-libvirt Authors. // Copyright 20[[:digit:]]{2} The go-libvirt Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 \(the "License"\);
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
@ -23,12 +23,11 @@ EXIT=0
GOFILES=$(find . -name "*.go") GOFILES=$(find . -name "*.go")
for FILE in $GOFILES; do for FILE in $GOFILES; do
BLOCK=$(head -n 14 $FILE) BLOCK=$(head -n 20 $FILE)
if [ "$BLOCK" != "$EXPECTED" ]; then [[ $BLOCK =~ $EXPECTED ]] && continue
echo "file missing license: $FILE" echo "file missing license: $FILE"
EXIT=1 EXIT=1
fi
done done
exit $EXIT exit $EXIT