repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/defaults.go | vendor/kubevirt.io/api/core/v1/defaults.go | package v1
import (
"github.com/google/uuid"
"k8s.io/apimachinery/pkg/types"
)
var _true = t(true)
var _false = t(false)
func SetDefaults_HPETTimer(obj *HPETTimer) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_PITTimer(obj *PITTimer) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_KVMTimer(obj *KVMTimer) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_HypervTimer(obj *HypervTimer) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_RTCTimer(obj *RTCTimer) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_FeatureState(obj *FeatureState) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_SyNICTimer(obj *SyNICTimer) {
if obj.Enabled == nil {
obj.Enabled = _true
}
if obj.Direct != nil && obj.Direct.Enabled == nil {
obj.Direct.Enabled = _true
}
}
func SetDefaults_FeatureAPIC(obj *FeatureAPIC) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_FeatureVendorID(obj *FeatureVendorID) {
if obj.Enabled == nil {
obj.Enabled = _true
}
}
func SetDefaults_DiskDevice(obj *DiskDevice) {
if obj.Disk == nil &&
obj.CDRom == nil &&
obj.LUN == nil {
obj.Disk = &DiskTarget{}
}
}
func SetDefaults_CDRomTarget(obj *CDRomTarget) {
if obj.ReadOnly == nil {
obj.ReadOnly = _true
}
if obj.Tray == "" {
obj.Tray = TrayStateClosed
}
}
func SetDefaults_FeatureSpinlocks(obj *FeatureSpinlocks) {
if obj.Enabled == nil {
obj.Enabled = _true
}
if *obj.Enabled == *_true && obj.Retries == nil {
obj.Retries = ui32(4096)
}
}
func SetDefaults_Firmware(obj *Firmware) {
if obj.UUID == "" {
obj.UUID = types.UID(uuid.NewString())
}
}
func SetDefaults_VirtualMachineInstance(obj *VirtualMachineInstance) {
if obj.Spec.Domain.Firmware == nil {
obj.Spec.Domain.Firmware = &Firmware{}
}
if obj.Spec.Domain.Features == nil {
obj.Spec.Domain.Features = &Features{}
}
setDefaults_Disk(obj)
setDefaults_Input(obj)
SetDefaults_Probe(obj.Spec.ReadinessProbe)
SetDefaults_Probe(obj.Spec.LivenessProbe)
}
func setDefaults_Disk(obj *VirtualMachineInstance) {
for i := range obj.Spec.Domain.Devices.Disks {
disk := &obj.Spec.Domain.Devices.Disks[i].DiskDevice
SetDefaults_DiskDevice(disk)
}
}
func setDefaults_Input(obj *VirtualMachineInstance) {
for i := range obj.Spec.Domain.Devices.Inputs {
input := &obj.Spec.Domain.Devices.Inputs[i]
if input.Bus == "" {
input.Bus = InputBusUSB
}
if input.Type == "" {
input.Type = InputTypeTablet
}
}
}
func SetDefaults_Probe(probe *Probe) {
if probe == nil {
return
}
if probe.TimeoutSeconds < 1 {
probe.TimeoutSeconds = 1
}
if probe.PeriodSeconds < 1 {
probe.PeriodSeconds = 10
}
if probe.SuccessThreshold < 1 {
probe.SuccessThreshold = 1
}
if probe.FailureThreshold < 1 {
probe.FailureThreshold = 3
}
}
func DefaultBridgeNetworkInterface() *Interface {
iface := &Interface{
Name: "default",
InterfaceBindingMethod: InterfaceBindingMethod{
Bridge: &InterfaceBridge{},
},
}
return iface
}
func DefaultMasqueradeNetworkInterface() *Interface {
iface := &Interface{
Name: "default",
InterfaceBindingMethod: InterfaceBindingMethod{
Masquerade: &InterfaceMasquerade{},
},
}
return iface
}
func DefaultPodNetwork() *Network {
defaultNet := &Network{
Name: "default",
NetworkSource: NetworkSource{
Pod: &PodNetwork{},
},
}
return defaultNet
}
func t(v bool) *bool {
return &v
}
func ui32(v uint32) *uint32 {
return &v
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/zz_generated.defaults.go | vendor/kubevirt.io/api/core/v1/zz_generated.defaults.go | //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
This file is part of the KubeVirt project
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.
Copyright The KubeVirt Authors.
*/
// Code generated by defaulter-gen. DO NOT EDIT.
package v1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&VirtualMachine{}, func(obj interface{}) { SetObjectDefaults_VirtualMachine(obj.(*VirtualMachine)) })
scheme.AddTypeDefaultingFunc(&VirtualMachineInstance{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineInstance(obj.(*VirtualMachineInstance)) })
scheme.AddTypeDefaultingFunc(&VirtualMachineInstanceList{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineInstanceList(obj.(*VirtualMachineInstanceList)) })
scheme.AddTypeDefaultingFunc(&VirtualMachineInstancePreset{}, func(obj interface{}) {
SetObjectDefaults_VirtualMachineInstancePreset(obj.(*VirtualMachineInstancePreset))
})
scheme.AddTypeDefaultingFunc(&VirtualMachineInstancePresetList{}, func(obj interface{}) {
SetObjectDefaults_VirtualMachineInstancePresetList(obj.(*VirtualMachineInstancePresetList))
})
scheme.AddTypeDefaultingFunc(&VirtualMachineInstanceReplicaSet{}, func(obj interface{}) {
SetObjectDefaults_VirtualMachineInstanceReplicaSet(obj.(*VirtualMachineInstanceReplicaSet))
})
scheme.AddTypeDefaultingFunc(&VirtualMachineInstanceReplicaSetList{}, func(obj interface{}) {
SetObjectDefaults_VirtualMachineInstanceReplicaSetList(obj.(*VirtualMachineInstanceReplicaSetList))
})
scheme.AddTypeDefaultingFunc(&VirtualMachineList{}, func(obj interface{}) { SetObjectDefaults_VirtualMachineList(obj.(*VirtualMachineList)) })
return nil
}
func SetObjectDefaults_VirtualMachine(in *VirtualMachine) {
if in.Spec.Template != nil {
if in.Spec.Template.Spec.Domain.Firmware != nil {
SetDefaults_Firmware(in.Spec.Template.Spec.Domain.Firmware)
}
if in.Spec.Template.Spec.Domain.Clock != nil {
if in.Spec.Template.Spec.Domain.Clock.Timer != nil {
if in.Spec.Template.Spec.Domain.Clock.Timer.HPET != nil {
SetDefaults_HPETTimer(in.Spec.Template.Spec.Domain.Clock.Timer.HPET)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.KVM != nil {
SetDefaults_KVMTimer(in.Spec.Template.Spec.Domain.Clock.Timer.KVM)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.PIT != nil {
SetDefaults_PITTimer(in.Spec.Template.Spec.Domain.Clock.Timer.PIT)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.RTC != nil {
SetDefaults_RTCTimer(in.Spec.Template.Spec.Domain.Clock.Timer.RTC)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.Hyperv != nil {
SetDefaults_HypervTimer(in.Spec.Template.Spec.Domain.Clock.Timer.Hyperv)
}
}
}
if in.Spec.Template.Spec.Domain.Features != nil {
SetDefaults_FeatureState(&in.Spec.Template.Spec.Domain.Features.ACPI)
if in.Spec.Template.Spec.Domain.Features.APIC != nil {
SetDefaults_FeatureAPIC(in.Spec.Template.Spec.Domain.Features.APIC)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv != nil {
if in.Spec.Template.Spec.Domain.Features.Hyperv.Relaxed != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Relaxed)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.VAPIC != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.VAPIC)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Spinlocks != nil {
SetDefaults_FeatureSpinlocks(in.Spec.Template.Spec.Domain.Features.Hyperv.Spinlocks)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.VPIndex != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.VPIndex)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Runtime != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Runtime)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.SyNIC != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.SyNIC)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer != nil {
SetDefaults_SyNICTimer(in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer)
if in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer.Direct != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer.Direct)
}
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Reset != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Reset)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.VendorID != nil {
SetDefaults_FeatureVendorID(in.Spec.Template.Spec.Domain.Features.Hyperv.VendorID)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Frequencies != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Frequencies)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Reenlightenment != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Reenlightenment)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.TLBFlush != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.TLBFlush)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.IPI != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.IPI)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.EVMCS != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.EVMCS)
}
}
if in.Spec.Template.Spec.Domain.Features.SMM != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.SMM)
}
if in.Spec.Template.Spec.Domain.Features.Pvspinlock != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Pvspinlock)
}
}
for i := range in.Spec.Template.Spec.Domain.Devices.Disks {
a := &in.Spec.Template.Spec.Domain.Devices.Disks[i]
SetDefaults_DiskDevice(&a.DiskDevice)
if a.DiskDevice.CDRom != nil {
SetDefaults_CDRomTarget(a.DiskDevice.CDRom)
}
if a.BlockSize != nil {
if a.BlockSize.MatchVolume != nil {
SetDefaults_FeatureState(a.BlockSize.MatchVolume)
}
}
}
for i := range in.Spec.Template.Spec.Domain.Devices.GPUs {
a := &in.Spec.Template.Spec.Domain.Devices.GPUs[i]
if a.VirtualGPUOptions != nil {
if a.VirtualGPUOptions.Display != nil {
if a.VirtualGPUOptions.Display.RamFB != nil {
SetDefaults_FeatureState(a.VirtualGPUOptions.Display.RamFB)
}
}
}
}
if in.Spec.Template.Spec.LivenessProbe != nil {
SetDefaults_Probe(in.Spec.Template.Spec.LivenessProbe)
}
if in.Spec.Template.Spec.ReadinessProbe != nil {
SetDefaults_Probe(in.Spec.Template.Spec.ReadinessProbe)
}
}
for i := range in.Status.VolumeRequests {
a := &in.Status.VolumeRequests[i]
if a.AddVolumeOptions != nil {
if a.AddVolumeOptions.Disk != nil {
SetDefaults_DiskDevice(&a.AddVolumeOptions.Disk.DiskDevice)
if a.AddVolumeOptions.Disk.DiskDevice.CDRom != nil {
SetDefaults_CDRomTarget(a.AddVolumeOptions.Disk.DiskDevice.CDRom)
}
if a.AddVolumeOptions.Disk.BlockSize != nil {
if a.AddVolumeOptions.Disk.BlockSize.MatchVolume != nil {
SetDefaults_FeatureState(a.AddVolumeOptions.Disk.BlockSize.MatchVolume)
}
}
}
}
}
}
func SetObjectDefaults_VirtualMachineInstance(in *VirtualMachineInstance) {
SetDefaults_VirtualMachineInstance(in)
if in.Spec.Domain.Firmware != nil {
SetDefaults_Firmware(in.Spec.Domain.Firmware)
}
if in.Spec.Domain.Clock != nil {
if in.Spec.Domain.Clock.Timer != nil {
if in.Spec.Domain.Clock.Timer.HPET != nil {
SetDefaults_HPETTimer(in.Spec.Domain.Clock.Timer.HPET)
}
if in.Spec.Domain.Clock.Timer.KVM != nil {
SetDefaults_KVMTimer(in.Spec.Domain.Clock.Timer.KVM)
}
if in.Spec.Domain.Clock.Timer.PIT != nil {
SetDefaults_PITTimer(in.Spec.Domain.Clock.Timer.PIT)
}
if in.Spec.Domain.Clock.Timer.RTC != nil {
SetDefaults_RTCTimer(in.Spec.Domain.Clock.Timer.RTC)
}
if in.Spec.Domain.Clock.Timer.Hyperv != nil {
SetDefaults_HypervTimer(in.Spec.Domain.Clock.Timer.Hyperv)
}
}
}
if in.Spec.Domain.Features != nil {
SetDefaults_FeatureState(&in.Spec.Domain.Features.ACPI)
if in.Spec.Domain.Features.APIC != nil {
SetDefaults_FeatureAPIC(in.Spec.Domain.Features.APIC)
}
if in.Spec.Domain.Features.Hyperv != nil {
if in.Spec.Domain.Features.Hyperv.Relaxed != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Relaxed)
}
if in.Spec.Domain.Features.Hyperv.VAPIC != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.VAPIC)
}
if in.Spec.Domain.Features.Hyperv.Spinlocks != nil {
SetDefaults_FeatureSpinlocks(in.Spec.Domain.Features.Hyperv.Spinlocks)
}
if in.Spec.Domain.Features.Hyperv.VPIndex != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.VPIndex)
}
if in.Spec.Domain.Features.Hyperv.Runtime != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Runtime)
}
if in.Spec.Domain.Features.Hyperv.SyNIC != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.SyNIC)
}
if in.Spec.Domain.Features.Hyperv.SyNICTimer != nil {
SetDefaults_SyNICTimer(in.Spec.Domain.Features.Hyperv.SyNICTimer)
if in.Spec.Domain.Features.Hyperv.SyNICTimer.Direct != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.SyNICTimer.Direct)
}
}
if in.Spec.Domain.Features.Hyperv.Reset != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Reset)
}
if in.Spec.Domain.Features.Hyperv.VendorID != nil {
SetDefaults_FeatureVendorID(in.Spec.Domain.Features.Hyperv.VendorID)
}
if in.Spec.Domain.Features.Hyperv.Frequencies != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Frequencies)
}
if in.Spec.Domain.Features.Hyperv.Reenlightenment != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Reenlightenment)
}
if in.Spec.Domain.Features.Hyperv.TLBFlush != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.TLBFlush)
}
if in.Spec.Domain.Features.Hyperv.IPI != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.IPI)
}
if in.Spec.Domain.Features.Hyperv.EVMCS != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.EVMCS)
}
}
if in.Spec.Domain.Features.SMM != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.SMM)
}
if in.Spec.Domain.Features.Pvspinlock != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Pvspinlock)
}
}
for i := range in.Spec.Domain.Devices.Disks {
a := &in.Spec.Domain.Devices.Disks[i]
SetDefaults_DiskDevice(&a.DiskDevice)
if a.DiskDevice.CDRom != nil {
SetDefaults_CDRomTarget(a.DiskDevice.CDRom)
}
if a.BlockSize != nil {
if a.BlockSize.MatchVolume != nil {
SetDefaults_FeatureState(a.BlockSize.MatchVolume)
}
}
}
for i := range in.Spec.Domain.Devices.GPUs {
a := &in.Spec.Domain.Devices.GPUs[i]
if a.VirtualGPUOptions != nil {
if a.VirtualGPUOptions.Display != nil {
if a.VirtualGPUOptions.Display.RamFB != nil {
SetDefaults_FeatureState(a.VirtualGPUOptions.Display.RamFB)
}
}
}
}
if in.Spec.LivenessProbe != nil {
SetDefaults_Probe(in.Spec.LivenessProbe)
}
if in.Spec.ReadinessProbe != nil {
SetDefaults_Probe(in.Spec.ReadinessProbe)
}
}
func SetObjectDefaults_VirtualMachineInstanceList(in *VirtualMachineInstanceList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_VirtualMachineInstance(a)
}
}
func SetObjectDefaults_VirtualMachineInstancePreset(in *VirtualMachineInstancePreset) {
if in.Spec.Domain != nil {
if in.Spec.Domain.Firmware != nil {
SetDefaults_Firmware(in.Spec.Domain.Firmware)
}
if in.Spec.Domain.Clock != nil {
if in.Spec.Domain.Clock.Timer != nil {
if in.Spec.Domain.Clock.Timer.HPET != nil {
SetDefaults_HPETTimer(in.Spec.Domain.Clock.Timer.HPET)
}
if in.Spec.Domain.Clock.Timer.KVM != nil {
SetDefaults_KVMTimer(in.Spec.Domain.Clock.Timer.KVM)
}
if in.Spec.Domain.Clock.Timer.PIT != nil {
SetDefaults_PITTimer(in.Spec.Domain.Clock.Timer.PIT)
}
if in.Spec.Domain.Clock.Timer.RTC != nil {
SetDefaults_RTCTimer(in.Spec.Domain.Clock.Timer.RTC)
}
if in.Spec.Domain.Clock.Timer.Hyperv != nil {
SetDefaults_HypervTimer(in.Spec.Domain.Clock.Timer.Hyperv)
}
}
}
if in.Spec.Domain.Features != nil {
SetDefaults_FeatureState(&in.Spec.Domain.Features.ACPI)
if in.Spec.Domain.Features.APIC != nil {
SetDefaults_FeatureAPIC(in.Spec.Domain.Features.APIC)
}
if in.Spec.Domain.Features.Hyperv != nil {
if in.Spec.Domain.Features.Hyperv.Relaxed != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Relaxed)
}
if in.Spec.Domain.Features.Hyperv.VAPIC != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.VAPIC)
}
if in.Spec.Domain.Features.Hyperv.Spinlocks != nil {
SetDefaults_FeatureSpinlocks(in.Spec.Domain.Features.Hyperv.Spinlocks)
}
if in.Spec.Domain.Features.Hyperv.VPIndex != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.VPIndex)
}
if in.Spec.Domain.Features.Hyperv.Runtime != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Runtime)
}
if in.Spec.Domain.Features.Hyperv.SyNIC != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.SyNIC)
}
if in.Spec.Domain.Features.Hyperv.SyNICTimer != nil {
SetDefaults_SyNICTimer(in.Spec.Domain.Features.Hyperv.SyNICTimer)
if in.Spec.Domain.Features.Hyperv.SyNICTimer.Direct != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.SyNICTimer.Direct)
}
}
if in.Spec.Domain.Features.Hyperv.Reset != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Reset)
}
if in.Spec.Domain.Features.Hyperv.VendorID != nil {
SetDefaults_FeatureVendorID(in.Spec.Domain.Features.Hyperv.VendorID)
}
if in.Spec.Domain.Features.Hyperv.Frequencies != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Frequencies)
}
if in.Spec.Domain.Features.Hyperv.Reenlightenment != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.Reenlightenment)
}
if in.Spec.Domain.Features.Hyperv.TLBFlush != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.TLBFlush)
}
if in.Spec.Domain.Features.Hyperv.IPI != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.IPI)
}
if in.Spec.Domain.Features.Hyperv.EVMCS != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Hyperv.EVMCS)
}
}
if in.Spec.Domain.Features.SMM != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.SMM)
}
if in.Spec.Domain.Features.Pvspinlock != nil {
SetDefaults_FeatureState(in.Spec.Domain.Features.Pvspinlock)
}
}
for i := range in.Spec.Domain.Devices.Disks {
a := &in.Spec.Domain.Devices.Disks[i]
SetDefaults_DiskDevice(&a.DiskDevice)
if a.DiskDevice.CDRom != nil {
SetDefaults_CDRomTarget(a.DiskDevice.CDRom)
}
if a.BlockSize != nil {
if a.BlockSize.MatchVolume != nil {
SetDefaults_FeatureState(a.BlockSize.MatchVolume)
}
}
}
for i := range in.Spec.Domain.Devices.GPUs {
a := &in.Spec.Domain.Devices.GPUs[i]
if a.VirtualGPUOptions != nil {
if a.VirtualGPUOptions.Display != nil {
if a.VirtualGPUOptions.Display.RamFB != nil {
SetDefaults_FeatureState(a.VirtualGPUOptions.Display.RamFB)
}
}
}
}
}
}
func SetObjectDefaults_VirtualMachineInstancePresetList(in *VirtualMachineInstancePresetList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_VirtualMachineInstancePreset(a)
}
}
func SetObjectDefaults_VirtualMachineInstanceReplicaSet(in *VirtualMachineInstanceReplicaSet) {
if in.Spec.Template != nil {
if in.Spec.Template.Spec.Domain.Firmware != nil {
SetDefaults_Firmware(in.Spec.Template.Spec.Domain.Firmware)
}
if in.Spec.Template.Spec.Domain.Clock != nil {
if in.Spec.Template.Spec.Domain.Clock.Timer != nil {
if in.Spec.Template.Spec.Domain.Clock.Timer.HPET != nil {
SetDefaults_HPETTimer(in.Spec.Template.Spec.Domain.Clock.Timer.HPET)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.KVM != nil {
SetDefaults_KVMTimer(in.Spec.Template.Spec.Domain.Clock.Timer.KVM)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.PIT != nil {
SetDefaults_PITTimer(in.Spec.Template.Spec.Domain.Clock.Timer.PIT)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.RTC != nil {
SetDefaults_RTCTimer(in.Spec.Template.Spec.Domain.Clock.Timer.RTC)
}
if in.Spec.Template.Spec.Domain.Clock.Timer.Hyperv != nil {
SetDefaults_HypervTimer(in.Spec.Template.Spec.Domain.Clock.Timer.Hyperv)
}
}
}
if in.Spec.Template.Spec.Domain.Features != nil {
SetDefaults_FeatureState(&in.Spec.Template.Spec.Domain.Features.ACPI)
if in.Spec.Template.Spec.Domain.Features.APIC != nil {
SetDefaults_FeatureAPIC(in.Spec.Template.Spec.Domain.Features.APIC)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv != nil {
if in.Spec.Template.Spec.Domain.Features.Hyperv.Relaxed != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Relaxed)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.VAPIC != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.VAPIC)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Spinlocks != nil {
SetDefaults_FeatureSpinlocks(in.Spec.Template.Spec.Domain.Features.Hyperv.Spinlocks)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.VPIndex != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.VPIndex)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Runtime != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Runtime)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.SyNIC != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.SyNIC)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer != nil {
SetDefaults_SyNICTimer(in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer)
if in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer.Direct != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.SyNICTimer.Direct)
}
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Reset != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Reset)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.VendorID != nil {
SetDefaults_FeatureVendorID(in.Spec.Template.Spec.Domain.Features.Hyperv.VendorID)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Frequencies != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Frequencies)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.Reenlightenment != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.Reenlightenment)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.TLBFlush != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.TLBFlush)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.IPI != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.IPI)
}
if in.Spec.Template.Spec.Domain.Features.Hyperv.EVMCS != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Hyperv.EVMCS)
}
}
if in.Spec.Template.Spec.Domain.Features.SMM != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.SMM)
}
if in.Spec.Template.Spec.Domain.Features.Pvspinlock != nil {
SetDefaults_FeatureState(in.Spec.Template.Spec.Domain.Features.Pvspinlock)
}
}
for i := range in.Spec.Template.Spec.Domain.Devices.Disks {
a := &in.Spec.Template.Spec.Domain.Devices.Disks[i]
SetDefaults_DiskDevice(&a.DiskDevice)
if a.DiskDevice.CDRom != nil {
SetDefaults_CDRomTarget(a.DiskDevice.CDRom)
}
if a.BlockSize != nil {
if a.BlockSize.MatchVolume != nil {
SetDefaults_FeatureState(a.BlockSize.MatchVolume)
}
}
}
for i := range in.Spec.Template.Spec.Domain.Devices.GPUs {
a := &in.Spec.Template.Spec.Domain.Devices.GPUs[i]
if a.VirtualGPUOptions != nil {
if a.VirtualGPUOptions.Display != nil {
if a.VirtualGPUOptions.Display.RamFB != nil {
SetDefaults_FeatureState(a.VirtualGPUOptions.Display.RamFB)
}
}
}
}
if in.Spec.Template.Spec.LivenessProbe != nil {
SetDefaults_Probe(in.Spec.Template.Spec.LivenessProbe)
}
if in.Spec.Template.Spec.ReadinessProbe != nil {
SetDefaults_Probe(in.Spec.Template.Spec.ReadinessProbe)
}
}
}
func SetObjectDefaults_VirtualMachineInstanceReplicaSetList(in *VirtualMachineInstanceReplicaSetList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_VirtualMachineInstanceReplicaSet(a)
}
}
func SetObjectDefaults_VirtualMachineList(in *VirtualMachineList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_VirtualMachine(a)
}
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/deepcopy_generated.go | vendor/kubevirt.io/api/core/v1/deepcopy_generated.go | //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
This file is part of the KubeVirt project
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.
Copyright The KubeVirt Authors.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
types "k8s.io/apimachinery/pkg/types"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ACPI) DeepCopyInto(out *ACPI) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACPI.
func (in *ACPI) DeepCopy() *ACPI {
if in == nil {
return nil
}
out := new(ACPI)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AccessCredential) DeepCopyInto(out *AccessCredential) {
*out = *in
if in.SSHPublicKey != nil {
in, out := &in.SSHPublicKey, &out.SSHPublicKey
*out = new(SSHPublicKeyAccessCredential)
(*in).DeepCopyInto(*out)
}
if in.UserPassword != nil {
in, out := &in.UserPassword, &out.UserPassword
*out = new(UserPasswordAccessCredential)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessCredential.
func (in *AccessCredential) DeepCopy() *AccessCredential {
if in == nil {
return nil
}
out := new(AccessCredential)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AccessCredentialSecretSource) DeepCopyInto(out *AccessCredentialSecretSource) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AccessCredentialSecretSource.
func (in *AccessCredentialSecretSource) DeepCopy() *AccessCredentialSecretSource {
if in == nil {
return nil
}
out := new(AccessCredentialSecretSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddVolumeOptions) DeepCopyInto(out *AddVolumeOptions) {
*out = *in
if in.Disk != nil {
in, out := &in.Disk, &out.Disk
*out = new(Disk)
(*in).DeepCopyInto(*out)
}
if in.VolumeSource != nil {
in, out := &in.VolumeSource, &out.VolumeSource
*out = new(HotplugVolumeSource)
(*in).DeepCopyInto(*out)
}
if in.DryRun != nil {
in, out := &in.DryRun, &out.DryRun
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddVolumeOptions.
func (in *AddVolumeOptions) DeepCopy() *AddVolumeOptions {
if in == nil {
return nil
}
out := new(AddVolumeOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArchConfiguration) DeepCopyInto(out *ArchConfiguration) {
*out = *in
if in.Amd64 != nil {
in, out := &in.Amd64, &out.Amd64
*out = new(ArchSpecificConfiguration)
(*in).DeepCopyInto(*out)
}
if in.Arm64 != nil {
in, out := &in.Arm64, &out.Arm64
*out = new(ArchSpecificConfiguration)
(*in).DeepCopyInto(*out)
}
if in.Ppc64le != nil {
in, out := &in.Ppc64le, &out.Ppc64le
*out = new(ArchSpecificConfiguration)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArchConfiguration.
func (in *ArchConfiguration) DeepCopy() *ArchConfiguration {
if in == nil {
return nil
}
out := new(ArchConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArchSpecificConfiguration) DeepCopyInto(out *ArchSpecificConfiguration) {
*out = *in
if in.EmulatedMachines != nil {
in, out := &in.EmulatedMachines, &out.EmulatedMachines
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArchSpecificConfiguration.
func (in *ArchSpecificConfiguration) DeepCopy() *ArchSpecificConfiguration {
if in == nil {
return nil
}
out := new(ArchSpecificConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AuthorizedKeysFile) DeepCopyInto(out *AuthorizedKeysFile) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AuthorizedKeysFile.
func (in *AuthorizedKeysFile) DeepCopy() *AuthorizedKeysFile {
if in == nil {
return nil
}
out := new(AuthorizedKeysFile)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BIOS) DeepCopyInto(out *BIOS) {
*out = *in
if in.UseSerial != nil {
in, out := &in.UseSerial, &out.UseSerial
*out = new(bool)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BIOS.
func (in *BIOS) DeepCopy() *BIOS {
if in == nil {
return nil
}
out := new(BIOS)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BlockSize) DeepCopyInto(out *BlockSize) {
*out = *in
if in.Custom != nil {
in, out := &in.Custom, &out.Custom
*out = new(CustomBlockSize)
**out = **in
}
if in.MatchVolume != nil {
in, out := &in.MatchVolume, &out.MatchVolume
*out = new(FeatureState)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockSize.
func (in *BlockSize) DeepCopy() *BlockSize {
if in == nil {
return nil
}
out := new(BlockSize)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Bootloader) DeepCopyInto(out *Bootloader) {
*out = *in
if in.BIOS != nil {
in, out := &in.BIOS, &out.BIOS
*out = new(BIOS)
(*in).DeepCopyInto(*out)
}
if in.EFI != nil {
in, out := &in.EFI, &out.EFI
*out = new(EFI)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Bootloader.
func (in *Bootloader) DeepCopy() *Bootloader {
if in == nil {
return nil
}
out := new(Bootloader)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDRomTarget) DeepCopyInto(out *CDRomTarget) {
*out = *in
if in.ReadOnly != nil {
in, out := &in.ReadOnly, &out.ReadOnly
*out = new(bool)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDRomTarget.
func (in *CDRomTarget) DeepCopy() *CDRomTarget {
if in == nil {
return nil
}
out := new(CDRomTarget)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CPU) DeepCopyInto(out *CPU) {
*out = *in
if in.Features != nil {
in, out := &in.Features, &out.Features
*out = make([]CPUFeature, len(*in))
copy(*out, *in)
}
if in.NUMA != nil {
in, out := &in.NUMA, &out.NUMA
*out = new(NUMA)
(*in).DeepCopyInto(*out)
}
if in.Realtime != nil {
in, out := &in.Realtime, &out.Realtime
*out = new(Realtime)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPU.
func (in *CPU) DeepCopy() *CPU {
if in == nil {
return nil
}
out := new(CPU)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CPUFeature) DeepCopyInto(out *CPUFeature) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPUFeature.
func (in *CPUFeature) DeepCopy() *CPUFeature {
if in == nil {
return nil
}
out := new(CPUFeature)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CPUTopology) DeepCopyInto(out *CPUTopology) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CPUTopology.
func (in *CPUTopology) DeepCopy() *CPUTopology {
if in == nil {
return nil
}
out := new(CPUTopology)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CertConfig) DeepCopyInto(out *CertConfig) {
*out = *in
if in.Duration != nil {
in, out := &in.Duration, &out.Duration
*out = new(metav1.Duration)
**out = **in
}
if in.RenewBefore != nil {
in, out := &in.RenewBefore, &out.RenewBefore
*out = new(metav1.Duration)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertConfig.
func (in *CertConfig) DeepCopy() *CertConfig {
if in == nil {
return nil
}
out := new(CertConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Chassis) DeepCopyInto(out *Chassis) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Chassis.
func (in *Chassis) DeepCopy() *Chassis {
if in == nil {
return nil
}
out := new(Chassis)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClaimRequest) DeepCopyInto(out *ClaimRequest) {
*out = *in
if in.ClaimName != nil {
in, out := &in.ClaimName, &out.ClaimName
*out = new(string)
**out = **in
}
if in.RequestName != nil {
in, out := &in.RequestName, &out.RequestName
*out = new(string)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimRequest.
func (in *ClaimRequest) DeepCopy() *ClaimRequest {
if in == nil {
return nil
}
out := new(ClaimRequest)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClientPassthroughDevices) DeepCopyInto(out *ClientPassthroughDevices) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientPassthroughDevices.
func (in *ClientPassthroughDevices) DeepCopy() *ClientPassthroughDevices {
if in == nil {
return nil
}
out := new(ClientPassthroughDevices)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Clock) DeepCopyInto(out *Clock) {
*out = *in
in.ClockOffset.DeepCopyInto(&out.ClockOffset)
if in.Timer != nil {
in, out := &in.Timer, &out.Timer
*out = new(Timer)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Clock.
func (in *Clock) DeepCopy() *Clock {
if in == nil {
return nil
}
out := new(Clock)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClockOffset) DeepCopyInto(out *ClockOffset) {
*out = *in
if in.UTC != nil {
in, out := &in.UTC, &out.UTC
*out = new(ClockOffsetUTC)
(*in).DeepCopyInto(*out)
}
if in.Timezone != nil {
in, out := &in.Timezone, &out.Timezone
*out = new(ClockOffsetTimezone)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClockOffset.
func (in *ClockOffset) DeepCopy() *ClockOffset {
if in == nil {
return nil
}
out := new(ClockOffset)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClockOffsetUTC) DeepCopyInto(out *ClockOffsetUTC) {
*out = *in
if in.OffsetSeconds != nil {
in, out := &in.OffsetSeconds, &out.OffsetSeconds
*out = new(int)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClockOffsetUTC.
func (in *ClockOffsetUTC) DeepCopy() *ClockOffsetUTC {
if in == nil {
return nil
}
out := new(ClockOffsetUTC)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CloudInitConfigDriveSource) DeepCopyInto(out *CloudInitConfigDriveSource) {
*out = *in
if in.UserDataSecretRef != nil {
in, out := &in.UserDataSecretRef, &out.UserDataSecretRef
*out = new(corev1.LocalObjectReference)
**out = **in
}
if in.NetworkDataSecretRef != nil {
in, out := &in.NetworkDataSecretRef, &out.NetworkDataSecretRef
*out = new(corev1.LocalObjectReference)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudInitConfigDriveSource.
func (in *CloudInitConfigDriveSource) DeepCopy() *CloudInitConfigDriveSource {
if in == nil {
return nil
}
out := new(CloudInitConfigDriveSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CloudInitNoCloudSource) DeepCopyInto(out *CloudInitNoCloudSource) {
*out = *in
if in.UserDataSecretRef != nil {
in, out := &in.UserDataSecretRef, &out.UserDataSecretRef
*out = new(corev1.LocalObjectReference)
**out = **in
}
if in.NetworkDataSecretRef != nil {
in, out := &in.NetworkDataSecretRef, &out.NetworkDataSecretRef
*out = new(corev1.LocalObjectReference)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudInitNoCloudSource.
func (in *CloudInitNoCloudSource) DeepCopy() *CloudInitNoCloudSource {
if in == nil {
return nil
}
out := new(CloudInitNoCloudSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterProfilerRequest) DeepCopyInto(out *ClusterProfilerRequest) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterProfilerRequest.
func (in *ClusterProfilerRequest) DeepCopy() *ClusterProfilerRequest {
if in == nil {
return nil
}
out := new(ClusterProfilerRequest)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterProfilerResults) DeepCopyInto(out *ClusterProfilerResults) {
*out = *in
if in.ComponentResults != nil {
in, out := &in.ComponentResults, &out.ComponentResults
*out = make(map[string]ProfilerResult, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterProfilerResults.
func (in *ClusterProfilerResults) DeepCopy() *ClusterProfilerResults {
if in == nil {
return nil
}
out := new(ClusterProfilerResults)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CommonInstancetypesDeployment) DeepCopyInto(out *CommonInstancetypesDeployment) {
*out = *in
if in.Enabled != nil {
in, out := &in.Enabled, &out.Enabled
*out = new(bool)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CommonInstancetypesDeployment.
func (in *CommonInstancetypesDeployment) DeepCopy() *CommonInstancetypesDeployment {
if in == nil {
return nil
}
out := new(CommonInstancetypesDeployment)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComponentConfig) DeepCopyInto(out *ComponentConfig) {
*out = *in
if in.NodePlacement != nil {
in, out := &in.NodePlacement, &out.NodePlacement
*out = new(NodePlacement)
(*in).DeepCopyInto(*out)
}
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(byte)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentConfig.
func (in *ComponentConfig) DeepCopy() *ComponentConfig {
if in == nil {
return nil
}
out := new(ComponentConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConfigDriveSSHPublicKeyAccessCredentialPropagation) DeepCopyInto(out *ConfigDriveSSHPublicKeyAccessCredentialPropagation) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigDriveSSHPublicKeyAccessCredentialPropagation.
func (in *ConfigDriveSSHPublicKeyAccessCredentialPropagation) DeepCopy() *ConfigDriveSSHPublicKeyAccessCredentialPropagation {
if in == nil {
return nil
}
out := new(ConfigDriveSSHPublicKeyAccessCredentialPropagation)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConfigMapVolumeSource) DeepCopyInto(out *ConfigMapVolumeSource) {
*out = *in
out.LocalObjectReference = in.LocalObjectReference
if in.Optional != nil {
in, out := &in.Optional, &out.Optional
*out = new(bool)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapVolumeSource.
func (in *ConfigMapVolumeSource) DeepCopy() *ConfigMapVolumeSource {
if in == nil {
return nil
}
out := new(ConfigMapVolumeSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerDiskInfo) DeepCopyInto(out *ContainerDiskInfo) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerDiskInfo.
func (in *ContainerDiskInfo) DeepCopy() *ContainerDiskInfo {
if in == nil {
return nil
}
out := new(ContainerDiskInfo)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerDiskSource) DeepCopyInto(out *ContainerDiskSource) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerDiskSource.
func (in *ContainerDiskSource) DeepCopy() *ContainerDiskSource {
if in == nil {
return nil
}
out := new(ContainerDiskSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ControllerRevisionRef) DeepCopyInto(out *ControllerRevisionRef) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerRevisionRef.
func (in *ControllerRevisionRef) DeepCopy() *ControllerRevisionRef {
if in == nil {
return nil
}
out := new(ControllerRevisionRef)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomBlockSize) DeepCopyInto(out *CustomBlockSize) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomBlockSize.
func (in *CustomBlockSize) DeepCopy() *CustomBlockSize {
if in == nil {
return nil
}
out := new(CustomBlockSize)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomProfile) DeepCopyInto(out *CustomProfile) {
*out = *in
if in.LocalhostProfile != nil {
in, out := &in.LocalhostProfile, &out.LocalhostProfile
*out = new(string)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomProfile.
func (in *CustomProfile) DeepCopy() *CustomProfile {
if in == nil {
return nil
}
out := new(CustomProfile)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomizeComponents) DeepCopyInto(out *CustomizeComponents) {
*out = *in
if in.Patches != nil {
in, out := &in.Patches, &out.Patches
*out = make([]CustomizeComponentsPatch, len(*in))
copy(*out, *in)
}
if in.Flags != nil {
in, out := &in.Flags, &out.Flags
*out = new(Flags)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomizeComponents.
func (in *CustomizeComponents) DeepCopy() *CustomizeComponents {
if in == nil {
return nil
}
out := new(CustomizeComponents)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomizeComponentsPatch) DeepCopyInto(out *CustomizeComponentsPatch) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomizeComponentsPatch.
func (in *CustomizeComponentsPatch) DeepCopy() *CustomizeComponentsPatch {
if in == nil {
return nil
}
out := new(CustomizeComponentsPatch)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DHCPOptions) DeepCopyInto(out *DHCPOptions) {
*out = *in
if in.NTPServers != nil {
in, out := &in.NTPServers, &out.NTPServers
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.PrivateOptions != nil {
in, out := &in.PrivateOptions, &out.PrivateOptions
*out = make([]DHCPPrivateOptions, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DHCPOptions.
func (in *DHCPOptions) DeepCopy() *DHCPOptions {
if in == nil {
return nil
}
out := new(DHCPOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DHCPPrivateOptions) DeepCopyInto(out *DHCPPrivateOptions) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DHCPPrivateOptions.
func (in *DHCPPrivateOptions) DeepCopy() *DHCPPrivateOptions {
if in == nil {
return nil
}
out := new(DHCPPrivateOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSource) DeepCopyInto(out *DataVolumeSource) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSource.
func (in *DataVolumeSource) DeepCopy() *DataVolumeSource {
if in == nil {
return nil
}
out := new(DataVolumeSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeTemplateDummyStatus) DeepCopyInto(out *DataVolumeTemplateDummyStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeTemplateDummyStatus.
func (in *DataVolumeTemplateDummyStatus) DeepCopy() *DataVolumeTemplateDummyStatus {
if in == nil {
return nil
}
out := new(DataVolumeTemplateDummyStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeTemplateSpec) DeepCopyInto(out *DataVolumeTemplateSpec) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
if in.Status != nil {
in, out := &in.Status, &out.Status
*out = new(DataVolumeTemplateDummyStatus)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeTemplateSpec.
func (in *DataVolumeTemplateSpec) DeepCopy() *DataVolumeTemplateSpec {
if in == nil {
return nil
}
out := new(DataVolumeTemplateSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeprecatedInterfaceMacvtap) DeepCopyInto(out *DeprecatedInterfaceMacvtap) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedInterfaceMacvtap.
func (in *DeprecatedInterfaceMacvtap) DeepCopy() *DeprecatedInterfaceMacvtap {
if in == nil {
return nil
}
out := new(DeprecatedInterfaceMacvtap)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeprecatedInterfacePasst) DeepCopyInto(out *DeprecatedInterfacePasst) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedInterfacePasst.
func (in *DeprecatedInterfacePasst) DeepCopy() *DeprecatedInterfacePasst {
if in == nil {
return nil
}
out := new(DeprecatedInterfacePasst)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeprecatedInterfaceSlirp) DeepCopyInto(out *DeprecatedInterfaceSlirp) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeprecatedInterfaceSlirp.
func (in *DeprecatedInterfaceSlirp) DeepCopy() *DeprecatedInterfaceSlirp {
if in == nil {
return nil
}
out := new(DeprecatedInterfaceSlirp)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeveloperConfiguration) DeepCopyInto(out *DeveloperConfiguration) {
*out = *in
if in.FeatureGates != nil {
in, out := &in.FeatureGates, &out.FeatureGates
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.NodeSelectors != nil {
in, out := &in.NodeSelectors, &out.NodeSelectors
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.MinimumClusterTSCFrequency != nil {
in, out := &in.MinimumClusterTSCFrequency, &out.MinimumClusterTSCFrequency
*out = new(int64)
**out = **in
}
if in.DiskVerification != nil {
in, out := &in.DiskVerification, &out.DiskVerification
*out = new(DiskVerification)
(*in).DeepCopyInto(*out)
}
if in.LogVerbosity != nil {
in, out := &in.LogVerbosity, &out.LogVerbosity
*out = new(LogVerbosity)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeveloperConfiguration.
func (in *DeveloperConfiguration) DeepCopy() *DeveloperConfiguration {
if in == nil {
return nil
}
out := new(DeveloperConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeviceAttribute) DeepCopyInto(out *DeviceAttribute) {
*out = *in
if in.PCIAddress != nil {
in, out := &in.PCIAddress, &out.PCIAddress
*out = new(string)
**out = **in
}
if in.MDevUUID != nil {
in, out := &in.MDevUUID, &out.MDevUUID
*out = new(string)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceAttribute.
func (in *DeviceAttribute) DeepCopy() *DeviceAttribute {
if in == nil {
return nil
}
out := new(DeviceAttribute)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeviceResourceClaimStatus) DeepCopyInto(out *DeviceResourceClaimStatus) {
*out = *in
if in.Name != nil {
in, out := &in.Name, &out.Name
*out = new(string)
**out = **in
}
if in.ResourceClaimName != nil {
in, out := &in.ResourceClaimName, &out.ResourceClaimName
*out = new(string)
**out = **in
}
if in.Attributes != nil {
in, out := &in.Attributes, &out.Attributes
*out = new(DeviceAttribute)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceResourceClaimStatus.
func (in *DeviceResourceClaimStatus) DeepCopy() *DeviceResourceClaimStatus {
if in == nil {
return nil
}
out := new(DeviceResourceClaimStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeviceStatus) DeepCopyInto(out *DeviceStatus) {
*out = *in
if in.GPUStatuses != nil {
in, out := &in.GPUStatuses, &out.GPUStatuses
*out = make([]DeviceStatusInfo, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.HostDeviceStatuses != nil {
in, out := &in.HostDeviceStatuses, &out.HostDeviceStatuses
*out = make([]DeviceStatusInfo, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceStatus.
func (in *DeviceStatus) DeepCopy() *DeviceStatus {
if in == nil {
return nil
}
out := new(DeviceStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DeviceStatusInfo) DeepCopyInto(out *DeviceStatusInfo) {
*out = *in
if in.DeviceResourceClaimStatus != nil {
in, out := &in.DeviceResourceClaimStatus, &out.DeviceResourceClaimStatus
*out = new(DeviceResourceClaimStatus)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceStatusInfo.
func (in *DeviceStatusInfo) DeepCopy() *DeviceStatusInfo {
if in == nil {
return nil
}
out := new(DeviceStatusInfo)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Devices) DeepCopyInto(out *Devices) {
*out = *in
if in.UseVirtioTransitional != nil {
in, out := &in.UseVirtioTransitional, &out.UseVirtioTransitional
*out = new(bool)
**out = **in
}
if in.Disks != nil {
in, out := &in.Disks, &out.Disks
*out = make([]Disk, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Watchdog != nil {
in, out := &in.Watchdog, &out.Watchdog
*out = new(Watchdog)
(*in).DeepCopyInto(*out)
}
if in.Interfaces != nil {
in, out := &in.Interfaces, &out.Interfaces
*out = make([]Interface, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Inputs != nil {
in, out := &in.Inputs, &out.Inputs
*out = make([]Input, len(*in))
copy(*out, *in)
}
if in.AutoattachPodInterface != nil {
in, out := &in.AutoattachPodInterface, &out.AutoattachPodInterface
*out = new(bool)
**out = **in
}
if in.AutoattachGraphicsDevice != nil {
in, out := &in.AutoattachGraphicsDevice, &out.AutoattachGraphicsDevice
*out = new(bool)
**out = **in
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/schema_swagger_generated.go | vendor/kubevirt.io/api/core/v1/schema_swagger_generated.go | // Code generated by swagger-doc. DO NOT EDIT.
package v1
func (HostDisk) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents a disk created on the cluster level",
"path": "The path to HostDisk image located on the cluster",
"type": "Contains information if disk.img exists or should be created\nallowed options are 'Disk' and 'DiskOrCreate'",
"capacity": "Capacity of the sparse disk\n+optional",
"shared": "Shared indicate whether the path is shared between nodes",
}
}
func (ConfigMapVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "ConfigMapVolumeSource adapts a ConfigMap into a volume.\nMore info: https://kubernetes.io/docs/concepts/storage/volumes/#configmap",
"optional": "Specify whether the ConfigMap or it's keys must be defined\n+optional",
"volumeLabel": "The volume label of the resulting disk inside the VMI.\nDifferent bootstrapping mechanisms require different values.\nTypical values are \"cidata\" (cloud-init), \"config-2\" (cloud-init) or \"OEMDRV\" (kickstart).\n+optional",
}
}
func (SecretVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "SecretVolumeSource adapts a Secret into a volume.",
"secretName": "Name of the secret in the pod's namespace to use.\nMore info: https://kubernetes.io/docs/concepts/storage/volumes#secret",
"optional": "Specify whether the Secret or it's keys must be defined\n+optional",
"volumeLabel": "The volume label of the resulting disk inside the VMI.\nDifferent bootstrapping mechanisms require different values.\nTypical values are \"cidata\" (cloud-init), \"config-2\" (cloud-init) or \"OEMDRV\" (kickstart).\n+optional",
}
}
func (DownwardAPIVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "DownwardAPIVolumeSource represents a volume containing downward API info.",
"fields": "Fields is a list of downward API volume file\n+optional",
"volumeLabel": "The volume label of the resulting disk inside the VMI.\nDifferent bootstrapping mechanisms require different values.\nTypical values are \"cidata\" (cloud-init), \"config-2\" (cloud-init) or \"OEMDRV\" (kickstart).\n+optional",
}
}
func (ServiceAccountVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "ServiceAccountVolumeSource adapts a ServiceAccount into a volume.",
"serviceAccountName": "Name of the service account in the pod's namespace to use.\nMore info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/",
}
}
func (DownwardMetricsVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "DownwardMetricsVolumeSource adds a very small disk to VMIs which contains a limited view of host and guest\nmetrics. The disk content is compatible with vhostmd (https://github.com/vhostmd/vhostmd) and vm-dump-metrics.",
}
}
func (SysprepSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents a Sysprep volume source.",
"secret": "Secret references a k8s Secret that contains Sysprep answer file named autounattend.xml that should be attached as disk of CDROM type.\n+ optional",
"configMap": "ConfigMap references a ConfigMap that contains Sysprep answer file named autounattend.xml that should be attached as disk of CDROM type.\n+ optional",
}
}
func (CloudInitNoCloudSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents a cloud-init nocloud user data source.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html",
"secretRef": "UserDataSecretRef references a k8s secret that contains NoCloud userdata.\n+ optional",
"userDataBase64": "UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string.\n+ optional",
"userData": "UserData contains NoCloud inline cloud-init userdata.\n+ optional",
"networkDataSecretRef": "NetworkDataSecretRef references a k8s secret that contains NoCloud networkdata.\n+ optional",
"networkDataBase64": "NetworkDataBase64 contains NoCloud cloud-init networkdata as a base64 encoded string.\n+ optional",
"networkData": "NetworkData contains NoCloud inline cloud-init networkdata.\n+ optional",
}
}
func (CloudInitConfigDriveSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents a cloud-init config drive user data source.\nMore info: https://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html",
"secretRef": "UserDataSecretRef references a k8s secret that contains config drive userdata.\n+ optional",
"userDataBase64": "UserDataBase64 contains config drive cloud-init userdata as a base64 encoded string.\n+ optional",
"userData": "UserData contains config drive inline cloud-init userdata.\n+ optional",
"networkDataSecretRef": "NetworkDataSecretRef references a k8s secret that contains config drive networkdata.\n+ optional",
"networkDataBase64": "NetworkDataBase64 contains config drive cloud-init networkdata as a base64 encoded string.\n+ optional",
"networkData": "NetworkData contains config drive inline cloud-init networkdata.\n+ optional",
}
}
func (DomainSpec) SwaggerDoc() map[string]string {
return map[string]string{
"resources": "Resources describes the Compute Resources required by this vmi.",
"cpu": "CPU allow specified the detailed CPU topology inside the vmi.\n+optional",
"memory": "Memory allow specifying the VMI memory features.\n+optional",
"machine": "Machine type.\n+optional",
"firmware": "Firmware.\n+optional",
"clock": "Clock sets the clock and timers of the vmi.\n+optional",
"features": "Features like acpi, apic, hyperv, smm.\n+optional",
"devices": "Devices allows adding disks, network interfaces, and others",
"ioThreadsPolicy": "Controls whether or not disks will share IOThreads.\nOmitting IOThreadsPolicy disables use of IOThreads.\nOne of: shared, auto, supplementalPool\n+optional",
"ioThreads": "IOThreads specifies the IOThreads options.\n+optional",
"chassis": "Chassis specifies the chassis info passed to the domain.\n+optional",
"launchSecurity": "Launch Security setting of the vmi.\n+optional",
}
}
func (Chassis) SwaggerDoc() map[string]string {
return map[string]string{
"": "Chassis specifies the chassis info passed to the domain.",
}
}
func (Bootloader) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents the firmware blob used to assist in the domain creation process.\nUsed for setting the QEMU BIOS file path for the libvirt domain.",
"bios": "If set (default), BIOS will be used.\n+optional",
"efi": "If set, EFI will be used instead of BIOS.\n+optional",
}
}
func (BIOS) SwaggerDoc() map[string]string {
return map[string]string{
"": "If set (default), BIOS will be used.",
"useSerial": "If set, the BIOS output will be transmitted over serial\n+optional",
}
}
func (EFI) SwaggerDoc() map[string]string {
return map[string]string{
"": "If set, EFI will be used instead of BIOS.",
"secureBoot": "If set, SecureBoot will be enabled and the OVMF roms will be swapped for\nSecureBoot-enabled ones.\nRequires SMM to be enabled.\nDefaults to true\n+optional",
"persistent": "If set to true, Persistent will persist the EFI NVRAM across reboots.\nDefaults to false\n+optional",
}
}
func (KernelBootContainer) SwaggerDoc() map[string]string {
return map[string]string{
"": "If set, the VM will be booted from the defined kernel / initrd.",
"image": "Image that contains initrd / kernel files.",
"imagePullSecret": "ImagePullSecret is the name of the Docker registry secret required to pull the image. The secret must already exist.\n+optional",
"imagePullPolicy": "Image pull policy.\nOne of Always, Never, IfNotPresent.\nDefaults to Always if :latest tag is specified, or IfNotPresent otherwise.\nCannot be updated.\nMore info: https://kubernetes.io/docs/concepts/containers/images#updating-images\n+optional",
"kernelPath": "The fully-qualified path to the kernel image in the host OS\n+optional",
"initrdPath": "the fully-qualified path to the ramdisk image in the host OS\n+optional",
}
}
func (KernelBoot) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents the firmware blob used to assist in the kernel boot process.\nUsed for setting the kernel, initrd and command line arguments",
"kernelArgs": "Arguments to be passed to the kernel at boot time",
"container": "Container defines the container that containes kernel artifacts",
}
}
func (ResourceRequirements) SwaggerDoc() map[string]string {
return map[string]string{
"requests": "Requests is a description of the initial vmi resources.\nValid resource keys are \"memory\" and \"cpu\".\n+optional",
"limits": "Limits describes the maximum amount of compute resources allowed.\nValid resource keys are \"memory\" and \"cpu\".\n+optional",
"overcommitGuestOverhead": "Don't ask the scheduler to take the guest-management overhead into account. Instead\nput the overhead only into the container's memory limit. This can lead to crashes if\nall memory is in use on a node. Defaults to false.",
}
}
func (CPU) SwaggerDoc() map[string]string {
return map[string]string{
"": "CPU allows specifying the CPU topology.",
"cores": "Cores specifies the number of cores inside the vmi.\nMust be a value greater or equal 1.",
"sockets": "Sockets specifies the number of sockets inside the vmi.\nMust be a value greater or equal 1.",
"maxSockets": "MaxSockets specifies the maximum amount of sockets that can\nbe hotplugged",
"threads": "Threads specifies the number of threads inside the vmi.\nMust be a value greater or equal 1.",
"model": "Model specifies the CPU model inside the VMI.\nList of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map.\nIt is possible to specify special cases like \"host-passthrough\" to get the same CPU as the node\nand \"host-model\" to get CPU closest to the node one.\nDefaults to host-model.\n+optional",
"features": "Features specifies the CPU features list inside the VMI.\n+optional",
"dedicatedCpuPlacement": "DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node\nwith enough dedicated pCPUs and pin the vCPUs to it.\n+optional",
"numa": "NUMA allows specifying settings for the guest NUMA topology\n+optional",
"isolateEmulatorThread": "IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place\nthe emulator thread on it.\n+optional",
"realtime": "Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads\n+optional",
}
}
func (Realtime) SwaggerDoc() map[string]string {
return map[string]string{
"": "Realtime holds the tuning knobs specific for realtime workloads.",
"mask": "Mask defines the vcpu mask expression that defines which vcpus are used for realtime. Format matches libvirt's expressions.\nExample: \"0-3,^1\",\"0,2,3\",\"2-3\"\n+optional",
}
}
func (NUMAGuestMappingPassthrough) SwaggerDoc() map[string]string {
return map[string]string{
"": "NUMAGuestMappingPassthrough instructs kubevirt to model numa topology which is compatible with the CPU pinning on the guest.\nThis will result in a subset of the node numa topology being passed through, ensuring that virtual numa nodes and their memory\nnever cross boundaries coming from the node numa mapping.",
}
}
func (NUMA) SwaggerDoc() map[string]string {
return map[string]string{
"guestMappingPassthrough": "GuestMappingPassthrough will create an efficient guest topology based on host CPUs exclusively assigned to a pod.\nThe created topology ensures that memory and CPUs on the virtual numa nodes never cross boundaries of host numa nodes.\n+optional",
}
}
func (CPUFeature) SwaggerDoc() map[string]string {
return map[string]string{
"": "CPUFeature allows specifying a CPU feature.",
"name": "Name of the CPU feature",
"policy": "Policy is the CPU feature attribute which can have the following attributes:\nforce - The virtual CPU will claim the feature is supported regardless of it being supported by host CPU.\nrequire - Guest creation will fail unless the feature is supported by the host CPU or the hypervisor is able to emulate it.\noptional - The feature will be supported by virtual CPU if and only if it is supported by host CPU.\ndisable - The feature will not be supported by virtual CPU.\nforbid - Guest creation will fail if the feature is supported by host CPU.\nDefaults to require\n+optional",
}
}
func (Memory) SwaggerDoc() map[string]string {
return map[string]string{
"": "Memory allows specifying the VirtualMachineInstance memory features.",
"hugepages": "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.\n+optional",
"guest": "Guest allows to specifying the amount of memory which is visible inside the Guest OS.\nThe Guest must lie between Requests and Limits from the resources section.\nDefaults to the requested memory in the resources section if not specified.\n+ optional",
"maxGuest": "MaxGuest allows to specify the maximum amount of memory which is visible inside the Guest OS.\nThe delta between MaxGuest and Guest is the amount of memory that can be hot(un)plugged.",
}
}
func (MemoryStatus) SwaggerDoc() map[string]string {
return map[string]string{
"guestAtBoot": "GuestAtBoot specifies with how much memory the VirtualMachine intiallly booted with.\n+optional",
"guestCurrent": "GuestCurrent specifies how much memory is currently available for the VirtualMachine.\n+optional",
"guestRequested": "GuestRequested specifies how much memory was requested (hotplug) for the VirtualMachine.\n+optional",
}
}
func (Hugepages) SwaggerDoc() map[string]string {
return map[string]string{
"": "Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.",
"pageSize": "PageSize specifies the hugepage size, for x86_64 architecture valid values are 1Gi and 2Mi.",
}
}
func (Machine) SwaggerDoc() map[string]string {
return map[string]string{
"type": "QEMU machine type is the actual chipset of the VirtualMachineInstance.\n+optional",
}
}
func (Firmware) SwaggerDoc() map[string]string {
return map[string]string{
"uuid": "UUID reported by the vmi bios.\nDefaults to a random generated uid.",
"bootloader": "Settings to control the bootloader that is used.\n+optional",
"serial": "The system-serial-number in SMBIOS",
"kernelBoot": "Settings to set the kernel for booting.\n+optional",
"acpi": "Information that can be set in the ACPI table",
}
}
func (ACPI) SwaggerDoc() map[string]string {
return map[string]string{
"slicNameRef": "SlicNameRef should match the volume name of a secret object. The data in the secret should\nbe a binary blob that follows the ACPI SLIC standard, see:\nhttps://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85)",
"msdmNameRef": "Similar to SlicNameRef, another ACPI entry that is used in more recent Windows versions.\nThe above points to the spec of MSDM too.",
}
}
func (Devices) SwaggerDoc() map[string]string {
return map[string]string{
"useVirtioTransitional": "Fall back to legacy virtio 0.9 support if virtio bus is selected on devices.\nThis is helpful for old machines like CentOS6 or RHEL6 which\ndo not understand virtio_non_transitional (virtio 1.0).",
"disableHotplug": "DisableHotplug disabled the ability to hotplug disks.",
"disks": "Disks describes disks, cdroms and luns which are connected to the vmi.\n+kubebuilder:validation:MaxItems:=256",
"watchdog": "Watchdog describes a watchdog device which can be added to the vmi.",
"interfaces": "Interfaces describe network interfaces which are added to the vmi.\n+kubebuilder:validation:MaxItems:=256",
"inputs": "Inputs describe input devices",
"autoattachPodInterface": "Whether to attach a pod network interface. Defaults to true.",
"autoattachGraphicsDevice": "Whether to attach the default graphics device or not.\nVNC will not be available if set to false. Defaults to true.",
"autoattachSerialConsole": "Whether to attach the default virtio-serial console or not.\nSerial console access will not be available if set to false. Defaults to true.",
"logSerialConsole": "Whether to log the auto-attached default serial console or not.\nSerial console logs will be collect to a file and then streamed from a named `guest-console-log`.\nNot relevant if autoattachSerialConsole is disabled.\nDefaults to cluster wide setting on VirtualMachineOptions.",
"autoattachMemBalloon": "Whether to attach the Memory balloon device with default period.\nPeriod can be adjusted in virt-config.\nDefaults to true.\n+optional",
"autoattachInputDevice": "Whether to attach an Input Device.\nDefaults to false.\n+optional",
"autoattachVSOCK": "Whether to attach the VSOCK CID to the VM or not.\nVSOCK access will be available if set to true. Defaults to false.",
"rng": "Whether to have random number generator from host\n+optional",
"blockMultiQueue": "Whether or not to enable virtio multi-queue for block devices.\nDefaults to false.\n+optional",
"networkInterfaceMultiqueue": "If specified, virtual network interfaces configured with a virtio bus will also enable the vhost multiqueue feature for network devices. The number of queues created depends on additional factors of the VirtualMachineInstance, like the number of guest CPUs.\n+optional",
"gpus": "Whether to attach a GPU device to the vmi.\n+optional\n+listType=atomic",
"downwardMetrics": "DownwardMetrics creates a virtio serials for exposing the downward metrics to the vmi.\n+optional",
"panicDevices": "PanicDevices provides additional crash information when a guest crashes.\n+optional\n+listtype=atomic",
"filesystems": "Filesystems describes filesystem which is connected to the vmi.\n+optional\n+listType=atomic",
"hostDevices": "Whether to attach a host device to the vmi.\n+optional\n+listType=atomic",
"clientPassthrough": "To configure and access client devices such as redirecting USB\n+optional",
"sound": "Whether to emulate a sound device.\n+optional",
"tpm": "Whether to emulate a TPM device.\n+optional",
"video": "Video describes the video device configuration for the vmi.\n+optional",
}
}
func (ClientPassthroughDevices) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represent a subset of client devices that can be accessed by VMI. At the\nmoment only, USB devices using Usbredir's library and tooling. Another fit\nwould be a smartcard with libcacard.\n\nThe struct is currently empty as there is no immediate request for\nuser-facing APIs. This structure simply turns on USB redirection of\nUsbClientPassthroughMaxNumberOf devices.",
}
}
func (SoundDevice) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents the user's configuration to emulate sound cards in the VMI.",
"name": "User's defined name for this sound device",
"model": "We only support ich9 or ac97.\nIf SoundDevice is not set: No sound card is emulated.\nIf SoundDevice is set but Model is not: ich9\n+optional",
}
}
func (TPMDevice) SwaggerDoc() map[string]string {
return map[string]string{
"enabled": "Enabled allows a user to explicitly disable the vTPM even when one is enabled by a preference referenced by the VirtualMachine\nDefaults to True",
"persistent": "Persistent indicates the state of the TPM device should be kept accross reboots\nDefaults to false",
}
}
func (VideoDevice) SwaggerDoc() map[string]string {
return map[string]string{
"type": "Type specifies the video device type (e.g., virtio, vga, bochs, ramfb).\nIf not specified, the default is architecture-dependent (VGA for BIOS-based VMs, Bochs for EFI-based VMs on AMD64; virtio for Arm and s390x).\n+optional",
}
}
func (Input) SwaggerDoc() map[string]string {
return map[string]string{
"bus": "Bus indicates the bus of input device to emulate.\nSupported values: virtio, usb.",
"type": "Type indicated the type of input device.\nSupported values: tablet.",
"name": "Name is the device name",
}
}
func (Filesystem) SwaggerDoc() map[string]string {
return map[string]string{
"name": "Name is the device name",
"virtiofs": "Virtiofs is supported",
}
}
func (FilesystemVirtiofs) SwaggerDoc() map[string]string {
return map[string]string{}
}
func (DownwardMetrics) SwaggerDoc() map[string]string {
return map[string]string{}
}
func (GPU) SwaggerDoc() map[string]string {
return map[string]string{
"name": "Name of the GPU device as exposed by a device plugin",
"deviceName": "DeviceName is the name of the device provisioned by device-plugins",
"tag": "If specified, the virtual network interface address and its tag will be provided to the guest via config drive\n+optional",
}
}
func (ClaimRequest) SwaggerDoc() map[string]string {
return map[string]string{
"claimName": "ClaimName needs to be provided from the list vmi.spec.resourceClaims[].name where this\ndevice is allocated\n+optional",
"requestName": "RequestName needs to be provided from resourceClaim.spec.devices.requests[].name where this\ndevice is requested\n+optional",
}
}
func (VGPUOptions) SwaggerDoc() map[string]string {
return map[string]string{}
}
func (VGPUDisplayOptions) SwaggerDoc() map[string]string {
return map[string]string{
"enabled": "Enabled determines if a display addapter backed by a vGPU should be enabled or disabled on the guest.\nDefaults to true.\n+optional",
"ramFB": "Enables a boot framebuffer, until the guest OS loads a real GPU driver\nDefaults to true.\n+optional",
}
}
func (PanicDevice) SwaggerDoc() map[string]string {
return map[string]string{
"model": "Model specifies what type of panic device is provided.\nThe panic model used when this attribute is missing depends on the hypervisor and guest arch.\nOne of: isa, hyperv, pvpanic.\n+optional",
}
}
func (HostDevice) SwaggerDoc() map[string]string {
return map[string]string{
"deviceName": "DeviceName is the name of the device provisioned by device-plugins",
"tag": "If specified, the virtual network interface address and its tag will be provided to the guest via config drive\n+optional",
}
}
func (Disk) SwaggerDoc() map[string]string {
return map[string]string{
"name": "Name is the device name",
"bootOrder": "BootOrder is an integer value > 0, used to determine ordering of boot devices.\nLower values take precedence.\nEach disk or interface that has a boot order must have a unique value.\nDisks without a boot order are not tried if a disk with a boot order exists.\n+optional",
"serial": "Serial provides the ability to specify a serial number for the disk device.\n+optional",
"dedicatedIOThread": "dedicatedIOThread indicates this disk should have an exclusive IO Thread.\nEnabling this implies useIOThreads = true.\nDefaults to false.\n+optional",
"cache": "Cache specifies which kvm disk cache mode should be used.\nSupported values are:\nnone: Guest I/O not cached on the host, but may be kept in a disk cache.\nwritethrough: Guest I/O cached on the host but written through to the physical medium. Slowest but with most guarantees.\nwriteback: Guest I/O cached on the host.\nDefaults to none if the storage supports O_DIRECT, otherwise writethrough.\n+optional",
"io": "IO specifies which QEMU disk IO mode should be used.\nSupported values are: native, default, threads.\n+optional",
"tag": "If specified, disk address and its tag will be provided to the guest via config drive metadata\n+optional",
"blockSize": "If specified, the virtual disk will be presented with the given block sizes.\n+optional",
"shareable": "If specified the disk is made sharable and multiple write from different VMs are permitted\n+optional",
"errorPolicy": "If specified, it can change the default error policy (stop) for the disk\n+optional",
}
}
func (CustomBlockSize) SwaggerDoc() map[string]string {
return map[string]string{
"": "CustomBlockSize represents the desired logical and physical block size for a VM disk.",
}
}
func (BlockSize) SwaggerDoc() map[string]string {
return map[string]string{
"": "BlockSize provides the option to change the block size presented to the VM for a disk.\nOnly one of its members may be specified.",
}
}
func (DiskDevice) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents the target of a volume to mount.\nOnly one of its members may be specified.",
"disk": "Attach a volume as a disk to the vmi.",
"lun": "Attach a volume as a LUN to the vmi.",
"cdrom": "Attach a volume as a cdrom to the vmi.",
}
}
func (DiskTarget) SwaggerDoc() map[string]string {
return map[string]string{
"bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi, usb.",
"readonly": "ReadOnly.\nDefaults to false.",
"pciAddress": "If specified, the virtual disk will be placed on the guests pci address with the specified PCI address. For example: 0000:81:01.10\n+optional",
}
}
func (LaunchSecurity) SwaggerDoc() map[string]string {
return map[string]string{
"sev": "AMD Secure Encrypted Virtualization (SEV).",
}
}
func (SEV) SwaggerDoc() map[string]string {
return map[string]string{
"policy": "Guest policy flags as defined in AMD SEV API specification.\nNote: due to security reasons it is not allowed to enable guest debugging. Therefore NoDebug flag is not exposed to users and is always true.",
"attestation": "If specified, run the attestation process for a vmi.\n+optional",
"session": "Base64 encoded session blob.",
"dhCert": "Base64 encoded guest owner's Diffie-Hellman key.",
}
}
func (SEVPolicy) SwaggerDoc() map[string]string {
return map[string]string{
"encryptedState": "SEV-ES is required.\nDefaults to false.\n+optional",
}
}
func (SEVAttestation) SwaggerDoc() map[string]string {
return map[string]string{}
}
func (LunTarget) SwaggerDoc() map[string]string {
return map[string]string{
"bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi.",
"readonly": "ReadOnly.\nDefaults to false.",
"reservation": "Reservation indicates if the disk needs to support the persistent reservation for the SCSI disk",
}
}
func (CDRomTarget) SwaggerDoc() map[string]string {
return map[string]string{
"bus": "Bus indicates the type of disk device to emulate.\nsupported values: virtio, sata, scsi.",
"readonly": "ReadOnly.\nDefaults to true.",
"tray": "Tray indicates if the tray of the device is open or closed.\nAllowed values are \"open\" and \"closed\".\nDefaults to closed.\n+optional",
}
}
func (Volume) SwaggerDoc() map[string]string {
return map[string]string{
"": "Volume represents a named volume in a vmi.",
"name": "Volume's name.\nMust be a DNS_LABEL and unique within the vmi.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
}
}
func (VolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "Represents the source of a volume to mount.\nOnly one of its members may be specified.",
"hostDisk": "HostDisk represents a disk created on the cluster level\n+optional",
"persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional",
"cloudInitNoCloud": "CloudInitNoCloud represents a cloud-init NoCloud user-data source.\nThe NoCloud data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest.\nMore info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html\n+optional",
"cloudInitConfigDrive": "CloudInitConfigDrive represents a cloud-init Config Drive user-data source.\nThe Config Drive data will be added as a disk to the vmi. A proper cloud-init installation is required inside the guest.\nMore info: https://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html\n+optional",
"sysprep": "Represents a Sysprep volume source.\n+optional",
"containerDisk": "ContainerDisk references a docker image, embedding a qcow or raw disk.\nMore info: https://kubevirt.gitbooks.io/user-guide/registry-disk.html\n+optional",
"ephemeral": "Ephemeral is a special volume source that \"wraps\" specified source and provides copy-on-write image on top of it.\n+optional",
"emptyDisk": "EmptyDisk represents a temporary disk which shares the vmis lifecycle.\nMore info: https://kubevirt.gitbooks.io/user-guide/disks-and-volumes.html\n+optional",
"dataVolume": "DataVolume represents the dynamic creation a PVC for this volume as well as\nthe process of populating that PVC with a disk image.\n+optional",
"configMap": "ConfigMapSource represents a reference to a ConfigMap in the same namespace.\nMore info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/\n+optional",
"secret": "SecretVolumeSource represents a reference to a secret data in the same namespace.\nMore info: https://kubernetes.io/docs/concepts/configuration/secret/\n+optional",
"downwardAPI": "DownwardAPI represents downward API about the pod that should populate this volume\n+optional",
"serviceAccount": "ServiceAccountVolumeSource represents a reference to a service account.\nThere can only be one volume of this type!\nMore info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/\n+optional",
"downwardMetrics": "DownwardMetrics adds a very small disk to VMIs which contains a limited view of host and guest\nmetrics. The disk content is compatible with vhostmd (https://github.com/vhostmd/vhostmd) and vm-dump-metrics.",
"memoryDump": "MemoryDump is attached to the virt launcher and is populated with a memory dump of the vmi",
}
}
func (HotplugVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "HotplugVolumeSource Represents the source of a volume to mount which are capable\nof being hotplugged on a live running VMI.\nOnly one of its members may be specified.",
"persistentVolumeClaim": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims\n+optional",
"dataVolume": "DataVolume represents the dynamic creation a PVC for this volume as well as\nthe process of populating that PVC with a disk image.\n+optional",
}
}
func (DataVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"name": "Name of both the DataVolume and the PVC in the same namespace.",
"hotpluggable": "Hotpluggable indicates whether the volume can be hotplugged and hotunplugged.\n+optional",
}
}
func (PersistentVolumeClaimVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "PersistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace.\nDirectly attached to the vmi via qemu.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims",
"hotpluggable": "Hotpluggable indicates whether the volume can be hotplugged and hotunplugged.\n+optional",
}
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/doc.go | vendor/kubevirt.io/api/core/v1/doc.go | // +k8s:deepcopy-gen=package
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
// +groupName=kubevirt.io
// +versionName=v1
// Package v1 is the v1 version of the API.
package v1
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/sanitizers.go | vendor/kubevirt.io/api/core/v1/sanitizers.go | /*
* This file is part of the KubeVirt project
*
* 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.
*
* Copyright 2022 Red Hat, Inc.
*
*/
package v1
import (
"fmt"
netutils "k8s.io/utils/net"
)
func sanitizeIP(address string) (string, error) {
sanitizedAddress := netutils.ParseIPSloppy(address)
if sanitizedAddress == nil {
return "", fmt.Errorf("not a valid IP address")
}
return sanitizedAddress.String(), nil
}
func sanitizeCIDR(cidr string) (string, error) {
ip, net, err := netutils.ParseCIDRSloppy(cidr)
if err != nil {
return "", err
}
netMaskSize, _ := net.Mask.Size()
return fmt.Sprintf("%s/%d", ip.String(), netMaskSize), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/core/v1/schema.go | vendor/kubevirt.io/api/core/v1/schema.go | /*
* This file is part of the KubeVirt project
*
* 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.
*
* Copyright 2017, 2018 Red Hat, Inc.
*
*/
package v1
import (
"encoding/json"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/types"
)
type IOThreadsPolicy string
const (
IOThreadsPolicyShared IOThreadsPolicy = "shared"
IOThreadsPolicyAuto IOThreadsPolicy = "auto"
IOThreadsPolicySupplementalPool IOThreadsPolicy = "supplementalPool"
CPUModeHostPassthrough = "host-passthrough"
CPUModeHostModel = "host-model"
DefaultCPUModel = CPUModeHostModel
)
const HotplugDiskDir = "/var/run/kubevirt/hotplug-disks/"
type DiskErrorPolicy string
const (
DiskErrorPolicyStop DiskErrorPolicy = "stop"
DiskErrorPolicyIgnore DiskErrorPolicy = "ignore"
DiskErrorPolicyReport DiskErrorPolicy = "report"
DiskErrorPolicyEnospace DiskErrorPolicy = "enospace"
)
type PanicDeviceModel string
const (
Hyperv PanicDeviceModel = "hyperv"
Isa PanicDeviceModel = "isa"
Pvpanic PanicDeviceModel = "pvpanic"
)
/*
ATTENTION: Rerun code generators when comments on structs or fields are modified.
*/
// Represents a disk created on the cluster level
type HostDisk struct {
// The path to HostDisk image located on the cluster
Path string `json:"path"`
// Contains information if disk.img exists or should be created
// allowed options are 'Disk' and 'DiskOrCreate'
Type HostDiskType `json:"type"`
// Capacity of the sparse disk
// +optional
Capacity resource.Quantity `json:"capacity,omitempty"`
// Shared indicate whether the path is shared between nodes
Shared *bool `json:"shared,omitempty"`
}
// ConfigMapVolumeSource adapts a ConfigMap into a volume.
// More info: https://kubernetes.io/docs/concepts/storage/volumes/#configmap
type ConfigMapVolumeSource struct {
v1.LocalObjectReference `json:",inline"`
// Specify whether the ConfigMap or it's keys must be defined
// +optional
Optional *bool `json:"optional,omitempty"`
// The volume label of the resulting disk inside the VMI.
// Different bootstrapping mechanisms require different values.
// Typical values are "cidata" (cloud-init), "config-2" (cloud-init) or "OEMDRV" (kickstart).
// +optional
VolumeLabel string `json:"volumeLabel,omitempty"`
}
// SecretVolumeSource adapts a Secret into a volume.
type SecretVolumeSource struct {
// Name of the secret in the pod's namespace to use.
// More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
SecretName string `json:"secretName,omitempty"`
// Specify whether the Secret or it's keys must be defined
// +optional
Optional *bool `json:"optional,omitempty"`
// The volume label of the resulting disk inside the VMI.
// Different bootstrapping mechanisms require different values.
// Typical values are "cidata" (cloud-init), "config-2" (cloud-init) or "OEMDRV" (kickstart).
// +optional
VolumeLabel string `json:"volumeLabel,omitempty"`
}
// DownwardAPIVolumeSource represents a volume containing downward API info.
type DownwardAPIVolumeSource struct {
// Fields is a list of downward API volume file
// +optional
Fields []v1.DownwardAPIVolumeFile `json:"fields,omitempty"`
// The volume label of the resulting disk inside the VMI.
// Different bootstrapping mechanisms require different values.
// Typical values are "cidata" (cloud-init), "config-2" (cloud-init) or "OEMDRV" (kickstart).
// +optional
VolumeLabel string `json:"volumeLabel,omitempty"`
}
// ServiceAccountVolumeSource adapts a ServiceAccount into a volume.
type ServiceAccountVolumeSource struct {
// Name of the service account in the pod's namespace to use.
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
ServiceAccountName string `json:"serviceAccountName,omitempty"`
}
// DownwardMetricsVolumeSource adds a very small disk to VMIs which contains a limited view of host and guest
// metrics. The disk content is compatible with vhostmd (https://github.com/vhostmd/vhostmd) and vm-dump-metrics.
type DownwardMetricsVolumeSource struct {
}
// Represents a Sysprep volume source.
type SysprepSource struct {
// Secret references a k8s Secret that contains Sysprep answer file named autounattend.xml that should be attached as disk of CDROM type.
// + optional
Secret *v1.LocalObjectReference `json:"secret,omitempty"`
// ConfigMap references a ConfigMap that contains Sysprep answer file named autounattend.xml that should be attached as disk of CDROM type.
// + optional
ConfigMap *v1.LocalObjectReference `json:"configMap,omitempty"`
}
// Represents a cloud-init nocloud user data source.
// More info: http://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
type CloudInitNoCloudSource struct {
// UserDataSecretRef references a k8s secret that contains NoCloud userdata.
// + optional
UserDataSecretRef *v1.LocalObjectReference `json:"secretRef,omitempty"`
// UserDataBase64 contains NoCloud cloud-init userdata as a base64 encoded string.
// + optional
UserDataBase64 string `json:"userDataBase64,omitempty"`
// UserData contains NoCloud inline cloud-init userdata.
// + optional
UserData string `json:"userData,omitempty"`
// NetworkDataSecretRef references a k8s secret that contains NoCloud networkdata.
// + optional
NetworkDataSecretRef *v1.LocalObjectReference `json:"networkDataSecretRef,omitempty"`
// NetworkDataBase64 contains NoCloud cloud-init networkdata as a base64 encoded string.
// + optional
NetworkDataBase64 string `json:"networkDataBase64,omitempty"`
// NetworkData contains NoCloud inline cloud-init networkdata.
// + optional
NetworkData string `json:"networkData,omitempty"`
}
// Represents a cloud-init config drive user data source.
// More info: https://cloudinit.readthedocs.io/en/latest/topics/datasources/configdrive.html
type CloudInitConfigDriveSource struct {
// UserDataSecretRef references a k8s secret that contains config drive userdata.
// + optional
UserDataSecretRef *v1.LocalObjectReference `json:"secretRef,omitempty"`
// UserDataBase64 contains config drive cloud-init userdata as a base64 encoded string.
// + optional
UserDataBase64 string `json:"userDataBase64,omitempty"`
// UserData contains config drive inline cloud-init userdata.
// + optional
UserData string `json:"userData,omitempty"`
// NetworkDataSecretRef references a k8s secret that contains config drive networkdata.
// + optional
NetworkDataSecretRef *v1.LocalObjectReference `json:"networkDataSecretRef,omitempty"`
// NetworkDataBase64 contains config drive cloud-init networkdata as a base64 encoded string.
// + optional
NetworkDataBase64 string `json:"networkDataBase64,omitempty"`
// NetworkData contains config drive inline cloud-init networkdata.
// + optional
NetworkData string `json:"networkData,omitempty"`
}
type DomainSpec struct {
// Resources describes the Compute Resources required by this vmi.
Resources ResourceRequirements `json:"resources,omitempty"`
// CPU allow specified the detailed CPU topology inside the vmi.
// +optional
CPU *CPU `json:"cpu,omitempty"`
// Memory allow specifying the VMI memory features.
// +optional
Memory *Memory `json:"memory,omitempty"`
// Machine type.
// +optional
Machine *Machine `json:"machine,omitempty"`
// Firmware.
// +optional
Firmware *Firmware `json:"firmware,omitempty"`
// Clock sets the clock and timers of the vmi.
// +optional
Clock *Clock `json:"clock,omitempty"`
// Features like acpi, apic, hyperv, smm.
// +optional
Features *Features `json:"features,omitempty"`
// Devices allows adding disks, network interfaces, and others
Devices Devices `json:"devices"`
// Controls whether or not disks will share IOThreads.
// Omitting IOThreadsPolicy disables use of IOThreads.
// One of: shared, auto, supplementalPool
// +optional
IOThreadsPolicy *IOThreadsPolicy `json:"ioThreadsPolicy,omitempty"`
// IOThreads specifies the IOThreads options.
// +optional
IOThreads *DiskIOThreads `json:"ioThreads,omitempty"`
// Chassis specifies the chassis info passed to the domain.
// +optional
Chassis *Chassis `json:"chassis,omitempty"`
// Launch Security setting of the vmi.
// +optional
LaunchSecurity *LaunchSecurity `json:"launchSecurity,omitempty"`
}
// Chassis specifies the chassis info passed to the domain.
type Chassis struct {
Manufacturer string `json:"manufacturer,omitempty"`
Version string `json:"version,omitempty"`
Serial string `json:"serial,omitempty"`
Asset string `json:"asset,omitempty"`
Sku string `json:"sku,omitempty"`
}
// Represents the firmware blob used to assist in the domain creation process.
// Used for setting the QEMU BIOS file path for the libvirt domain.
type Bootloader struct {
// If set (default), BIOS will be used.
// +optional
BIOS *BIOS `json:"bios,omitempty"`
// If set, EFI will be used instead of BIOS.
// +optional
EFI *EFI `json:"efi,omitempty"`
}
// If set (default), BIOS will be used.
type BIOS struct {
// If set, the BIOS output will be transmitted over serial
// +optional
UseSerial *bool `json:"useSerial,omitempty"`
}
// If set, EFI will be used instead of BIOS.
type EFI struct {
// If set, SecureBoot will be enabled and the OVMF roms will be swapped for
// SecureBoot-enabled ones.
// Requires SMM to be enabled.
// Defaults to true
// +optional
SecureBoot *bool `json:"secureBoot,omitempty"`
// If set to true, Persistent will persist the EFI NVRAM across reboots.
// Defaults to false
// +optional
Persistent *bool `json:"persistent,omitempty"`
}
// If set, the VM will be booted from the defined kernel / initrd.
type KernelBootContainer struct {
// Image that contains initrd / kernel files.
Image string `json:"image"`
// ImagePullSecret is the name of the Docker registry secret required to pull the image. The secret must already exist.
//+optional
ImagePullSecret string `json:"imagePullSecret,omitempty"`
// Image pull policy.
// One of Always, Never, IfNotPresent.
// Defaults to Always if :latest tag is specified, or IfNotPresent otherwise.
// Cannot be updated.
// More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
// +optional
ImagePullPolicy v1.PullPolicy `json:"imagePullPolicy,omitempty"`
// The fully-qualified path to the kernel image in the host OS
//+optional
KernelPath string `json:"kernelPath,omitempty"`
// the fully-qualified path to the ramdisk image in the host OS
//+optional
InitrdPath string `json:"initrdPath,omitempty"`
}
// Represents the firmware blob used to assist in the kernel boot process.
// Used for setting the kernel, initrd and command line arguments
type KernelBoot struct {
// Arguments to be passed to the kernel at boot time
KernelArgs string `json:"kernelArgs,omitempty"`
// Container defines the container that containes kernel artifacts
Container *KernelBootContainer `json:"container,omitempty"`
}
type ResourceRequirements struct {
// Requests is a description of the initial vmi resources.
// Valid resource keys are "memory" and "cpu".
// +optional
Requests v1.ResourceList `json:"requests,omitempty"`
// Limits describes the maximum amount of compute resources allowed.
// Valid resource keys are "memory" and "cpu".
// +optional
Limits v1.ResourceList `json:"limits,omitempty"`
// Don't ask the scheduler to take the guest-management overhead into account. Instead
// put the overhead only into the container's memory limit. This can lead to crashes if
// all memory is in use on a node. Defaults to false.
OvercommitGuestOverhead bool `json:"overcommitGuestOverhead,omitempty"`
}
// CPU allows specifying the CPU topology.
type CPU struct {
// Cores specifies the number of cores inside the vmi.
// Must be a value greater or equal 1.
Cores uint32 `json:"cores,omitempty"`
// Sockets specifies the number of sockets inside the vmi.
// Must be a value greater or equal 1.
Sockets uint32 `json:"sockets,omitempty"`
// MaxSockets specifies the maximum amount of sockets that can
// be hotplugged
MaxSockets uint32 `json:"maxSockets,omitempty"`
// Threads specifies the number of threads inside the vmi.
// Must be a value greater or equal 1.
Threads uint32 `json:"threads,omitempty"`
// Model specifies the CPU model inside the VMI.
// List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map.
// It is possible to specify special cases like "host-passthrough" to get the same CPU as the node
// and "host-model" to get CPU closest to the node one.
// Defaults to host-model.
// +optional
Model string `json:"model,omitempty"`
// Features specifies the CPU features list inside the VMI.
// +optional
Features []CPUFeature `json:"features,omitempty"`
// DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node
// with enough dedicated pCPUs and pin the vCPUs to it.
// +optional
DedicatedCPUPlacement bool `json:"dedicatedCpuPlacement,omitempty"`
// NUMA allows specifying settings for the guest NUMA topology
// +optional
NUMA *NUMA `json:"numa,omitempty"`
// IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place
// the emulator thread on it.
// +optional
IsolateEmulatorThread bool `json:"isolateEmulatorThread,omitempty"`
// Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads
// +optional
Realtime *Realtime `json:"realtime,omitempty"`
}
// Realtime holds the tuning knobs specific for realtime workloads.
type Realtime struct {
// Mask defines the vcpu mask expression that defines which vcpus are used for realtime. Format matches libvirt's expressions.
// Example: "0-3,^1","0,2,3","2-3"
// +optional
Mask string `json:"mask,omitempty"`
}
// NUMAGuestMappingPassthrough instructs kubevirt to model numa topology which is compatible with the CPU pinning on the guest.
// This will result in a subset of the node numa topology being passed through, ensuring that virtual numa nodes and their memory
// never cross boundaries coming from the node numa mapping.
type NUMAGuestMappingPassthrough struct {
}
type NUMA struct {
// GuestMappingPassthrough will create an efficient guest topology based on host CPUs exclusively assigned to a pod.
// The created topology ensures that memory and CPUs on the virtual numa nodes never cross boundaries of host numa nodes.
// +optional
GuestMappingPassthrough *NUMAGuestMappingPassthrough `json:"guestMappingPassthrough,omitempty"`
}
// CPUFeature allows specifying a CPU feature.
type CPUFeature struct {
// Name of the CPU feature
Name string `json:"name"`
// Policy is the CPU feature attribute which can have the following attributes:
// force - The virtual CPU will claim the feature is supported regardless of it being supported by host CPU.
// require - Guest creation will fail unless the feature is supported by the host CPU or the hypervisor is able to emulate it.
// optional - The feature will be supported by virtual CPU if and only if it is supported by host CPU.
// disable - The feature will not be supported by virtual CPU.
// forbid - Guest creation will fail if the feature is supported by host CPU.
// Defaults to require
// +optional
Policy string `json:"policy,omitempty"`
}
// Memory allows specifying the VirtualMachineInstance memory features.
type Memory struct {
// Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.
// +optional
Hugepages *Hugepages `json:"hugepages,omitempty"`
// Guest allows to specifying the amount of memory which is visible inside the Guest OS.
// The Guest must lie between Requests and Limits from the resources section.
// Defaults to the requested memory in the resources section if not specified.
// + optional
Guest *resource.Quantity `json:"guest,omitempty"`
// MaxGuest allows to specify the maximum amount of memory which is visible inside the Guest OS.
// The delta between MaxGuest and Guest is the amount of memory that can be hot(un)plugged.
MaxGuest *resource.Quantity `json:"maxGuest,omitempty"`
}
type MemoryStatus struct {
// GuestAtBoot specifies with how much memory the VirtualMachine intiallly booted with.
// +optional
GuestAtBoot *resource.Quantity `json:"guestAtBoot,omitempty"`
// GuestCurrent specifies how much memory is currently available for the VirtualMachine.
// +optional
GuestCurrent *resource.Quantity `json:"guestCurrent,omitempty"`
// GuestRequested specifies how much memory was requested (hotplug) for the VirtualMachine.
// +optional
GuestRequested *resource.Quantity `json:"guestRequested,omitempty"`
}
// Hugepages allow to use hugepages for the VirtualMachineInstance instead of regular memory.
type Hugepages struct {
// PageSize specifies the hugepage size, for x86_64 architecture valid values are 1Gi and 2Mi.
PageSize string `json:"pageSize,omitempty"`
}
type Machine struct {
// QEMU machine type is the actual chipset of the VirtualMachineInstance.
// +optional
Type string `json:"type"`
}
type Firmware struct {
// UUID reported by the vmi bios.
// Defaults to a random generated uid.
UUID types.UID `json:"uuid,omitempty"`
// Settings to control the bootloader that is used.
// +optional
Bootloader *Bootloader `json:"bootloader,omitempty"`
// The system-serial-number in SMBIOS
Serial string `json:"serial,omitempty"`
// Settings to set the kernel for booting.
// +optional
KernelBoot *KernelBoot `json:"kernelBoot,omitempty"`
// Information that can be set in the ACPI table
ACPI *ACPI `json:"acpi,omitempty"`
}
type ACPI struct {
// SlicNameRef should match the volume name of a secret object. The data in the secret should
// be a binary blob that follows the ACPI SLIC standard, see:
// https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653305(v=vs.85)
SlicNameRef string `json:"slicNameRef,omitempty"`
// Similar to SlicNameRef, another ACPI entry that is used in more recent Windows versions.
// The above points to the spec of MSDM too.
MsdmNameRef string `json:"msdmNameRef,omitempty"`
}
type Devices struct {
// Fall back to legacy virtio 0.9 support if virtio bus is selected on devices.
// This is helpful for old machines like CentOS6 or RHEL6 which
// do not understand virtio_non_transitional (virtio 1.0).
UseVirtioTransitional *bool `json:"useVirtioTransitional,omitempty"`
// DisableHotplug disabled the ability to hotplug disks.
DisableHotplug bool `json:"disableHotplug,omitempty"`
// Disks describes disks, cdroms and luns which are connected to the vmi.
// +kubebuilder:validation:MaxItems:=256
Disks []Disk `json:"disks,omitempty"`
// Watchdog describes a watchdog device which can be added to the vmi.
Watchdog *Watchdog `json:"watchdog,omitempty"`
// Interfaces describe network interfaces which are added to the vmi.
// +kubebuilder:validation:MaxItems:=256
Interfaces []Interface `json:"interfaces,omitempty"`
// Inputs describe input devices
Inputs []Input `json:"inputs,omitempty"`
// Whether to attach a pod network interface. Defaults to true.
AutoattachPodInterface *bool `json:"autoattachPodInterface,omitempty"`
// Whether to attach the default graphics device or not.
// VNC will not be available if set to false. Defaults to true.
AutoattachGraphicsDevice *bool `json:"autoattachGraphicsDevice,omitempty"`
// Whether to attach the default virtio-serial console or not.
// Serial console access will not be available if set to false. Defaults to true.
AutoattachSerialConsole *bool `json:"autoattachSerialConsole,omitempty"`
// Whether to log the auto-attached default serial console or not.
// Serial console logs will be collect to a file and then streamed from a named `guest-console-log`.
// Not relevant if autoattachSerialConsole is disabled.
// Defaults to cluster wide setting on VirtualMachineOptions.
LogSerialConsole *bool `json:"logSerialConsole,omitempty"`
// Whether to attach the Memory balloon device with default period.
// Period can be adjusted in virt-config.
// Defaults to true.
// +optional
AutoattachMemBalloon *bool `json:"autoattachMemBalloon,omitempty"`
// Whether to attach an Input Device.
// Defaults to false.
// +optional
AutoattachInputDevice *bool `json:"autoattachInputDevice,omitempty"`
// Whether to attach the VSOCK CID to the VM or not.
// VSOCK access will be available if set to true. Defaults to false.
AutoattachVSOCK *bool `json:"autoattachVSOCK,omitempty"`
// Whether to have random number generator from host
// +optional
Rng *Rng `json:"rng,omitempty"`
// Whether or not to enable virtio multi-queue for block devices.
// Defaults to false.
// +optional
BlockMultiQueue *bool `json:"blockMultiQueue,omitempty"`
// If specified, virtual network interfaces configured with a virtio bus will also enable the vhost multiqueue feature for network devices. The number of queues created depends on additional factors of the VirtualMachineInstance, like the number of guest CPUs.
// +optional
NetworkInterfaceMultiQueue *bool `json:"networkInterfaceMultiqueue,omitempty"`
//Whether to attach a GPU device to the vmi.
// +optional
// +listType=atomic
GPUs []GPU `json:"gpus,omitempty"`
// DownwardMetrics creates a virtio serials for exposing the downward metrics to the vmi.
// +optional
DownwardMetrics *DownwardMetrics `json:"downwardMetrics,omitempty"`
// PanicDevices provides additional crash information when a guest crashes.
// +optional
// +listtype=atomic
PanicDevices []PanicDevice `json:"panicDevices,omitempty"`
// Filesystems describes filesystem which is connected to the vmi.
// +optional
// +listType=atomic
Filesystems []Filesystem `json:"filesystems,omitempty"`
//Whether to attach a host device to the vmi.
// +optional
// +listType=atomic
HostDevices []HostDevice `json:"hostDevices,omitempty"`
// To configure and access client devices such as redirecting USB
// +optional
ClientPassthrough *ClientPassthroughDevices `json:"clientPassthrough,omitempty"`
// Whether to emulate a sound device.
// +optional
Sound *SoundDevice `json:"sound,omitempty"`
// Whether to emulate a TPM device.
// +optional
TPM *TPMDevice `json:"tpm,omitempty"`
// Video describes the video device configuration for the vmi.
// +optional
Video *VideoDevice `json:"video,omitempty"`
}
// Represent a subset of client devices that can be accessed by VMI. At the
// moment only, USB devices using Usbredir's library and tooling. Another fit
// would be a smartcard with libcacard.
//
// The struct is currently empty as there is no immediate request for
// user-facing APIs. This structure simply turns on USB redirection of
// UsbClientPassthroughMaxNumberOf devices.
type ClientPassthroughDevices struct {
}
// Represents the upper limit allowed by QEMU + KubeVirt.
const (
UsbClientPassthroughMaxNumberOf = 4
)
// Represents the user's configuration to emulate sound cards in the VMI.
type SoundDevice struct {
// User's defined name for this sound device
Name string `json:"name"`
// We only support ich9 or ac97.
// If SoundDevice is not set: No sound card is emulated.
// If SoundDevice is set but Model is not: ich9
// +optional
Model string `json:"model,omitempty"`
}
type TPMDevice struct {
// Enabled allows a user to explicitly disable the vTPM even when one is enabled by a preference referenced by the VirtualMachine
// Defaults to True
Enabled *bool `json:"enabled,omitempty"`
// Persistent indicates the state of the TPM device should be kept accross reboots
// Defaults to false
Persistent *bool `json:"persistent,omitempty"`
}
type VideoDevice struct {
// Type specifies the video device type (e.g., virtio, vga, bochs, ramfb).
// If not specified, the default is architecture-dependent (VGA for BIOS-based VMs, Bochs for EFI-based VMs on AMD64; virtio for Arm and s390x).
// +optional
Type string `json:"type,omitempty"`
}
type InputBus string
const (
InputBusUSB InputBus = "usb"
InputBusVirtio InputBus = "virtio"
)
type InputType string
const (
InputTypeTablet InputType = "tablet"
InputTypeKeyboard InputType = "keyboard"
)
type Input struct {
// Bus indicates the bus of input device to emulate.
// Supported values: virtio, usb.
Bus InputBus `json:"bus,omitempty"`
// Type indicated the type of input device.
// Supported values: tablet.
Type InputType `json:"type"`
// Name is the device name
Name string `json:"name"`
}
type Filesystem struct {
// Name is the device name
Name string `json:"name"`
// Virtiofs is supported
Virtiofs *FilesystemVirtiofs `json:"virtiofs"`
}
type FilesystemVirtiofs struct{}
type DownwardMetrics struct{}
type GPU struct {
// Name of the GPU device as exposed by a device plugin
Name string `json:"name"`
// DeviceName is the name of the device provisioned by device-plugins
DeviceName string `json:"deviceName,omitempty"`
// ClaimRequest provides the ClaimName from vmi.spec.resourceClaims[].name and
// requestName from resourceClaim.spec.devices.requests[].name
// This field should only be configured if one of the feature-gates GPUsWithDRA or HostDevicesWithDRA is enabled.
// This feature is in alpha.
*ClaimRequest `json:",inline"`
VirtualGPUOptions *VGPUOptions `json:"virtualGPUOptions,omitempty"`
// If specified, the virtual network interface address and its tag will be provided to the guest via config drive
// +optional
Tag string `json:"tag,omitempty"`
}
type ClaimRequest struct {
// ClaimName needs to be provided from the list vmi.spec.resourceClaims[].name where this
// device is allocated
// +optional
ClaimName *string `json:"claimName,omitempty"`
// RequestName needs to be provided from resourceClaim.spec.devices.requests[].name where this
// device is requested
// +optional
RequestName *string `json:"requestName,omitempty"`
}
type VGPUOptions struct {
Display *VGPUDisplayOptions `json:"display,omitempty"`
}
type VGPUDisplayOptions struct {
// Enabled determines if a display addapter backed by a vGPU should be enabled or disabled on the guest.
// Defaults to true.
// +optional
Enabled *bool `json:"enabled,omitempty"`
// Enables a boot framebuffer, until the guest OS loads a real GPU driver
// Defaults to true.
// +optional
RamFB *FeatureState `json:"ramFB,omitempty"`
}
type PanicDevice struct {
// Model specifies what type of panic device is provided.
// The panic model used when this attribute is missing depends on the hypervisor and guest arch.
// One of: isa, hyperv, pvpanic.
// +optional
Model *PanicDeviceModel `json:"model,omitempty"`
}
type HostDevice struct {
Name string `json:"name"`
// DeviceName is the name of the device provisioned by device-plugins
DeviceName string `json:"deviceName,omitempty"`
// ClaimRequest provides the ClaimName from vmi.spec.resourceClaims[].name and
// requestName from resourceClaim.spec.devices.requests[].name
// this fields requires DRA feature gate enabled
// This field should only be configured if one of the feature-gates GPUsWithDRA or HostDevicesWithDRA is enabled.
// This feature is in alpha.
*ClaimRequest `json:",inline"`
// If specified, the virtual network interface address and its tag will be provided to the guest via config drive
// +optional
Tag string `json:"tag,omitempty"`
}
type Disk struct {
// Name is the device name
Name string `json:"name"`
// DiskDevice specifies as which device the disk should be added to the guest.
// Defaults to Disk.
DiskDevice `json:",inline"`
// BootOrder is an integer value > 0, used to determine ordering of boot devices.
// Lower values take precedence.
// Each disk or interface that has a boot order must have a unique value.
// Disks without a boot order are not tried if a disk with a boot order exists.
// +optional
BootOrder *uint `json:"bootOrder,omitempty"`
// Serial provides the ability to specify a serial number for the disk device.
// +optional
Serial string `json:"serial,omitempty"`
// dedicatedIOThread indicates this disk should have an exclusive IO Thread.
// Enabling this implies useIOThreads = true.
// Defaults to false.
// +optional
DedicatedIOThread *bool `json:"dedicatedIOThread,omitempty"`
// Cache specifies which kvm disk cache mode should be used.
// Supported values are:
// none: Guest I/O not cached on the host, but may be kept in a disk cache.
// writethrough: Guest I/O cached on the host but written through to the physical medium. Slowest but with most guarantees.
// writeback: Guest I/O cached on the host.
// Defaults to none if the storage supports O_DIRECT, otherwise writethrough.
// +optional
Cache DriverCache `json:"cache,omitempty"`
// IO specifies which QEMU disk IO mode should be used.
// Supported values are: native, default, threads.
// +optional
IO DriverIO `json:"io,omitempty"`
// If specified, disk address and its tag will be provided to the guest via config drive metadata
// +optional
Tag string `json:"tag,omitempty"`
// If specified, the virtual disk will be presented with the given block sizes.
// +optional
BlockSize *BlockSize `json:"blockSize,omitempty"`
// If specified the disk is made sharable and multiple write from different VMs are permitted
// +optional
Shareable *bool `json:"shareable,omitempty"`
// If specified, it can change the default error policy (stop) for the disk
// +optional
ErrorPolicy *DiskErrorPolicy `json:"errorPolicy,omitempty"`
}
// CustomBlockSize represents the desired logical and physical block size for a VM disk.
type CustomBlockSize struct {
Logical uint `json:"logical"`
Physical uint `json:"physical"`
}
// BlockSize provides the option to change the block size presented to the VM for a disk.
// Only one of its members may be specified.
type BlockSize struct {
Custom *CustomBlockSize `json:"custom,omitempty"`
MatchVolume *FeatureState `json:"matchVolume,omitempty"`
}
// Represents the target of a volume to mount.
// Only one of its members may be specified.
type DiskDevice struct {
// Attach a volume as a disk to the vmi.
Disk *DiskTarget `json:"disk,omitempty"`
// Attach a volume as a LUN to the vmi.
LUN *LunTarget `json:"lun,omitempty"`
// Attach a volume as a cdrom to the vmi.
CDRom *CDRomTarget `json:"cdrom,omitempty"`
}
type DiskBus string
const (
DiskBusSCSI DiskBus = "scsi"
DiskBusSATA DiskBus = "sata"
DiskBusVirtio DiskBus = VirtIO
DiskBusUSB DiskBus = "usb"
)
type DiskTarget struct {
// Bus indicates the type of disk device to emulate.
// supported values: virtio, sata, scsi, usb.
Bus DiskBus `json:"bus,omitempty"`
// ReadOnly.
// Defaults to false.
ReadOnly bool `json:"readonly,omitempty"`
// If specified, the virtual disk will be placed on the guests pci address with the specified PCI address. For example: 0000:81:01.10
// +optional
PciAddress string `json:"pciAddress,omitempty"`
}
type LaunchSecurity struct {
// AMD Secure Encrypted Virtualization (SEV).
SEV *SEV `json:"sev,omitempty"`
}
type SEV struct {
// Guest policy flags as defined in AMD SEV API specification.
// Note: due to security reasons it is not allowed to enable guest debugging. Therefore NoDebug flag is not exposed to users and is always true.
Policy *SEVPolicy `json:"policy,omitempty"`
// If specified, run the attestation process for a vmi.
// +optional
Attestation *SEVAttestation `json:"attestation,omitempty"`
// Base64 encoded session blob.
Session string `json:"session,omitempty"`
// Base64 encoded guest owner's Diffie-Hellman key.
DHCert string `json:"dhCert,omitempty"`
}
type SEVPolicy struct {
// SEV-ES is required.
// Defaults to false.
// +optional
EncryptedState *bool `json:"encryptedState,omitempty"`
}
type SEVAttestation struct {
}
type LunTarget struct {
// Bus indicates the type of disk device to emulate.
// supported values: virtio, sata, scsi.
Bus DiskBus `json:"bus,omitempty"`
// ReadOnly.
// Defaults to false.
ReadOnly bool `json:"readonly,omitempty"`
// Reservation indicates if the disk needs to support the persistent reservation for the SCSI disk
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/export/register.go | vendor/kubevirt.io/api/export/register.go | /*
* This file is part of the KubeVirt project
*
* 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.
*
* Copyright 2022 Red Hat, Inc.
*
*/
package export
// GroupName is the group name used in this package
const (
GroupName = "export.kubevirt.io"
)
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/export/v1alpha1/types_swagger_generated.go | vendor/kubevirt.io/api/export/v1alpha1/types_swagger_generated.go | // Code generated by swagger-doc. DO NOT EDIT.
package v1alpha1
func (VirtualMachineExport) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExport defines the operation of exporting a VM source\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"status": "+optional",
}
}
func (VirtualMachineExportList) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportList is a list of VirtualMachineExport resources\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "+listType=atomic",
}
}
func (VirtualMachineExportSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportSpec is the spec for a VirtualMachineExport resource",
"tokenSecretRef": "+optional\nTokenSecretRef is the name of the custom-defined secret that contains the token used by the export server pod",
"ttlDuration": "ttlDuration limits the lifetime of an export\nIf this field is set, after this duration has passed from counting from CreationTimestamp,\nthe export is eligible to be automatically deleted.\nIf this field is omitted, a reasonable default is applied.\n+optional",
}
}
func (VirtualMachineExportStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportStatus is the status for a VirtualMachineExport resource",
"phase": "+optional",
"links": "+optional",
"tokenSecretRef": "+optional\nTokenSecretRef is the name of the secret that contains the token used by the export server pod",
"ttlExpirationTime": "The time at which the VM Export will be completely removed according to specified TTL\nFormula is CreationTimestamp + TTL",
"serviceName": "+optional\nServiceName is the name of the service created associated with the Virtual Machine export. It will be used to\ncreate the internal URLs for downloading the images",
"virtualMachineName": "+optional\nVirtualMachineName shows the name of the source virtual machine if the source is either a VirtualMachine or\na VirtualMachineSnapshot. This is mainly to easily identify the source VirtualMachine in case of a\nVirtualMachineSnapshot",
"conditions": "+optional\n+listType=atomic",
}
}
func (VirtualMachineExportLinks) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportLinks contains the links that point the exported VM resources",
"internal": "+optional",
"external": "+optional",
}
}
func (VirtualMachineExportLink) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportLink contains a list of volumes available for export, as well as the URLs to obtain these volumes",
"cert": "Cert is the public CA certificate base64 encoded",
"volumes": "Volumes is a list of available volumes to export\n+listType=map\n+listMapKey=name\n+optional",
"manifests": "Manifests is a list of available manifests for the export\n+listType=map\n+listMapKey=type\n+optional",
}
}
func (VirtualMachineExportManifest) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportManifest contains the type and URL of the exported manifest",
"type": "Type is the type of manifest returned",
"url": "Url is the url of the endpoint that returns the manifest",
}
}
func (VirtualMachineExportVolume) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportVolume contains the name and available formats for the exported volume",
"name": "Name is the name of the exported volume",
"formats": "+listType=map\n+listMapKey=format\n+optional",
}
}
func (VirtualMachineExportVolumeFormat) SwaggerDoc() map[string]string {
return map[string]string{
"": "VirtualMachineExportVolumeFormat contains the format type and URL to get the volume in that format",
"format": "Format is the format of the image at the specified URL",
"url": "Url is the url that contains the volume in the format specified",
}
}
func (Condition) SwaggerDoc() map[string]string {
return map[string]string{
"": "Condition defines conditions",
"lastProbeTime": "+optional\n+nullable",
"lastTransitionTime": "+optional\n+nullable",
"reason": "+optional",
"message": "+optional",
}
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/export/v1alpha1/types.go | vendor/kubevirt.io/api/export/v1alpha1/types.go | /*
* This file is part of the KubeVirt project
*
* 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.
*
* Copyright 2022 Red Hat, Inc.
*
*/
package v1alpha1
import (
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
App = "virt-exporter"
DefaultDurationTTL = 2 * time.Hour
)
// VirtualMachineExport defines the operation of exporting a VM source
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type VirtualMachineExport struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec VirtualMachineExportSpec `json:"spec"`
// +optional
Status *VirtualMachineExportStatus `json:"status,omitempty"`
}
// VirtualMachineExportList is a list of VirtualMachineExport resources
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type VirtualMachineExportList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
// +listType=atomic
Items []VirtualMachineExport `json:"items"`
}
// VirtualMachineExportSpec is the spec for a VirtualMachineExport resource
type VirtualMachineExportSpec struct {
Source corev1.TypedLocalObjectReference `json:"source"`
// +optional
// TokenSecretRef is the name of the custom-defined secret that contains the token used by the export server pod
TokenSecretRef *string `json:"tokenSecretRef,omitempty"`
// ttlDuration limits the lifetime of an export
// If this field is set, after this duration has passed from counting from CreationTimestamp,
// the export is eligible to be automatically deleted.
// If this field is omitted, a reasonable default is applied.
// +optional
TTLDuration *metav1.Duration `json:"ttlDuration,omitempty"`
}
// VirtualMachineExportPhase is the current phase of the VirtualMachineExport
type VirtualMachineExportPhase string
const (
// Pending means the Virtual Machine export is pending
Pending VirtualMachineExportPhase = "Pending"
// Ready means the Virtual Machine export is ready
Ready VirtualMachineExportPhase = "Ready"
// Terminated means the Virtual Machine export is terminated and no longer available
Terminated VirtualMachineExportPhase = "Terminated"
// Skipped means the export is invalid in a way so the exporter pod cannot start, and we are skipping creating the exporter server pod.
Skipped VirtualMachineExportPhase = "Skipped"
)
// VirtualMachineExportStatus is the status for a VirtualMachineExport resource
type VirtualMachineExportStatus struct {
// +optional
Phase VirtualMachineExportPhase `json:"phase,omitempty"`
// +optional
Links *VirtualMachineExportLinks `json:"links,omitempty"`
// +optional
// TokenSecretRef is the name of the secret that contains the token used by the export server pod
TokenSecretRef *string `json:"tokenSecretRef,omitempty"`
// The time at which the VM Export will be completely removed according to specified TTL
// Formula is CreationTimestamp + TTL
TTLExpirationTime *metav1.Time `json:"ttlExpirationTime,omitempty"`
// +optional
// ServiceName is the name of the service created associated with the Virtual Machine export. It will be used to
// create the internal URLs for downloading the images
ServiceName string `json:"serviceName,omitempty"`
// +optional
// VirtualMachineName shows the name of the source virtual machine if the source is either a VirtualMachine or
// a VirtualMachineSnapshot. This is mainly to easily identify the source VirtualMachine in case of a
// VirtualMachineSnapshot
VirtualMachineName *string `json:"virtualMachineName,omitempty"`
// +optional
// +listType=atomic
Conditions []Condition `json:"conditions,omitempty"`
}
// VirtualMachineExportLinks contains the links that point the exported VM resources
type VirtualMachineExportLinks struct {
// +optional
Internal *VirtualMachineExportLink `json:"internal,omitempty"`
// +optional
External *VirtualMachineExportLink `json:"external,omitempty"`
}
// VirtualMachineExportLink contains a list of volumes available for export, as well as the URLs to obtain these volumes
type VirtualMachineExportLink struct {
// Cert is the public CA certificate base64 encoded
Cert string `json:"cert"`
// Volumes is a list of available volumes to export
// +listType=map
// +listMapKey=name
// +optional
Volumes []VirtualMachineExportVolume `json:"volumes,omitempty"`
// Manifests is a list of available manifests for the export
// +listType=map
// +listMapKey=type
// +optional
Manifests []VirtualMachineExportManifest `json:"manifests,omitempty"`
}
// VirtualMachineExportManifest contains the type and URL of the exported manifest
type VirtualMachineExportManifest struct {
// Type is the type of manifest returned
Type ExportManifestType `json:"type"`
// Url is the url of the endpoint that returns the manifest
Url string `json:"url"`
}
type ExportManifestType string
const (
// AllManifests returns all manifests except for the token secret
AllManifests ExportManifestType = "all"
// AuthHeader returns a CDI compatible secret containing the token as an Auth header
AuthHeader ExportManifestType = "auth-header-secret"
)
// VirtualMachineExportVolume contains the name and available formats for the exported volume
type VirtualMachineExportVolume struct {
// Name is the name of the exported volume
Name string `json:"name"`
// +listType=map
// +listMapKey=format
// +optional
Formats []VirtualMachineExportVolumeFormat `json:"formats,omitempty"`
}
type ExportVolumeFormat string
const (
// KubeVirtRaw is the volume in RAW format
KubeVirtRaw ExportVolumeFormat = "raw"
// KubeVirtGZ is the volume in gzipped RAW format.
KubeVirtGz ExportVolumeFormat = "gzip"
// Dir is an uncompressed directory, which points to the root of a PersistentVolumeClaim, exposed using a FileServer https://pkg.go.dev/net/http#FileServer
Dir ExportVolumeFormat = "dir"
// ArchiveGz is a tarred and gzipped version of the root of a PersistentVolumeClaim
ArchiveGz ExportVolumeFormat = "tar.gz"
)
// VirtualMachineExportVolumeFormat contains the format type and URL to get the volume in that format
type VirtualMachineExportVolumeFormat struct {
// Format is the format of the image at the specified URL
Format ExportVolumeFormat `json:"format"`
// Url is the url that contains the volume in the format specified
Url string `json:"url"`
}
// ConditionType is the const type for Conditions
type ConditionType string
const (
// ConditionReady is the "ready" condition type
ConditionReady ConditionType = "Ready"
// ConditionPVC is the condition of the PVC we are exporting
ConditionPVC ConditionType = "PVCReady"
// ConditionVolumesCreated is the condition to see if volumes are created from volume snapshots
ConditionVolumesCreated ConditionType = "VolumesCreated"
)
// Condition defines conditions
type Condition struct {
Type ConditionType `json:"type"`
Status corev1.ConditionStatus `json:"status"`
// +optional
// +nullable
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
// +optional
// +nullable
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
// +optional
Reason string `json:"reason,omitempty"`
// +optional
Message string `json:"message,omitempty"`
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/export/v1alpha1/register.go | vendor/kubevirt.io/api/export/v1alpha1/register.go | /*
* This file is part of the KubeVirt project
*
* 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.
*
* Copyright 2022 Red Hat, Inc.
*
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"kubevirt.io/api/export"
)
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: export.GroupName, Version: "v1alpha1"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// SchemeBuilder initializes a scheme builder
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme is a global function that registers this API group & version to a scheme
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&VirtualMachineExport{},
&VirtualMachineExportList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/export/v1alpha1/deepcopy_generated.go | vendor/kubevirt.io/api/export/v1alpha1/deepcopy_generated.go | //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
This file is part of the KubeVirt project
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.
Copyright The KubeVirt Authors.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Condition) DeepCopyInto(out *Condition) {
*out = *in
in.LastProbeTime.DeepCopyInto(&out.LastProbeTime)
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
func (in *Condition) DeepCopy() *Condition {
if in == nil {
return nil
}
out := new(Condition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExport) DeepCopyInto(out *VirtualMachineExport) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
if in.Status != nil {
in, out := &in.Status, &out.Status
*out = new(VirtualMachineExportStatus)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExport.
func (in *VirtualMachineExport) DeepCopy() *VirtualMachineExport {
if in == nil {
return nil
}
out := new(VirtualMachineExport)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VirtualMachineExport) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportLink) DeepCopyInto(out *VirtualMachineExportLink) {
*out = *in
if in.Volumes != nil {
in, out := &in.Volumes, &out.Volumes
*out = make([]VirtualMachineExportVolume, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Manifests != nil {
in, out := &in.Manifests, &out.Manifests
*out = make([]VirtualMachineExportManifest, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportLink.
func (in *VirtualMachineExportLink) DeepCopy() *VirtualMachineExportLink {
if in == nil {
return nil
}
out := new(VirtualMachineExportLink)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportLinks) DeepCopyInto(out *VirtualMachineExportLinks) {
*out = *in
if in.Internal != nil {
in, out := &in.Internal, &out.Internal
*out = new(VirtualMachineExportLink)
(*in).DeepCopyInto(*out)
}
if in.External != nil {
in, out := &in.External, &out.External
*out = new(VirtualMachineExportLink)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportLinks.
func (in *VirtualMachineExportLinks) DeepCopy() *VirtualMachineExportLinks {
if in == nil {
return nil
}
out := new(VirtualMachineExportLinks)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportList) DeepCopyInto(out *VirtualMachineExportList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]VirtualMachineExport, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportList.
func (in *VirtualMachineExportList) DeepCopy() *VirtualMachineExportList {
if in == nil {
return nil
}
out := new(VirtualMachineExportList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VirtualMachineExportList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportManifest) DeepCopyInto(out *VirtualMachineExportManifest) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportManifest.
func (in *VirtualMachineExportManifest) DeepCopy() *VirtualMachineExportManifest {
if in == nil {
return nil
}
out := new(VirtualMachineExportManifest)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportSpec) DeepCopyInto(out *VirtualMachineExportSpec) {
*out = *in
in.Source.DeepCopyInto(&out.Source)
if in.TokenSecretRef != nil {
in, out := &in.TokenSecretRef, &out.TokenSecretRef
*out = new(string)
**out = **in
}
if in.TTLDuration != nil {
in, out := &in.TTLDuration, &out.TTLDuration
*out = new(v1.Duration)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportSpec.
func (in *VirtualMachineExportSpec) DeepCopy() *VirtualMachineExportSpec {
if in == nil {
return nil
}
out := new(VirtualMachineExportSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportStatus) DeepCopyInto(out *VirtualMachineExportStatus) {
*out = *in
if in.Links != nil {
in, out := &in.Links, &out.Links
*out = new(VirtualMachineExportLinks)
(*in).DeepCopyInto(*out)
}
if in.TokenSecretRef != nil {
in, out := &in.TokenSecretRef, &out.TokenSecretRef
*out = new(string)
**out = **in
}
if in.TTLExpirationTime != nil {
in, out := &in.TTLExpirationTime, &out.TTLExpirationTime
*out = (*in).DeepCopy()
}
if in.VirtualMachineName != nil {
in, out := &in.VirtualMachineName, &out.VirtualMachineName
*out = new(string)
**out = **in
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportStatus.
func (in *VirtualMachineExportStatus) DeepCopy() *VirtualMachineExportStatus {
if in == nil {
return nil
}
out := new(VirtualMachineExportStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportVolume) DeepCopyInto(out *VirtualMachineExportVolume) {
*out = *in
if in.Formats != nil {
in, out := &in.Formats, &out.Formats
*out = make([]VirtualMachineExportVolumeFormat, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportVolume.
func (in *VirtualMachineExportVolume) DeepCopy() *VirtualMachineExportVolume {
if in == nil {
return nil
}
out := new(VirtualMachineExportVolume)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VirtualMachineExportVolumeFormat) DeepCopyInto(out *VirtualMachineExportVolumeFormat) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachineExportVolumeFormat.
func (in *VirtualMachineExportVolumeFormat) DeepCopy() *VirtualMachineExportVolumeFormat {
if in == nil {
return nil
}
out := new(VirtualMachineExportVolumeFormat)
in.DeepCopyInto(out)
return out
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/api/export/v1alpha1/doc.go | vendor/kubevirt.io/api/export/v1alpha1/doc.go | /*
* This file is part of the KubeVirt project
*
* 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.
*
* Copyright 2022 Red Hat, Inc.
*
*/
// +k8s:deepcopy-gen=package
// +groupName=export.kubevirt.io
// +k8s:openapi-gen=true
package v1alpha1
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/register.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/register.go | package core
const (
// GroupName to hold the string name for the cdi project
GroupName = "cdi.kubevirt.io"
)
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_transfer.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_transfer.go | /*
Copyright 2021 The CDI 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 v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// this has to be here otherwise informer-gen doesn't recognize it
// see https://github.com/kubernetes/code-generator/issues/59
// +genclient:nonNamespaced
// Deprecated for removal in v1.
//
// ObjectTransfer is the cluster scoped object transfer resource
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=ot;ots,scope=Cluster
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The phase of the ObjectTransfer"
// +kubebuilder:subresource:status
type ObjectTransfer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ObjectTransferSpec `json:"spec"`
// +optional
Status ObjectTransferStatus `json:"status"`
}
// TransferSource is the source of a ObjectTransfer
type TransferSource struct {
// +optional
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
RequiredAnnotations map[string]string `json:"requiredAnnotations,omitempty"`
}
// TransferTarget is the target of an ObjectTransfer
type TransferTarget struct {
Namespace *string `json:"namespace,omitempty"`
Name *string `json:"name,omitempty"`
}
// ObjectTransferSpec specifies the source/target of the transfer
type ObjectTransferSpec struct {
Source TransferSource `json:"source"`
Target TransferTarget `json:"target"`
ParentName *string `json:"parentName,omitempty"`
}
// ObjectTransferPhase is the phase of the ObjectTransfer
type ObjectTransferPhase string
const (
// ObjectTransferEmpty is the empty transfer phase
ObjectTransferEmpty ObjectTransferPhase = ""
// ObjectTransferPending is the pending transfer phase
ObjectTransferPending ObjectTransferPhase = "Pending"
// ObjectTransferRunning is the running transfer phase
ObjectTransferRunning ObjectTransferPhase = "Running"
// ObjectTransferComplete is the complete transfer phase
ObjectTransferComplete ObjectTransferPhase = "Complete"
// ObjectTransferError is the (terminal) error transfer phase
ObjectTransferError ObjectTransferPhase = "Error"
)
// ObjectTransferConditionType is the type of ObjectTransferCondition
type ObjectTransferConditionType string
const (
// ObjectTransferConditionComplete is the "complete" condition
ObjectTransferConditionComplete ObjectTransferConditionType = "Complete"
)
// ObjectTransferCondition contains condition data
type ObjectTransferCondition struct {
Type ObjectTransferConditionType `json:"type"`
Status corev1.ConditionStatus `json:"status"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
// ObjectTransferStatus is the status of the ObjectTransfer
type ObjectTransferStatus struct {
// Data is a place for intermediary state. Or anything really.
Data map[string]string `json:"data,omitempty"`
// Phase is the current phase of the transfer
Phase ObjectTransferPhase `json:"phase,omitempty"`
Conditions []ObjectTransferCondition `json:"conditions,omitempty"`
}
// ObjectTransferList provides the needed parameters to do request a list of ObjectTransfers from the system
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ObjectTransferList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
// Items provides a list of ObjectTransfers
Items []ObjectTransfer `json:"items"`
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/zz_generated.deepcopy.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/zz_generated.deepcopy.go | //go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright 2018 The CDI 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 deepcopy-gen. DO NOT EDIT.
package v1beta1
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDI) DeepCopyInto(out *CDI) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDI.
func (in *CDI) DeepCopy() *CDI {
if in == nil {
return nil
}
out := new(CDI)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CDI) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDICertConfig) DeepCopyInto(out *CDICertConfig) {
*out = *in
if in.CA != nil {
in, out := &in.CA, &out.CA
*out = new(CertConfig)
(*in).DeepCopyInto(*out)
}
if in.Server != nil {
in, out := &in.Server, &out.Server
*out = new(CertConfig)
(*in).DeepCopyInto(*out)
}
if in.Client != nil {
in, out := &in.Client, &out.Client
*out = new(CertConfig)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDICertConfig.
func (in *CDICertConfig) DeepCopy() *CDICertConfig {
if in == nil {
return nil
}
out := new(CDICertConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDIConfig) DeepCopyInto(out *CDIConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfig.
func (in *CDIConfig) DeepCopy() *CDIConfig {
if in == nil {
return nil
}
out := new(CDIConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CDIConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDIConfigList) DeepCopyInto(out *CDIConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CDIConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfigList.
func (in *CDIConfigList) DeepCopy() *CDIConfigList {
if in == nil {
return nil
}
out := new(CDIConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CDIConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDIConfigSpec) DeepCopyInto(out *CDIConfigSpec) {
*out = *in
if in.UploadProxyURLOverride != nil {
in, out := &in.UploadProxyURLOverride, &out.UploadProxyURLOverride
*out = new(string)
**out = **in
}
if in.ImportProxy != nil {
in, out := &in.ImportProxy, &out.ImportProxy
*out = new(ImportProxy)
(*in).DeepCopyInto(*out)
}
if in.ScratchSpaceStorageClass != nil {
in, out := &in.ScratchSpaceStorageClass, &out.ScratchSpaceStorageClass
*out = new(string)
**out = **in
}
if in.PodResourceRequirements != nil {
in, out := &in.PodResourceRequirements, &out.PodResourceRequirements
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.FeatureGates != nil {
in, out := &in.FeatureGates, &out.FeatureGates
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.FilesystemOverhead != nil {
in, out := &in.FilesystemOverhead, &out.FilesystemOverhead
*out = new(FilesystemOverhead)
(*in).DeepCopyInto(*out)
}
if in.Preallocation != nil {
in, out := &in.Preallocation, &out.Preallocation
*out = new(bool)
**out = **in
}
if in.InsecureRegistries != nil {
in, out := &in.InsecureRegistries, &out.InsecureRegistries
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.DataVolumeTTLSeconds != nil {
in, out := &in.DataVolumeTTLSeconds, &out.DataVolumeTTLSeconds
*out = new(int32)
**out = **in
}
if in.TLSSecurityProfile != nil {
in, out := &in.TLSSecurityProfile, &out.TLSSecurityProfile
*out = new(TLSSecurityProfile)
(*in).DeepCopyInto(*out)
}
if in.ImagePullSecrets != nil {
in, out := &in.ImagePullSecrets, &out.ImagePullSecrets
*out = make([]v1.LocalObjectReference, len(*in))
copy(*out, *in)
}
if in.LogVerbosity != nil {
in, out := &in.LogVerbosity, &out.LogVerbosity
*out = new(int32)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfigSpec.
func (in *CDIConfigSpec) DeepCopy() *CDIConfigSpec {
if in == nil {
return nil
}
out := new(CDIConfigSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDIConfigStatus) DeepCopyInto(out *CDIConfigStatus) {
*out = *in
if in.UploadProxyURL != nil {
in, out := &in.UploadProxyURL, &out.UploadProxyURL
*out = new(string)
**out = **in
}
if in.UploadProxyCA != nil {
in, out := &in.UploadProxyCA, &out.UploadProxyCA
*out = new(string)
**out = **in
}
if in.ImportProxy != nil {
in, out := &in.ImportProxy, &out.ImportProxy
*out = new(ImportProxy)
(*in).DeepCopyInto(*out)
}
if in.DefaultPodResourceRequirements != nil {
in, out := &in.DefaultPodResourceRequirements, &out.DefaultPodResourceRequirements
*out = new(v1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
if in.FilesystemOverhead != nil {
in, out := &in.FilesystemOverhead, &out.FilesystemOverhead
*out = new(FilesystemOverhead)
(*in).DeepCopyInto(*out)
}
if in.ImagePullSecrets != nil {
in, out := &in.ImagePullSecrets, &out.ImagePullSecrets
*out = make([]v1.LocalObjectReference, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIConfigStatus.
func (in *CDIConfigStatus) DeepCopy() *CDIConfigStatus {
if in == nil {
return nil
}
out := new(CDIConfigStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDIList) DeepCopyInto(out *CDIList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CDI, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIList.
func (in *CDIList) DeepCopy() *CDIList {
if in == nil {
return nil
}
out := new(CDIList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *CDIList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDISpec) DeepCopyInto(out *CDISpec) {
*out = *in
if in.UninstallStrategy != nil {
in, out := &in.UninstallStrategy, &out.UninstallStrategy
*out = new(CDIUninstallStrategy)
**out = **in
}
in.Infra.DeepCopyInto(&out.Infra)
in.Workloads.DeepCopyInto(&out.Workloads)
in.CustomizeComponents.DeepCopyInto(&out.CustomizeComponents)
if in.CloneStrategyOverride != nil {
in, out := &in.CloneStrategyOverride, &out.CloneStrategyOverride
*out = new(CDICloneStrategy)
**out = **in
}
if in.Config != nil {
in, out := &in.Config, &out.Config
*out = new(CDIConfigSpec)
(*in).DeepCopyInto(*out)
}
if in.CertConfig != nil {
in, out := &in.CertConfig, &out.CertConfig
*out = new(CDICertConfig)
(*in).DeepCopyInto(*out)
}
if in.PriorityClass != nil {
in, out := &in.PriorityClass, &out.PriorityClass
*out = new(CDIPriorityClass)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDISpec.
func (in *CDISpec) DeepCopy() *CDISpec {
if in == nil {
return nil
}
out := new(CDISpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CDIStatus) DeepCopyInto(out *CDIStatus) {
*out = *in
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CDIStatus.
func (in *CDIStatus) DeepCopy() *CDIStatus {
if in == nil {
return nil
}
out := new(CDIStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CertConfig) DeepCopyInto(out *CertConfig) {
*out = *in
if in.Duration != nil {
in, out := &in.Duration, &out.Duration
*out = new(metav1.Duration)
**out = **in
}
if in.RenewBefore != nil {
in, out := &in.RenewBefore, &out.RenewBefore
*out = new(metav1.Duration)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertConfig.
func (in *CertConfig) DeepCopy() *CertConfig {
if in == nil {
return nil
}
out := new(CertConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClaimPropertySet) DeepCopyInto(out *ClaimPropertySet) {
*out = *in
if in.AccessModes != nil {
in, out := &in.AccessModes, &out.AccessModes
*out = make([]v1.PersistentVolumeAccessMode, len(*in))
copy(*out, *in)
}
if in.VolumeMode != nil {
in, out := &in.VolumeMode, &out.VolumeMode
*out = new(v1.PersistentVolumeMode)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimPropertySet.
func (in *ClaimPropertySet) DeepCopy() *ClaimPropertySet {
if in == nil {
return nil
}
out := new(ClaimPropertySet)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ComponentConfig) DeepCopyInto(out *ComponentConfig) {
*out = *in
in.NodePlacement.DeepCopyInto(&out.NodePlacement)
if in.DeploymentReplicas != nil {
in, out := &in.DeploymentReplicas, &out.DeploymentReplicas
*out = new(int32)
**out = **in
}
if in.APIServerReplicas != nil {
in, out := &in.APIServerReplicas, &out.APIServerReplicas
*out = new(int32)
**out = **in
}
if in.UploadProxyReplicas != nil {
in, out := &in.UploadProxyReplicas, &out.UploadProxyReplicas
*out = new(int32)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentConfig.
func (in *ComponentConfig) DeepCopy() *ComponentConfig {
if in == nil {
return nil
}
out := new(ComponentConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConditionState) DeepCopyInto(out *ConditionState) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
in.LastHeartbeatTime.DeepCopyInto(&out.LastHeartbeatTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionState.
func (in *ConditionState) DeepCopy() *ConditionState {
if in == nil {
return nil
}
out := new(ConditionState)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomTLSProfile) DeepCopyInto(out *CustomTLSProfile) {
*out = *in
in.TLSProfileSpec.DeepCopyInto(&out.TLSProfileSpec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomTLSProfile.
func (in *CustomTLSProfile) DeepCopy() *CustomTLSProfile {
if in == nil {
return nil
}
out := new(CustomTLSProfile)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomizeComponents) DeepCopyInto(out *CustomizeComponents) {
*out = *in
if in.Patches != nil {
in, out := &in.Patches, &out.Patches
*out = make([]CustomizeComponentsPatch, len(*in))
copy(*out, *in)
}
if in.Flags != nil {
in, out := &in.Flags, &out.Flags
*out = new(Flags)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomizeComponents.
func (in *CustomizeComponents) DeepCopy() *CustomizeComponents {
if in == nil {
return nil
}
out := new(CustomizeComponents)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomizeComponentsPatch) DeepCopyInto(out *CustomizeComponentsPatch) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomizeComponentsPatch.
func (in *CustomizeComponentsPatch) DeepCopy() *CustomizeComponentsPatch {
if in == nil {
return nil
}
out := new(CustomizeComponentsPatch)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataImportCron) DeepCopyInto(out *DataImportCron) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImportCron.
func (in *DataImportCron) DeepCopy() *DataImportCron {
if in == nil {
return nil
}
out := new(DataImportCron)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DataImportCron) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataImportCronCondition) DeepCopyInto(out *DataImportCronCondition) {
*out = *in
in.ConditionState.DeepCopyInto(&out.ConditionState)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImportCronCondition.
func (in *DataImportCronCondition) DeepCopy() *DataImportCronCondition {
if in == nil {
return nil
}
out := new(DataImportCronCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataImportCronList) DeepCopyInto(out *DataImportCronList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]DataImportCron, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImportCronList.
func (in *DataImportCronList) DeepCopy() *DataImportCronList {
if in == nil {
return nil
}
out := new(DataImportCronList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DataImportCronList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataImportCronSpec) DeepCopyInto(out *DataImportCronSpec) {
*out = *in
in.Template.DeepCopyInto(&out.Template)
if in.GarbageCollect != nil {
in, out := &in.GarbageCollect, &out.GarbageCollect
*out = new(DataImportCronGarbageCollect)
**out = **in
}
if in.ImportsToKeep != nil {
in, out := &in.ImportsToKeep, &out.ImportsToKeep
*out = new(int32)
**out = **in
}
if in.RetentionPolicy != nil {
in, out := &in.RetentionPolicy, &out.RetentionPolicy
*out = new(DataImportCronRetentionPolicy)
**out = **in
}
if in.CreatedBy != nil {
in, out := &in.CreatedBy, &out.CreatedBy
*out = new(string)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImportCronSpec.
func (in *DataImportCronSpec) DeepCopy() *DataImportCronSpec {
if in == nil {
return nil
}
out := new(DataImportCronSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataImportCronStatus) DeepCopyInto(out *DataImportCronStatus) {
*out = *in
if in.CurrentImports != nil {
in, out := &in.CurrentImports, &out.CurrentImports
*out = make([]ImportStatus, len(*in))
copy(*out, *in)
}
if in.LastImportedPVC != nil {
in, out := &in.LastImportedPVC, &out.LastImportedPVC
*out = new(DataVolumeSourcePVC)
**out = **in
}
if in.LastExecutionTimestamp != nil {
in, out := &in.LastExecutionTimestamp, &out.LastExecutionTimestamp
*out = (*in).DeepCopy()
}
if in.LastImportTimestamp != nil {
in, out := &in.LastImportTimestamp, &out.LastImportTimestamp
*out = (*in).DeepCopy()
}
if in.SourceFormat != nil {
in, out := &in.SourceFormat, &out.SourceFormat
*out = new(DataImportCronSourceFormat)
**out = **in
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]DataImportCronCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataImportCronStatus.
func (in *DataImportCronStatus) DeepCopy() *DataImportCronStatus {
if in == nil {
return nil
}
out := new(DataImportCronStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSource) DeepCopyInto(out *DataSource) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSource.
func (in *DataSource) DeepCopy() *DataSource {
if in == nil {
return nil
}
out := new(DataSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DataSource) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSourceCondition) DeepCopyInto(out *DataSourceCondition) {
*out = *in
in.ConditionState.DeepCopyInto(&out.ConditionState)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceCondition.
func (in *DataSourceCondition) DeepCopy() *DataSourceCondition {
if in == nil {
return nil
}
out := new(DataSourceCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSourceList) DeepCopyInto(out *DataSourceList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]DataSource, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceList.
func (in *DataSourceList) DeepCopy() *DataSourceList {
if in == nil {
return nil
}
out := new(DataSourceList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DataSourceList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSourceRefSourceDataSource) DeepCopyInto(out *DataSourceRefSourceDataSource) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceRefSourceDataSource.
func (in *DataSourceRefSourceDataSource) DeepCopy() *DataSourceRefSourceDataSource {
if in == nil {
return nil
}
out := new(DataSourceRefSourceDataSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSourceSource) DeepCopyInto(out *DataSourceSource) {
*out = *in
if in.PVC != nil {
in, out := &in.PVC, &out.PVC
*out = new(DataVolumeSourcePVC)
**out = **in
}
if in.Snapshot != nil {
in, out := &in.Snapshot, &out.Snapshot
*out = new(DataVolumeSourceSnapshot)
**out = **in
}
if in.DataSource != nil {
in, out := &in.DataSource, &out.DataSource
*out = new(DataSourceRefSourceDataSource)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceSource.
func (in *DataSourceSource) DeepCopy() *DataSourceSource {
if in == nil {
return nil
}
out := new(DataSourceSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSourceSpec) DeepCopyInto(out *DataSourceSpec) {
*out = *in
in.Source.DeepCopyInto(&out.Source)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceSpec.
func (in *DataSourceSpec) DeepCopy() *DataSourceSpec {
if in == nil {
return nil
}
out := new(DataSourceSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataSourceStatus) DeepCopyInto(out *DataSourceStatus) {
*out = *in
in.Source.DeepCopyInto(&out.Source)
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]DataSourceCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataSourceStatus.
func (in *DataSourceStatus) DeepCopy() *DataSourceStatus {
if in == nil {
return nil
}
out := new(DataSourceStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolume) DeepCopyInto(out *DataVolume) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolume.
func (in *DataVolume) DeepCopy() *DataVolume {
if in == nil {
return nil
}
out := new(DataVolume)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DataVolume) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeBlankImage) DeepCopyInto(out *DataVolumeBlankImage) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeBlankImage.
func (in *DataVolumeBlankImage) DeepCopy() *DataVolumeBlankImage {
if in == nil {
return nil
}
out := new(DataVolumeBlankImage)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeCheckpoint) DeepCopyInto(out *DataVolumeCheckpoint) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeCheckpoint.
func (in *DataVolumeCheckpoint) DeepCopy() *DataVolumeCheckpoint {
if in == nil {
return nil
}
out := new(DataVolumeCheckpoint)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeCondition) DeepCopyInto(out *DataVolumeCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
in.LastHeartbeatTime.DeepCopyInto(&out.LastHeartbeatTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeCondition.
func (in *DataVolumeCondition) DeepCopy() *DataVolumeCondition {
if in == nil {
return nil
}
out := new(DataVolumeCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeList) DeepCopyInto(out *DataVolumeList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]DataVolume, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeList.
func (in *DataVolumeList) DeepCopy() *DataVolumeList {
if in == nil {
return nil
}
out := new(DataVolumeList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DataVolumeList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSource) DeepCopyInto(out *DataVolumeSource) {
*out = *in
if in.HTTP != nil {
in, out := &in.HTTP, &out.HTTP
*out = new(DataVolumeSourceHTTP)
(*in).DeepCopyInto(*out)
}
if in.S3 != nil {
in, out := &in.S3, &out.S3
*out = new(DataVolumeSourceS3)
**out = **in
}
if in.GCS != nil {
in, out := &in.GCS, &out.GCS
*out = new(DataVolumeSourceGCS)
**out = **in
}
if in.Registry != nil {
in, out := &in.Registry, &out.Registry
*out = new(DataVolumeSourceRegistry)
(*in).DeepCopyInto(*out)
}
if in.PVC != nil {
in, out := &in.PVC, &out.PVC
*out = new(DataVolumeSourcePVC)
**out = **in
}
if in.Upload != nil {
in, out := &in.Upload, &out.Upload
*out = new(DataVolumeSourceUpload)
**out = **in
}
if in.Blank != nil {
in, out := &in.Blank, &out.Blank
*out = new(DataVolumeBlankImage)
**out = **in
}
if in.Imageio != nil {
in, out := &in.Imageio, &out.Imageio
*out = new(DataVolumeSourceImageIO)
(*in).DeepCopyInto(*out)
}
if in.VDDK != nil {
in, out := &in.VDDK, &out.VDDK
*out = new(DataVolumeSourceVDDK)
**out = **in
}
if in.Snapshot != nil {
in, out := &in.Snapshot, &out.Snapshot
*out = new(DataVolumeSourceSnapshot)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSource.
func (in *DataVolumeSource) DeepCopy() *DataVolumeSource {
if in == nil {
return nil
}
out := new(DataVolumeSource)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSourceGCS) DeepCopyInto(out *DataVolumeSourceGCS) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceGCS.
func (in *DataVolumeSourceGCS) DeepCopy() *DataVolumeSourceGCS {
if in == nil {
return nil
}
out := new(DataVolumeSourceGCS)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSourceHTTP) DeepCopyInto(out *DataVolumeSourceHTTP) {
*out = *in
if in.ExtraHeaders != nil {
in, out := &in.ExtraHeaders, &out.ExtraHeaders
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.SecretExtraHeaders != nil {
in, out := &in.SecretExtraHeaders, &out.SecretExtraHeaders
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceHTTP.
func (in *DataVolumeSourceHTTP) DeepCopy() *DataVolumeSourceHTTP {
if in == nil {
return nil
}
out := new(DataVolumeSourceHTTP)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSourceImageIO) DeepCopyInto(out *DataVolumeSourceImageIO) {
*out = *in
if in.InsecureSkipVerify != nil {
in, out := &in.InsecureSkipVerify, &out.InsecureSkipVerify
*out = new(bool)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceImageIO.
func (in *DataVolumeSourceImageIO) DeepCopy() *DataVolumeSourceImageIO {
if in == nil {
return nil
}
out := new(DataVolumeSourceImageIO)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSourcePVC) DeepCopyInto(out *DataVolumeSourcePVC) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourcePVC.
func (in *DataVolumeSourcePVC) DeepCopy() *DataVolumeSourcePVC {
if in == nil {
return nil
}
out := new(DataVolumeSourcePVC)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSourceRef) DeepCopyInto(out *DataVolumeSourceRef) {
*out = *in
if in.Namespace != nil {
in, out := &in.Namespace, &out.Namespace
*out = new(string)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataVolumeSourceRef.
func (in *DataVolumeSourceRef) DeepCopy() *DataVolumeSourceRef {
if in == nil {
return nil
}
out := new(DataVolumeSourceRef)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DataVolumeSourceRegistry) DeepCopyInto(out *DataVolumeSourceRegistry) {
*out = *in
if in.URL != nil {
in, out := &in.URL, &out.URL
*out = new(string)
**out = **in
}
if in.ImageStream != nil {
in, out := &in.ImageStream, &out.ImageStream
*out = new(string)
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_swagger_generated.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_swagger_generated.go | // Code generated by swagger-doc. DO NOT EDIT.
package v1beta1
func (DataVolume) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolume is an abstraction on top of PersistentVolumeClaims to allow easy population of those PersistentVolumeClaims with relation to VirtualMachines\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion\n+kubebuilder:resource:shortName=dv;dvs,categories=all\n+kubebuilder:subresource:status\n+kubebuilder:printcolumn:name=\"Phase\",type=\"string\",JSONPath=\".status.phase\",description=\"The phase the data volume is in\"\n+kubebuilder:printcolumn:name=\"Progress\",type=\"string\",JSONPath=\".status.progress\",description=\"Transfer progress in percentage if known, N/A otherwise\"\n+kubebuilder:printcolumn:name=\"Restarts\",type=\"integer\",JSONPath=\".status.restartCount\",description=\"The number of times the transfer has been restarted.\"\n+kubebuilder:printcolumn:name=\"Age\",type=\"date\",JSONPath=\".metadata.creationTimestamp\"",
"status": "+optional",
}
}
func (DataVolumeSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSpec defines the DataVolume type specification",
"source": "Source is the src of the data for the requested DataVolume\n+optional",
"sourceRef": "SourceRef is an indirect reference to the source of data for the requested DataVolume\n+optional",
"pvc": "PVC is the PVC specification",
"storage": "Storage is the requested storage specification",
"priorityClassName": "PriorityClassName for Importer, Cloner and Uploader pod",
"contentType": "DataVolumeContentType options: \"kubevirt\", \"archive\"\n+kubebuilder:validation:Enum=\"kubevirt\";\"archive\"",
"checkpoints": "Checkpoints is a list of DataVolumeCheckpoints, representing stages in a multistage import.",
"finalCheckpoint": "FinalCheckpoint indicates whether the current DataVolumeCheckpoint is the final checkpoint.",
"preallocation": "Preallocation controls whether storage for DataVolumes should be allocated in advance.",
}
}
func (StorageSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "StorageSpec defines the Storage type specification",
"accessModes": "AccessModes contains the desired access modes the volume should have.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1\n+optional",
"selector": "A label query over volumes to consider for binding.\n+optional",
"resources": "Resources represents the minimum resources the volume should have.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources\n+optional",
"volumeName": "VolumeName is the binding reference to the PersistentVolume backing this claim.\n+optional",
"storageClassName": "Name of the StorageClass required by the claim.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1\n+optional",
"volumeMode": "volumeMode defines what type of volume is required by the claim.\nValue of Filesystem is implied when not included in claim spec.\n+optional",
"dataSource": "This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) * An existing custom resource that implements data population (Alpha) In order to use custom resource types that implement data population, the AnyVolumeDataSource feature gate must be enabled. If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source.\nIf the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field.\n+optional",
"dataSourceRef": "Specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any local object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner.\nThis field will replace the functionality of the DataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, both fields (DataSource and DataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty.\nThere are two important differences between DataSource and DataSourceRef:\n* While DataSource only allows two specific types of objects, DataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects.\n* While DataSource ignores disallowed values (dropping them), DataSourceRef preserves all values, and generates an error if a disallowed value is specified.\n(Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled.\n+optional",
}
}
func (DataVolumeCheckpoint) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeCheckpoint defines a stage in a warm migration.",
"previous": "Previous is the identifier of the snapshot from the previous checkpoint.",
"current": "Current is the identifier of the snapshot created for this checkpoint.",
}
}
func (DataVolumeSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSource represents the source for our Data Volume, this can be HTTP, Imageio, S3, GCS, Registry or an existing PVC",
}
}
func (DataVolumeSourcePVC) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourcePVC provides the parameters to create a Data Volume from an existing PVC",
"namespace": "The namespace of the source PVC",
"name": "The name of the source PVC",
}
}
func (DataVolumeSourceSnapshot) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceSnapshot provides the parameters to create a Data Volume from an existing VolumeSnapshot",
"namespace": "The namespace of the source VolumeSnapshot",
"name": "The name of the source VolumeSnapshot",
}
}
func (DataSourceRefSourceDataSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSourceRefSourceDataSource serves as a reference to another DataSource\nCan be resolved into a DataVolumeSourcePVC or a DataVolumeSourceSnapshot\nThe maximum depth of a reference chain may not exceed 1.",
"namespace": "The namespace of the source DataSource",
"name": "The name of the source DataSource",
}
}
func (DataVolumeBlankImage) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeBlankImage provides the parameters to create a new raw blank image for the PVC",
}
}
func (DataVolumeSourceUpload) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceUpload provides the parameters to create a Data Volume by uploading the source",
}
}
func (DataVolumeSourceS3) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceS3 provides the parameters to create a Data Volume from an S3 source",
"url": "URL is the url of the S3 source",
"secretRef": "SecretRef provides the secret reference needed to access the S3 source",
"certConfigMap": "CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate\n+optional",
}
}
func (DataVolumeSourceGCS) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceGCS provides the parameters to create a Data Volume from an GCS source",
"url": "URL is the url of the GCS source",
"secretRef": "SecretRef provides the secret reference needed to access the GCS source",
}
}
func (DataVolumeSourceRegistry) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceRegistry provides the parameters to create a Data Volume from an registry source",
"url": "URL is the url of the registry source (starting with the scheme: docker, oci-archive)\n+optional",
"imageStream": "ImageStream is the name of image stream for import\n+optional",
"pullMethod": "PullMethod can be either \"pod\" (default import), or \"node\" (node docker cache based import)\n+optional",
"secretRef": "SecretRef provides the secret reference needed to access the Registry source\n+optional",
"certConfigMap": "CertConfigMap provides a reference to the Registry certs\n+optional",
"platform": "Platform describes the minimum runtime requirements of the image\n+optional",
}
}
func (PlatformOptions) SwaggerDoc() map[string]string {
return map[string]string{
"architecture": "Architecture specifies the image target CPU architecture\n+optional",
}
}
func (DataVolumeSourceHTTP) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceHTTP can be either an http or https endpoint, with an optional basic auth user name and password, and an optional configmap containing additional CAs",
"url": "URL is the URL of the http(s) endpoint",
"secretRef": "SecretRef A Secret reference, the secret should contain accessKeyId (user name) base64 encoded, and secretKey (password) also base64 encoded\n+optional",
"certConfigMap": "CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate\n+optional",
"extraHeaders": "ExtraHeaders is a list of strings containing extra headers to include with HTTP transfer requests\n+optional",
"secretExtraHeaders": "SecretExtraHeaders is a list of Secret references, each containing an extra HTTP header that may include sensitive information\n+optional",
}
}
func (DataVolumeSourceImageIO) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceImageIO provides the parameters to create a Data Volume from an imageio source",
"url": "URL is the URL of the ovirt-engine",
"diskId": "DiskID provides id of a disk to be imported",
"secretRef": "SecretRef provides the secret reference needed to access the ovirt-engine",
"certConfigMap": "CertConfigMap provides a reference to the CA cert",
"insecureSkipVerify": "InsecureSkipVerify is a flag to skip certificate verification",
}
}
func (DataVolumeSourceVDDK) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceVDDK provides the parameters to create a Data Volume from a Vmware source",
"url": "URL is the URL of the vCenter or ESXi host with the VM to migrate",
"uuid": "UUID is the UUID of the virtual machine that the backing file is attached to in vCenter/ESXi",
"backingFile": "BackingFile is the path to the virtual hard disk to migrate from vCenter/ESXi",
"thumbprint": "Thumbprint is the certificate thumbprint of the vCenter or ESXi host",
"secretRef": "SecretRef provides a reference to a secret containing the username and password needed to access the vCenter or ESXi host",
"initImageURL": "InitImageURL is an optional URL to an image containing an extracted VDDK library, overrides v2v-vmware config map",
"extraArgs": "ExtraArgs is a reference to a ConfigMap containing extra arguments to pass directly to the VDDK library",
}
}
func (DataVolumeSourceRef) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeSourceRef defines an indirect reference to the source of data for the DataVolume",
"kind": "The kind of the source reference, currently only \"DataSource\" is supported",
"namespace": "The namespace of the source reference, defaults to the DataVolume namespace\n+optional",
"name": "The name of the source reference",
}
}
func (DataVolumeStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeStatus contains the current status of the DataVolume",
"claimName": "ClaimName is the name of the underlying PVC used by the DataVolume.",
"phase": "Phase is the current phase of the data volume",
"restartCount": "RestartCount is the number of times the pod populating the DataVolume has restarted",
}
}
func (DataVolumeList) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeList provides the needed parameters to do request a list of Data Volumes from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of DataVolumes",
}
}
func (DataVolumeCondition) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataVolumeCondition represents the state of a data volume condition.",
}
}
func (StorageProfile) SwaggerDoc() map[string]string {
return map[string]string{
"": "StorageProfile provides a CDI specific recommendation for storage parameters\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion\n+kubebuilder:resource:scope=Cluster\n+kubebuilder:subresource:status",
}
}
func (StorageProfileSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "StorageProfileSpec defines specification for StorageProfile",
"cloneStrategy": "CloneStrategy defines the preferred method for performing a CDI clone",
"claimPropertySets": "ClaimPropertySets is a provided set of properties applicable to PVC\n+kubebuilder:validation:MaxItems=8",
"dataImportCronSourceFormat": "DataImportCronSourceFormat defines the format of the DataImportCron-created disk image sources",
"snapshotClass": "SnapshotClass is optional specific VolumeSnapshotClass for CloneStrategySnapshot. If not set, a VolumeSnapshotClass is chosen according to the provisioner.",
}
}
func (StorageProfileStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "StorageProfileStatus provides the most recently observed status of the StorageProfile",
"storageClass": "The StorageClass name for which capabilities are defined",
"provisioner": "The Storage class provisioner plugin name",
"cloneStrategy": "CloneStrategy defines the preferred method for performing a CDI clone",
"claimPropertySets": "ClaimPropertySets computed from the spec and detected in the system\n+kubebuilder:validation:MaxItems=8",
"dataImportCronSourceFormat": "DataImportCronSourceFormat defines the format of the DataImportCron-created disk image sources",
"snapshotClass": "SnapshotClass is optional specific VolumeSnapshotClass for CloneStrategySnapshot. If not set, a VolumeSnapshotClass is chosen according to the provisioner.",
}
}
func (ClaimPropertySet) SwaggerDoc() map[string]string {
return map[string]string{
"": "ClaimPropertySet is a set of properties applicable to PVC",
"accessModes": "AccessModes contains the desired access modes the volume should have.\nMore info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1\n+kubebuilder:validation:MaxItems=4\n+kubebuilder:validation:XValidation:rule=\"self.all(am, am in ['ReadWriteOnce', 'ReadOnlyMany', 'ReadWriteMany', 'ReadWriteOncePod'])\", message=\"Illegal AccessMode\"",
"volumeMode": "VolumeMode defines what type of volume is required by the claim.\nValue of Filesystem is implied when not included in claim spec.\n+kubebuilder:validation:Enum=\"Block\";\"Filesystem\"",
}
}
func (StorageProfileList) SwaggerDoc() map[string]string {
return map[string]string{
"": "StorageProfileList provides the needed parameters to request a list of StorageProfile from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of StorageProfile",
}
}
func (DataSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSource references an import/clone source for a DataVolume\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion\n+kubebuilder:resource:shortName=das,categories=all",
}
}
func (DataSourceSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSourceSpec defines specification for DataSource",
"source": "Source is the source of the data referenced by the DataSource",
}
}
func (DataSourceSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSourceSource represents the source for our DataSource",
"pvc": "+optional",
"snapshot": "+optional",
"dataSource": "+optional",
}
}
func (DataSourceStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSourceStatus provides the most recently observed status of the DataSource",
"source": "Source is the current source of the data referenced by the DataSource",
}
}
func (DataSourceCondition) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSourceCondition represents the state of a data source condition",
}
}
func (ConditionState) SwaggerDoc() map[string]string {
return map[string]string{
"": "ConditionState represents the state of a condition",
}
}
func (DataSourceList) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataSourceList provides the needed parameters to do request a list of Data Sources from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of DataSources",
}
}
func (DataImportCron) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataImportCron defines a cron job for recurring polling/importing disk images as PVCs into a golden image namespace\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion\n+kubebuilder:resource:shortName=dic;dics,categories=all\n+kubebuilder:printcolumn:name=\"Format\",type=\"string\",JSONPath=\".status.sourceFormat\",description=\"The format in which created sources are saved\"",
}
}
func (DataImportCronSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataImportCronSpec defines specification for DataImportCron",
"template": "Template specifies template for the DVs to be created",
"schedule": "Schedule specifies in cron format when and how often to look for new imports",
"garbageCollect": "GarbageCollect specifies whether old PVCs should be cleaned up after a new PVC is imported.\nOptions are currently \"Outdated\" and \"Never\", defaults to \"Outdated\".\n+optional",
"importsToKeep": "Number of import PVCs to keep when garbage collecting. Default is 3.\n+optional",
"managedDataSource": "ManagedDataSource specifies the name of the corresponding DataSource this cron will manage.\nDataSource has to be in the same namespace.",
"retentionPolicy": "RetentionPolicy specifies whether the created DataVolumes and DataSources are retained when their DataImportCron is deleted. Default is RatainAll.\n+optional",
"createdBy": "CreatedBy is the JSON-marshaled UserInfo of the user who created this DataImportCron.\nThis field is set by the mutating webhook and cannot be set by users.\n+optional",
}
}
func (DataImportCronStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataImportCronStatus provides the most recently observed status of the DataImportCron",
"currentImports": "CurrentImports are the imports in progress. Currently only a single import is supported.",
"lastImportedPVC": "LastImportedPVC is the last imported PVC",
"lastExecutionTimestamp": "LastExecutionTimestamp is the time of the last polling",
"lastImportTimestamp": "LastImportTimestamp is the time of the last import",
"sourceFormat": "SourceFormat defines the format of the DataImportCron-created disk image sources",
}
}
func (ImportStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "ImportStatus of a currently in progress import",
"DataVolumeName": "DataVolumeName is the currently in progress import DataVolume",
"Digest": "Digest of the currently imported image",
}
}
func (DataImportCronCondition) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataImportCronCondition represents the state of a data import cron condition",
}
}
func (DataImportCronList) SwaggerDoc() map[string]string {
return map[string]string{
"": "DataImportCronList provides the needed parameters to do request a list of DataImportCrons from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of DataImportCrons",
}
}
func (VolumeImportSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeImportSource works as a specification to populate PersistentVolumeClaims with data\nimported from an HTTP/S3/Registry/Blank/ImageIO/VDDK source\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion",
"status": "+optional",
}
}
func (VolumeImportSourceSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeImportSourceSpec defines the Spec field for VolumeImportSource",
"source": "Source is the src of the data to be imported in the target PVC",
"preallocation": "Preallocation controls whether storage for the target PVC should be allocated in advance.",
"contentType": "ContentType represents the type of the imported data (Kubevirt or archive)",
"targetClaim": "TargetClaim the name of the specific claim to be populated with a multistage import.",
"checkpoints": "Checkpoints is a list of DataVolumeCheckpoints, representing stages in a multistage import.",
"finalCheckpoint": "FinalCheckpoint indicates whether the current DataVolumeCheckpoint is the final checkpoint.",
}
}
func (ImportSourceType) SwaggerDoc() map[string]string {
return map[string]string{
"": "ImportSourceType contains each one of the source types allowed in a VolumeImportSource",
}
}
func (VolumeImportSourceStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeImportSourceStatus provides the most recently observed status of the VolumeImportSource",
}
}
func (VolumeImportSourceList) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeImportSourceList provides the needed parameters to do request a list of Import Sources from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of DataSources",
}
}
func (VolumeUploadSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeUploadSource is a specification to populate PersistentVolumeClaims with upload data\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion",
"status": "+optional",
}
}
func (VolumeUploadSourceSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeUploadSourceSpec defines specification for VolumeUploadSource",
"contentType": "ContentType represents the type of the upload data (Kubevirt or archive)",
"preallocation": "Preallocation controls whether storage for the target PVC should be allocated in advance.",
}
}
func (VolumeUploadSourceStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeUploadSourceStatus provides the most recently observed status of the VolumeUploadSource",
}
}
func (VolumeUploadSourceList) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeUploadSourceList provides the needed parameters to do request a list of Upload Sources from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of DataSources",
}
}
func (VolumeCloneSource) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeCloneSource refers to a PVC/VolumeSnapshot of any storageclass/volumemode\nto be used as the source of a new PVC\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion",
}
}
func (VolumeCloneSourceSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeCloneSourceSpec defines the Spec field for VolumeCloneSource",
"source": "Source is the src of the data to be cloned to the target PVC",
"preallocation": "Preallocation controls whether storage for the target PVC should be allocated in advance.\n+optional",
"priorityClassName": "PriorityClassName is the priorityclass for the claim\n+optional",
}
}
func (VolumeCloneSourceList) SwaggerDoc() map[string]string {
return map[string]string{
"": "VolumeCloneSourceList provides the needed parameters to do request a list of VolumeCloneSources from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of DataSources",
}
}
func (CDI) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDI is the CDI Operator CRD\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion\n+kubebuilder:resource:shortName=cdi;cdis,scope=Cluster\n+kubebuilder:printcolumn:name=\"Age\",type=\"date\",JSONPath=\".metadata.creationTimestamp\"\n+kubebuilder:printcolumn:name=\"Phase\",type=\"string\",JSONPath=\".status.phase\"",
"status": "+optional",
}
}
func (CertConfig) SwaggerDoc() map[string]string {
return map[string]string{
"": "CertConfig contains the tunables for TLS certificates",
"duration": "The requested 'duration' (i.e. lifetime) of the Certificate.",
"renewBefore": "The amount of time before the currently issued certificate's `notAfter`\ntime that we will begin to attempt to renew the certificate.",
}
}
func (CDICertConfig) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDICertConfig has the CertConfigs for CDI",
"ca": "CA configuration\nCA certs are kept in the CA bundle as long as they are valid",
"server": "Server configuration\nCerts are rotated and discarded",
"client": "Client configuration\nCerts are rotated and discarded",
}
}
func (CDISpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDISpec defines our specification for the CDI installation",
"imagePullPolicy": "+kubebuilder:validation:Enum=Always;IfNotPresent;Never\nPullPolicy describes a policy for if/when to pull a container image",
"uninstallStrategy": "+kubebuilder:validation:Enum=RemoveWorkloads;BlockUninstallIfWorkloadsExist\nCDIUninstallStrategy defines the state to leave CDI on uninstall",
"infra": "Selectors and tolerations that should apply to cdi infrastructure components",
"workload": "Restrict on which nodes CDI workload pods will be scheduled",
"cloneStrategyOverride": "Clone strategy override: should we use a host-assisted copy even if snapshots are available?\n+kubebuilder:validation:Enum=\"copy\";\"snapshot\";\"csi-clone\"",
"config": "CDIConfig at CDI level",
"certConfig": "certificate configuration",
"priorityClass": "PriorityClass of the CDI control plane",
}
}
func (ComponentConfig) SwaggerDoc() map[string]string {
return map[string]string{
"": "ComponentConfig defines the scheduling and replicas configuration for CDI components",
"deploymentReplicas": "DeploymentReplicas set Replicas for cdi-deployment",
"apiServerReplicas": "ApiserverReplicas set Replicas for cdi-apiserver",
"uploadProxyReplicas": "UploadproxyReplicas set Replicas for cdi-uploadproxy",
}
}
func (CustomizeComponents) SwaggerDoc() map[string]string {
return map[string]string{
"": "CustomizeComponents defines patches for components deployed by the CDI operator.",
"patches": "+listType=atomic",
"flags": "Configure the value used for deployment and daemonset resources",
}
}
func (Flags) SwaggerDoc() map[string]string {
return map[string]string{
"": "Flags will create a patch that will replace all flags for the container's\ncommand field. The only flags that will be used are those define. There are no\nguarantees around forward/backward compatibility. If set incorrectly this will\ncause the resource when rolled out to error until flags are updated.",
}
}
func (CustomizeComponentsPatch) SwaggerDoc() map[string]string {
return map[string]string{
"": "CustomizeComponentsPatch defines a patch for some resource.",
"resourceName": "+kubebuilder:validation:MinLength=1",
"resourceType": "+kubebuilder:validation:MinLength=1",
}
}
func (CDIStatus) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDIStatus defines the status of the installation",
}
}
func (CDIList) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDIList provides the needed parameters to do request a list of CDIs from the system\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object",
"items": "Items provides a list of CDIs",
}
}
func (CDIConfig) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDIConfig provides a user configuration for CDI\n+genclient\n+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object\n+kubebuilder:object:root=true\n+kubebuilder:storageversion\n+kubebuilder:resource:scope=Cluster",
}
}
func (FilesystemOverhead) SwaggerDoc() map[string]string {
return map[string]string{
"": "FilesystemOverhead defines the reserved size for PVCs with VolumeMode: Filesystem",
"global": "Global is how much space of a Filesystem volume should be reserved for overhead. This value is used unless overridden by a more specific value (per storageClass)",
"storageClass": "StorageClass specifies how much space of a Filesystem volume should be reserved for safety. The keys are the storageClass and the values are the overhead. This value overrides the global value",
}
}
func (CDIConfigSpec) SwaggerDoc() map[string]string {
return map[string]string{
"": "CDIConfigSpec defines specification for user configuration",
"uploadProxyURLOverride": "Override the URL used when uploading to a DataVolume",
"importProxy": "ImportProxy contains importer pod proxy configuration.\n+optional",
"scratchSpaceStorageClass": "Override the storage class to used for scratch space during transfer operations. The scratch space storage class is determined in the following order: 1. value of scratchSpaceStorageClass, if that doesn't exist, use the default storage class, if there is no default storage class, use the storage class of the DataVolume, if no storage class specified, use no storage class for scratch space",
"podResourceRequirements": "ResourceRequirements describes the compute resource requirements.",
"featureGates": "FeatureGates are a list of specific enabled feature gates",
"filesystemOverhead": "FilesystemOverhead describes the space reserved for overhead when using Filesystem volumes. A value is between 0 and 1, if not defined it is 0.06 (6% overhead)",
"preallocation": "Preallocation controls whether storage for DataVolumes should be allocated in advance.",
"insecureRegistries": "InsecureRegistries is a list of TLS disabled registries",
"dataVolumeTTLSeconds": "DataVolumeTTLSeconds is the time in seconds after DataVolume completion it can be garbage collected. Disabled by default.\nDeprecated: Removed in v1.62.\n+optional",
"tlsSecurityProfile": "TLSSecurityProfile is used by operators to apply cluster-wide TLS security settings to operands.",
"imagePullSecrets": "The imagePullSecrets used to pull the container images",
"logVerbosity": "LogVerbosity overrides the default verbosity level used to initialize loggers\n+optional",
}
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types.go | /*
Copyright 2018 The CDI 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 v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
sdkapi "kubevirt.io/controller-lifecycle-operator-sdk/api"
)
// DataVolume is an abstraction on top of PersistentVolumeClaims to allow easy population of those PersistentVolumeClaims with relation to VirtualMachines
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=dv;dvs,categories=all
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The phase the data volume is in"
// +kubebuilder:printcolumn:name="Progress",type="string",JSONPath=".status.progress",description="Transfer progress in percentage if known, N/A otherwise"
// +kubebuilder:printcolumn:name="Restarts",type="integer",JSONPath=".status.restartCount",description="The number of times the transfer has been restarted."
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type DataVolume struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DataVolumeSpec `json:"spec"`
// +optional
Status DataVolumeStatus `json:"status,omitempty"`
}
// DataVolumeSpec defines the DataVolume type specification
type DataVolumeSpec struct {
//Source is the src of the data for the requested DataVolume
// +optional
Source *DataVolumeSource `json:"source,omitempty"`
//SourceRef is an indirect reference to the source of data for the requested DataVolume
// +optional
SourceRef *DataVolumeSourceRef `json:"sourceRef,omitempty"`
//PVC is the PVC specification
PVC *corev1.PersistentVolumeClaimSpec `json:"pvc,omitempty"`
// Storage is the requested storage specification
Storage *StorageSpec `json:"storage,omitempty"`
//PriorityClassName for Importer, Cloner and Uploader pod
PriorityClassName string `json:"priorityClassName,omitempty"`
//DataVolumeContentType options: "kubevirt", "archive"
// +kubebuilder:validation:Enum="kubevirt";"archive"
ContentType DataVolumeContentType `json:"contentType,omitempty"`
// Checkpoints is a list of DataVolumeCheckpoints, representing stages in a multistage import.
Checkpoints []DataVolumeCheckpoint `json:"checkpoints,omitempty"`
// FinalCheckpoint indicates whether the current DataVolumeCheckpoint is the final checkpoint.
FinalCheckpoint bool `json:"finalCheckpoint,omitempty"`
// Preallocation controls whether storage for DataVolumes should be allocated in advance.
Preallocation *bool `json:"preallocation,omitempty"`
}
// StorageSpec defines the Storage type specification
type StorageSpec struct {
// AccessModes contains the desired access modes the volume should have.
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
// +optional
AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
// A label query over volumes to consider for binding.
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// Resources represents the minimum resources the volume should have.
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
// +optional
Resources corev1.VolumeResourceRequirements `json:"resources,omitempty"`
// VolumeName is the binding reference to the PersistentVolume backing this claim.
// +optional
VolumeName string `json:"volumeName,omitempty"`
// Name of the StorageClass required by the claim.
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
// +optional
StorageClassName *string `json:"storageClassName,omitempty"`
// volumeMode defines what type of volume is required by the claim.
// Value of Filesystem is implied when not included in claim spec.
// +optional
VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode,omitempty"`
// This field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) * An existing custom resource that implements data population (Alpha) In order to use custom resource types that implement data population, the AnyVolumeDataSource feature gate must be enabled. If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source.
// If the AnyVolumeDataSource feature gate is enabled, this field will always have the same contents as the DataSourceRef field.
// +optional
DataSource *corev1.TypedLocalObjectReference `json:"dataSource,omitempty"`
// Specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any local object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner.
// This field will replace the functionality of the DataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, both fields (DataSource and DataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty.
// There are two important differences between DataSource and DataSourceRef:
// * While DataSource only allows two specific types of objects, DataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects.
// * While DataSource ignores disallowed values (dropping them), DataSourceRef preserves all values, and generates an error if a disallowed value is specified.
// (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled.
// +optional
DataSourceRef *corev1.TypedObjectReference `json:"dataSourceRef,omitempty"`
}
// PersistentVolumeFromStorageProfile means the volume mode will be auto selected by CDI according to a matching StorageProfile
const PersistentVolumeFromStorageProfile corev1.PersistentVolumeMode = "FromStorageProfile"
// DataVolumeCheckpoint defines a stage in a warm migration.
type DataVolumeCheckpoint struct {
// Previous is the identifier of the snapshot from the previous checkpoint.
Previous string `json:"previous"`
// Current is the identifier of the snapshot created for this checkpoint.
Current string `json:"current"`
}
// DataVolumeContentType represents the types of the imported data
type DataVolumeContentType string
const (
// DataVolumeKubeVirt is the content-type of the imported file, defaults to kubevirt
DataVolumeKubeVirt DataVolumeContentType = "kubevirt"
// DataVolumeArchive is the content-type to specify if there is a need to extract the imported archive
DataVolumeArchive DataVolumeContentType = "archive"
)
// DataVolumeSource represents the source for our Data Volume, this can be HTTP, Imageio, S3, GCS, Registry or an existing PVC
type DataVolumeSource struct {
HTTP *DataVolumeSourceHTTP `json:"http,omitempty"`
S3 *DataVolumeSourceS3 `json:"s3,omitempty"`
GCS *DataVolumeSourceGCS `json:"gcs,omitempty"`
Registry *DataVolumeSourceRegistry `json:"registry,omitempty"`
PVC *DataVolumeSourcePVC `json:"pvc,omitempty"`
Upload *DataVolumeSourceUpload `json:"upload,omitempty"`
Blank *DataVolumeBlankImage `json:"blank,omitempty"`
Imageio *DataVolumeSourceImageIO `json:"imageio,omitempty"`
VDDK *DataVolumeSourceVDDK `json:"vddk,omitempty"`
Snapshot *DataVolumeSourceSnapshot `json:"snapshot,omitempty"`
}
// DataVolumeSourcePVC provides the parameters to create a Data Volume from an existing PVC
type DataVolumeSourcePVC struct {
// The namespace of the source PVC
Namespace string `json:"namespace"`
// The name of the source PVC
Name string `json:"name"`
}
// DataVolumeSourceSnapshot provides the parameters to create a Data Volume from an existing VolumeSnapshot
type DataVolumeSourceSnapshot struct {
// The namespace of the source VolumeSnapshot
Namespace string `json:"namespace"`
// The name of the source VolumeSnapshot
Name string `json:"name"`
}
// DataSourceRefSourceDataSource serves as a reference to another DataSource
// Can be resolved into a DataVolumeSourcePVC or a DataVolumeSourceSnapshot
// The maximum depth of a reference chain may not exceed 1.
type DataSourceRefSourceDataSource struct {
// The namespace of the source DataSource
Namespace string `json:"namespace"`
// The name of the source DataSource
Name string `json:"name"`
}
// DataVolumeBlankImage provides the parameters to create a new raw blank image for the PVC
type DataVolumeBlankImage struct{}
// DataVolumeSourceUpload provides the parameters to create a Data Volume by uploading the source
type DataVolumeSourceUpload struct {
}
// DataVolumeSourceS3 provides the parameters to create a Data Volume from an S3 source
type DataVolumeSourceS3 struct {
//URL is the url of the S3 source
URL string `json:"url"`
//SecretRef provides the secret reference needed to access the S3 source
SecretRef string `json:"secretRef,omitempty"`
// CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate
// +optional
CertConfigMap string `json:"certConfigMap,omitempty"`
}
// DataVolumeSourceGCS provides the parameters to create a Data Volume from an GCS source
type DataVolumeSourceGCS struct {
//URL is the url of the GCS source
URL string `json:"url"`
//SecretRef provides the secret reference needed to access the GCS source
SecretRef string `json:"secretRef,omitempty"`
}
// DataVolumeSourceRegistry provides the parameters to create a Data Volume from an registry source
type DataVolumeSourceRegistry struct {
//URL is the url of the registry source (starting with the scheme: docker, oci-archive)
// +optional
URL *string `json:"url,omitempty"`
//ImageStream is the name of image stream for import
// +optional
ImageStream *string `json:"imageStream,omitempty"`
//PullMethod can be either "pod" (default import), or "node" (node docker cache based import)
// +optional
PullMethod *RegistryPullMethod `json:"pullMethod,omitempty"`
//SecretRef provides the secret reference needed to access the Registry source
// +optional
SecretRef *string `json:"secretRef,omitempty"`
//CertConfigMap provides a reference to the Registry certs
// +optional
CertConfigMap *string `json:"certConfigMap,omitempty"`
//Platform describes the minimum runtime requirements of the image
// +optional
Platform *PlatformOptions `json:"platform,omitempty"`
}
type PlatformOptions struct {
//Architecture specifies the image target CPU architecture
// +optional
Architecture string `json:"architecture,omitempty"`
}
const (
// RegistrySchemeDocker is docker scheme prefix
RegistrySchemeDocker = "docker"
// RegistrySchemeOci is oci-archive scheme prefix
RegistrySchemeOci = "oci-archive"
)
// RegistryPullMethod represents the registry import pull method
type RegistryPullMethod string
const (
// RegistryPullPod is the standard import
RegistryPullPod RegistryPullMethod = "pod"
// RegistryPullNode is the node docker cache based import
RegistryPullNode RegistryPullMethod = "node"
)
// DataVolumeSourceHTTP can be either an http or https endpoint, with an optional basic auth user name and password, and an optional configmap containing additional CAs
type DataVolumeSourceHTTP struct {
// URL is the URL of the http(s) endpoint
URL string `json:"url"`
// SecretRef A Secret reference, the secret should contain accessKeyId (user name) base64 encoded, and secretKey (password) also base64 encoded
// +optional
SecretRef string `json:"secretRef,omitempty"`
// CertConfigMap is a configmap reference, containing a Certificate Authority(CA) public key, and a base64 encoded pem certificate
// +optional
CertConfigMap string `json:"certConfigMap,omitempty"`
// ExtraHeaders is a list of strings containing extra headers to include with HTTP transfer requests
// +optional
ExtraHeaders []string `json:"extraHeaders,omitempty"`
// SecretExtraHeaders is a list of Secret references, each containing an extra HTTP header that may include sensitive information
// +optional
SecretExtraHeaders []string `json:"secretExtraHeaders,omitempty"`
}
// DataVolumeSourceImageIO provides the parameters to create a Data Volume from an imageio source
type DataVolumeSourceImageIO struct {
//URL is the URL of the ovirt-engine
URL string `json:"url"`
// DiskID provides id of a disk to be imported
DiskID string `json:"diskId"`
//SecretRef provides the secret reference needed to access the ovirt-engine
SecretRef string `json:"secretRef,omitempty"`
//CertConfigMap provides a reference to the CA cert
CertConfigMap string `json:"certConfigMap,omitempty"`
// InsecureSkipVerify is a flag to skip certificate verification
InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty"`
}
// DataVolumeSourceVDDK provides the parameters to create a Data Volume from a Vmware source
type DataVolumeSourceVDDK struct {
// URL is the URL of the vCenter or ESXi host with the VM to migrate
URL string `json:"url,omitempty"`
// UUID is the UUID of the virtual machine that the backing file is attached to in vCenter/ESXi
UUID string `json:"uuid,omitempty"`
// BackingFile is the path to the virtual hard disk to migrate from vCenter/ESXi
BackingFile string `json:"backingFile,omitempty"`
// Thumbprint is the certificate thumbprint of the vCenter or ESXi host
Thumbprint string `json:"thumbprint,omitempty"`
// SecretRef provides a reference to a secret containing the username and password needed to access the vCenter or ESXi host
SecretRef string `json:"secretRef,omitempty"`
// InitImageURL is an optional URL to an image containing an extracted VDDK library, overrides v2v-vmware config map
InitImageURL string `json:"initImageURL,omitempty"`
// ExtraArgs is a reference to a ConfigMap containing extra arguments to pass directly to the VDDK library
ExtraArgs string `json:"extraArgs,omitempty"`
}
// DataVolumeSourceRef defines an indirect reference to the source of data for the DataVolume
type DataVolumeSourceRef struct {
// The kind of the source reference, currently only "DataSource" is supported
Kind string `json:"kind"`
// The namespace of the source reference, defaults to the DataVolume namespace
// +optional
Namespace *string `json:"namespace,omitempty"`
// The name of the source reference
Name string `json:"name"`
}
const (
// DataVolumeDataSource is DataSource source reference for DataVolume
DataVolumeDataSource = "DataSource"
)
// DataVolumeStatus contains the current status of the DataVolume
type DataVolumeStatus struct {
// ClaimName is the name of the underlying PVC used by the DataVolume.
ClaimName string `json:"claimName,omitempty"`
//Phase is the current phase of the data volume
Phase DataVolumePhase `json:"phase,omitempty"`
Progress DataVolumeProgress `json:"progress,omitempty"`
// RestartCount is the number of times the pod populating the DataVolume has restarted
RestartCount int32 `json:"restartCount,omitempty"`
Conditions []DataVolumeCondition `json:"conditions,omitempty" optional:"true"`
}
// DataVolumeList provides the needed parameters to do request a list of Data Volumes from the system
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type DataVolumeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
// Items provides a list of DataVolumes
Items []DataVolume `json:"items"`
}
// DataVolumeCondition represents the state of a data volume condition.
type DataVolumeCondition struct {
Type DataVolumeConditionType `json:"type" description:"type of condition ie. Ready|Bound|Running."`
Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"`
Reason string `json:"reason,omitempty" description:"reason for the condition's last transition"`
Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`
}
// DataVolumePhase is the current phase of the DataVolume
type DataVolumePhase string
// DataVolumeProgress is the current progress of the DataVolume transfer operation. Value between 0 and 100 inclusive, N/A if not available
type DataVolumeProgress string
// DataVolumeConditionType is the string representation of known condition types
type DataVolumeConditionType string
const (
// PhaseUnset represents a data volume with no current phase
PhaseUnset DataVolumePhase = ""
// Pending represents a data volume with a current phase of Pending
Pending DataVolumePhase = "Pending"
// PVCBound represents a data volume with a current phase of PVCBound
PVCBound DataVolumePhase = "PVCBound"
// ImportScheduled represents a data volume with a current phase of ImportScheduled
ImportScheduled DataVolumePhase = "ImportScheduled"
// ImportInProgress represents a data volume with a current phase of ImportInProgress
ImportInProgress DataVolumePhase = "ImportInProgress"
// CloneScheduled represents a data volume with a current phase of CloneScheduled
CloneScheduled DataVolumePhase = "CloneScheduled"
// CloneInProgress represents a data volume with a current phase of CloneInProgress
CloneInProgress DataVolumePhase = "CloneInProgress"
// SnapshotForSmartCloneInProgress represents a data volume with a current phase of SnapshotForSmartCloneInProgress
SnapshotForSmartCloneInProgress DataVolumePhase = "SnapshotForSmartCloneInProgress"
// CloneFromSnapshotSourceInProgress represents a data volume with a current phase of CloneFromSnapshotSourceInProgress
CloneFromSnapshotSourceInProgress DataVolumePhase = "CloneFromSnapshotSourceInProgress"
// SmartClonePVCInProgress represents a data volume with a current phase of SmartClonePVCInProgress
SmartClonePVCInProgress DataVolumePhase = "SmartClonePVCInProgress"
// CSICloneInProgress represents a data volume with a current phase of CSICloneInProgress
CSICloneInProgress DataVolumePhase = "CSICloneInProgress"
// ExpansionInProgress is the state when a PVC is expanded
ExpansionInProgress DataVolumePhase = "ExpansionInProgress"
// NamespaceTransferInProgress is the state when a PVC is transferred
NamespaceTransferInProgress DataVolumePhase = "NamespaceTransferInProgress"
// UploadScheduled represents a data volume with a current phase of UploadScheduled
UploadScheduled DataVolumePhase = "UploadScheduled"
// UploadReady represents a data volume with a current phase of UploadReady
UploadReady DataVolumePhase = "UploadReady"
// WaitForFirstConsumer represents a data volume with a current phase of WaitForFirstConsumer
WaitForFirstConsumer DataVolumePhase = "WaitForFirstConsumer"
// PendingPopulation represents a data volume which should be populated by
// the CDI populators but haven't created the pvc' yet
PendingPopulation DataVolumePhase = "PendingPopulation"
// Succeeded represents a DataVolumePhase of Succeeded
Succeeded DataVolumePhase = "Succeeded"
// Failed represents a DataVolumePhase of Failed
Failed DataVolumePhase = "Failed"
// Unknown represents a DataVolumePhase of Unknown
Unknown DataVolumePhase = "Unknown"
// Paused represents a DataVolumePhase of Paused
Paused DataVolumePhase = "Paused"
// PrepClaimInProgress represents a data volume with a current phase of PrepClaimInProgress
PrepClaimInProgress DataVolumePhase = "PrepClaimInProgress"
// RebindInProgress represents a data volume with a current phase of RebindInProgress
RebindInProgress DataVolumePhase = "RebindInProgress"
// DataVolumeReady is the condition that indicates if the data volume is ready to be consumed.
DataVolumeReady DataVolumeConditionType = "Ready"
// DataVolumeBound is the condition that indicates if the underlying PVC is bound or not.
DataVolumeBound DataVolumeConditionType = "Bound"
// DataVolumeRunning is the condition that indicates if the import/upload/clone container is running.
DataVolumeRunning DataVolumeConditionType = "Running"
)
// DataVolumeCloneSourceSubresource is the subresource checked for permission to clone
const DataVolumeCloneSourceSubresource = "source"
// this has to be here otherwise informer-gen doesn't recognize it
// see https://github.com/kubernetes/code-generator/issues/59
// +genclient:nonNamespaced
// StorageProfile provides a CDI specific recommendation for storage parameters
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:subresource:status
type StorageProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec StorageProfileSpec `json:"spec"`
Status StorageProfileStatus `json:"status,omitempty"`
}
// StorageProfileSpec defines specification for StorageProfile
type StorageProfileSpec struct {
// CloneStrategy defines the preferred method for performing a CDI clone
CloneStrategy *CDICloneStrategy `json:"cloneStrategy,omitempty"`
// ClaimPropertySets is a provided set of properties applicable to PVC
// +kubebuilder:validation:MaxItems=8
ClaimPropertySets []ClaimPropertySet `json:"claimPropertySets,omitempty"`
// DataImportCronSourceFormat defines the format of the DataImportCron-created disk image sources
DataImportCronSourceFormat *DataImportCronSourceFormat `json:"dataImportCronSourceFormat,omitempty"`
// SnapshotClass is optional specific VolumeSnapshotClass for CloneStrategySnapshot. If not set, a VolumeSnapshotClass is chosen according to the provisioner.
SnapshotClass *string `json:"snapshotClass,omitempty"`
}
// StorageProfileStatus provides the most recently observed status of the StorageProfile
type StorageProfileStatus struct {
// The StorageClass name for which capabilities are defined
StorageClass *string `json:"storageClass,omitempty"`
// The Storage class provisioner plugin name
Provisioner *string `json:"provisioner,omitempty"`
// CloneStrategy defines the preferred method for performing a CDI clone
CloneStrategy *CDICloneStrategy `json:"cloneStrategy,omitempty"`
// ClaimPropertySets computed from the spec and detected in the system
// +kubebuilder:validation:MaxItems=8
ClaimPropertySets []ClaimPropertySet `json:"claimPropertySets,omitempty"`
// DataImportCronSourceFormat defines the format of the DataImportCron-created disk image sources
DataImportCronSourceFormat *DataImportCronSourceFormat `json:"dataImportCronSourceFormat,omitempty"`
// SnapshotClass is optional specific VolumeSnapshotClass for CloneStrategySnapshot. If not set, a VolumeSnapshotClass is chosen according to the provisioner.
SnapshotClass *string `json:"snapshotClass,omitempty"`
}
// ClaimPropertySet is a set of properties applicable to PVC
type ClaimPropertySet struct {
// AccessModes contains the desired access modes the volume should have.
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
// +kubebuilder:validation:MaxItems=4
// +kubebuilder:validation:XValidation:rule="self.all(am, am in ['ReadWriteOnce', 'ReadOnlyMany', 'ReadWriteMany', 'ReadWriteOncePod'])", message="Illegal AccessMode"
AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes"`
// VolumeMode defines what type of volume is required by the claim.
// Value of Filesystem is implied when not included in claim spec.
// +kubebuilder:validation:Enum="Block";"Filesystem"
VolumeMode *corev1.PersistentVolumeMode `json:"volumeMode"`
}
// StorageProfileList provides the needed parameters to request a list of StorageProfile from the system
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type StorageProfileList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
// Items provides a list of StorageProfile
Items []StorageProfile `json:"items"`
}
// DataSource references an import/clone source for a DataVolume
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=das,categories=all
type DataSource struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DataSourceSpec `json:"spec"`
Status DataSourceStatus `json:"status,omitempty"`
}
// DataSourceSpec defines specification for DataSource
type DataSourceSpec struct {
// Source is the source of the data referenced by the DataSource
Source DataSourceSource `json:"source"`
}
// DataSourceSource represents the source for our DataSource
type DataSourceSource struct {
// +optional
PVC *DataVolumeSourcePVC `json:"pvc,omitempty"`
// +optional
Snapshot *DataVolumeSourceSnapshot `json:"snapshot,omitempty"`
// +optional
DataSource *DataSourceRefSourceDataSource `json:"dataSource,omitempty"`
}
// DataSourceStatus provides the most recently observed status of the DataSource
type DataSourceStatus struct {
// Source is the current source of the data referenced by the DataSource
Source DataSourceSource `json:"source,omitempty"`
Conditions []DataSourceCondition `json:"conditions,omitempty" optional:"true"`
}
// DataSourceCondition represents the state of a data source condition
type DataSourceCondition struct {
Type DataSourceConditionType `json:"type" description:"type of condition ie. Ready"`
ConditionState `json:",inline"`
}
// DataSourceConditionType is the string representation of known condition types
type DataSourceConditionType string
const (
// DataSourceReady is the condition that indicates if the data source is ready to be consumed
DataSourceReady DataSourceConditionType = "Ready"
)
// ConditionState represents the state of a condition
type ConditionState struct {
Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime,omitempty"`
Reason string `json:"reason,omitempty" description:"reason for the condition's last transition"`
Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`
}
// DataSourceList provides the needed parameters to do request a list of Data Sources from the system
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type DataSourceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
// Items provides a list of DataSources
Items []DataSource `json:"items"`
}
// DataImportCron defines a cron job for recurring polling/importing disk images as PVCs into a golden image namespace
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=dic;dics,categories=all
// +kubebuilder:printcolumn:name="Format",type="string",JSONPath=".status.sourceFormat",description="The format in which created sources are saved"
type DataImportCron struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DataImportCronSpec `json:"spec"`
Status DataImportCronStatus `json:"status,omitempty"`
}
// DataImportCronSpec defines specification for DataImportCron
type DataImportCronSpec struct {
// Template specifies template for the DVs to be created
Template DataVolume `json:"template"`
// Schedule specifies in cron format when and how often to look for new imports
Schedule string `json:"schedule"`
// GarbageCollect specifies whether old PVCs should be cleaned up after a new PVC is imported.
// Options are currently "Outdated" and "Never", defaults to "Outdated".
// +optional
GarbageCollect *DataImportCronGarbageCollect `json:"garbageCollect,omitempty"`
// Number of import PVCs to keep when garbage collecting. Default is 3.
// +optional
ImportsToKeep *int32 `json:"importsToKeep,omitempty"`
// ManagedDataSource specifies the name of the corresponding DataSource this cron will manage.
// DataSource has to be in the same namespace.
ManagedDataSource string `json:"managedDataSource"`
// RetentionPolicy specifies whether the created DataVolumes and DataSources are retained when their DataImportCron is deleted. Default is RatainAll.
// +optional
RetentionPolicy *DataImportCronRetentionPolicy `json:"retentionPolicy,omitempty"`
// CreatedBy is the JSON-marshaled UserInfo of the user who created this DataImportCron.
// This field is set by the mutating webhook and cannot be set by users.
// +optional
CreatedBy *string `json:"createdBy,omitempty"`
}
// DataImportCronGarbageCollect represents the DataImportCron garbage collection mode
type DataImportCronGarbageCollect string
const (
// DataImportCronGarbageCollectNever specifies that garbage collection is disabled
DataImportCronGarbageCollectNever DataImportCronGarbageCollect = "Never"
// DataImportCronGarbageCollectOutdated specifies that old PVCs should be cleaned up after a new PVC is imported
DataImportCronGarbageCollectOutdated DataImportCronGarbageCollect = "Outdated"
)
// DataImportCronRetentionPolicy represents the DataImportCron retention policy
type DataImportCronRetentionPolicy string
const (
// DataImportCronRetainNone specifies that the created DataVolumes and DataSources are deleted when their DataImportCron is deleted
DataImportCronRetainNone DataImportCronRetentionPolicy = "None"
// DataImportCronRetainAll specifies that the created DataVolumes and DataSources are retained when their DataImportCron is deleted
DataImportCronRetainAll DataImportCronRetentionPolicy = "All"
)
// DataImportCronStatus provides the most recently observed status of the DataImportCron
type DataImportCronStatus struct {
// CurrentImports are the imports in progress. Currently only a single import is supported.
CurrentImports []ImportStatus `json:"currentImports,omitempty"`
// LastImportedPVC is the last imported PVC
LastImportedPVC *DataVolumeSourcePVC `json:"lastImportedPVC,omitempty"`
// LastExecutionTimestamp is the time of the last polling
LastExecutionTimestamp *metav1.Time `json:"lastExecutionTimestamp,omitempty"`
// LastImportTimestamp is the time of the last import
LastImportTimestamp *metav1.Time `json:"lastImportTimestamp,omitempty"`
// SourceFormat defines the format of the DataImportCron-created disk image sources
SourceFormat *DataImportCronSourceFormat `json:"sourceFormat,omitempty"`
Conditions []DataImportCronCondition `json:"conditions,omitempty" optional:"true"`
}
// ImportStatus of a currently in progress import
type ImportStatus struct {
// DataVolumeName is the currently in progress import DataVolume
DataVolumeName string `json:"DataVolumeName"`
// Digest of the currently imported image
Digest string `json:"Digest"`
}
// DataImportCronCondition represents the state of a data import cron condition
type DataImportCronCondition struct {
Type DataImportCronConditionType `json:"type" description:"type of condition ie. Progressing, UpToDate"`
ConditionState `json:",inline"`
}
// DataImportCronConditionType is the string representation of known condition types
type DataImportCronConditionType string
const (
// DataImportCronProgressing is the condition that indicates import is progressing
DataImportCronProgressing DataImportCronConditionType = "Progressing"
// DataImportCronUpToDate is the condition that indicates latest import is up to date
DataImportCronUpToDate DataImportCronConditionType = "UpToDate"
)
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/utils.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/utils.go | /*
Copyright 2020 The CDI 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 v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// IsPopulated indicates if the persistent volume passed in has been fully populated. It follow the following logic
// 1. If the PVC is not owned by a DataVolume, return true, we assume someone else has properly populated the image
// 2. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase succeeded return true
// 3. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase !succeeded return false
func IsPopulated(pvc *corev1.PersistentVolumeClaim, getDvFunc func(name, namespace string) (*DataVolume, error)) (bool, error) {
pvcOwner := metav1.GetControllerOf(pvc)
if pvcOwner != nil && pvcOwner.Kind == "DataVolume" {
// Find the data volume:
dv, err := getDvFunc(pvcOwner.Name, pvc.Namespace)
if err != nil {
return false, err
}
if dv.Status.Phase != Succeeded {
return false, nil
}
}
return true, nil
}
// IsSucceededOrPendingPopulation indicates if the persistent volume passed in has been fully populated or is waiting for a consumer.
// It follow the following logic
// 1. If the PVC is not owned by a DataVolume, return true, we assume someone else has properly populated the image
// 2. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase succeeded or pending population return true
// 3. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase !succeeded return false
func IsSucceededOrPendingPopulation(pvc *corev1.PersistentVolumeClaim, getDvFunc func(name, namespace string) (*DataVolume, error)) (bool, error) {
pvcOwner := metav1.GetControllerOf(pvc)
if pvcOwner != nil && pvcOwner.Kind == "DataVolume" {
// Find the data volume:
dv, err := getDvFunc(pvcOwner.Name, pvc.Namespace)
if err != nil {
return false, err
}
return dv.Status.Phase == Succeeded || dv.Status.Phase == PendingPopulation, nil
}
return true, nil
}
// IsWaitForFirstConsumerBeforePopulating indicates if the persistent volume passed in is in ClaimPending state and waiting for first consumer.
// It follow the following logic
// 1. If the PVC is not owned by a DataVolume, return false, we can not assume it will be populated
// 2. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase WaitForFirstConsumer return true
// 3. If the PVC is owned by a DataVolume, look up the DV and check the phase, if phase !WaitForFirstConsumer return false
func IsWaitForFirstConsumerBeforePopulating(pvc *corev1.PersistentVolumeClaim, getDvFunc func(name, namespace string) (*DataVolume, error)) (bool, error) {
pvcOwner := metav1.GetControllerOf(pvc)
if pvcOwner != nil && pvcOwner.Kind == "DataVolume" {
// Find the data volume:
dv, err := getDvFunc(pvcOwner.Name, pvc.Namespace)
if err != nil {
return false, err
}
if dv.Status.Phase == WaitForFirstConsumer {
return true, nil
}
}
return false, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_tlssecurityprofile.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/types_tlssecurityprofile.go | package v1beta1
// following copied from github.com/openshift/api/config/v1
// TLSSecurityProfile defines the schema for a TLS security profile. This object
// is used by operators to apply TLS security settings to operands.
// +union
type TLSSecurityProfile struct {
// type is one of Old, Intermediate, Modern or Custom. Custom provides
// the ability to specify individual TLS security profile parameters.
// Old, Intermediate and Modern are TLS security profiles based on:
//
// https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_configurations
//
// The profiles are intent based, so they may change over time as new ciphers are developed and existing ciphers
// are found to be insecure. Depending on precisely which ciphers are available to a process, the list may be
// reduced.
//
// Note that the Modern profile is currently not supported because it is not
// yet well adopted by common software libraries.
//
// +unionDiscriminator
// +optional
Type TLSProfileType `json:"type"`
// old is a TLS security profile based on:
//
// https://wiki.mozilla.org/Security/Server_Side_TLS#Old_backward_compatibility
//
// and looks like this (yaml):
//
// ciphers:
// - TLS_AES_128_GCM_SHA256
// - TLS_AES_256_GCM_SHA384
// - TLS_CHACHA20_POLY1305_SHA256
// - ECDHE-ECDSA-AES128-GCM-SHA256
// - ECDHE-RSA-AES128-GCM-SHA256
// - ECDHE-ECDSA-AES256-GCM-SHA384
// - ECDHE-RSA-AES256-GCM-SHA384
// - ECDHE-ECDSA-CHACHA20-POLY1305
// - ECDHE-RSA-CHACHA20-POLY1305
// - DHE-RSA-AES128-GCM-SHA256
// - DHE-RSA-AES256-GCM-SHA384
// - DHE-RSA-CHACHA20-POLY1305
// - ECDHE-ECDSA-AES128-SHA256
// - ECDHE-RSA-AES128-SHA256
// - ECDHE-ECDSA-AES128-SHA
// - ECDHE-RSA-AES128-SHA
// - ECDHE-ECDSA-AES256-SHA384
// - ECDHE-RSA-AES256-SHA384
// - ECDHE-ECDSA-AES256-SHA
// - ECDHE-RSA-AES256-SHA
// - DHE-RSA-AES128-SHA256
// - DHE-RSA-AES256-SHA256
// - AES128-GCM-SHA256
// - AES256-GCM-SHA384
// - AES128-SHA256
// - AES256-SHA256
// - AES128-SHA
// - AES256-SHA
// - DES-CBC3-SHA
// minTLSVersion: VersionTLS10
//
// +optional
// +nullable
Old *OldTLSProfile `json:"old,omitempty"`
// intermediate is a TLS security profile based on:
//
// https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29
//
// and looks like this (yaml):
//
// ciphers:
// - TLS_AES_128_GCM_SHA256
// - TLS_AES_256_GCM_SHA384
// - TLS_CHACHA20_POLY1305_SHA256
// - ECDHE-ECDSA-AES128-GCM-SHA256
// - ECDHE-RSA-AES128-GCM-SHA256
// - ECDHE-ECDSA-AES256-GCM-SHA384
// - ECDHE-RSA-AES256-GCM-SHA384
// - ECDHE-ECDSA-CHACHA20-POLY1305
// - ECDHE-RSA-CHACHA20-POLY1305
// - DHE-RSA-AES128-GCM-SHA256
// - DHE-RSA-AES256-GCM-SHA384
// minTLSVersion: VersionTLS12
//
// +optional
// +nullable
Intermediate *IntermediateTLSProfile `json:"intermediate,omitempty"`
// modern is a TLS security profile based on:
//
// https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility
//
// and looks like this (yaml):
//
// ciphers:
// - TLS_AES_128_GCM_SHA256
// - TLS_AES_256_GCM_SHA384
// - TLS_CHACHA20_POLY1305_SHA256
// minTLSVersion: VersionTLS13
//
// NOTE: Currently unsupported.
//
// +optional
// +nullable
Modern *ModernTLSProfile `json:"modern,omitempty"`
// custom is a user-defined TLS security profile. Be extremely careful using a custom
// profile as invalid configurations can be catastrophic. An example custom profile
// looks like this:
//
// ciphers:
// - ECDHE-ECDSA-CHACHA20-POLY1305
// - ECDHE-RSA-CHACHA20-POLY1305
// - ECDHE-RSA-AES128-GCM-SHA256
// - ECDHE-ECDSA-AES128-GCM-SHA256
// minTLSVersion: VersionTLS11
//
// +optional
// +nullable
Custom *CustomTLSProfile `json:"custom,omitempty"`
}
// OldTLSProfile is a TLS security profile based on:
// https://wiki.mozilla.org/Security/Server_Side_TLS#Old_backward_compatibility
type OldTLSProfile struct{}
// IntermediateTLSProfile is a TLS security profile based on:
// https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28default.29
type IntermediateTLSProfile struct{}
// ModernTLSProfile is a TLS security profile based on:
// https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility
type ModernTLSProfile struct{}
// CustomTLSProfile is a user-defined TLS security profile. Be extremely careful
// using a custom TLS profile as invalid configurations can be catastrophic.
type CustomTLSProfile struct {
TLSProfileSpec `json:",inline"`
}
// TLSProfileType defines a TLS security profile type.
// +kubebuilder:validation:Enum=Old;Intermediate;Modern;Custom
type TLSProfileType string
const (
// TLSProfileOldType is a TLS security profile based on:
// https://wiki.mozilla.org/Security/Server_Side_TLS#Old_backward_compatibility
TLSProfileOldType TLSProfileType = "Old"
// TLSProfileIntermediateType is a TLS security profile based on:
// https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28default.29
TLSProfileIntermediateType TLSProfileType = "Intermediate"
// TLSProfileModernType is a TLS security profile based on:
// https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility
TLSProfileModernType TLSProfileType = "Modern"
// TLSProfileCustomType is a TLS security profile that allows for user-defined parameters.
TLSProfileCustomType TLSProfileType = "Custom"
)
// TLSProfileSpec is the desired behavior of a TLSSecurityProfile.
type TLSProfileSpec struct {
// ciphers is used to specify the cipher algorithms that are negotiated
// during the TLS handshake. Operators may remove entries their operands
// do not support. For example, to use DES-CBC3-SHA (yaml):
//
// ciphers:
// - DES-CBC3-SHA
//
Ciphers []string `json:"ciphers"`
// minTLSVersion is used to specify the minimal version of the TLS protocol
// that is negotiated during the TLS handshake. For example, to use TLS
// versions 1.1, 1.2 and 1.3 (yaml):
//
// minTLSVersion: VersionTLS11
//
// NOTE: currently the highest minTLSVersion allowed is VersionTLS12
//
MinTLSVersion TLSProtocolVersion `json:"minTLSVersion"`
}
// TLSProtocolVersion is a way to specify the protocol version used for TLS connections.
// Protocol versions are based on the following most common TLS configurations:
//
// https://ssl-config.mozilla.org/
//
// Note that SSLv3.0 is not a supported protocol version due to well known
// vulnerabilities such as POODLE: https://en.wikipedia.org/wiki/POODLE
// +kubebuilder:validation:Enum=VersionTLS10;VersionTLS11;VersionTLS12;VersionTLS13
type TLSProtocolVersion string
const (
// VersionTLS10 is version 1.0 of the TLS security protocol.
VersionTLS10 TLSProtocolVersion = "VersionTLS10"
// VersionTLS11 is version 1.1 of the TLS security protocol.
VersionTLS11 TLSProtocolVersion = "VersionTLS11"
// VersionTLS12 is version 1.2 of the TLS security protocol.
VersionTLS12 TLSProtocolVersion = "VersionTLS12"
// VersionTLS13 is version 1.3 of the TLS security protocol.
VersionTLS13 TLSProtocolVersion = "VersionTLS13"
)
// TLSProfiles Contains a map of TLSProfileType names to TLSProfileSpec.
//
// NOTE: The caller needs to make sure to check that these constants are valid for their binary. Not all
// entries map to values for all binaries. In the case of ties, the kube-apiserver wins. Do not fail,
// just be sure to allowlist only and everything will be ok.
var TLSProfiles = map[TLSProfileType]*TLSProfileSpec{
TLSProfileOldType: {
Ciphers: []string{
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256",
"ECDHE-ECDSA-AES128-GCM-SHA256",
"ECDHE-RSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-AES256-GCM-SHA384",
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-ECDSA-CHACHA20-POLY1305",
"ECDHE-RSA-CHACHA20-POLY1305",
"DHE-RSA-AES128-GCM-SHA256",
"DHE-RSA-AES256-GCM-SHA384",
"DHE-RSA-CHACHA20-POLY1305",
"ECDHE-ECDSA-AES128-SHA256",
"ECDHE-RSA-AES128-SHA256",
"ECDHE-ECDSA-AES128-SHA",
"ECDHE-RSA-AES128-SHA",
"ECDHE-ECDSA-AES256-SHA384",
"ECDHE-RSA-AES256-SHA384",
"ECDHE-ECDSA-AES256-SHA",
"ECDHE-RSA-AES256-SHA",
"DHE-RSA-AES128-SHA256",
"DHE-RSA-AES256-SHA256",
"AES128-GCM-SHA256",
"AES256-GCM-SHA384",
"AES128-SHA256",
"AES256-SHA256",
"AES128-SHA",
"AES256-SHA",
"DES-CBC3-SHA",
},
MinTLSVersion: VersionTLS10,
},
TLSProfileIntermediateType: {
Ciphers: []string{
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256",
"ECDHE-ECDSA-AES128-GCM-SHA256",
"ECDHE-RSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-AES256-GCM-SHA384",
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-ECDSA-CHACHA20-POLY1305",
"ECDHE-RSA-CHACHA20-POLY1305",
"DHE-RSA-AES128-GCM-SHA256",
"DHE-RSA-AES256-GCM-SHA384",
},
MinTLSVersion: VersionTLS12,
},
TLSProfileModernType: {
Ciphers: []string{
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256",
},
MinTLSVersion: VersionTLS13,
},
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/register.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/register.go | package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"kubevirt.io/containerized-data-importer-api/pkg/apis/core"
)
// SchemeGroupVersion and GroupVersion is group version used to register these objects
var (
SchemeGroupVersion = schema.GroupVersion{Group: core.GroupName, Version: "v1beta1"}
GroupVersion = schema.GroupVersion{Group: core.GroupName, Version: "v1beta1"}
)
// CDIGroupVersionKind group version kind
var CDIGroupVersionKind = schema.GroupVersionKind{Group: SchemeGroupVersion.Group, Version: SchemeGroupVersion.Version, Kind: "CDI"}
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// SchemeBuilder tbd
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme tbd
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&DataVolume{},
&DataVolumeList{},
&CDIConfig{},
&CDIConfigList{},
&CDI{},
&CDIList{},
&StorageProfile{},
&StorageProfileList{},
&DataSource{},
&DataSourceList{},
&DataImportCron{},
&DataImportCronList{},
&ObjectTransfer{},
&ObjectTransferList{},
&VolumeImportSource{},
&VolumeImportSourceList{},
&VolumeUploadSource{},
&VolumeUploadSourceList{},
&VolumeCloneSource{},
&VolumeCloneSourceList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/authorize_utils.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/authorize_utils.go | /*
Copyright 2020 The CDI 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 v1beta1
import (
"fmt"
authentication "k8s.io/api/authentication/v1"
authorization "k8s.io/api/authorization/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
)
func newCloneSourceHandler(dataVolume *DataVolume, dsGet dsGetFunc) (CloneSourceHandler, error) {
var pvcSource *DataVolumeSourcePVC
var snapshotSource *DataVolumeSourceSnapshot
if dataVolume.Spec.Source != nil {
if dataVolume.Spec.Source.PVC != nil {
pvcSource = dataVolume.Spec.Source.PVC
} else if dataVolume.Spec.Source.Snapshot != nil {
snapshotSource = dataVolume.Spec.Source.Snapshot
}
} else if dataVolume.Spec.SourceRef != nil && dataVolume.Spec.SourceRef.Kind == DataVolumeDataSource {
ns := dataVolume.Namespace
if dataVolume.Spec.SourceRef.Namespace != nil && *dataVolume.Spec.SourceRef.Namespace != "" {
ns = *dataVolume.Spec.SourceRef.Namespace
}
dataSource, err := dsGet(ns, dataVolume.Spec.SourceRef.Name)
if err != nil {
return CloneSourceHandler{}, err
}
pvcSource = dataSource.Spec.Source.PVC
snapshotSource = dataSource.Spec.Source.Snapshot
if dataSource.Spec.Source.DataSource != nil {
pvcSource = dataSource.Status.Source.PVC
snapshotSource = dataSource.Status.Source.Snapshot
}
}
switch {
case pvcSource != nil:
return CloneSourceHandler{
CloneType: pvcClone,
TokenResource: tokenResourcePvc,
UserCloneAuthFunc: CanUserClonePVC,
SACloneAuthFunc: CanServiceAccountClonePVC,
SourceName: pvcSource.Name,
SourceNamespace: pvcSource.Namespace,
}, nil
case snapshotSource != nil:
return CloneSourceHandler{
CloneType: snapshotClone,
TokenResource: tokenResourceSnapshot,
UserCloneAuthFunc: CanUserCloneSnapshot,
SACloneAuthFunc: CanServiceAccountCloneSnapshot,
SourceName: snapshotSource.Name,
SourceNamespace: snapshotSource.Namespace,
}, nil
default:
return CloneSourceHandler{
CloneType: noClone,
}, nil
}
}
var (
tokenResourcePvc = metav1.GroupVersionResource{
Group: "",
Version: "v1",
Resource: "persistentvolumeclaims",
}
tokenResourceSnapshot = metav1.GroupVersionResource{
Group: "snapshot.storage.k8s.io",
Version: "v1",
Resource: "volumesnapshots",
}
)
type cloneType int
const (
noClone cloneType = iota
pvcClone
snapshotClone
)
// CloneSourceHandler is a helper around determining the
// correct way of authorizing a particular DataVolume
// +k8s:deepcopy-gen=false
// +k8s:openapi-gen=false
type CloneSourceHandler struct {
CloneType cloneType
TokenResource metav1.GroupVersionResource
UserCloneAuthFunc UserCloneAuthFunc
SACloneAuthFunc ServiceAccountCloneAuthFunc
SourceName string
SourceNamespace string
}
// CloneAuthResponse contains various response details
// regarding authorizing a datavolume
// +k8s:deepcopy-gen=false
// +k8s:openapi-gen=false
type CloneAuthResponse struct {
Handler CloneSourceHandler
Allowed bool
Reason string
}
type createSarFunc func(*authorization.SubjectAccessReview) (*authorization.SubjectAccessReview, error)
type dsGetFunc func(string, string) (*DataSource, error)
// AuthorizationHelperProxy proxies calls to APIs used for DV authorization
type AuthorizationHelperProxy interface {
CreateSar(*authorization.SubjectAccessReview) (*authorization.SubjectAccessReview, error)
GetNamespace(string) (*corev1.Namespace, error)
GetDataSource(string, string) (*DataSource, error)
}
// UserCloneAuthFunc represents a user clone auth func
type UserCloneAuthFunc func(createSar createSarFunc, sourceNamespace, pvcName, targetNamespace string, userInfo authentication.UserInfo) (bool, string, error)
// ServiceAccountCloneAuthFunc represents a serviceaccount clone auth func
type ServiceAccountCloneAuthFunc func(createSar createSarFunc, pvcNamespace, pvcName, saNamespace, saName string) (bool, string, error)
// CanUserClonePVC checks if a user has "appropriate" permission to clone from the given PVC
func CanUserClonePVC(createSar createSarFunc, sourceNamespace, pvcName, targetNamespace string,
userInfo authentication.UserInfo) (bool, string, error) {
if sourceNamespace == targetNamespace {
return true, "", nil
}
var newExtra map[string]authorization.ExtraValue
if len(userInfo.Extra) > 0 {
newExtra = make(map[string]authorization.ExtraValue)
for k, v := range userInfo.Extra {
newExtra[k] = authorization.ExtraValue(v)
}
}
sarSpec := authorization.SubjectAccessReviewSpec{
User: userInfo.Username,
Groups: userInfo.Groups,
Extra: newExtra,
}
return sendSubjectAccessReviewsPvc(createSar, sourceNamespace, pvcName, sarSpec)
}
// CanServiceAccountClonePVC checks if a ServiceAccount has "appropriate" permission to clone from the given PVC
func CanServiceAccountClonePVC(createSar createSarFunc, pvcNamespace, pvcName, saNamespace, saName string) (bool, string, error) {
if pvcNamespace == saNamespace {
return true, "", nil
}
user := fmt.Sprintf("system:serviceaccount:%s:%s", saNamespace, saName)
sarSpec := authorization.SubjectAccessReviewSpec{
User: user,
Groups: []string{
"system:serviceaccounts",
"system:serviceaccounts:" + saNamespace,
"system:authenticated",
},
}
return sendSubjectAccessReviewsPvc(createSar, pvcNamespace, pvcName, sarSpec)
}
// CanUserCloneSnapshot checks if a user has "appropriate" permission to clone from the given snapshot
func CanUserCloneSnapshot(createSar createSarFunc, sourceNamespace, pvcName, targetNamespace string,
userInfo authentication.UserInfo) (bool, string, error) {
if sourceNamespace == targetNamespace {
return true, "", nil
}
var newExtra map[string]authorization.ExtraValue
if len(userInfo.Extra) > 0 {
newExtra = make(map[string]authorization.ExtraValue)
for k, v := range userInfo.Extra {
newExtra[k] = authorization.ExtraValue(v)
}
}
sarSpec := authorization.SubjectAccessReviewSpec{
User: userInfo.Username,
Groups: userInfo.Groups,
Extra: newExtra,
}
return sendSubjectAccessReviewsSnapshot(createSar, sourceNamespace, pvcName, sarSpec)
}
// CanServiceAccountCloneSnapshot checks if a ServiceAccount has "appropriate" permission to clone from the given snapshot
func CanServiceAccountCloneSnapshot(createSar createSarFunc, pvcNamespace, pvcName, saNamespace, saName string) (bool, string, error) {
if pvcNamespace == saNamespace {
return true, "", nil
}
user := fmt.Sprintf("system:serviceaccount:%s:%s", saNamespace, saName)
sarSpec := authorization.SubjectAccessReviewSpec{
User: user,
Groups: []string{
"system:serviceaccounts",
"system:serviceaccounts:" + saNamespace,
"system:authenticated",
},
}
return sendSubjectAccessReviewsSnapshot(createSar, pvcNamespace, pvcName, sarSpec)
}
func sendSubjectAccessReviewsPvc(createSar createSarFunc, namespace, name string, sarSpec authorization.SubjectAccessReviewSpec) (bool, string, error) {
allowed := false
for _, ra := range getResourceAttributesPvc(namespace, name) {
sar := &authorization.SubjectAccessReview{
Spec: sarSpec,
}
sar.Spec.ResourceAttributes = &ra
klog.V(3).Infof("Sending SubjectAccessReview %+v", sar)
response, err := createSar(sar)
if err != nil {
return false, "", err
}
klog.V(3).Infof("SubjectAccessReview response %+v", response)
if response.Status.Allowed {
allowed = true
break
}
}
if !allowed {
return false, fmt.Sprintf("User %s has insufficient permissions in clone source namespace %s", sarSpec.User, namespace), nil
}
return true, "", nil
}
func sendSubjectAccessReviewsSnapshot(createSar createSarFunc, namespace, name string, sarSpec authorization.SubjectAccessReviewSpec) (bool, string, error) {
// Either explicitly allowed
sar := &authorization.SubjectAccessReview{
Spec: sarSpec,
}
explicitResourceAttr := getExplicitResourceAttributeSnapshot(namespace, name)
sar.Spec.ResourceAttributes = &explicitResourceAttr
klog.V(3).Infof("Sending SubjectAccessReview %+v", sar)
response, err := createSar(sar)
if err != nil {
return false, "", err
}
klog.V(3).Infof("SubjectAccessReview response %+v", response)
if response.Status.Allowed {
return true, "", nil
}
// Or both implicit conditions hold
for _, ra := range getImplicitResourceAttributesSnapshot(namespace, name) {
sar = &authorization.SubjectAccessReview{
Spec: sarSpec,
}
sar.Spec.ResourceAttributes = &ra
klog.V(3).Infof("Sending SubjectAccessReview %+v", sar)
response, err = createSar(sar)
if err != nil {
return false, "", err
}
klog.V(3).Infof("SubjectAccessReview response %+v", response)
if !response.Status.Allowed {
return false, fmt.Sprintf("User %s has insufficient permissions in clone source namespace %s", sarSpec.User, namespace), nil
}
}
return true, "", nil
}
func getResourceAttributesPvc(namespace, name string) []authorization.ResourceAttributes {
return []authorization.ResourceAttributes{
{
Namespace: namespace,
Verb: "create",
Group: SchemeGroupVersion.Group,
Resource: "datavolumes",
Subresource: DataVolumeCloneSourceSubresource,
Name: name,
},
{
Namespace: namespace,
Verb: "create",
Resource: "pods",
Name: name,
},
}
}
func getExplicitResourceAttributeSnapshot(namespace, name string) authorization.ResourceAttributes {
return authorization.ResourceAttributes{
Namespace: namespace,
Verb: "create",
Group: SchemeGroupVersion.Group,
Resource: "datavolumes",
Subresource: DataVolumeCloneSourceSubresource,
Name: name,
}
}
func getImplicitResourceAttributesSnapshot(namespace, name string) []authorization.ResourceAttributes {
return []authorization.ResourceAttributes{
{
Namespace: namespace,
Verb: "create",
Resource: "pods",
Name: name,
},
{
Namespace: namespace,
Verb: "create",
Resource: "pvcs",
Name: name,
},
}
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/doc.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/doc.go | // +k8s:deepcopy-gen=package
// +k8s:openapi-gen=true
// Package v1beta1 is the v1beta1 version of the API.
// +groupName=cdi.kubevirt.io
package v1beta1
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/authorize.go | vendor/kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1/authorize.go | /*
Copyright 2020 The CDI 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 v1beta1
import (
"errors"
authentication "k8s.io/api/authentication/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
"kubevirt.io/containerized-data-importer-api/pkg/apis/core"
)
const (
// AnnPrePopulated is a PVC annotation telling the datavolume controller that the PVC is already populated
AnnPrePopulated = core.GroupName + "/storage.prePopulated"
// AnnCheckStaticVolume checks if a statically allocated PV exists before creating the target PVC.
// If so, PVC is still created but population is skipped
AnnCheckStaticVolume = core.GroupName + "/storage.checkStaticVolume"
)
// ErrNoTokenOkay indicates proceeding without token is allowed
// This error should only be of interest to entities that give out DataVolume tokens
var ErrNoTokenOkay = errors.New("proceeding without token is okay under the circumstances")
// AuthorizeUser indicates if the creating user is authorized to create the data volume
// For sources other than clone (import/upload/etc), this is a no-op
func (dv *DataVolume) AuthorizeUser(requestNamespace, requestName string, proxy AuthorizationHelperProxy, userInfo authentication.UserInfo) (CloneAuthResponse, error) {
_, prePopulated := dv.Annotations[AnnPrePopulated]
_, checkStaticVolume := dv.Annotations[AnnCheckStaticVolume]
noTokenOkay := prePopulated || checkStaticVolume
targetNamespace, targetName := dv.Namespace, dv.Name
if targetNamespace == "" {
targetNamespace = requestNamespace
}
if targetName == "" {
targetName = requestName
}
cloneSourceHandler, err := newCloneSourceHandler(dv, proxy.GetDataSource)
if err != nil {
if k8serrors.IsNotFound(err) && noTokenOkay {
// no token needed, likely since no datasource
klog.V(3).Infof("DataVolume %s/%s is pre/static populated, not adding token, no datasource", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
return CloneAuthResponse{Allowed: false, Reason: "", Handler: cloneSourceHandler}, err
}
if cloneSourceHandler.CloneType == noClone {
klog.V(3).Infof("DataVolume %s/%s not cloning", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
sourceName, sourceNamespace := cloneSourceHandler.SourceName, cloneSourceHandler.SourceNamespace
if sourceNamespace == "" {
sourceNamespace = targetNamespace
}
_, err = proxy.GetNamespace(sourceNamespace)
if err != nil {
if k8serrors.IsNotFound(err) && noTokenOkay {
// no token needed, likely since no source namespace
klog.V(3).Infof("DataVolume %s/%s is pre/static populated, not adding token, no source namespace", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
return CloneAuthResponse{Allowed: false, Reason: "", Handler: cloneSourceHandler}, err
}
ok, reason, err := cloneSourceHandler.UserCloneAuthFunc(proxy.CreateSar, sourceNamespace, sourceName, targetNamespace, userInfo)
if err != nil {
return CloneAuthResponse{Allowed: false, Reason: reason, Handler: cloneSourceHandler}, err
}
if !ok {
if noTokenOkay {
klog.V(3).Infof("DataVolume %s/%s is pre/static populated, not adding token, auth failed", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
}
return CloneAuthResponse{Allowed: ok, Reason: reason, Handler: cloneSourceHandler}, err
}
// AuthorizeSA indicates if the creating ServiceAccount is authorized to create the data volume
// For sources other than clone (import/upload/etc), this is a no-op
func (dv *DataVolume) AuthorizeSA(requestNamespace, requestName string, proxy AuthorizationHelperProxy, saNamespace, saName string) (CloneAuthResponse, error) {
_, prePopulated := dv.Annotations[AnnPrePopulated]
_, checkStaticVolume := dv.Annotations[AnnCheckStaticVolume]
noTokenOkay := prePopulated || checkStaticVolume
targetNamespace, targetName := dv.Namespace, dv.Name
if targetNamespace == "" {
targetNamespace = requestNamespace
}
if saNamespace == "" {
saNamespace = targetNamespace
}
if targetName == "" {
targetName = requestName
}
cloneSourceHandler, err := newCloneSourceHandler(dv, proxy.GetDataSource)
if err != nil {
if k8serrors.IsNotFound(err) && noTokenOkay {
// no token needed, likely since no datasource
klog.V(3).Infof("DataVolume %s/%s is pre/static populated, not adding token, no datasource", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
return CloneAuthResponse{Allowed: false, Reason: "", Handler: cloneSourceHandler}, err
}
if cloneSourceHandler.CloneType == noClone {
klog.V(3).Infof("DataVolume %s/%s not cloning", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
sourceName, sourceNamespace := cloneSourceHandler.SourceName, cloneSourceHandler.SourceNamespace
if sourceNamespace == "" {
sourceNamespace = targetNamespace
}
_, err = proxy.GetNamespace(sourceNamespace)
if err != nil {
if k8serrors.IsNotFound(err) && noTokenOkay {
// no token needed, likely since no source namespace
klog.V(3).Infof("DataVolume %s/%s is pre/static populated, not adding token, no source namespace", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
return CloneAuthResponse{Allowed: false, Reason: "", Handler: cloneSourceHandler}, err
}
ok, reason, err := cloneSourceHandler.SACloneAuthFunc(proxy.CreateSar, sourceNamespace, sourceName, saNamespace, saName)
if err != nil {
return CloneAuthResponse{Allowed: false, Reason: reason, Handler: cloneSourceHandler}, err
}
if !ok {
if noTokenOkay {
klog.V(3).Infof("DataVolume %s/%s is pre/static populated, not adding token, auth failed", targetNamespace, targetName)
return CloneAuthResponse{Allowed: true, Reason: "", Handler: cloneSourceHandler}, ErrNoTokenOkay
}
}
return CloneAuthResponse{Allowed: ok, Reason: reason, Handler: cloneSourceHandler}, err
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/domain.go | vendor/libvirt.org/go/libvirtxml/domain.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
"fmt"
"io"
"strconv"
"strings"
)
type DomainControllerPCIHole64 struct {
Size uint64 `xml:",chardata"`
Unit string `xml:"unit,attr,omitempty"`
}
type DomainControllerPCIModel struct {
Name string `xml:"name,attr"`
}
type DomainControllerPCITarget struct {
ChassisNr *uint
Chassis *uint
Port *uint
BusNr *uint
Index *uint
NUMANode *uint
Hotplug string
MemReserve *uint64
}
type DomainControllerPCI struct {
Model *DomainControllerPCIModel `xml:"model"`
Target *DomainControllerPCITarget `xml:"target"`
Hole64 *DomainControllerPCIHole64 `xml:"pcihole64"`
}
type DomainControllerUSBMaster struct {
StartPort uint `xml:"startport,attr"`
}
type DomainControllerUSB struct {
Port *uint `xml:"ports,attr"`
Master *DomainControllerUSBMaster `xml:"master"`
}
type DomainControllerVirtIOSerial struct {
Ports *uint `xml:"ports,attr"`
Vectors *uint `xml:"vectors,attr"`
}
type DomainControllerXenBus struct {
MaxGrantFrames uint `xml:"maxGrantFrames,attr,omitempty"`
MaxEventChannels uint `xml:"maxEventChannels,attr,omitempty"`
}
type DomainControllerNVME struct {
Serial string `xml:"serial,omitempty"`
}
type DomainControllerDriverIOThreads struct {
IOThread []DomainControllerDriverIOThread `xml:"iothread"`
}
type DomainControllerDriverIOThread struct {
ID uint `xml:"id,attr"`
Queues []DomainControllerDriverIOThreadQueue `xml:"queue"`
}
type DomainControllerDriverIOThreadQueue struct {
ID uint `xml:"id,attr"`
}
type DomainControllerDriver struct {
Queues *uint `xml:"queues,attr"`
CmdPerLUN *uint `xml:"cmd_per_lun,attr"`
MaxSectors *uint `xml:"max_sectors,attr"`
IOEventFD string `xml:"ioeventfd,attr,omitempty"`
IOThread uint `xml:"iothread,attr,omitempty"`
IOMMU string `xml:"iommu,attr,omitempty"`
ATS string `xml:"ats,attr,omitempty"`
Packed string `xml:"packed,attr,omitempty"`
PagePerVQ string `xml:"page_per_vq,attr,omitempty"`
IOThreads *DomainControllerDriverIOThreads `xml:"iothreads"`
}
type DomainController struct {
XMLName xml.Name `xml:"controller"`
Type string `xml:"type,attr"`
Index *uint `xml:"index,attr"`
Model string `xml:"model,attr,omitempty"`
Driver *DomainControllerDriver `xml:"driver"`
PCI *DomainControllerPCI `xml:"-"`
USB *DomainControllerUSB `xml:"-"`
VirtIOSerial *DomainControllerVirtIOSerial `xml:"-"`
XenBus *DomainControllerXenBus `xml:"-"`
NVME *DomainControllerNVME `xml:"-"`
ACPI *DomainDeviceACPI `xml:"acpi"`
Alias *DomainAlias `xml:"alias"`
Address *DomainAddress `xml:"address"`
}
type DomainDiskSecret struct {
Type string `xml:"type,attr,omitempty"`
Usage string `xml:"usage,attr,omitempty"`
UUID string `xml:"uuid,attr,omitempty"`
}
type DomainDiskAuth struct {
Username string `xml:"username,attr,omitempty"`
Secret *DomainDiskSecret `xml:"secret"`
}
type DomainDiskSourceHost struct {
Transport string `xml:"transport,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
Port string `xml:"port,attr,omitempty"`
Socket string `xml:"socket,attr,omitempty"`
}
type DomainDiskSourceSSL struct {
Verify string `xml:"verify,attr"`
}
type DomainDiskCookie struct {
Name string `xml:"name,attr"`
Value string `xml:",chardata"`
}
type DomainDiskCookies struct {
Cookies []DomainDiskCookie `xml:"cookie"`
}
type DomainDiskSourceReadahead struct {
Size string `xml:"size,attr"`
}
type DomainDiskSourceTimeout struct {
Seconds string `xml:"seconds,attr"`
}
type DomainDiskReservationsSource DomainChardevSource
type DomainDiskReservations struct {
Enabled string `xml:"enabled,attr,omitempty"`
Managed string `xml:"managed,attr,omitempty"`
Source *DomainDiskReservationsSource `xml:"source"`
}
type DomainDiskSource struct {
File *DomainDiskSourceFile `xml:"-"`
Block *DomainDiskSourceBlock `xml:"-"`
Dir *DomainDiskSourceDir `xml:"-"`
Network *DomainDiskSourceNetwork `xml:"-"`
Volume *DomainDiskSourceVolume `xml:"-"`
NVME *DomainDiskSourceNVME `xml:"-"`
VHostUser *DomainDiskSourceVHostUser `xml:"-"`
VHostVDPA *DomainDiskSourceVHostVDPA `xml:"-"`
StartupPolicy string `xml:"startupPolicy,attr,omitempty"`
Index uint `xml:"index,attr,omitempty"`
Encryption *DomainDiskEncryption `xml:"encryption"`
Reservations *DomainDiskReservations `xml:"reservations"`
Slices *DomainDiskSlices `xml:"slices"`
SSL *DomainDiskSourceSSL `xml:"ssl"`
Cookies *DomainDiskCookies `xml:"cookies"`
Readahead *DomainDiskSourceReadahead `xml:"readahead"`
Timeout *DomainDiskSourceTimeout `xml:"timeout"`
DataStore *DomainDiskDataStore `xml:"dataStore"`
}
type DomainDiskDataStore struct {
Format *DomainDiskFormat `xml:"format"`
Source *DomainDiskSource `xml:"source"`
}
type DomainDiskSlices struct {
Slices []DomainDiskSlice `xml:"slice"`
}
type DomainDiskSlice struct {
Type string `xml:"type,attr"`
Offset uint `xml:"offset,attr"`
Size uint `xml:"size,attr"`
}
type DomainDiskSourceFile struct {
File string `xml:"file,attr,omitempty"`
FDGroup string `xml:"fdgroup,attr,omitempty"`
SecLabel []DomainDeviceSecLabel `xml:"seclabel"`
}
type DomainDiskSourceNVME struct {
PCI *DomainDiskSourceNVMEPCI
}
type DomainDiskSourceNVMEPCI struct {
Managed string `xml:"managed,attr,omitempty"`
Namespace uint64 `xml:"namespace,attr,omitempty"`
Address *DomainAddressPCI `xml:"address"`
}
type DomainDiskSourceBlock struct {
Dev string `xml:"dev,attr,omitempty"`
SecLabel []DomainDeviceSecLabel `xml:"seclabel"`
}
type DomainDiskSourceDir struct {
Dir string `xml:"dir,attr,omitempty"`
}
type DomainDiskSourceNetwork struct {
Protocol string `xml:"protocol,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
Query string `xml:"query,attr,omitempty"`
TLS string `xml:"tls,attr,omitempty"`
TLSHostname string `xml:"tlsHostname,attr,omitempty"`
Hosts []DomainDiskSourceHost `xml:"host"`
Identity *DomainDiskSourceNetworkIdentity `xml:"identity"`
KnownHosts *DomainDiskSourceNetworkKnownHosts `xml:"knownHosts"`
Initiator *DomainDiskSourceNetworkInitiator `xml:"initiator"`
Snapshot *DomainDiskSourceNetworkSnapshot `xml:"snapshot"`
Config *DomainDiskSourceNetworkConfig `xml:"config"`
Reconnect *DomainDiskSourceNetworkReconnect `xml:"reconnect"`
Auth *DomainDiskAuth `xml:"auth"`
}
type DomainDiskSourceNetworkKnownHosts struct {
Path string `xml:"path,attr"`
}
type DomainDiskSourceNetworkIdentity struct {
User string `xml:"user,attr,omitempty"`
Group string `xml:"group,attr,omitempty"`
UserName string `xml:"username,attr,omitempty"`
Keyfile string `xml:"keyfile,attr,omitempty"`
AgentSock string `xml:"agentsock,attr,omitempty"`
}
type DomainDiskSourceNetworkInitiator struct {
IQN *DomainDiskSourceNetworkIQN `xml:"iqn"`
}
type DomainDiskSourceNetworkIQN struct {
Name string `xml:"name,attr,omitempty"`
}
type DomainDiskSourceNetworkSnapshot struct {
Name string `xml:"name,attr"`
}
type DomainDiskSourceNetworkConfig struct {
File string `xml:"file,attr"`
}
type DomainDiskSourceNetworkReconnect struct {
Delay string `xml:"delay,attr"`
}
type DomainDiskSourceVolume struct {
Pool string `xml:"pool,attr,omitempty"`
Volume string `xml:"volume,attr,omitempty"`
Mode string `xml:"mode,attr,omitempty"`
SecLabel []DomainDeviceSecLabel `xml:"seclabel"`
}
type DomainDiskSourceVHostUser DomainChardevSource
type DomainDiskSourceVHostVDPA struct {
Dev string `xml:"dev,attr"`
}
type DomainDiskMetadataCache struct {
MaxSize *DomainDiskMetadataCacheSize `xml:"max_size"`
}
type DomainDiskMetadataCacheSize struct {
Unit string `xml:"unit,attr,omitempty"`
Value int `xml:",cdata"`
}
type DomainDiskIOThreads struct {
IOThread []DomainDiskIOThread `xml:"iothread"`
}
type DomainDiskIOThread struct {
ID uint `xml:"id,attr"`
Queues []DomainDiskIOThreadQueue `xml:"queue"`
}
type DomainDiskIOThreadQueue struct {
ID uint `xml:"id,attr"`
}
type DomainDiskDriver struct {
Name string `xml:"name,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
Cache string `xml:"cache,attr,omitempty"`
ErrorPolicy string `xml:"error_policy,attr,omitempty"`
RErrorPolicy string `xml:"rerror_policy,attr,omitempty"`
IO string `xml:"io,attr,omitempty"`
IOEventFD string `xml:"ioeventfd,attr,omitempty"`
EventIDX string `xml:"event_idx,attr,omitempty"`
CopyOnRead string `xml:"copy_on_read,attr,omitempty"`
Discard string `xml:"discard,attr,omitempty"`
DiscardNoUnref string `xml:"discard_no_unref,attr,omitempty"`
IOThread *uint `xml:"iothread,attr"`
IOThreads *DomainDiskIOThreads `xml:"iothreads"`
DetectZeros string `xml:"detect_zeroes,attr,omitempty"`
Queues *uint `xml:"queues,attr"`
QueueSize *uint `xml:"queue_size,attr"`
IOMMU string `xml:"iommu,attr,omitempty"`
ATS string `xml:"ats,attr,omitempty"`
Packed string `xml:"packed,attr,omitempty"`
PagePerVQ string `xml:"page_per_vq,attr,omitempty"`
MetadataCache *DomainDiskMetadataCache `xml:"metadata_cache"`
}
type DomainDiskTarget struct {
Dev string `xml:"dev,attr,omitempty"`
Bus string `xml:"bus,attr,omitempty"`
Tray string `xml:"tray,attr,omitempty"`
Removable string `xml:"removable,attr,omitempty"`
RotationRate uint `xml:"rotation_rate,attr,omitempty"`
}
type DomainDiskEncryption struct {
Format string `xml:"format,attr,omitempty"`
Engine string `xml:"engine,attr,omitempty"`
Secrets []DomainDiskSecret `xml:"secret"`
}
type DomainDiskReadOnly struct {
}
type DomainDiskShareable struct {
}
type DomainDiskTransient struct {
ShareBacking string `xml:"shareBacking,attr,omitempty"`
}
type DomainDiskIOTune struct {
TotalBytesSec uint64 `xml:"total_bytes_sec,omitempty"`
ReadBytesSec uint64 `xml:"read_bytes_sec,omitempty"`
WriteBytesSec uint64 `xml:"write_bytes_sec,omitempty"`
TotalIopsSec uint64 `xml:"total_iops_sec,omitempty"`
ReadIopsSec uint64 `xml:"read_iops_sec,omitempty"`
WriteIopsSec uint64 `xml:"write_iops_sec,omitempty"`
TotalBytesSecMax uint64 `xml:"total_bytes_sec_max,omitempty"`
ReadBytesSecMax uint64 `xml:"read_bytes_sec_max,omitempty"`
WriteBytesSecMax uint64 `xml:"write_bytes_sec_max,omitempty"`
TotalIopsSecMax uint64 `xml:"total_iops_sec_max,omitempty"`
ReadIopsSecMax uint64 `xml:"read_iops_sec_max,omitempty"`
WriteIopsSecMax uint64 `xml:"write_iops_sec_max,omitempty"`
TotalBytesSecMaxLength uint64 `xml:"total_bytes_sec_max_length,omitempty"`
ReadBytesSecMaxLength uint64 `xml:"read_bytes_sec_max_length,omitempty"`
WriteBytesSecMaxLength uint64 `xml:"write_bytes_sec_max_length,omitempty"`
TotalIopsSecMaxLength uint64 `xml:"total_iops_sec_max_length,omitempty"`
ReadIopsSecMaxLength uint64 `xml:"read_iops_sec_max_length,omitempty"`
WriteIopsSecMaxLength uint64 `xml:"write_iops_sec_max_length,omitempty"`
SizeIopsSec uint64 `xml:"size_iops_sec,omitempty"`
GroupName string `xml:"group_name,omitempty"`
}
type ThrottleFilter struct {
Group string `xml:"group,attr"`
}
type ThrottleFilters struct {
ThrottleFilter []ThrottleFilter `xml:"throttlefilter"`
}
type DomainDiskGeometry struct {
Cylinders uint `xml:"cyls,attr"`
Headers uint `xml:"heads,attr"`
Sectors uint `xml:"secs,attr"`
Trans string `xml:"trans,attr,omitempty"`
}
type DomainDiskBlockIO struct {
LogicalBlockSize uint `xml:"logical_block_size,attr,omitempty"`
PhysicalBlockSize uint `xml:"physical_block_size,attr,omitempty"`
DiscardGranularity *uint `xml:"discard_granularity,attr"`
}
type DomainDiskFormat struct {
Type string `xml:"type,attr"`
MetadataCache *DomainDiskMetadataCache `xml:"metadata_cache"`
}
type DomainDiskBackingStore struct {
Index uint `xml:"index,attr,omitempty"`
Format *DomainDiskFormat `xml:"format"`
Source *DomainDiskSource `xml:"source"`
BackingStore *DomainDiskBackingStore `xml:"backingStore"`
}
type DomainDiskMirror struct {
Job string `xml:"job,attr,omitempty"`
Ready string `xml:"ready,attr,omitempty"`
Format *DomainDiskFormat `xml:"format"`
Source *DomainDiskSource `xml:"source"`
BackingStore *DomainDiskBackingStore `xml:"backingStore"`
}
type DomainBackendDomain struct {
Name string `xml:"name,attr"`
}
type DomainDisk struct {
XMLName xml.Name `xml:"disk"`
Device string `xml:"device,attr,omitempty"`
RawIO string `xml:"rawio,attr,omitempty"`
SGIO string `xml:"sgio,attr,omitempty"`
Snapshot string `xml:"snapshot,attr,omitempty"`
Model string `xml:"model,attr,omitempty"`
Driver *DomainDiskDriver `xml:"driver"`
Auth *DomainDiskAuth `xml:"auth"`
Source *DomainDiskSource `xml:"source"`
BackingStore *DomainDiskBackingStore `xml:"backingStore"`
BackendDomain *DomainBackendDomain `xml:"backenddomain"`
Geometry *DomainDiskGeometry `xml:"geometry"`
BlockIO *DomainDiskBlockIO `xml:"blockio"`
Mirror *DomainDiskMirror `xml:"mirror"`
Target *DomainDiskTarget `xml:"target"`
IOTune *DomainDiskIOTune `xml:"iotune"`
ThrottleFilters *ThrottleFilters `xml:"throttlefilters"`
ReadOnly *DomainDiskReadOnly `xml:"readonly"`
Shareable *DomainDiskShareable `xml:"shareable"`
Transient *DomainDiskTransient `xml:"transient"`
Serial string `xml:"serial,omitempty"`
WWN string `xml:"wwn,omitempty"`
Vendor string `xml:"vendor,omitempty"`
Product string `xml:"product,omitempty"`
Encryption *DomainDiskEncryption `xml:"encryption"`
Boot *DomainDeviceBoot `xml:"boot"`
ACPI *DomainDeviceACPI `xml:"acpi"`
Alias *DomainAlias `xml:"alias"`
Address *DomainAddress `xml:"address"`
}
type DomainFilesystemDriver struct {
Type string `xml:"type,attr,omitempty"`
Format string `xml:"format,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
WRPolicy string `xml:"wrpolicy,attr,omitempty"`
IOMMU string `xml:"iommu,attr,omitempty"`
ATS string `xml:"ats,attr,omitempty"`
Packed string `xml:"packed,attr,omitempty"`
PagePerVQ string `xml:"page_per_vq,attr,omitempty"`
Queue uint `xml:"queue,attr,omitempty"`
}
type DomainFilesystemSource struct {
Mount *DomainFilesystemSourceMount `xml:"-"`
Block *DomainFilesystemSourceBlock `xml:"-"`
File *DomainFilesystemSourceFile `xml:"-"`
Template *DomainFilesystemSourceTemplate `xml:"-"`
RAM *DomainFilesystemSourceRAM `xml:"-"`
Bind *DomainFilesystemSourceBind `xml:"-"`
Volume *DomainFilesystemSourceVolume `xml:"-"`
}
type DomainFilesystemSourceMount struct {
Dir string `xml:"dir,attr,omitempty"`
Socket string `xml:"socket,attr,omitempty"`
}
type DomainFilesystemSourceBlock struct {
Dev string `xml:"dev,attr"`
}
type DomainFilesystemSourceFile struct {
File string `xml:"file,attr"`
}
type DomainFilesystemSourceTemplate struct {
Name string `xml:"name,attr"`
}
type DomainFilesystemSourceRAM struct {
Usage uint `xml:"usage,attr"`
Units string `xml:"units,attr,omitempty"`
}
type DomainFilesystemSourceBind struct {
Dir string `xml:"dir,attr"`
}
type DomainFilesystemSourceVolume struct {
Pool string `xml:"pool,attr"`
Volume string `xml:"volume,attr"`
}
type DomainFilesystemTarget struct {
Dir string `xml:"dir,attr"`
}
type DomainFilesystemReadOnly struct {
}
type DomainFilesystemSpaceHardLimit struct {
Value uint `xml:",chardata"`
Unit string `xml:"unit,attr,omitempty"`
}
type DomainFilesystemSpaceSoftLimit struct {
Value uint `xml:",chardata"`
Unit string `xml:"unit,attr,omitempty"`
}
type DomainFilesystemBinaryCache struct {
Mode string `xml:"mode,attr"`
}
type DomainFilesystemBinarySandbox struct {
Mode string `xml:"mode,attr"`
}
type DomainFilesystemBinaryLock struct {
POSIX string `xml:"posix,attr,omitempty"`
Flock string `xml:"flock,attr,omitempty"`
}
type DomainFilesystemBinaryThreadPool struct {
Size uint `xml:"size,attr,omitempty"`
}
type DomainFilesystemBinaryOpenFiles struct {
Max uint `xml:"max,attr,"`
}
type DomainFilesystemBinary struct {
Path string `xml:"path,attr,omitempty"`
XAttr string `xml:"xattr,attr,omitempty"`
Cache *DomainFilesystemBinaryCache `xml:"cache"`
Sandbox *DomainFilesystemBinarySandbox `xml:"sandbox"`
Lock *DomainFilesystemBinaryLock `xml:"lock"`
ThreadPool *DomainFilesystemBinaryThreadPool `xml:"thread_pool"`
OpenFiles *DomainFilesystemBinaryOpenFiles `xml:"openfiles"`
}
type DomainFilesystemIDMapEntry struct {
Start uint `xml:"start,attr"`
Target uint `xml:"target,attr"`
Count uint `xml:"count,attr"`
}
type DomainFilesystemIDMap struct {
UID []DomainFilesystemIDMapEntry `xml:"uid"`
GID []DomainFilesystemIDMapEntry `xml:"gid"`
}
type DomainFilesystem struct {
XMLName xml.Name `xml:"filesystem"`
AccessMode string `xml:"accessmode,attr,omitempty"`
Model string `xml:"model,attr,omitempty"`
MultiDevs string `xml:"multidevs,attr,omitempty"`
FMode string `xml:"fmode,attr,omitempty"`
DMode string `xml:"dmode,attr,omitempty"`
Driver *DomainFilesystemDriver `xml:"driver"`
Binary *DomainFilesystemBinary `xml:"binary"`
IDMap *DomainFilesystemIDMap `xml:"idmap"`
Source *DomainFilesystemSource `xml:"source"`
Target *DomainFilesystemTarget `xml:"target"`
ReadOnly *DomainFilesystemReadOnly `xml:"readonly"`
SpaceHardLimit *DomainFilesystemSpaceHardLimit `xml:"space_hard_limit"`
SpaceSoftLimit *DomainFilesystemSpaceSoftLimit `xml:"space_soft_limit"`
Boot *DomainDeviceBoot `xml:"boot"`
ACPI *DomainDeviceACPI `xml:"acpi"`
Alias *DomainAlias `xml:"alias"`
Address *DomainAddress `xml:"address"`
}
type DomainInterfaceMAC struct {
Address string `xml:"address,attr"`
Type string `xml:"type,attr,omitempty"`
Check string `xml:"check,attr,omitempty"`
}
type DomainInterfaceModel struct {
Type string `xml:"type,attr"`
}
type DomainInterfaceSourceVHostUser struct {
Chardev *DomainChardevSource `xml:"-"`
Dev string `xml:"-"`
}
type DomainInterfaceSource struct {
User *DomainInterfaceSourceUser `xml:"-"`
Ethernet *DomainInterfaceSourceEthernet `xml:"-"`
VHostUser *DomainInterfaceSourceVHostUser `xml:"-"`
Server *DomainInterfaceSourceServer `xml:"-"`
Client *DomainInterfaceSourceClient `xml:"-"`
MCast *DomainInterfaceSourceMCast `xml:"-"`
Network *DomainInterfaceSourceNetwork `xml:"-"`
Bridge *DomainInterfaceSourceBridge `xml:"-"`
Internal *DomainInterfaceSourceInternal `xml:"-"`
Direct *DomainInterfaceSourceDirect `xml:"-"`
Hostdev *DomainInterfaceSourceHostdev `xml:"-"`
UDP *DomainInterfaceSourceUDP `xml:"-"`
VDPA *DomainInterfaceSourceVDPA `xml:"-"`
Null *DomainInterfaceSourceNull `xml:"-"`
VDS *DomainInterfaceSourceVDS `xml:"-"`
}
type DomainInterfaceSourceUser struct {
Dev string `xml:"dev,attr,omitempty"`
}
type DomainInterfaceSourcePortForward struct {
Proto string `xml:"proto,attr"`
Address string `xml:"address,attr,omitempty"`
Dev string `xml:"dev,attr,omitempty"`
Ranges []DomainInterfaceSourcePortForwardRange `xml:"range"`
}
type DomainInterfaceSourcePortForwardRange struct {
Start uint `xml:"start,attr"`
End uint `xml:"end,attr,omitempty"`
To uint `xml:"to,attr,omitempty"`
Exclude string `xml:"exclude,attr,omitempty"`
}
type DomainInterfaceSourceEthernet struct {
IP []DomainInterfaceIP `xml:"ip"`
Route []DomainInterfaceRoute `xml:"route"`
}
type DomainInterfaceSourceServer struct {
Address string `xml:"address,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
Local *DomainInterfaceSourceLocal `xml:"local"`
}
type DomainInterfaceSourceClient struct {
Address string `xml:"address,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
Local *DomainInterfaceSourceLocal `xml:"local"`
}
type DomainInterfaceSourceMCast struct {
Address string `xml:"address,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
Local *DomainInterfaceSourceLocal `xml:"local"`
}
type DomainInterfaceSourceNetwork struct {
Network string `xml:"network,attr,omitempty"`
PortGroup string `xml:"portgroup,attr,omitempty"`
Bridge string `xml:"bridge,attr,omitempty"`
PortID string `xml:"portid,attr,omitempty"`
}
type DomainInterfaceSourceBridge struct {
Bridge string `xml:"bridge,attr"`
}
type DomainInterfaceSourceInternal struct {
Name string `xml:"name,attr,omitempty"`
}
type DomainInterfaceSourceDirect struct {
Dev string `xml:"dev,attr,omitempty"`
Mode string `xml:"mode,attr,omitempty"`
}
type DomainInterfaceSourceHostdev struct {
PCI *DomainHostdevSubsysPCISource `xml:"-"`
USB *DomainHostdevSubsysUSBSource `xml:"-"`
}
type DomainInterfaceSourceUDP struct {
Address string `xml:"address,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
Local *DomainInterfaceSourceLocal `xml:"local"`
}
type DomainInterfaceSourceVDPA struct {
Device string `xml:"dev,attr,omitempty"`
}
type DomainInterfaceSourceNull struct {
}
type DomainInterfaceSourceVDS struct {
SwitchID string `xml:"switchid,attr"`
PortID int `xml:"portid,attr,omitempty"`
PortGroupID string `xml:"portgroupid,attr,omitempty"`
ConnectionID int `xml:"connectionid,attr,omitempty"`
}
type DomainInterfaceSourceLocal struct {
Address string `xml:"address,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
}
type DomainInterfaceTarget struct {
Dev string `xml:"dev,attr"`
Managed string `xml:"managed,attr,omitempty"`
}
type DomainInterfaceLink struct {
State string `xml:"state,attr"`
}
type DomainDeviceBoot struct {
Order uint `xml:"order,attr"`
LoadParm string `xml:"loadparm,attr,omitempty"`
}
type DomainInterfaceScript struct {
Path string `xml:"path,attr"`
}
type DomainInterfaceDriver struct {
Name string `xml:"name,attr,omitempty"`
TXMode string `xml:"txmode,attr,omitempty"`
IOEventFD string `xml:"ioeventfd,attr,omitempty"`
EventIDX string `xml:"event_idx,attr,omitempty"`
Queues uint `xml:"queues,attr,omitempty"`
RXQueueSize uint `xml:"rx_queue_size,attr,omitempty"`
TXQueueSize uint `xml:"tx_queue_size,attr,omitempty"`
IOMMU string `xml:"iommu,attr,omitempty"`
ATS string `xml:"ats,attr,omitempty"`
Packed string `xml:"packed,attr,omitempty"`
PagePerVQ string `xml:"page_per_vq,attr,omitempty"`
RSS string `xml:"rss,attr,omitempty"`
RSSHashReport string `xml:"rss_hash_report,attr,omitempty"`
Host *DomainInterfaceDriverHost `xml:"host"`
Guest *DomainInterfaceDriverGuest `xml:"guest"`
}
type DomainInterfaceDriverHost struct {
CSum string `xml:"csum,attr,omitempty"`
GSO string `xml:"gso,attr,omitempty"`
TSO4 string `xml:"tso4,attr,omitempty"`
TSO6 string `xml:"tso6,attr,omitempty"`
ECN string `xml:"ecn,attr,omitempty"`
UFO string `xml:"ufo,attr,omitempty"`
MrgRXBuf string `xml:"mrg_rxbuf,attr,omitempty"`
}
type DomainInterfaceDriverGuest struct {
CSum string `xml:"csum,attr,omitempty"`
TSO4 string `xml:"tso4,attr,omitempty"`
TSO6 string `xml:"tso6,attr,omitempty"`
ECN string `xml:"ecn,attr,omitempty"`
UFO string `xml:"ufo,attr,omitempty"`
}
type DomainInterfaceVirtualPort struct {
Params *DomainInterfaceVirtualPortParams `xml:"parameters"`
}
type DomainInterfaceVirtualPortParams struct {
Any *DomainInterfaceVirtualPortParamsAny `xml:"-"`
VEPA8021QBG *DomainInterfaceVirtualPortParamsVEPA8021QBG `xml:"-"`
VNTag8011QBH *DomainInterfaceVirtualPortParamsVNTag8021QBH `xml:"-"`
OpenVSwitch *DomainInterfaceVirtualPortParamsOpenVSwitch `xml:"-"`
MidoNet *DomainInterfaceVirtualPortParamsMidoNet `xml:"-"`
}
type DomainInterfaceVirtualPortParamsAny struct {
ManagerID *uint `xml:"managerid,attr"`
TypeID *uint `xml:"typeid,attr"`
TypeIDVersion *uint `xml:"typeidversion,attr"`
InstanceID string `xml:"instanceid,attr,omitempty"`
ProfileID string `xml:"profileid,attr,omitempty"`
InterfaceID string `xml:"interfaceid,attr,omitempty"`
}
type DomainInterfaceVirtualPortParamsVEPA8021QBG struct {
ManagerID *uint `xml:"managerid,attr"`
TypeID *uint `xml:"typeid,attr"`
TypeIDVersion *uint `xml:"typeidversion,attr"`
InstanceID string `xml:"instanceid,attr,omitempty"`
}
type DomainInterfaceVirtualPortParamsVNTag8021QBH struct {
ProfileID string `xml:"profileid,attr,omitempty"`
}
type DomainInterfaceVirtualPortParamsOpenVSwitch struct {
InterfaceID string `xml:"interfaceid,attr,omitempty"`
ProfileID string `xml:"profileid,attr,omitempty"`
}
type DomainInterfaceVirtualPortParamsMidoNet struct {
InterfaceID string `xml:"interfaceid,attr,omitempty"`
}
type DomainInterfaceBandwidthParams struct {
Average *int `xml:"average,attr"`
Peak *int `xml:"peak,attr"`
Burst *int `xml:"burst,attr"`
Floor *int `xml:"floor,attr"`
}
type DomainInterfaceBandwidth struct {
Inbound *DomainInterfaceBandwidthParams `xml:"inbound"`
Outbound *DomainInterfaceBandwidthParams `xml:"outbound"`
}
type DomainInterfaceVLan struct {
Trunk string `xml:"trunk,attr,omitempty"`
Tags []DomainInterfaceVLanTag `xml:"tag"`
}
type DomainInterfaceVLanTag struct {
ID uint `xml:"id,attr"`
NativeMode string `xml:"nativeMode,attr,omitempty"`
}
type DomainInterfaceGuest struct {
Dev string `xml:"dev,attr,omitempty"`
Actual string `xml:"actual,attr,omitempty"`
}
type DomainInterfaceFilterRef struct {
Filter string `xml:"filter,attr"`
Parameters []DomainInterfaceFilterParam `xml:"parameter"`
}
type DomainInterfaceFilterParam struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
type DomainInterfaceBackend struct {
Type string `xml:"type,attr,omitempty"`
Tap string `xml:"tap,attr,omitempty"`
VHost string `xml:"vhost,attr,omitempty"`
LogFile string `xml:"logFile,attr,omitempty"`
Hostname string `xml:"hostname,attr,omitempty"`
FQDN string `xml:"fqdn,attr,omitempty"`
}
type DomainInterfaceTune struct {
SndBuf uint `xml:"sndbuf"`
}
type DomainInterfaceMTU struct {
Size uint `xml:"size,attr"`
}
type DomainInterfaceCoalesce struct {
RX *DomainInterfaceCoalesceRX `xml:"rx"`
}
type DomainInterfaceCoalesceRX struct {
Frames *DomainInterfaceCoalesceRXFrames `xml:"frames"`
}
type DomainInterfaceCoalesceRXFrames struct {
Max *uint `xml:"max,attr"`
}
type DomainROM struct {
Bar string `xml:"bar,attr,omitempty"`
File *string `xml:"file,attr"`
Enabled string `xml:"enabled,attr,omitempty"`
}
type DomainInterfaceIP struct {
Address string `xml:"address,attr"`
Family string `xml:"family,attr,omitempty"`
Prefix uint `xml:"prefix,attr,omitempty"`
Peer string `xml:"peer,attr,omitempty"`
}
type DomainInterfaceRoute struct {
Family string `xml:"family,attr,omitempty"`
Address string `xml:"address,attr"`
Netmask string `xml:"netmask,attr,omitempty"`
Prefix uint `xml:"prefix,attr,omitempty"`
Gateway string `xml:"gateway,attr"`
Metric uint `xml:"metric,attr,omitempty"`
}
type DomainInterfaceTeaming struct {
Type string `xml:"type,attr"`
Persistent string `xml:"persistent,attr,omitempty"`
}
type DomainInterfacePortOptions struct {
Isolated string `xml:"isolated,attr,omitempty"`
}
type DomainInterface struct {
XMLName xml.Name `xml:"interface"`
Managed string `xml:"managed,attr,omitempty"`
TrustGuestRXFilters string `xml:"trustGuestRxFilters,attr,omitempty"`
MAC *DomainInterfaceMAC `xml:"mac"`
Source *DomainInterfaceSource `xml:"source"`
Boot *DomainDeviceBoot `xml:"boot"`
VLan *DomainInterfaceVLan `xml:"vlan"`
VirtualPort *DomainInterfaceVirtualPort `xml:"virtualport"`
IP []DomainInterfaceIP `xml:"ip"`
Route []DomainInterfaceRoute `xml:"route"`
PortForward []DomainInterfaceSourcePortForward `xml:"portForward"`
Script *DomainInterfaceScript `xml:"script"`
DownScript *DomainInterfaceScript `xml:"downscript"`
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/document.go | vendor/libvirt.org/go/libvirtxml/document.go | package libvirtxml
type Document interface {
Unmarshal(doc string) error
Marshal() (string, error)
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/domain_backup.go | vendor/libvirt.org/go/libvirtxml/domain_backup.go | /* SPDX-License-Identifier: MIT */
package libvirtxml
import "encoding/xml"
type DomainBackupPullServerTCP struct {
Name string `xml:"name,attr"`
Port uint `xml:"port,attr,omitempty"`
}
type DomainBackupPullServerUNIX struct {
Socket string `xml:"socket,attr"`
}
type DomainBackupPullServerFD struct {
FDGroup string `xml:"fdgroup,attr"`
}
type DomainBackupPullServer struct {
TLS string `xml:"tls,attr,omitempty"`
TCP *DomainBackupPullServerTCP `xml:"-"`
UNIX *DomainBackupPullServerUNIX `xml:"-"`
FD *DomainBackupPullServerFD `xml:"-"`
}
type DomainBackupDiskDriver struct {
Type string `xml:"type,attr,omitempty"`
}
type DomainBackupPushDisk struct {
Name string `xml:"name,attr"`
Backup string `xml:"backup,attr,omitempty"`
BackupMode string `xml:"backupmode,attr,omitempty"`
Incremental string `xml:"incremental,attr,omitempty"`
Driver *DomainBackupDiskDriver `xml:"driver"`
Target *DomainDiskSource `xml:"target"`
}
type DomainBackupPushDisks struct {
Disks []DomainBackupPushDisk `xml:"disk"`
}
type DomainBackupPullDisk struct {
Name string `xml:"name,attr"`
Backup string `xml:"backup,attr,omitempty"`
BackupMode string `xml:"backupmode,attr,omitempty"`
Incremental string `xml:"incremental,attr,omitempty"`
ExportName string `xml:"exportname,attr,omitempty"`
ExportBitmap string `xml:"exportbitmap,attr,omitempty"`
Driver *DomainBackupDiskDriver `xml:"driver"`
Scratch *DomainDiskSource `xml:"scratch"`
}
type DomainBackupPullDisks struct {
Disks []DomainBackupPullDisk `xml:"disk"`
}
type DomainBackupPush struct {
Disks *DomainBackupPushDisks `xml:"disks"`
}
type DomainBackupPull struct {
Server *DomainBackupPullServer `xml:"server"`
Disks *DomainBackupPullDisks `xml:"disks"`
}
type DomainBackup struct {
XMLName xml.Name `xml:"domainbackup"`
Incremental string `xml:"incremental,omitempty"`
Push *DomainBackupPush `xml:"-"`
Pull *DomainBackupPull `xml:"-"`
}
type domainBackupPullServer DomainBackupPullServer
type domainBackupPullServerTCP struct {
DomainBackupPullServerTCP
domainBackupPullServer
}
type domainBackupPullServerUNIX struct {
DomainBackupPullServerUNIX
domainBackupPullServer
}
type domainBackupPullServerFD struct {
DomainBackupPullServerFD
domainBackupPullServer
}
func (a *DomainBackupPullServer) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if a.TCP != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "transport"}, "tcp",
})
tmp := domainBackupPullServerTCP{}
tmp.domainBackupPullServer = domainBackupPullServer(*a)
tmp.DomainBackupPullServerTCP = *a.TCP
return e.EncodeElement(tmp, start)
} else if a.UNIX != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "transport"}, "unix",
})
tmp := domainBackupPullServerUNIX{}
tmp.domainBackupPullServer = domainBackupPullServer(*a)
tmp.DomainBackupPullServerUNIX = *a.UNIX
return e.EncodeElement(tmp, start)
} else if a.FD != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "transport"}, "fd",
})
tmp := domainBackupPullServerFD{}
tmp.domainBackupPullServer = domainBackupPullServer(*a)
tmp.DomainBackupPullServerFD = *a.FD
return e.EncodeElement(tmp, start)
}
return nil
}
func (a *DomainBackupPullServer) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
transport, ok := getAttr(start.Attr, "transport")
if !ok {
transport = "tcp"
}
if transport == "tcp" {
var tmp domainBackupPullServerTCP
err := d.DecodeElement(&tmp, &start)
if err != nil {
return err
}
*a = DomainBackupPullServer(tmp.domainBackupPullServer)
a.TCP = &tmp.DomainBackupPullServerTCP
return nil
} else if transport == "unix" {
var tmp domainBackupPullServerUNIX
err := d.DecodeElement(&tmp, &start)
if err != nil {
return err
}
*a = DomainBackupPullServer(tmp.domainBackupPullServer)
a.UNIX = &tmp.DomainBackupPullServerUNIX
return nil
} else if transport == "fd" {
var tmp domainBackupPullServerFD
err := d.DecodeElement(&tmp, &start)
if err != nil {
return err
}
*a = DomainBackupPullServer(tmp.domainBackupPullServer)
a.FD = &tmp.DomainBackupPullServerFD
return nil
}
return nil
}
type domainBackupPushDisk DomainBackupPushDisk
func (a *DomainBackupPushDisk) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "disk"
if a.Target != nil {
if a.Target.File != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "file",
})
} else if a.Target.Block != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "block",
})
} else if a.Target.Dir != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "dir",
})
} else if a.Target.Network != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "network",
})
} else if a.Target.Volume != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "volume",
})
}
}
disk := domainBackupPushDisk(*a)
return e.EncodeElement(disk, start)
}
func (a *DomainBackupPushDisk) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if ok {
a.Target = &DomainDiskSource{}
if typ == "file" {
a.Target.File = &DomainDiskSourceFile{}
} else if typ == "block" {
a.Target.Block = &DomainDiskSourceBlock{}
} else if typ == "network" {
a.Target.Network = &DomainDiskSourceNetwork{}
} else if typ == "dir" {
a.Target.Dir = &DomainDiskSourceDir{}
} else if typ == "volume" {
a.Target.Volume = &DomainDiskSourceVolume{}
}
}
disk := domainBackupPushDisk(*a)
err := d.DecodeElement(&disk, &start)
if err != nil {
return err
}
*a = DomainBackupPushDisk(disk)
return nil
}
type domainBackupPullDisk DomainBackupPullDisk
func (a *DomainBackupPullDisk) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "disk"
if a.Scratch != nil {
if a.Scratch.File != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "file",
})
} else if a.Scratch.Block != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "block",
})
} else if a.Scratch.Dir != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "dir",
})
} else if a.Scratch.Network != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "network",
})
} else if a.Scratch.Volume != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "volume",
})
}
}
disk := domainBackupPullDisk(*a)
return e.EncodeElement(disk, start)
}
func (a *DomainBackupPullDisk) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if ok {
a.Scratch = &DomainDiskSource{}
if typ == "file" {
a.Scratch.File = &DomainDiskSourceFile{}
} else if typ == "block" {
a.Scratch.Block = &DomainDiskSourceBlock{}
} else if typ == "network" {
a.Scratch.Network = &DomainDiskSourceNetwork{}
} else if typ == "dir" {
a.Scratch.Dir = &DomainDiskSourceDir{}
} else if typ == "volume" {
a.Scratch.Volume = &DomainDiskSourceVolume{}
}
}
disk := domainBackupPullDisk(*a)
err := d.DecodeElement(&disk, &start)
if err != nil {
return err
}
*a = DomainBackupPullDisk(disk)
return nil
}
type domainBackup DomainBackup
type domainBackupPull struct {
DomainBackupPull
domainBackup
}
type domainBackupPush struct {
DomainBackupPush
domainBackup
}
func (a *DomainBackup) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "domainbackup"
if a.Push != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "mode"}, "push",
})
tmp := domainBackupPush{}
tmp.domainBackup = domainBackup(*a)
tmp.DomainBackupPush = *a.Push
return e.EncodeElement(tmp, start)
} else if a.Pull != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "mode"}, "pull",
})
tmp := domainBackupPull{}
tmp.domainBackup = domainBackup(*a)
tmp.DomainBackupPull = *a.Pull
return e.EncodeElement(tmp, start)
}
return nil
}
func (a *DomainBackup) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
mode, ok := getAttr(start.Attr, "mode")
if !ok {
mode = "push"
}
if mode == "push" {
var tmp domainBackupPush
err := d.DecodeElement(&tmp, &start)
if err != nil {
return err
}
*a = DomainBackup(tmp.domainBackup)
a.Push = &tmp.DomainBackupPush
return nil
} else if mode == "pull" {
var tmp domainBackupPull
err := d.DecodeElement(&tmp, &start)
if err != nil {
return err
}
*a = DomainBackup(tmp.domainBackup)
a.Pull = &tmp.DomainBackupPull
return nil
}
return nil
}
func (s *DomainBackup) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *DomainBackup) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/network.go | vendor/libvirt.org/go/libvirtxml/network.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Lian Duan <blazeblue@gmail.com>
*
*/
package libvirtxml
import (
"encoding/xml"
)
type NetworkBridge struct {
Name string `xml:"name,attr,omitempty"`
STP string `xml:"stp,attr,omitempty"`
Delay string `xml:"delay,attr,omitempty"`
MACTableManager string `xml:"macTableManager,attr,omitempty"`
Zone string `xml:"zone,attr,omitempty"`
}
type NetworkVirtualPort struct {
Params *NetworkVirtualPortParams `xml:"parameters"`
}
type NetworkVirtualPortParams struct {
Any *NetworkVirtualPortParamsAny `xml:"-"`
VEPA8021QBG *NetworkVirtualPortParamsVEPA8021QBG `xml:"-"`
VNTag8011QBH *NetworkVirtualPortParamsVNTag8021QBH `xml:"-"`
OpenVSwitch *NetworkVirtualPortParamsOpenVSwitch `xml:"-"`
MidoNet *NetworkVirtualPortParamsMidoNet `xml:"-"`
}
type NetworkVirtualPortParamsAny struct {
ManagerID *uint `xml:"managerid,attr"`
TypeID *uint `xml:"typeid,attr"`
TypeIDVersion *uint `xml:"typeidversion,attr"`
InstanceID string `xml:"instanceid,attr,omitempty"`
ProfileID string `xml:"profileid,attr,omitempty"`
InterfaceID string `xml:"interfaceid,attr,omitempty"`
}
type NetworkVirtualPortParamsVEPA8021QBG struct {
ManagerID *uint `xml:"managerid,attr"`
TypeID *uint `xml:"typeid,attr"`
TypeIDVersion *uint `xml:"typeidversion,attr"`
InstanceID string `xml:"instanceid,attr,omitempty"`
}
type NetworkVirtualPortParamsVNTag8021QBH struct {
ProfileID string `xml:"profileid,attr,omitempty"`
}
type NetworkVirtualPortParamsOpenVSwitch struct {
InterfaceID string `xml:"interfaceid,attr,omitempty"`
ProfileID string `xml:"profileid,attr,omitempty"`
}
type NetworkVirtualPortParamsMidoNet struct {
InterfaceID string `xml:"interfaceid,attr,omitempty"`
}
type NetworkDomain struct {
Name string `xml:"name,attr,omitempty"`
LocalOnly string `xml:"localOnly,attr,omitempty"`
}
type NetworkForwardNATAddress struct {
Start string `xml:"start,attr"`
End string `xml:"end,attr"`
}
type NetworkForwardNATPort struct {
Start uint `xml:"start,attr"`
End uint `xml:"end,attr"`
}
type NetworkForwardNAT struct {
IPv6 string `xml:"ipv6,attr,omitempty"`
Addresses []NetworkForwardNATAddress `xml:"address"`
Ports []NetworkForwardNATPort `xml:"port"`
}
type NetworkForward struct {
Mode string `xml:"mode,attr,omitempty"`
Dev string `xml:"dev,attr,omitempty"`
Managed string `xml:"managed,attr,omitempty"`
Driver *NetworkForwardDriver `xml:"driver"`
PFs []NetworkForwardPF `xml:"pf"`
NAT *NetworkForwardNAT `xml:"nat"`
Interfaces []NetworkForwardInterface `xml:"interface"`
Addresses []NetworkForwardAddress `xml:"address"`
}
type NetworkForwardDriver struct {
Name string `xml:"name,attr,omitempty"`
Model string `xml:"model,attr,omitempty"`
}
type NetworkForwardPF struct {
Dev string `xml:"dev,attr"`
}
type NetworkForwardAddress struct {
PCI *NetworkForwardAddressPCI `xml:"-"`
}
type NetworkForwardAddressPCI struct {
Domain *uint `xml:"domain,attr"`
Bus *uint `xml:"bus,attr"`
Slot *uint `xml:"slot,attr"`
Function *uint `xml:"function,attr"`
}
type NetworkForwardInterface struct {
XMLName xml.Name `xml:"interface"`
Dev string `xml:"dev,attr,omitempty"`
}
type NetworkMAC struct {
Address string `xml:"address,attr,omitempty"`
}
type NetworkDHCPRange struct {
XMLName xml.Name `xml:"range"`
Start string `xml:"start,attr,omitempty"`
End string `xml:"end,attr,omitempty"`
Lease *NetworkDHCPLease `xml:"lease"`
}
type NetworkDHCPLease struct {
Expiry uint `xml:"expiry,attr"`
Unit string `xml:"unit,attr,omitempty"`
}
type NetworkDHCPHost struct {
XMLName xml.Name `xml:"host"`
ID string `xml:"id,attr,omitempty"`
MAC string `xml:"mac,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
IP string `xml:"ip,attr,omitempty"`
Lease *NetworkDHCPLease `xml:"lease"`
}
type NetworkBootp struct {
File string `xml:"file,attr,omitempty"`
Server string `xml:"server,attr,omitempty"`
}
type NetworkDHCP struct {
Ranges []NetworkDHCPRange `xml:"range"`
Hosts []NetworkDHCPHost `xml:"host"`
Bootp []NetworkBootp `xml:"bootp"`
}
type NetworkIP struct {
Address string `xml:"address,attr,omitempty"`
Family string `xml:"family,attr,omitempty"`
Netmask string `xml:"netmask,attr,omitempty"`
Prefix uint `xml:"prefix,attr,omitempty"`
LocalPtr string `xml:"localPtr,attr,omitempty"`
DHCP *NetworkDHCP `xml:"dhcp"`
TFTP *NetworkTFTP `xml:"tftp"`
}
type NetworkTFTP struct {
Root string `xml:"root,attr,omitempty"`
}
type NetworkRoute struct {
Family string `xml:"family,attr,omitempty"`
Address string `xml:"address,attr,omitempty"`
Netmask string `xml:"netmask,attr,omitempty"`
Prefix uint `xml:"prefix,attr,omitempty"`
Gateway string `xml:"gateway,attr,omitempty"`
Metric string `xml:"metric,attr,omitempty"`
}
type NetworkDNSForwarder struct {
Domain string `xml:"domain,attr,omitempty"`
Addr string `xml:"addr,attr,omitempty"`
}
type NetworkDNSTXT struct {
XMLName xml.Name `xml:"txt"`
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
type NetworkDNSHostHostname struct {
Hostname string `xml:",chardata"`
}
type NetworkDNSHost struct {
XMLName xml.Name `xml:"host"`
IP string `xml:"ip,attr"`
Hostnames []NetworkDNSHostHostname `xml:"hostname"`
}
type NetworkDNSSRV struct {
XMLName xml.Name `xml:"srv"`
Service string `xml:"service,attr,omitempty"`
Protocol string `xml:"protocol,attr,omitempty"`
Target string `xml:"target,attr,omitempty"`
Port uint `xml:"port,attr,omitempty"`
Priority uint `xml:"priority,attr,omitempty"`
Weight uint `xml:"weight,attr,omitempty"`
Domain string `xml:"domain,attr,omitempty"`
}
type NetworkDNS struct {
Enable string `xml:"enable,attr,omitempty"`
ForwardPlainNames string `xml:"forwardPlainNames,attr,omitempty"`
Forwarders []NetworkDNSForwarder `xml:"forwarder"`
TXTs []NetworkDNSTXT `xml:"txt"`
Host []NetworkDNSHost `xml:"host"`
SRVs []NetworkDNSSRV `xml:"srv"`
}
type NetworkMetadata struct {
XML string `xml:",innerxml"`
}
type NetworkMTU struct {
Size uint `xml:"size,attr"`
}
type Network struct {
XMLName xml.Name `xml:"network"`
IPv6 string `xml:"ipv6,attr,omitempty"`
TrustGuestRxFilters string `xml:"trustGuestRxFilters,attr,omitempty"`
Name string `xml:"name,omitempty"`
UUID string `xml:"uuid,omitempty"`
Metadata *NetworkMetadata `xml:"metadata"`
Forward *NetworkForward `xml:"forward"`
Bridge *NetworkBridge `xml:"bridge"`
MTU *NetworkMTU `xml:"mtu"`
MAC *NetworkMAC `xml:"mac"`
Domain *NetworkDomain `xml:"domain"`
DNS *NetworkDNS `xml:"dns"`
VLAN *NetworkVLAN `xml:"vlan"`
Bandwidth *NetworkBandwidth `xml:"bandwidth"`
PortOptions *NetworkPortOptions `xml:"port"`
IPs []NetworkIP `xml:"ip"`
Routes []NetworkRoute `xml:"route"`
VirtualPort *NetworkVirtualPort `xml:"virtualport"`
PortGroups []NetworkPortGroup `xml:"portgroup"`
DnsmasqOptions *NetworkDnsmasqOptions
}
type NetworkPortOptions struct {
Isolated string `xml:"isolated,attr,omitempty"`
}
type NetworkPortGroup struct {
XMLName xml.Name `xml:"portgroup"`
Name string `xml:"name,attr,omitempty"`
Default string `xml:"default,attr,omitempty"`
TrustGuestRxFilters string `xml:"trustGuestRxFilters,attr,omitempty"`
VLAN *NetworkVLAN `xml:"vlan"`
VirtualPort *NetworkVirtualPort `xml:"virtualport"`
}
type NetworkVLAN struct {
Trunk string `xml:"trunk,attr,omitempty"`
Tags []NetworkVLANTag `xml:"tag"`
}
type NetworkVLANTag struct {
ID uint `xml:"id,attr"`
NativeMode string `xml:"nativeMode,attr,omitempty"`
}
type NetworkBandwidthParams struct {
Average *uint `xml:"average,attr"`
Peak *uint `xml:"peak,attr"`
Burst *uint `xml:"burst,attr"`
Floor *uint `xml:"floor,attr"`
}
type NetworkBandwidth struct {
ClassID uint `xml:"classID,attr,omitempty"`
Inbound *NetworkBandwidthParams `xml:"inbound"`
Outbound *NetworkBandwidthParams `xml:"outbound"`
}
type NetworkDnsmasqOptions struct {
XMLName xml.Name `xml:"http://libvirt.org/schemas/network/dnsmasq/1.0 options"`
Option []NetworkDnsmasqOption `xml:"option"`
}
type NetworkDnsmasqOption struct {
Value string `xml:"value,attr"`
}
func (a *NetworkVirtualPortParams) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "parameters"
if a.Any != nil {
return e.EncodeElement(a.Any, start)
} else if a.VEPA8021QBG != nil {
return e.EncodeElement(a.VEPA8021QBG, start)
} else if a.VNTag8011QBH != nil {
return e.EncodeElement(a.VNTag8011QBH, start)
} else if a.OpenVSwitch != nil {
return e.EncodeElement(a.OpenVSwitch, start)
} else if a.MidoNet != nil {
return e.EncodeElement(a.MidoNet, start)
}
return nil
}
func (a *NetworkVirtualPortParams) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
if a.Any != nil {
return d.DecodeElement(a.Any, &start)
} else if a.VEPA8021QBG != nil {
return d.DecodeElement(a.VEPA8021QBG, &start)
} else if a.VNTag8011QBH != nil {
return d.DecodeElement(a.VNTag8011QBH, &start)
} else if a.OpenVSwitch != nil {
return d.DecodeElement(a.OpenVSwitch, &start)
} else if a.MidoNet != nil {
return d.DecodeElement(a.MidoNet, &start)
}
return nil
}
type networkVirtualPort NetworkVirtualPort
func (a *NetworkVirtualPort) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "virtualport"
if a.Params != nil {
if a.Params.Any != nil {
/* no type attr wanted */
} else if a.Params.VEPA8021QBG != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "802.1Qbg",
})
} else if a.Params.VNTag8011QBH != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "802.1Qbh",
})
} else if a.Params.OpenVSwitch != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "openvswitch",
})
} else if a.Params.MidoNet != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "midonet",
})
}
}
vp := networkVirtualPort(*a)
return e.EncodeElement(&vp, start)
}
func (a *NetworkVirtualPort) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
a.Params = &NetworkVirtualPortParams{}
if !ok {
var any NetworkVirtualPortParamsAny
a.Params.Any = &any
} else if typ == "802.1Qbg" {
var vepa NetworkVirtualPortParamsVEPA8021QBG
a.Params.VEPA8021QBG = &vepa
} else if typ == "802.1Qbh" {
var vntag NetworkVirtualPortParamsVNTag8021QBH
a.Params.VNTag8011QBH = &vntag
} else if typ == "openvswitch" {
var ovs NetworkVirtualPortParamsOpenVSwitch
a.Params.OpenVSwitch = &ovs
} else if typ == "midonet" {
var mido NetworkVirtualPortParamsMidoNet
a.Params.MidoNet = &mido
}
vp := networkVirtualPort(*a)
err := d.DecodeElement(&vp, &start)
if err != nil {
return err
}
*a = NetworkVirtualPort(vp)
return nil
}
func (a *NetworkForwardAddressPCI) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
marshalUintAttr(&start, "domain", a.Domain, "0x%04x")
marshalUintAttr(&start, "bus", a.Bus, "0x%02x")
marshalUintAttr(&start, "slot", a.Slot, "0x%02x")
marshalUintAttr(&start, "function", a.Function, "0x%x")
e.EncodeToken(start)
e.EncodeToken(start.End())
return nil
}
func (a *NetworkForwardAddressPCI) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for _, attr := range start.Attr {
if attr.Name.Local == "domain" {
if err := unmarshalUintAttr(attr.Value, &a.Domain, 0); err != nil {
return err
}
} else if attr.Name.Local == "bus" {
if err := unmarshalUintAttr(attr.Value, &a.Bus, 0); err != nil {
return err
}
} else if attr.Name.Local == "slot" {
if err := unmarshalUintAttr(attr.Value, &a.Slot, 0); err != nil {
return err
}
} else if attr.Name.Local == "function" {
if err := unmarshalUintAttr(attr.Value, &a.Function, 0); err != nil {
return err
}
}
}
d.Skip()
return nil
}
func (a *NetworkForwardAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if a.PCI != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "pci",
})
return e.EncodeElement(a.PCI, start)
} else {
return nil
}
}
func (a *NetworkForwardAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var typ string
for _, attr := range start.Attr {
if attr.Name.Local == "type" {
typ = attr.Value
break
}
}
if typ == "" {
d.Skip()
return nil
}
if typ == "pci" {
a.PCI = &NetworkForwardAddressPCI{}
return d.DecodeElement(a.PCI, &start)
}
return nil
}
func (s *NetworkDHCPHost) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkDHCPHost) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *NetworkDNSHost) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkDNSHost) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *NetworkPortGroup) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkPortGroup) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *NetworkDNSTXT) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkDNSTXT) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *NetworkDNSSRV) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkDNSSRV) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *NetworkDHCPRange) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkDHCPRange) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *NetworkForwardInterface) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkForwardInterface) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (s *Network) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *Network) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/storage_encryption.go | vendor/libvirt.org/go/libvirtxml/storage_encryption.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
package libvirtxml
type StorageEncryptionSecret struct {
Type string `xml:"type,attr"`
UUID string `xml:"uuid,attr"`
}
type StorageEncryptionCipher struct {
Name string `xml:"name,attr"`
Size uint64 `xml:"size,attr"`
Mode string `xml:"mode,attr"`
Hash string `xml:"hash,attr"`
}
type StorageEncryptionIvgen struct {
Name string `xml:"name,attr"`
Hash string `xml:"hash,attr"`
}
type StorageEncryption struct {
Format string `xml:"format,attr"`
Secret *StorageEncryptionSecret `xml:"secret"`
Cipher *StorageEncryptionCipher `xml:"cipher"`
Ivgen *StorageEncryptionIvgen `xml:"ivgen"`
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/capabilities.go | vendor/libvirt.org/go/libvirtxml/capabilities.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
)
type CapsHostCPUTopology struct {
Sockets int `xml:"sockets,attr"`
Dies int `xml:"dies,attr,omitempty"`
Clusters int `xml:"clusters,attr,omitempty"`
Cores int `xml:"cores,attr"`
Threads int `xml:"threads,attr"`
}
type CapsHostCPUFeatureFlag struct {
Name string `xml:"name,attr"`
}
type CapsHostCPUPageSize struct {
Size int `xml:"size,attr"`
Unit string `xml:"unit,attr"`
}
type CapsHostCPUMicrocode struct {
Version int `xml:"version,attr"`
}
type CapsHostCPUSignature struct {
Family int `xml:"family,attr"`
Model int `xml:"model,attr"`
Stepping int `xml:"stepping,attr"`
}
type CapsHostCPUCounter struct {
Name string `xml:"name,attr"`
Frequency uint `xml:"frequency,attr"`
Scaling string `xml:"scaling,attr,omitempty"`
}
type CapsHostCPUCache struct {
Level *uint `xml:"level,attr,omitempty"`
Mode string `xml:"mode,attr"`
}
type CapsHostCPUMaxPhysAddr struct {
Mode string `xml:"mode,attr"`
Bits uint `xml:"bits,attr,omitempty"`
}
type CapsHostCPU struct {
XMLName xml.Name `xml:"cpu"`
Arch string `xml:"arch,omitempty"`
Model string `xml:"model,omitempty"`
Vendor string `xml:"vendor,omitempty"`
Microcode *CapsHostCPUMicrocode `xml:"microcode"`
Signature *CapsHostCPUSignature `xml:"signature"`
Counter *CapsHostCPUCounter `xml:"counter"`
Topology *CapsHostCPUTopology `xml:"topology"`
Cache *CapsHostCPUCache `xml:"cache"`
MaxPhysAddr *CapsHostCPUMaxPhysAddr `xml:"maxphysaddr"`
FeatureFlags []CapsHostCPUFeatureFlag `xml:"feature"`
Features *CapsHostCPUFeatures `xml:"features"`
PageSizes []CapsHostCPUPageSize `xml:"pages"`
}
type CapsHostCPUFeature struct {
}
type CapsHostCPUFeatures struct {
PAE *CapsHostCPUFeature `xml:"pae"`
NonPAE *CapsHostCPUFeature `xml:"nonpae"`
SVM *CapsHostCPUFeature `xml:"svm"`
VMX *CapsHostCPUFeature `xml:"vmx"`
}
type CapsHostNUMAMemory struct {
Size uint64 `xml:",chardata"`
Unit string `xml:"unit,attr"`
}
type CapsHostNUMAPageInfo struct {
Size int `xml:"size,attr"`
Unit string `xml:"unit,attr"`
Count uint64 `xml:",chardata"`
}
type CapsHostNUMACPU struct {
ID int `xml:"id,attr"`
SocketID *int `xml:"socket_id,attr"`
DieID *int `xml:"die_id,attr"`
ClusterID *int `xml:"cluster_id,attr"`
CoreID *int `xml:"core_id,attr"`
Siblings string `xml:"siblings,attr,omitempty"`
}
type CapsHostNUMASibling struct {
ID int `xml:"id,attr"`
Value int `xml:"value,attr"`
}
type CapsHostNUMACacheSize struct {
Value uint `xml:"value,attr,omitempty"`
Unit string `xml:"unit,attr,omitempty"`
}
type CapsHostNUMACacheLine struct {
Value uint `xml:"value,attr,omitempty"`
Unit string `xml:"unit,attr,omitempty"`
}
type CapsHostNUMACache struct {
Level int `xml:"level,attr,omitempty"`
Associativity string `xml:"associativity,attr,omitempty"`
Policy string `xml:"policy,attr,omitempty"`
Size *CapsHostNUMACacheSize `xml:"size"`
Line *CapsHostNUMACacheLine `xml:"line"`
}
type CapsHostNUMACell struct {
ID int `xml:"id,attr"`
Memory *CapsHostNUMAMemory `xml:"memory"`
PageInfo []CapsHostNUMAPageInfo `xml:"pages"`
Distances *CapsHostNUMADistances `xml:"distances"`
Cache []CapsHostNUMACache `xml:"cache"`
CPUS *CapsHostNUMACPUs `xml:"cpus"`
}
type CapsHostNUMADistances struct {
Siblings []CapsHostNUMASibling `xml:"sibling"`
}
type CapsHostNUMACPUs struct {
Num uint `xml:"num,attr"`
CPUs []CapsHostNUMACPU `xml:"cpu"`
}
type CapsHostNUMAInterconnects struct {
Latency []CapsHostNUMAInterconnectLatency `xml:"latency"`
Bandwidth []CapsHostNUMAInterconnectBandwidth `xml:"bandwidth"`
}
type CapsHostNUMAInterconnectLatency struct {
Initiator uint `xml:"initiator,attr"`
Target uint `xml:"target,attr"`
Type string `xml:"type,attr"`
Value uint `xml:"value,attr"`
}
type CapsHostNUMAInterconnectBandwidth struct {
Initiator uint `xml:"initiator,attr"`
Target uint `xml:"target,attr"`
Type string `xml:"type,attr"`
Value uint `xml:"value,attr"`
Unit string `xml:"unit,attr"`
}
type CapsHostNUMATopology struct {
Cells *CapsHostNUMACells `xml:"cells"`
Interconnects *CapsHostNUMAInterconnects `xml:"interconnects"`
}
type CapsHostNUMACells struct {
Num uint `xml:"num,attr,omitempty"`
Cells []CapsHostNUMACell `xml:"cell"`
}
type CapsHostSecModelLabel struct {
Type string `xml:"type,attr"`
Value string `xml:",chardata"`
}
type CapsHostSecModel struct {
Name string `xml:"model"`
DOI string `xml:"doi"`
Labels []CapsHostSecModelLabel `xml:"baselabel"`
}
type CapsHostMigrationFeatures struct {
Live *CapsHostMigrationLive `xml:"live"`
URITransports *CapsHostMigrationURITransports `xml:"uri_transports"`
}
type CapsHostMigrationLive struct {
}
type CapsHostMigrationURITransports struct {
URI []string `xml:"uri_transport"`
}
type CapsHost struct {
UUID string `xml:"uuid,omitempty"`
CPU *CapsHostCPU `xml:"cpu"`
PowerManagement *CapsHostPowerManagement `xml:"power_management"`
IOMMU *CapsHostIOMMU `xml:"iommu"`
MigrationFeatures *CapsHostMigrationFeatures `xml:"migration_features"`
NUMA *CapsHostNUMATopology `xml:"topology"`
Cache *CapsHostCache `xml:"cache"`
MemoryBandwidth *CapsHostMemoryBandwidth `xml:"memory_bandwidth"`
SecModel []CapsHostSecModel `xml:"secmodel"`
}
type CapsHostPowerManagement struct {
SuspendMem *CapsHostPowerManagementMode `xml:"suspend_mem"`
SuspendDisk *CapsHostPowerManagementMode `xml:"suspend_disk"`
SuspendHybrid *CapsHostPowerManagementMode `xml:"suspend_hybrid"`
}
type CapsHostPowerManagementMode struct {
}
type CapsHostIOMMU struct {
Support string `xml:"support,attr"`
}
type CapsHostCache struct {
Banks []CapsHostCacheBank `xml:"bank"`
Monitor *CapsHostCacheMonitor `xml:"monitor"`
}
type CapsHostCacheBank struct {
ID uint `xml:"id,attr"`
Level uint `xml:"level,attr"`
Type string `xml:"type,attr"`
Size uint `xml:"size,attr"`
Unit string `xml:"unit,attr"`
CPUs string `xml:"cpus,attr"`
Control []CapsHostCacheControl `xml:"control"`
}
type CapsHostCacheMonitor struct {
Level uint `xml:"level,attr,omitempty"`
ResueThreshold uint `xml:"reuseThreshold,attr,omitempty"`
MaxMonitors uint `xml:"maxMonitors,attr"`
Features []CapsHostCacheMonitorFeature `xml:"feature"`
}
type CapsHostCacheMonitorFeature struct {
Name string `xml:"name,attr"`
}
type CapsHostCacheControl struct {
Granularity uint `xml:"granularity,attr"`
Min uint `xml:"min,attr,omitempty"`
Unit string `xml:"unit,attr"`
Type string `xml:"type,attr"`
MaxAllows uint `xml:"maxAllocs,attr"`
}
type CapsHostMemoryBandwidth struct {
Nodes []CapsHostMemoryBandwidthNode `xml:"node"`
Monitor *CapsHostMemoryBandwidthMonitor `xml:"monitor"`
}
type CapsHostMemoryBandwidthNode struct {
ID uint `xml:"id,attr"`
CPUs string `xml:"cpus,attr"`
Control *CapsHostMemoryBandwidthNodeControl `xml:"control"`
}
type CapsHostMemoryBandwidthNodeControl struct {
Granularity uint `xml:"granularity,attr"`
Min uint `xml:"min,attr"`
MaxAllocs uint `xml:"maxAllocs,attr"`
}
type CapsHostMemoryBandwidthMonitor struct {
MaxMonitors uint `xml:"maxMonitors,attr"`
Features []CapsHostMemoryBandwidthMonitorFeature `xml:"feature"`
}
type CapsHostMemoryBandwidthMonitorFeature struct {
Name string `xml:"name,attr"`
}
type CapsGuestMachine struct {
Name string `xml:",chardata"`
MaxCPUs int `xml:"maxCpus,attr,omitempty"`
Deprecated string `xml:"deprecated,attr,omitempty"`
Canonical string `xml:"canonical,attr,omitempty"`
}
type CapsGuestDomain struct {
Type string `xml:"type,attr"`
Emulator string `xml:"emulator,omitempty"`
Machines []CapsGuestMachine `xml:"machine"`
}
type CapsGuestArch struct {
Name string `xml:"name,attr"`
WordSize string `xml:"wordsize"`
Emulator string `xml:"emulator"`
Loader string `xml:"loader,omitempty"`
Machines []CapsGuestMachine `xml:"machine"`
Domains []CapsGuestDomain `xml:"domain"`
}
type CapsGuestFeatureCPUSelection struct {
}
type CapsGuestFeatureDeviceBoot struct {
}
type CapsGuestFeaturePAE struct {
}
type CapsGuestFeatureNonPAE struct {
}
type CapsGuestFeatureDiskSnapshot struct {
Default string `xml:"default,attr,omitempty"`
Toggle string `xml:"toggle,attr,omitempty"`
}
type CapsGuestFeatureAPIC struct {
Default string `xml:"default,attr,omitempty"`
Toggle string `xml:"toggle,attr,omitempty"`
}
type CapsGuestFeatureACPI struct {
Default string `xml:"default,attr,omitempty"`
Toggle string `xml:"toggle,attr,omitempty"`
}
type CapsGuestFeatureIA64BE struct {
}
type CapsGuestFeatures struct {
CPUSelection *CapsGuestFeatureCPUSelection `xml:"cpuselection"`
DeviceBoot *CapsGuestFeatureDeviceBoot `xml:"deviceboot"`
DiskSnapshot *CapsGuestFeatureDiskSnapshot `xml:"disksnapshot"`
PAE *CapsGuestFeaturePAE `xml:"pae"`
NonPAE *CapsGuestFeatureNonPAE `xml:"nonpae"`
APIC *CapsGuestFeatureAPIC `xml:"apic"`
ACPI *CapsGuestFeatureACPI `xml:"acpi"`
IA64BE *CapsGuestFeatureIA64BE `xml:"ia64_be"`
}
type CapsGuest struct {
OSType string `xml:"os_type"`
Arch CapsGuestArch `xml:"arch"`
Features *CapsGuestFeatures `xml:"features"`
}
type Caps struct {
XMLName xml.Name `xml:"capabilities"`
Host CapsHost `xml:"host"`
Guests []CapsGuest `xml:"guest"`
}
func (c *CapsHostCPU) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), c)
}
func (c *CapsHostCPU) Marshal() (string, error) {
doc, err := xml.MarshalIndent(c, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
func (c *Caps) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), c)
}
func (c *Caps) Marshal() (string, error) {
doc, err := xml.MarshalIndent(c, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/domain_capabilities.go | vendor/libvirt.org/go/libvirtxml/domain_capabilities.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
)
type DomainCaps struct {
XMLName xml.Name `xml:"domainCapabilities"`
Path string `xml:"path"`
Domain string `xml:"domain"`
Machine string `xml:"machine,omitempty"`
Arch string `xml:"arch"`
VCPU *DomainCapsVCPU `xml:"vcpu"`
IOThreads *DomainCapsIOThreads `xml:"iothreads"`
OS *DomainCapsOS `xml:"os"`
CPU *DomainCapsCPU `xml:"cpu"`
MemoryBacking *DomainCapsMemoryBacking `xml:"memoryBacking"`
Devices *DomainCapsDevices `xml:"devices"`
Features *DomainCapsFeatures `xml:"features"`
}
type DomainCapsVCPU struct {
Max uint `xml:"max,attr"`
}
type DomainCapsOS struct {
Supported string `xml:"supported,attr"`
Loader *DomainCapsOSLoader `xml:"loader"`
Enums []DomainCapsEnum `xml:"enum"`
}
type DomainCapsOSLoader struct {
Supported string `xml:"supported,attr"`
Values []string `xml:"value"`
Enums []DomainCapsEnum `xml:"enum"`
}
type DomainCapsIOThreads struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsCPU struct {
Modes []DomainCapsCPUMode `xml:"mode"`
}
type DomainCapsCPUMaxPhysAddr struct {
Mode string `xml:"mode,attr"`
Limit uint `xml:"limit,attr"`
}
type DomainCapsCPUMode struct {
Name string `xml:"name,attr"`
Supported string `xml:"supported,attr"`
Models []DomainCapsCPUModel `xml:"model"`
Vendor string `xml:"vendor,omitempty"`
MaxPhysAddr *DomainCapsCPUMaxPhysAddr `xml:"maxphysaddr"`
Features []DomainCapsCPUFeature `xml:"feature"`
Blockers []DomainCapsCPUBlockers `xml:"blockers"`
Enums []DomainCapsEnum `xml:"enum"`
}
type DomainCapsCPUModel struct {
Name string `xml:",chardata"`
Usable string `xml:"usable,attr,omitempty"`
Fallback string `xml:"fallback,attr,omitempty"`
Deprecated string `xml:"deprecated,attr,omitempty"`
Vendor string `xml:"vendor,attr,omitempty"`
Canonical string `xml:"canonical,attr,omitempty"`
}
type DomainCapsCPUFeature struct {
Policy string `xml:"policy,attr,omitempty"`
Name string `xml:"name,attr"`
}
type DomainCapsCPUBlockers struct {
Model string `xml:"model,attr"`
Features []DomainCapsCPUBlockedFeature `xml:"feature"`
}
type DomainCapsCPUBlockedFeature struct {
Name string `xml:"name,attr"`
}
type DomainCapsEnum struct {
Name string `xml:"name,attr"`
Values []string `xml:"value"`
}
type DomainCapsMemoryBacking struct {
Supported string `xml:"supported,attr"`
Enums []DomainCapsEnum `xml:"enum"`
}
type DomainCapsDevices struct {
Disk *DomainCapsDevice `xml:"disk"`
Graphics *DomainCapsDevice `xml:"graphics"`
Video *DomainCapsDevice `xml:"video"`
HostDev *DomainCapsDevice `xml:"hostdev"`
RNG *DomainCapsDevice `xml:"rng"`
FileSystem *DomainCapsDevice `xml:"filesystem"`
TPM *DomainCapsDevice `xml:"tpm"`
Redirdev *DomainCapsDevice `xml:"redirdev"`
Channel *DomainCapsDevice `xml:"channel"`
Crypto *DomainCapsDevice `xml:"crypto"`
Interface *DomainCapsDevice `xml:"interface"`
Panic *DomainCapsDevice `xml:"panic"`
Console *DomainCapsDevice `xml:"console"`
}
type DomainCapsDevice struct {
Supported string `xml:"supported,attr"`
Enums []DomainCapsEnum `xml:"enum"`
}
type DomainCapsFeatures struct {
GIC *DomainCapsFeatureGIC `xml:"gic"`
VMCoreInfo *DomainCapsFeatureVMCoreInfo `xml:"vmcoreinfo"`
GenID *DomainCapsFeatureGenID `xml:"genid"`
BackingStoreInput *DomainCapsFeatureBackingStoreInput `xml:"backingStoreInput"`
Backup *DomainCapsFeatureBackup `xml:"backup"`
AsyncTeardown *DomainCapsFeatureAsyncTeardown `xml:"async-teardown"`
S390PV *DomainCapsFeatureS390PV `xml:"s390-pv"`
PS2 *DomainCapsFeaturePS2 `xml:"ps2"`
TDX *DomainCapsFeatureTDX `xml:"tdx"`
SEV *DomainCapsFeatureSEV `xml:"sev"`
SGX *DomainCapsFeatureSGX `xml:"sgx"`
HyperV *DomainCapsFeatureHyperV `xml:"hyperv"`
LaunchSecurity *DomainCapsFeatureLaunchSecurity `xml:"launchSecurity"`
}
type DomainCapsFeatureGIC struct {
Supported string `xml:"supported,attr"`
Enums []DomainCapsEnum `xml:"enum"`
}
type DomainCapsFeatureVMCoreInfo struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureGenID struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureBackingStoreInput struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureBackup struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureAsyncTeardown struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureS390PV struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeaturePS2 struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureTDX struct {
Supported string `xml:"supported,attr"`
}
type DomainCapsFeatureSEV struct {
Supported string `xml:"supported,attr"`
CBitPos uint `xml:"cbitpos,omitempty"`
ReducedPhysBits uint `xml:"reducedPhysBits,omitempty"`
MaxGuests uint `xml:"maxGuests,omitempty"`
MaxESGuests uint `xml:"maxESGuests,omitempty"`
Cpu0ID string `xml:"cpu0Id,omitempty"`
}
type DomainCapsFeatureSGX struct {
Supported string `xml:"supported,attr"`
FLC *DomainCapsFeatureSGXFeature `xml:"flc"`
SGX1 *DomainCapsFeatureSGXFeature `xml:"sgx1"`
SGX2 *DomainCapsFeatureSGXFeature `xml:"sgx2"`
SectionSize *DomainCapsFeatureSGXSectionSize `xml:"section_size"`
Sections *[]DomainCapsFeatureSGXSection `xml:"sections>section"`
}
type DomainCapsFeatureSGXFeature struct {
Supported string `xml:",chardata"`
}
type DomainCapsFeatureSGXSectionSize struct {
Value uint `xml:",chardata"`
Unit string `xml:"unit,attr,omitempty"`
}
type DomainCapsFeatureSGXSection struct {
Node uint `xml:"node,attr"`
Size uint `xml:"size,attr"`
Unit string `xml:"unit,attr"`
}
type DomainCapsFeatureHyperVDefaults struct {
Spinlocks uint `xml:"spinlocks,omitempty"`
STimerDirect string `xml:"stimer_direct,omitempty"`
TLBFlushDirect string `xml:"tlbflush_direct,omitempty"`
TLBFlushExtended string `xml:"tlbflush_extended,omitempty"`
VendorID string `xml:"vendor_id,omitempty"`
}
type DomainCapsFeatureHyperV struct {
Supported string `xml:"supported,attr"`
Enums []DomainCapsEnum `xml:"enum"`
Defaults *DomainCapsFeatureHyperVDefaults `xml:"defaults"`
}
type DomainCapsFeatureLaunchSecurity struct {
Supported string `xml:"supported,attr"`
Enums []DomainCapsEnum `xml:"enum"`
}
func (c *DomainCaps) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), c)
}
func (c *DomainCaps) Marshal() (string, error) {
doc, err := xml.MarshalIndent(c, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/network_port.go | vendor/libvirt.org/go/libvirtxml/network_port.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2019 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
"fmt"
)
type NetworkPort struct {
XMLName xml.Name `xml:"networkport"`
UUID string `xml:"uuid,omitempty"`
Owner *NetworkPortOwner `xml:"owner",`
MAC *NetworkPortMAC `xml:"mac"`
Group string `xml:"group,omitempty"`
Bandwidth *NetworkBandwidth `xml:"bandwidth"`
VLAN *NetworkPortVLAN `xml:"vlan"`
PortOptions *NetworkPortPortOptions `xml:"port"`
VirtualPort *NetworkVirtualPort `xml:"virtualport"`
RXFilters *NetworkPortRXFilters `xml:"rxfilters"`
Plug *NetworkPortPlug `xml:"plug"`
}
type NetworkPortPortOptions struct {
Isolated string `xml:"isolated,attr,omitempty"`
}
type NetworkPortVLAN struct {
Trunk string `xml:"trunk,attr,omitempty"`
Tags []NetworkPortVLANTag `xml:"tag"`
}
type NetworkPortVLANTag struct {
ID uint `xml:"id,attr"`
NativeMode string `xml:"nativeMode,attr,omitempty"`
}
type NetworkPortOwner struct {
UUID string `xml:"uuid,omitempty"`
Name string `xml:"name,omitempty"`
}
type NetworkPortMAC struct {
Address string `xml:"address,attr"`
}
type NetworkPortRXFilters struct {
TrustGuest string `xml:"trustGuest,attr"`
}
type NetworkPortPlug struct {
Bridge *NetworkPortPlugBridge `xml:"-"`
Network *NetworkPortPlugNetwork `xml:"-"`
Direct *NetworkPortPlugDirect `xml:"-"`
HostDevPCI *NetworkPortPlugHostDevPCI `xml:"-"`
}
type NetworkPortPlugBridge struct {
Bridge string `xml:"bridge,attr"`
MacTableManager string `xml:"macTableManager,attr,omitempty"`
}
type NetworkPortPlugNetwork struct {
Bridge string `xml:"bridge,attr"`
MacTableManager string `xml:"macTableManager,attr,omitempty"`
}
type NetworkPortPlugDirect struct {
Dev string `xml:"dev,attr"`
Mode string `xml:"mode,attr"`
}
type NetworkPortPlugHostDevPCI struct {
Managed string `xml:"managed,attr,omitempty"`
Driver *NetworkPortPlugHostDevPCIDriver `xml:"driver"`
Address *NetworkPortPlugHostDevPCIAddress `xml:"address"`
}
type NetworkPortPlugHostDevPCIDriver struct {
Name string `xml:"name,attr"`
}
type NetworkPortPlugHostDevPCIAddress struct {
Domain *uint `xml:"domain,attr"`
Bus *uint `xml:"bus,attr"`
Slot *uint `xml:"slot,attr"`
Function *uint `xml:"function,attr"`
}
func (a *NetworkPortPlugHostDevPCIAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
marshalUintAttr(&start, "domain", a.Domain, "0x%04x")
marshalUintAttr(&start, "bus", a.Bus, "0x%02x")
marshalUintAttr(&start, "slot", a.Slot, "0x%02x")
marshalUintAttr(&start, "function", a.Function, "0x%x")
e.EncodeToken(start)
e.EncodeToken(start.End())
return nil
}
func (a *NetworkPortPlugHostDevPCIAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for _, attr := range start.Attr {
if attr.Name.Local == "domain" {
if err := unmarshalUintAttr(attr.Value, &a.Domain, 0); err != nil {
return err
}
} else if attr.Name.Local == "bus" {
if err := unmarshalUintAttr(attr.Value, &a.Bus, 0); err != nil {
return err
}
} else if attr.Name.Local == "slot" {
if err := unmarshalUintAttr(attr.Value, &a.Slot, 0); err != nil {
return err
}
} else if attr.Name.Local == "function" {
if err := unmarshalUintAttr(attr.Value, &a.Function, 0); err != nil {
return err
}
}
}
d.Skip()
return nil
}
func (p *NetworkPortPlug) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "plug"
if p.Bridge != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "bridge",
})
return e.EncodeElement(p.Bridge, start)
} else if p.Network != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "network",
})
return e.EncodeElement(p.Network, start)
} else if p.Direct != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "direct",
})
return e.EncodeElement(p.Direct, start)
} else if p.HostDevPCI != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "hostdev-pci",
})
return e.EncodeElement(p.HostDevPCI, start)
}
return nil
}
func (p *NetworkPortPlug) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing type attribute on plug")
} else if typ == "bridge" {
var pb NetworkPortPlugBridge
if err := d.DecodeElement(&pb, &start); err != nil {
return err
}
p.Bridge = &pb
} else if typ == "network" {
var pn NetworkPortPlugNetwork
if err := d.DecodeElement(&pn, &start); err != nil {
return err
}
p.Network = &pn
} else if typ == "direct" {
var pd NetworkPortPlugDirect
if err := d.DecodeElement(&pd, &start); err != nil {
return err
}
p.Direct = &pd
} else if typ == "hostdev-pci" {
var ph NetworkPortPlugHostDevPCI
if err := d.DecodeElement(&ph, &start); err != nil {
return err
}
p.HostDevPCI = &ph
}
d.Skip()
return nil
}
func (s *NetworkPort) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NetworkPort) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/storage_vol.go | vendor/libvirt.org/go/libvirtxml/storage_vol.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
package libvirtxml
import "encoding/xml"
type StorageVolumeSize struct {
Unit string `xml:"unit,attr,omitempty"`
Value uint64 `xml:",chardata"`
}
type StorageVolumeTargetPermissions struct {
Owner string `xml:"owner,omitempty"`
Group string `xml:"group,omitempty"`
Mode string `xml:"mode,omitempty"`
Label string `xml:"label,omitempty"`
}
type StorageVolumeTargetFeature struct {
LazyRefcounts *struct{} `xml:"lazy_refcounts"`
ExtendedL2 *struct{} `xml:"extended_l2"`
}
type StorageVolumeTargetFormat struct {
Type string `xml:"type,attr"`
}
type StorageVolumeTargetTimestamps struct {
Atime string `xml:"atime"`
Mtime string `xml:"mtime"`
Ctime string `xml:"ctime"`
}
type StorageVolumeTargetClusterSize struct {
Unit string `xml:"unit,attr,omitempty"`
Value uint64 `xml:",chardata"`
}
type StorageVolumeTarget struct {
Path string `xml:"path,omitempty"`
Format *StorageVolumeTargetFormat `xml:"format"`
Permissions *StorageVolumeTargetPermissions `xml:"permissions"`
Timestamps *StorageVolumeTargetTimestamps `xml:"timestamps"`
Compat string `xml:"compat,omitempty"`
ClusterSize *StorageVolumeTargetClusterSize `xml:"clusterSize"`
NoCOW *struct{} `xml:"nocow"`
Features []StorageVolumeTargetFeature `xml:"features"`
Encryption *StorageEncryption `xml:"encryption"`
}
type StorageVolumeBackingStore struct {
Path string `xml:"path"`
Format *StorageVolumeTargetFormat `xml:"format"`
Permissions *StorageVolumeTargetPermissions `xml:"permissions"`
}
type StorageVolume struct {
XMLName xml.Name `xml:"volume"`
Type string `xml:"type,attr,omitempty"`
Name string `xml:"name"`
Key string `xml:"key,omitempty"`
Allocation *StorageVolumeSize `xml:"allocation"`
Capacity *StorageVolumeSize `xml:"capacity"`
Physical *StorageVolumeSize `xml:"physical"`
Target *StorageVolumeTarget `xml:"target"`
BackingStore *StorageVolumeBackingStore `xml:"backingStore"`
}
func (s *StorageVolume) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *StorageVolume) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/xmlutil.go | vendor/libvirt.org/go/libvirtxml/xmlutil.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
"fmt"
"strconv"
"strings"
)
type element struct {
XMLNS string
Name string
Attrs map[string]string
Content string
Children []*element
}
type elementstack []*element
func (s *elementstack) push(v *element) {
*s = append(*s, v)
}
func (s *elementstack) pop() *element {
res := (*s)[len(*s)-1]
*s = (*s)[:len(*s)-1]
return res
}
func getNamespaceURI(xmlnsMap map[string]string, xmlns string, name xml.Name) string {
if name.Space != "" {
uri, ok := xmlnsMap[name.Space]
if !ok {
return "undefined://" + name.Space
} else {
return uri
}
} else {
return xmlns
}
}
func xmlName(xmlns string, name xml.Name) string {
if xmlns == "" {
return name.Local
}
return name.Local + "(" + xmlns + ")"
}
func loadXML(xmlstr string, ignoreNSDecl bool) (*element, error) {
xmlnsMap := make(map[string]string)
xmlr := strings.NewReader(xmlstr)
d := xml.NewDecoder(xmlr)
var root *element
stack := elementstack{}
for {
t, err := d.RawToken()
if err != nil {
return nil, err
}
var parent *element
if root != nil {
if len(stack) == 0 {
return nil, fmt.Errorf("Unexpectedly empty stack")
}
parent = stack[len(stack)-1]
}
switch t := t.(type) {
case xml.StartElement:
xmlns := ""
if parent != nil {
xmlns = parent.XMLNS
}
for _, a := range t.Attr {
if a.Name.Space == "xmlns" {
xmlnsMap[a.Name.Local] = a.Value
} else if a.Name.Space == "" && a.Name.Local == "xmlns" {
xmlns = a.Value
}
}
xmlns = getNamespaceURI(xmlnsMap, xmlns, t.Name)
child := &element{
XMLNS: xmlns,
Name: xmlName(xmlns, t.Name),
Attrs: make(map[string]string),
}
for _, a := range t.Attr {
if a.Name.Space == "xmlns" {
continue
}
if a.Name.Space == "" && a.Name.Local == "xmlns" {
continue
}
attrNS := getNamespaceURI(xmlnsMap, "", a.Name)
child.Attrs[xmlName(attrNS, a.Name)] = a.Value
}
stack.push(child)
if root == nil {
root = child
} else {
parent.Children = append(parent.Children, child)
parent.Content = ""
}
case xml.EndElement:
stack.pop()
case xml.CharData:
if parent != nil && len(parent.Children) == 0 {
val := string(t)
if strings.TrimSpace(val) != "" {
parent.Content = val
}
}
}
if root != nil && len(stack) == 0 {
break
}
}
return root, nil
}
func testCompareValue(filename, path, key, expected, actual string) error {
if expected == actual {
return nil
}
i1, err1 := strconv.ParseInt(expected, 0, 64)
i2, err2 := strconv.ParseInt(actual, 0, 64)
if err1 == nil && err2 == nil && i1 == i2 {
return nil
}
path = path + "/@" + key
return fmt.Errorf("%s: %s: attribute actual value '%s' does not match expected value '%s'",
filename, path, actual, expected)
}
func testCompareElement(filename, expectPath, actualPath string, expect, actual *element, extraExpectNodes, extraActualNodes map[string]bool) error {
if expect.Name != actual.Name {
return fmt.Errorf("%s: name '%s' doesn't match '%s'",
expectPath, expect.Name, actual.Name)
}
expectAttr := expect.Attrs
for key, val := range actual.Attrs {
expectval, ok := expectAttr[key]
if !ok {
attrPath := actualPath + "/@" + key
if _, ok := extraActualNodes[attrPath]; ok {
continue
}
return fmt.Errorf("%s: %s: attribute in actual XML missing in expected XML",
filename, attrPath)
}
err := testCompareValue(filename, actualPath, key, expectval, val)
if err != nil {
return err
}
delete(expectAttr, key)
}
for key, _ := range expectAttr {
attrPath := expectPath + "/@" + key
if _, ok := extraExpectNodes[attrPath]; ok {
continue
}
return fmt.Errorf("%s: %s: attribute '%s' in expected XML missing in actual XML",
filename, attrPath, expectAttr[key])
}
if expect.Content != actual.Content {
return fmt.Errorf("%s: %s: actual content '%s' does not match expected '%s'",
filename, actualPath, actual.Content, expect.Content)
}
used := make([]bool, len(actual.Children))
expectChildIndexes := make(map[string]uint)
actualChildIndexes := make(map[string]uint)
for _, expectChild := range expect.Children {
expectIndex, _ := expectChildIndexes[expectChild.Name]
expectChildIndexes[expectChild.Name] = expectIndex + 1
subExpectPath := fmt.Sprintf("%s/%s[%d]", expectPath, expectChild.Name, expectIndex)
var actualChild *element = nil
for i := 0; i < len(used); i++ {
if !used[i] && actual.Children[i].Name == expectChild.Name {
actualChild = actual.Children[i]
used[i] = true
break
}
}
if actualChild == nil {
if _, ok := extraExpectNodes[subExpectPath]; ok {
continue
}
return fmt.Errorf("%s: %s: element in expected XML missing in actual XML",
filename, subExpectPath)
}
actualIndex, _ := actualChildIndexes[actualChild.Name]
actualChildIndexes[actualChild.Name] = actualIndex + 1
subActualPath := fmt.Sprintf("%s/%s[%d]", actualPath, actualChild.Name, actualIndex)
err := testCompareElement(filename, subExpectPath, subActualPath, expectChild, actualChild, extraExpectNodes, extraActualNodes)
if err != nil {
return err
}
}
actualChildIndexes = make(map[string]uint)
for i, actualChild := range actual.Children {
actualIndex, _ := actualChildIndexes[actualChild.Name]
actualChildIndexes[actualChild.Name] = actualIndex + 1
if used[i] {
continue
}
subActualPath := fmt.Sprintf("%s/%s[%d]", actualPath, actualChild.Name, actualIndex)
if _, ok := extraActualNodes[subActualPath]; ok {
continue
}
return fmt.Errorf("%s: %s: element in actual XML missing in expected XML",
filename, subActualPath)
}
return nil
}
func makeExtraNodeMap(nodes []string) map[string]bool {
ret := make(map[string]bool)
for _, node := range nodes {
ret[node] = true
}
return ret
}
func testCompareXML(filename, expectStr, actualStr string, extraExpectNodes, extraActualNodes []string) error {
extraExpectNodeMap := makeExtraNodeMap(extraExpectNodes)
extraActualNodeMap := makeExtraNodeMap(extraActualNodes)
//fmt.Printf("%s\n", expectedstr)
expectRoot, err := loadXML(expectStr, true)
if err != nil {
return err
}
//fmt.Printf("%s\n", actualstr)
actualRoot, err := loadXML(actualStr, true)
if err != nil {
return err
}
if expectRoot.Name != actualRoot.Name {
return fmt.Errorf("%s: /: expected root element '%s' does not match actual '%s'",
filename, expectRoot.Name, actualRoot.Name)
}
err = testCompareElement(filename, "/"+expectRoot.Name+"[0]", "/"+actualRoot.Name+"[0]", expectRoot, actualRoot, extraExpectNodeMap, extraActualNodeMap)
if err != nil {
return err
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/interface.go | vendor/libvirt.org/go/libvirtxml/interface.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Lian Duan <blazeblue@gmail.com>
*
*/
package libvirtxml
import (
"encoding/xml"
)
type Interface struct {
XMLName xml.Name `xml:"interface"`
Name string `xml:"name,attr,omitempty"`
Start *InterfaceStart `xml:"start"`
MTU *InterfaceMTU `xml:"mtu"`
Protocol []InterfaceProtocol `xml:"protocol"`
Link *InterfaceLink `xml:"link"`
MAC *InterfaceMAC `xml:"mac"`
Bond *InterfaceBond `xml:"bond"`
Bridge *InterfaceBridge `xml:"bridge"`
VLAN *InterfaceVLAN `xml:"vlan"`
}
type InterfaceStart struct {
Mode string `xml:"mode,attr"`
}
type InterfaceMTU struct {
Size uint `xml:"size,attr"`
}
type InterfaceProtocol struct {
Family string `xml:"family,attr,omitempty"`
AutoConf *InterfaceAutoConf `xml:"autoconf"`
DHCP *InterfaceDHCP `xml:"dhcp"`
IPs []InterfaceIP `xml:"ip"`
Route []InterfaceRoute `xml:"route"`
}
type InterfaceAutoConf struct {
}
type InterfaceDHCP struct {
PeerDNS string `xml:"peerdns,attr,omitempty"`
}
type InterfaceIP struct {
Address string `xml:"address,attr"`
Prefix uint `xml:"prefix,attr,omitempty"`
}
type InterfaceRoute struct {
Gateway string `xml:"gateway,attr"`
}
type InterfaceLink struct {
Speed uint `xml:"speed,attr,omitempty"`
State string `xml:"state,attr,omitempty"`
}
type InterfaceMAC struct {
Address string `xml:"address,attr"`
}
type InterfaceBond struct {
Mode string `xml:"mode,attr,omitempty"`
ARPMon *InterfaceBondARPMon `xml:"arpmon"`
MIIMon *InterfaceBondMIIMon `xml:"miimon"`
Interfaces []Interface `xml:"interface"`
}
type InterfaceBondARPMon struct {
Interval uint `xml:"interval,attr,omitempty"`
Target string `xml:"target,attr,omitempty"`
Validate string `xml:"validate,attr,omitempty"`
}
type InterfaceBondMIIMon struct {
Freq uint `xml:"freq,attr,omitempty"`
UpDelay uint `xml:"updelay,attr,omitempty"`
Carrier string `xml:"carrier,attr,omitempty"`
}
type InterfaceBridge struct {
STP string `xml:"stp,attr,omitempty"`
Delay *float64 `xml:"delay,attr"`
Interfaces []Interface `xml:"interface"`
}
type InterfaceVLAN struct {
Tag *uint `xml:"tag,attr"`
Interface *Interface `xml:"interface"`
}
type interfaceDup Interface
func (s *Interface) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "interface"
typ := "ethernet"
if s.Bond != nil {
typ = "bond"
} else if s.Bridge != nil {
typ = "bridge"
} else if s.VLAN != nil {
typ = "vlan"
}
start.Attr = append(start.Attr, xml.Attr{
Name: xml.Name{Local: "type"},
Value: typ,
})
i := interfaceDup(*s)
return e.EncodeElement(i, start)
}
func (s *Interface) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *Interface) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/domain_snapshot.go | vendor/libvirt.org/go/libvirtxml/domain_snapshot.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
package libvirtxml
import "encoding/xml"
type DomainSnapshotDisk struct {
Name string `xml:"name,attr"`
Snapshot string `xml:"snapshot,attr,omitempty"`
Driver *DomainDiskDriver `xml:"driver"`
Source *DomainDiskSource `xml:"source"`
}
type DomainSnapshotDisks struct {
Disks []DomainSnapshotDisk `xml:"disk"`
}
type DomainSnapshotMemory struct {
Snapshot string `xml:"snapshot,attr"`
File string `xml:"file,attr,omitempty"`
}
type DomainSnapshotParent struct {
Name string `xml:"name"`
}
type DomainSnapshotInactiveDomain struct {
XMLName xml.Name `xml:"inactiveDomain"`
Domain
}
type DomainSnapshotCookie struct {
XML string `xml:",innerxml"`
}
type DomainSnapshot struct {
XMLName xml.Name `xml:"domainsnapshot"`
Name string `xml:"name,omitempty"`
Description string `xml:"description,omitempty"`
State string `xml:"state,omitempty"`
CreationTime string `xml:"creationTime,omitempty"`
Parent *DomainSnapshotParent `xml:"parent"`
Memory *DomainSnapshotMemory `xml:"memory"`
Disks *DomainSnapshotDisks `xml:"disks"`
Domain *Domain `xml:"domain"`
InactiveDomain *DomainSnapshotInactiveDomain `xml:"inactiveDomain"`
Active *uint `xml:"active"`
Cookie *DomainSnapshotCookie `xml:"cookie"`
}
type domainSnapshotDisk DomainSnapshotDisk
func (a *DomainSnapshotDisk) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "disk"
if a.Source != nil {
if a.Source.File != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "file",
})
} else if a.Source.Block != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "block",
})
} else if a.Source.Dir != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "dir",
})
} else if a.Source.Network != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "network",
})
} else if a.Source.Volume != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "volume",
})
}
}
disk := domainSnapshotDisk(*a)
return e.EncodeElement(disk, start)
}
func (a *DomainSnapshotDisk) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
typ = "file"
}
a.Source = &DomainDiskSource{}
if typ == "file" {
a.Source.File = &DomainDiskSourceFile{}
} else if typ == "block" {
a.Source.Block = &DomainDiskSourceBlock{}
} else if typ == "network" {
a.Source.Network = &DomainDiskSourceNetwork{}
} else if typ == "dir" {
a.Source.Dir = &DomainDiskSourceDir{}
} else if typ == "volume" {
a.Source.Volume = &DomainDiskSourceVolume{}
}
disk := domainSnapshotDisk(*a)
err := d.DecodeElement(&disk, &start)
if err != nil {
return err
}
*a = DomainSnapshotDisk(disk)
return nil
}
func (s *DomainSnapshot) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *DomainSnapshot) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/nwfilter_binding.go | vendor/libvirt.org/go/libvirtxml/nwfilter_binding.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Lian Duan <blazeblue@gmail.com>
*
*/
package libvirtxml
import (
"encoding/xml"
)
type NWFilterBinding struct {
XMLName xml.Name `xml:"filterbinding"`
Owner *NWFilterBindingOwner `xml:"owner"`
PortDev *NWFilterBindingPortDev `xml:"portdev"`
MAC *NWFilterBindingMAC `xml:"mac"`
FilterRef *NWFilterBindingFilterRef `xml:"filterref"`
}
type NWFilterBindingOwner struct {
UUID string `xml:"uuid,omitempty"`
Name string `xml:"name,omitempty"`
}
type NWFilterBindingPortDev struct {
Name string `xml:"name,attr"`
}
type NWFilterBindingMAC struct {
Address string `xml:"address,attr"`
}
type NWFilterBindingFilterRef struct {
Filter string `xml:"filter,attr"`
Parameters []NWFilterBindingFilterParam `xml:"parameter"`
}
type NWFilterBindingFilterParam struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
func (s *NWFilterBinding) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NWFilterBinding) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/secret.go | vendor/libvirt.org/go/libvirtxml/secret.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
)
type SecretUsage struct {
Type string `xml:"type,attr"`
Volume string `xml:"volume,omitempty"`
Name string `xml:"name,omitempty"`
Target string `xml:"target,omitempty"`
}
type Secret struct {
XMLName xml.Name `xml:"secret"`
Ephemeral string `xml:"ephemeral,attr,omitempty"`
Private string `xml:"private,attr,omitempty"`
Description string `xml:"description,omitempty"`
UUID string `xml:"uuid,omitempty"`
Usage *SecretUsage `xml:"usage"`
}
func (s *Secret) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *Secret) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/domain_checkpoint.go | vendor/libvirt.org/go/libvirtxml/domain_checkpoint.go | /* SPDX-License-Identifier: MIT */
package libvirtxml
import "encoding/xml"
type DomainCheckpointParent struct {
Name string `xml:"name"`
}
type DomainCheckpointDisk struct {
Name string `xml:"name,attr"`
Checkpoint string `xml:"checkpoint,attr,omitempty"`
Bitmap string `xml:"bitmap,attr,omitempty"`
Size uint64 `xml:"size,attr,omitempty"`
}
type DomainCheckpointDisks struct {
Disks []DomainCheckpointDisk `xml:"disk"`
}
type DomainCheckpoint struct {
XMLName xml.Name `xml:"domaincheckpoint"`
Name string `xml:"name,omitempty"`
Description string `xml:"description,omitempty"`
State string `xml:"state,omitempty"`
CreationTime string `xml:"creationTime,omitempty"`
Parent *DomainCheckpointParent `xml:"parent"`
Disks *DomainCheckpointDisks `xml:"disks"`
Domain *Domain `xml:"domain"`
}
func (s *DomainCheckpoint) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *DomainCheckpoint) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/nwfilter.go | vendor/libvirt.org/go/libvirtxml/nwfilter.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Lian Duan <blazeblue@gmail.com>
*
*/
package libvirtxml
import (
"encoding/xml"
"fmt"
"io"
"strconv"
"strings"
)
type NWFilter struct {
XMLName xml.Name `xml:"filter"`
Name string `xml:"name,attr"`
UUID string `xml:"uuid,omitempty"`
Chain string `xml:"chain,attr,omitempty"`
Priority int `xml:"priority,attr,omitempty"`
Entries []NWFilterEntry
}
type NWFilterEntry struct {
Rule *NWFilterRule
Ref *NWFilterRef
}
type NWFilterRef struct {
Filter string `xml:"filter,attr"`
Parameters []NWFilterParameter `xml:"parameter"`
}
type NWFilterParameter struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
type NWFilterField struct {
Var string
Str string
Uint *uint
}
type NWFilterRule struct {
Action string `xml:"action,attr,omitempty"`
Direction string `xml:"direction,attr,omitempty"`
Priority int `xml:"priority,attr,omitempty"`
StateMatch string `xml:"statematch,attr,omitempty"`
ARP *NWFilterRuleARP `xml:"arp"`
RARP *NWFilterRuleRARP `xml:"rarp"`
MAC *NWFilterRuleMAC `xml:"mac"`
VLAN *NWFilterRuleVLAN `xml:"vlan"`
STP *NWFilterRuleSTP `xml:"stp"`
IP *NWFilterRuleIP `xml:"ip"`
IPv6 *NWFilterRuleIPv6 `xml:"ipv6"`
TCP *NWFilterRuleTCP `xml:"tcp"`
UDP *NWFilterRuleUDP `xml:"udp"`
UDPLite *NWFilterRuleUDPLite `xml:"udplite"`
ESP *NWFilterRuleESP `xml:"esp"`
AH *NWFilterRuleAH `xml:"ah"`
SCTP *NWFilterRuleSCTP `xml:"sctp"`
ICMP *NWFilterRuleICMP `xml:"icmp"`
All *NWFilterRuleAll `xml:"all"`
IGMP *NWFilterRuleIGMP `xml:"igmp"`
TCPIPv6 *NWFilterRuleTCPIPv6 `xml:"tcp-ipv6"`
UDPIPv6 *NWFilterRuleUDPIPv6 `xml:"udp-ipv6"`
UDPLiteIPv6 *NWFilterRuleUDPLiteIPv6 `xml:"udplite-ipv6"`
ESPIPv6 *NWFilterRuleESPIPv6 `xml:"esp-ipv6"`
AHIPv6 *NWFilterRuleAHIPv6 `xml:"ah-ipv6"`
SCTPIPv6 *NWFilterRuleSCTPIPv6 `xml:"sctp-ipv6"`
ICMPv6 *NWFilterRuleICMPIPv6 `xml:"icmpv6"`
AllIPv6 *NWFilterRuleAllIPv6 `xml:"all-ipv6"`
}
type NWFilterRuleCommonMAC struct {
SrcMACAddr NWFilterField `xml:"srcmacaddr,attr,omitempty"`
SrcMACMask NWFilterField `xml:"srcmacmask,attr,omitempty"`
DstMACAddr NWFilterField `xml:"dstmacaddr,attr,omitempty"`
DstMACMask NWFilterField `xml:"dstmacmask,attr,omitempty"`
}
type NWFilterRuleCommonIP struct {
SrcMACAddr NWFilterField `xml:"srcmacaddr,attr,omitempty"`
SrcIPAddr NWFilterField `xml:"srcipaddr,attr,omitempty"`
SrcIPMask NWFilterField `xml:"srcipmask,attr,omitempty"`
DstIPAddr NWFilterField `xml:"dstipaddr,attr,omitempty"`
DstIPMask NWFilterField `xml:"dstipmask,attr,omitempty"`
SrcIPFrom NWFilterField `xml:"srcipfrom,attr,omitempty"`
SrcIPTo NWFilterField `xml:"srcipto,attr,omitempty"`
DstIPFrom NWFilterField `xml:"dstipfrom,attr,omitempty"`
DstIPTo NWFilterField `xml:"dstipto,attr,omitempty"`
DSCP NWFilterField `xml:"dscp,attr"`
ConnLimitAbove NWFilterField `xml:"connlimit-above,attr"`
State NWFilterField `xml:"state,attr,omitempty"`
IPSet NWFilterField `xml:"ipset,attr,omitempty"`
IPSetFlags NWFilterField `xml:"ipsetflags,attr,omitempty"`
}
type NWFilterRuleCommonPort struct {
SrcPortStart NWFilterField `xml:"srcportstart,attr"`
SrcPortEnd NWFilterField `xml:"srcportend,attr"`
DstPortStart NWFilterField `xml:"dstportstart,attr"`
DstPortEnd NWFilterField `xml:"dstportend,attr"`
}
type NWFilterRuleARP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonMAC
HWType NWFilterField `xml:"hwtype,attr"`
ProtocolType NWFilterField `xml:"protocoltype,attr"`
OpCode NWFilterField `xml:"opcode,attr,omitempty"`
ARPSrcMACAddr NWFilterField `xml:"arpsrcmacaddr,attr,omitempty"`
ARPDstMACAddr NWFilterField `xml:"arpdstmacaddr,attr,omitempty"`
ARPSrcIPAddr NWFilterField `xml:"arpsrcipaddr,attr,omitempty"`
ARPSrcIPMask NWFilterField `xml:"arpsrcipmask,attr,omitempty"`
ARPDstIPAddr NWFilterField `xml:"arpdstipaddr,attr,omitempty"`
ARPDstIPMask NWFilterField `xml:"arpdstipmask,attr,omitempty"`
Gratuitous NWFilterField `xml:"gratuitous,attr,omitempty"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleRARP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonMAC
HWType NWFilterField `xml:"hwtype,attr"`
ProtocolType NWFilterField `xml:"protocoltype,attr"`
OpCode NWFilterField `xml:"opcode,attr,omitempty"`
ARPSrcMACAddr NWFilterField `xml:"arpsrcmacaddr,attr,omitempty"`
ARPDstMACAddr NWFilterField `xml:"arpdstmacaddr,attr,omitempty"`
ARPSrcIPAddr NWFilterField `xml:"arpsrcipaddr,attr,omitempty"`
ARPSrcIPMask NWFilterField `xml:"arpsrcipmask,attr,omitempty"`
ARPDstIPAddr NWFilterField `xml:"arpdstipaddr,attr,omitempty"`
ARPDstIPMask NWFilterField `xml:"arpdstipmask,attr,omitempty"`
Gratuitous NWFilterField `xml:"gratuitous,attr,omitempty"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleMAC struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonMAC
ProtocolID NWFilterField `xml:"protocolid,attr,omitempty"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleVLAN struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonMAC
VLANID NWFilterField `xml:"vlanid,attr,omitempty"`
EncapProtocol NWFilterField `xml:"encap-protocol,attr,omitempty"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleSTP struct {
Match NWFilterField `xml:"match,attr,omitempty"`
SrcMACAddr NWFilterField `xml:"srcmacaddr,attr,omitempty"`
SrcMACMask NWFilterField `xml:"srcmacmask,attr,omitempty"`
Type NWFilterField `xml:"type,attr"`
Flags NWFilterField `xml:"flags,attr"`
RootPriority NWFilterField `xml:"root-priority,attr"`
RootPriorityHi NWFilterField `xml:"root-priority-hi,attr"`
RootAddress NWFilterField `xml:"root-address,attr,omitempty"`
RootAddressMask NWFilterField `xml:"root-address-mask,attr,omitempty"`
RootCost NWFilterField `xml:"root-cost,attr"`
RootCostHi NWFilterField `xml:"root-cost-hi,attr"`
SenderPriority NWFilterField `xml:"sender-priority,attr"`
SenderPriorityHi NWFilterField `xml:"sender-priority-hi,attr"`
SenderAddress NWFilterField `xml:"sender-address,attr,omitempty"`
SenderAddressMask NWFilterField `xml:"sender-address-mask,attr,omitempty"`
Port NWFilterField `xml:"port,attr"`
PortHi NWFilterField `xml:"port-hi,attr"`
Age NWFilterField `xml:"age,attr"`
AgeHi NWFilterField `xml:"age-hi,attr"`
MaxAge NWFilterField `xml:"max-age,attr"`
MaxAgeHi NWFilterField `xml:"max-age-hi,attr"`
HelloTime NWFilterField `xml:"hello-time,attr"`
HelloTimeHi NWFilterField `xml:"hello-time-hi,attr"`
ForwardDelay NWFilterField `xml:"forward-delay,attr"`
ForwardDelayHi NWFilterField `xml:"forward-delay-hi,attr"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleIP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonMAC
SrcIPAddr NWFilterField `xml:"srcipaddr,attr,omitempty"`
SrcIPMask NWFilterField `xml:"srcipmask,attr,omitempty"`
DstIPAddr NWFilterField `xml:"dstipaddr,attr,omitempty"`
DstIPMask NWFilterField `xml:"dstipmask,attr,omitempty"`
Protocol NWFilterField `xml:"protocol,attr,omitempty"`
NWFilterRuleCommonPort
DSCP NWFilterField `xml:"dscp,attr"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonMAC
SrcIPAddr NWFilterField `xml:"srcipaddr,attr,omitempty"`
SrcIPMask NWFilterField `xml:"srcipmask,attr,omitempty"`
DstIPAddr NWFilterField `xml:"dstipaddr,attr,omitempty"`
DstIPMask NWFilterField `xml:"dstipmask,attr,omitempty"`
Protocol NWFilterField `xml:"protocol,attr,omitempty"`
NWFilterRuleCommonPort
Type NWFilterField `xml:"type,attr"`
TypeEnd NWFilterField `xml:"typeend,attr"`
Code NWFilterField `xml:"code,attr"`
CodeEnd NWFilterField `xml:"codeend,attr"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleTCP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
NWFilterRuleCommonPort
Option NWFilterField `xml:"option,attr"`
Flags NWFilterField `xml:"flags,attr,omitempty"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleUDP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
NWFilterRuleCommonPort
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleUDPLite struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleESP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleAH struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleSCTP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
NWFilterRuleCommonPort
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleICMP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Type NWFilterField `xml:"type,attr"`
Code NWFilterField `xml:"code,attr"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleAll struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleIGMP struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleTCPIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
NWFilterRuleCommonPort
Option NWFilterField `xml:"option,attr"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleUDPIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
NWFilterRuleCommonPort
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleUDPLiteIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleESPIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleAHIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleSCTPIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
NWFilterRuleCommonPort
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleICMPIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Type NWFilterField `xml:"type,attr"`
Code NWFilterField `xml:"code,attr"`
Comment string `xml:"comment,attr,omitempty"`
}
type NWFilterRuleAllIPv6 struct {
Match string `xml:"match,attr,omitempty"`
NWFilterRuleCommonIP
Comment string `xml:"comment,attr,omitempty"`
}
func (s *NWFilterField) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if s == nil {
return xml.Attr{}, nil
}
if s.Str != "" {
return xml.Attr{
Name: name,
Value: s.Str,
}, nil
} else if s.Var != "" {
return xml.Attr{
Name: name,
Value: "$" + s.Str,
}, nil
} else if s.Uint != nil {
return xml.Attr{
Name: name,
Value: fmt.Sprintf("0x%x", *s.Uint),
}, nil
} else {
return xml.Attr{}, nil
}
}
func (s *NWFilterField) UnmarshalXMLAttr(attr xml.Attr) error {
if attr.Value == "" {
return nil
}
if attr.Value[0] == '$' {
s.Var = attr.Value[1:]
}
if strings.HasPrefix(attr.Value, "0x") {
val, err := strconv.ParseUint(attr.Value[2:], 16, 64)
if err != nil {
return err
}
uval := uint(val)
s.Uint = &uval
}
s.Str = attr.Value
return nil
}
func (a *NWFilter) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
start.Name.Local = "filter"
start.Attr = append(start.Attr, xml.Attr{
Name: xml.Name{Local: "name"},
Value: a.Name,
})
if a.Chain != "" {
start.Attr = append(start.Attr, xml.Attr{
Name: xml.Name{Local: "chain"},
Value: a.Chain,
})
}
if a.Priority != 0 {
start.Attr = append(start.Attr, xml.Attr{
Name: xml.Name{Local: "priority"},
Value: fmt.Sprintf("%d", a.Priority),
})
}
err := e.EncodeToken(start)
if err != nil {
return err
}
if a.UUID != "" {
uuid := xml.StartElement{
Name: xml.Name{Local: "uuid"},
}
e.EncodeToken(uuid)
e.EncodeToken(xml.CharData(a.UUID))
e.EncodeToken(uuid.End())
}
for _, entry := range a.Entries {
if entry.Rule != nil {
rule := xml.StartElement{
Name: xml.Name{Local: "rule"},
}
e.EncodeElement(entry.Rule, rule)
} else if entry.Ref != nil {
ref := xml.StartElement{
Name: xml.Name{Local: "filterref"},
}
e.EncodeElement(entry.Ref, ref)
}
}
err = e.EncodeToken(start.End())
if err != nil {
return err
}
return nil
}
func (a *NWFilter) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
name, ok := getAttr(start.Attr, "name")
if !ok {
return fmt.Errorf("Missing filter name")
}
a.Name = name
a.Chain, _ = getAttr(start.Attr, "chain")
prio, ok := getAttr(start.Attr, "priority")
if ok {
val, err := strconv.ParseInt(prio, 10, 64)
if err != nil {
return err
}
a.Priority = int(val)
}
for {
tok, err := d.Token()
if err == io.EOF {
break
}
switch tok := tok.(type) {
case xml.StartElement:
{
if tok.Name.Local == "uuid" {
txt, err := d.Token()
if err != nil {
return err
}
txt2, ok := txt.(xml.CharData)
if !ok {
return fmt.Errorf("Expected UUID string")
}
a.UUID = string(txt2)
} else if tok.Name.Local == "rule" {
entry := NWFilterEntry{
Rule: &NWFilterRule{},
}
d.DecodeElement(entry.Rule, &tok)
a.Entries = append(a.Entries, entry)
} else if tok.Name.Local == "filterref" {
entry := NWFilterEntry{
Ref: &NWFilterRef{},
}
d.DecodeElement(entry.Ref, &tok)
a.Entries = append(a.Entries, entry)
}
}
}
}
return nil
}
func (s *NWFilter) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *NWFilter) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/doc.go | vendor/libvirt.org/go/libvirtxml/doc.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
// Package libvirt-go-xml-module defines structs for parsing libvirt XML schemas
//
// The libvirt API uses XML schemas/documents to describe the configuration
// of many of its managed objects. Thus when using the libvirt-go package,
// it is often neccessary to either parse or format XML documents. This
// package defines a set of Go structs which have been annotated for use
// with the encoding/xml API to manage libvirt XML documents.
//
// Example creating a domain XML document from configuration:
//
// package main
//
// import (
// "libvirt.org/go/libvirtxml"
// )
//
// func main() {
// domcfg := &libvirtxml.Domain{Type: "kvm", Name: "demo",
// UUID: "8f99e332-06c4-463a-9099-330fb244e1b3",
// ....}
// xmldoc, err := domcfg.Marshal()
// }
//
// Example parsing a domainXML document, in combination with libvirt-go
//
// package main
//
// import (
// "libvirt.org/go/libvirt"
// "libvirt.org/go/libvirtxml"
// "fmt"
// )
//
// func main() {
// conn, err := libvirt.NewConnect("qemu:///system")
// dom, err := conn.LookupDomainByName("demo")
// xmldoc, err := dom.GetXMLDesc(0)
//
// domcfg := &libvirtxml.Domain{}
// err = domcfg.Unmarshal(xmldoc)
//
// fmt.Printf("Virt type %s\n", domcfg.Type)
// }
package libvirtxml
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/storage_pool.go | vendor/libvirt.org/go/libvirtxml/storage_pool.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
package libvirtxml
import "encoding/xml"
type StoragePoolSize struct {
Unit string `xml:"unit,attr,omitempty"`
Value uint64 `xml:",chardata"`
}
type StoragePoolTargetPermissions struct {
Owner string `xml:"owner,omitempty"`
Group string `xml:"group,omitempty"`
Mode string `xml:"mode,omitempty"`
Label string `xml:"label,omitempty"`
}
type StoragePoolTargetTimestamps struct {
Atime string `xml:"atime"`
Mtime string `xml:"mtime"`
Ctime string `xml:"ctime"`
}
type StoragePoolTarget struct {
Path string `xml:"path,omitempty"`
Permissions *StoragePoolTargetPermissions `xml:"permissions"`
Timestamps *StoragePoolTargetTimestamps `xml:"timestamps"`
Encryption *StorageEncryption `xml:"encryption"`
}
type StoragePoolSourceFormat struct {
Type string `xml:"type,attr"`
}
type StoragePoolSourceProtocol struct {
Version string `xml:"ver,attr"`
}
type StoragePoolSourceHost struct {
Name string `xml:"name,attr"`
Port string `xml:"port,attr,omitempty"`
}
type StoragePoolSourceDevice struct {
Path string `xml:"path,attr"`
PartSeparator string `xml:"part_separator,attr,omitempty"`
FreeExtents []StoragePoolSourceDeviceFreeExtent `xml:"freeExtent"`
}
type StoragePoolSourceDeviceFreeExtent struct {
Start uint64 `xml:"start,attr"`
End uint64 `xml:"end,attr"`
}
type StoragePoolSourceAuthSecret struct {
Usage string `xml:"usage,attr,omitempty"`
UUID string `xml:"uuid,attr,omitempty"`
}
type StoragePoolSourceAuth struct {
Type string `xml:"type,attr"`
Username string `xml:"username,attr"`
Secret *StoragePoolSourceAuthSecret `xml:"secret"`
}
type StoragePoolSourceVendor struct {
Name string `xml:"name,attr"`
}
type StoragePoolSourceProduct struct {
Name string `xml:"name,attr"`
}
type StoragePoolPCIAddress struct {
Domain *uint `xml:"domain,attr"`
Bus *uint `xml:"bus,attr"`
Slot *uint `xml:"slot,attr"`
Function *uint `xml:"function,attr"`
}
type StoragePoolSourceAdapterParentAddr struct {
UniqueID uint64 `xml:"unique_id,attr"`
Address *StoragePoolPCIAddress `xml:"address"`
}
type StoragePoolSourceAdapter struct {
Type string `xml:"type,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
Parent string `xml:"parent,attr,omitempty"`
Managed string `xml:"managed,attr,omitempty"`
WWNN string `xml:"wwnn,attr,omitempty"`
WWPN string `xml:"wwpn,attr,omitempty"`
ParentAddr *StoragePoolSourceAdapterParentAddr `xml:"parentaddr"`
}
type StoragePoolSourceDir struct {
Path string `xml:"path,attr"`
}
type StoragePoolSourceInitiator struct {
IQN StoragePoolSourceInitiatorIQN `xml:"iqn"`
}
type StoragePoolSourceInitiatorIQN struct {
Name string `xml:"name,attr,omitempty"`
}
type StoragePoolSource struct {
Name string `xml:"name,omitempty"`
Dir *StoragePoolSourceDir `xml:"dir"`
Host []StoragePoolSourceHost `xml:"host"`
Device []StoragePoolSourceDevice `xml:"device"`
Auth *StoragePoolSourceAuth `xml:"auth"`
Vendor *StoragePoolSourceVendor `xml:"vendor"`
Product *StoragePoolSourceProduct `xml:"product"`
Format *StoragePoolSourceFormat `xml:"format"`
Protocol *StoragePoolSourceProtocol `xml:"protocol"`
Adapter *StoragePoolSourceAdapter `xml:"adapter"`
Initiator *StoragePoolSourceInitiator `xml:"initiator"`
}
type StoragePoolRefreshVol struct {
Allocation string `xml:"allocation,attr"`
}
type StoragePoolRefresh struct {
Volume StoragePoolRefreshVol `xml:"volume"`
}
type StoragePoolFeatures struct {
COW StoragePoolFeatureCOW `xml:"cow"`
}
type StoragePoolFeatureCOW struct {
State string `xml:"state,attr"`
}
type StoragePool struct {
XMLName xml.Name `xml:"pool"`
Type string `xml:"type,attr"`
Name string `xml:"name,omitempty"`
UUID string `xml:"uuid,omitempty"`
Allocation *StoragePoolSize `xml:"allocation"`
Capacity *StoragePoolSize `xml:"capacity"`
Available *StoragePoolSize `xml:"available"`
Features *StoragePoolFeatures `xml:"features"`
Target *StoragePoolTarget `xml:"target"`
Source *StoragePoolSource `xml:"source"`
Refresh *StoragePoolRefresh `xml:"refresh"`
/* Pool backend namespcaes must be last */
FSCommandline *StoragePoolFSCommandline
RBDCommandline *StoragePoolRBDCommandline
}
type StoragePoolFSCommandlineOption struct {
Name string `xml:"name,attr"`
}
type StoragePoolFSCommandline struct {
XMLName xml.Name `xml:"http://libvirt.org/schemas/storagepool/fs/1.0 mount_opts"`
Options []StoragePoolFSCommandlineOption `xml:"option"`
}
type StoragePoolRBDCommandlineOption struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
type StoragePoolRBDCommandline struct {
XMLName xml.Name `xml:"http://libvirt.org/schemas/storagepool/rbd/1.0 config_opts"`
Options []StoragePoolRBDCommandlineOption `xml:"option"`
}
func (a *StoragePoolPCIAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
marshalUintAttr(&start, "domain", a.Domain, "0x%04x")
marshalUintAttr(&start, "bus", a.Bus, "0x%02x")
marshalUintAttr(&start, "slot", a.Slot, "0x%02x")
marshalUintAttr(&start, "function", a.Function, "0x%x")
e.EncodeToken(start)
e.EncodeToken(start.End())
return nil
}
func (a *StoragePoolPCIAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for _, attr := range start.Attr {
if attr.Name.Local == "domain" {
if err := unmarshalUintAttr(attr.Value, &a.Domain, 0); err != nil {
return err
}
} else if attr.Name.Local == "bus" {
if err := unmarshalUintAttr(attr.Value, &a.Bus, 0); err != nil {
return err
}
} else if attr.Name.Local == "slot" {
if err := unmarshalUintAttr(attr.Value, &a.Slot, 0); err != nil {
return err
}
} else if attr.Name.Local == "function" {
if err := unmarshalUintAttr(attr.Value, &a.Function, 0); err != nil {
return err
}
}
}
d.Skip()
return nil
}
func (s *StoragePool) Unmarshal(doc string) error {
return xml.Unmarshal([]byte(doc), s)
}
func (s *StoragePool) Marshal() (string, error) {
doc, err := xml.MarshalIndent(s, "", " ")
if err != nil {
return "", err
}
return string(doc), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirtxml/node_device.go | vendor/libvirt.org/go/libvirtxml/node_device.go | /*
* This file is part of the libvirt-go-xml-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2017 Red Hat, Inc.
*
*/
package libvirtxml
import (
"encoding/xml"
"fmt"
"io"
"strconv"
"strings"
)
type NodeDevice struct {
XMLName xml.Name `xml:"device"`
Name string `xml:"name"`
Path string `xml:"path,omitempty"`
DevNodes []NodeDeviceDevNode `xml:"devnode"`
Parent string `xml:"parent,omitempty"`
Driver *NodeDeviceDriver `xml:"driver"`
Capability NodeDeviceCapability `xml:"capability"`
}
type NodeDeviceDevNode struct {
Type string `xml:"type,attr,omitempty"`
Path string `xml:",chardata"`
}
type NodeDeviceDriver struct {
Name string `xml:"name"`
}
type NodeDeviceCapability struct {
System *NodeDeviceSystemCapability
PCI *NodeDevicePCICapability
USB *NodeDeviceUSBCapability
USBDevice *NodeDeviceUSBDeviceCapability
Net *NodeDeviceNetCapability
SCSIHost *NodeDeviceSCSIHostCapability
SCSITarget *NodeDeviceSCSITargetCapability
SCSI *NodeDeviceSCSICapability
Storage *NodeDeviceStorageCapability
DRM *NodeDeviceDRMCapability
CCW *NodeDeviceCCWCapability
MDev *NodeDeviceMDevCapability
CSS *NodeDeviceCSSCapability
APQueue *NodeDeviceAPQueueCapability
APCard *NodeDeviceAPCardCapability
APMatrix *NodeDeviceAPMatrixCapability
CCWGroup *NodeDeviceCCWGroupCapability
}
type NodeDeviceIDName struct {
ID string `xml:"id,attr"`
Name string `xml:",chardata"`
}
type NodeDevicePCIExpress struct {
Links []NodeDevicePCIExpressLink `xml:"link"`
}
type NodeDevicePCIExpressLink struct {
Validity string `xml:"validity,attr,omitempty"`
Speed float64 `xml:"speed,attr,omitempty"`
Port *uint `xml:"port,attr"`
Width *uint `xml:"width,attr"`
}
type NodeDeviceIOMMUGroup struct {
Number int `xml:"number,attr"`
Address []NodeDevicePCIAddress `xml:"address"`
}
type NodeDeviceNUMA struct {
Node int `xml:"node,attr"`
}
type NodeDevicePCICapability struct {
Class string `xml:"class,omitempty"`
Domain *uint `xml:"domain"`
Bus *uint `xml:"bus"`
Slot *uint `xml:"slot"`
Function *uint `xml:"function"`
Product NodeDeviceIDName `xml:"product,omitempty"`
Vendor NodeDeviceIDName `xml:"vendor,omitempty"`
IOMMUGroup *NodeDeviceIOMMUGroup `xml:"iommuGroup"`
NUMA *NodeDeviceNUMA `xml:"numa"`
PCIExpress *NodeDevicePCIExpress `xml:"pci-express"`
Capabilities []NodeDevicePCISubCapability `xml:"capability"`
}
type NodeDevicePCIAddress struct {
Domain *uint `xml:"domain,attr"`
Bus *uint `xml:"bus,attr"`
Slot *uint `xml:"slot,attr"`
Function *uint `xml:"function,attr"`
}
type NodeDevicePCISubCapability struct {
VirtFunctions *NodeDevicePCIVirtFunctionsCapability
PhysFunction *NodeDevicePCIPhysFunctionCapability
MDevTypes *NodeDevicePCIMDevTypesCapability
Bridge *NodeDevicePCIBridgeCapability
VPD *NodeDevicePCIVPDCapability
}
type NodeDevicePCIVirtFunctionsCapability struct {
Address []NodeDevicePCIAddress `xml:"address,omitempty"`
MaxCount int `xml:"maxCount,attr,omitempty"`
}
type NodeDevicePCIPhysFunctionCapability struct {
Address NodeDevicePCIAddress `xml:"address,omitempty"`
}
type NodeDevicePCIMDevTypesCapability struct {
Types []NodeDeviceMDevType `xml:"type"`
}
type NodeDeviceMDevType struct {
ID string `xml:"id,attr"`
Name string `xml:"name"`
DeviceAPI string `xml:"deviceAPI"`
AvailableInstances uint `xml:"availableInstances"`
}
type NodeDevicePCIBridgeCapability struct {
}
type NodeDevicePCIVPDCapability struct {
Name string `xml:"name,omitempty"`
ReadOnly *NodeDevicePCIVPDFieldsRO `xml:"-"`
ReadWrite *NodeDevicePCIVPDFieldsRW `xml:"-"`
}
type NodeDevicePCIVPDFieldsRO struct {
ChangeLevel string `xml:"change_level,omitempty"`
ManufactureID string `xml:"manufacture_id,omitempty"`
PartNumber string `xml:"part_number,omitempty"`
SerialNumber string `xml:"serial_number,omitempty"`
VendorFields []NodeDevicePCIVPDCustomField `xml:"vendor_field"`
}
type NodeDevicePCIVPDFieldsRW struct {
AssetTag string `xml:"asset_tag,omitempty"`
VendorFields []NodeDevicePCIVPDCustomField `xml:"vendor_field"`
SystemFields []NodeDevicePCIVPDCustomField `xml:"system_field"`
}
type NodeDevicePCIVPDCustomField struct {
Index string `xml:"index,attr"`
Value string `xml:",chardata"`
}
type NodeDeviceSystemHardware struct {
Vendor string `xml:"vendor"`
Version string `xml:"version"`
Serial string `xml:"serial"`
UUID string `xml:"uuid"`
}
type NodeDeviceSystemFirmware struct {
Vendor string `xml:"vendor"`
Version string `xml:"version"`
ReleaseData string `xml:"release_date"`
}
type NodeDeviceSystemCapability struct {
Product string `xml:"product,omitempty"`
Hardware *NodeDeviceSystemHardware `xml:"hardware"`
Firmware *NodeDeviceSystemFirmware `xml:"firmware"`
}
type NodeDeviceUSBDeviceCapability struct {
Bus int `xml:"bus"`
Device int `xml:"device"`
Product NodeDeviceIDName `xml:"product,omitempty"`
Vendor NodeDeviceIDName `xml:"vendor,omitempty"`
}
type NodeDeviceUSBCapability struct {
Number int `xml:"number"`
Class int `xml:"class"`
Subclass int `xml:"subclass"`
Protocol int `xml:"protocol"`
Description string `xml:"description,omitempty"`
}
type NodeDeviceNetOffloadFeatures struct {
Name string `xml:"name,attr"`
}
type NodeDeviceNetLink struct {
State string `xml:"state,attr"`
Speed string `xml:"speed,attr,omitempty"`
}
type NodeDeviceNetSubCapability struct {
Wireless80211 *NodeDeviceNet80211Capability
Ethernet80203 *NodeDeviceNet80203Capability
}
type NodeDeviceNet80211Capability struct {
}
type NodeDeviceNet80203Capability struct {
}
type NodeDeviceNetCapability struct {
Interface string `xml:"interface"`
Address string `xml:"address"`
Link *NodeDeviceNetLink `xml:"link"`
Features []NodeDeviceNetOffloadFeatures `xml:"feature,omitempty"`
Capability []NodeDeviceNetSubCapability `xml:"capability"`
}
type NodeDeviceSCSIVPortOpsCapability struct {
VPorts int `xml:"vports"`
MaxVPorts int `xml:"max_vports"`
}
type NodeDeviceSCSIFCHostCapability struct {
WWNN string `xml:"wwnn,omitempty"`
WWPN string `xml:"wwpn,omitempty"`
FabricWWN string `xml:"fabric_wwn,omitempty"`
}
type NodeDeviceSCSIHostSubCapability struct {
VPortOps *NodeDeviceSCSIVPortOpsCapability
FCHost *NodeDeviceSCSIFCHostCapability
}
type NodeDeviceSCSIHostCapability struct {
Host uint `xml:"host"`
UniqueID *uint `xml:"unique_id"`
Capability []NodeDeviceSCSIHostSubCapability `xml:"capability"`
}
type NodeDeviceSCSITargetCapability struct {
Target string `xml:"target"`
Capability []NodeDeviceSCSITargetSubCapability `xml:"capability"`
}
type NodeDeviceSCSITargetSubCapability struct {
FCRemotePort *NodeDeviceSCSIFCRemotePortCapability
}
type NodeDeviceSCSIFCRemotePortCapability struct {
RPort string `xml:"rport"`
WWPN string `xml:"wwpn"`
}
type NodeDeviceSCSICapability struct {
Host int `xml:"host"`
Bus int `xml:"bus"`
Target int `xml:"target"`
Lun int `xml:"lun"`
Type string `xml:"type"`
}
type NodeDeviceStorageSubCapability struct {
Removable *NodeDeviceStorageRemovableCapability
}
type NodeDeviceStorageRemovableCapability struct {
MediaAvailable *uint `xml:"media_available"`
MediaSize *uint `xml:"media_size"`
MediaLabel string `xml:"media_label,omitempty"`
LogicalBlockSize *uint `xml:"logical_block_size"`
NumBlocks *uint `xml:"num_blocks"`
}
type NodeDeviceStorageCapability struct {
Block string `xml:"block,omitempty"`
Bus string `xml:"bus,omitempty"`
DriverType string `xml:"drive_type,omitempty"`
Model string `xml:"model,omitempty"`
Vendor string `xml:"vendor,omitempty"`
Serial string `xml:"serial,omitempty"`
Size *uint `xml:"size"`
LogicalBlockSize *uint `xml:"logical_block_size"`
NumBlocks *uint `xml:"num_blocks"`
Capability []NodeDeviceStorageSubCapability `xml:"capability"`
}
type NodeDeviceDRMCapability struct {
Type string `xml:"type"`
}
type NodeDeviceCCWSubCapability struct {
GroupMember *NodeDeviceCCWGroupMemberCapability
}
type NodeDeviceCCWGroupMemberCapability struct {
GroupDevice string `xml:"group_device"`
}
type NodeDeviceCCWCapability struct {
CSSID *uint `xml:"cssid"`
SSID *uint `xml:"ssid"`
DevNo *uint `xml:"devno"`
Capabilities []NodeDeviceCCWSubCapability `xml:"capability"`
}
type NodeDeviceMDevCapability struct {
Type *NodeDeviceMDevCapabilityType `xml:"type"`
IOMMUGroup *NodeDeviceIOMMUGroup `xml:"iommuGroup"`
UUID string `xml:"uuid,omitempty"`
ParentAddr string `xml:"parent_addr,omitempty"`
Attrs []NodeDeviceMDevCapabilityAttrs `xml:"attr,omitempty"`
}
type NodeDeviceMDevCapabilityType struct {
ID string `xml:"id,attr"`
}
type NodeDeviceMDevCapabilityAttrs struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
type NodeDeviceCSSCapability struct {
CSSID *uint `xml:"cssid"`
SSID *uint `xml:"ssid"`
DevNo *uint `xml:"devno"`
ChannelDevAddr *NodeDeviceCSSChannelDevAddr `xml:"channel_dev_addr"`
Capabilities []NodeDeviceCSSSubCapability `xml:"capability"`
}
type NodeDeviceCSSChannelDevAddr struct {
CSSID *uint `xml:"cssid"`
SSID *uint `xml:"ssid"`
DevNo *uint `xml:"devno"`
}
type NodeDeviceCSSSubCapability struct {
MDevTypes *NodeDeviceCSSMDevTypesCapability
}
type NodeDeviceCSSMDevTypesCapability struct {
Types []NodeDeviceMDevType `xml:"type"`
}
type NodeDeviceAPQueueCapability struct {
APAdapter string `xml:"ap-adapter"`
APDomain string `xml:"ap-domain"`
}
type NodeDeviceAPCardCapability struct {
APAdapter string `xml:"ap-adapter"`
}
type NodeDeviceAPMatrixCapability struct {
Capabilities []NodeDeviceAPMatrixSubCapability `xml:"capability"`
}
type NodeDeviceAPMatrixSubCapability struct {
MDevTypes *NodeDeviceAPMatrixMDevTypesCapability
}
type NodeDeviceAPMatrixMDevTypesCapability struct {
Types []NodeDeviceMDevType `xml:"type"`
}
type NodeDeviceCCWGroupCapability struct {
State string `xml:"state",omitempty`
CSSID *uint `xml:"cssid"`
SSID *uint `xml:"ssid"`
DevNo *uint `xml:"devno"`
Members *NodeDeviceCCWGroupMembers `xml:"members"`
Capabilities []NodeDeviceCCWGroupSubCapability `xml:"capability"`
}
type NodeDeviceCCWGroupMembers struct {
CCWDevice []NodeDeviceCCWGroupMembersDevice `xml:"ccw_device"`
}
type NodeDeviceCCWGroupMembersDevice struct {
Ref string `xml:"ref,attr,omitempty"`
Name string `xml:",chardata"`
}
type NodeDeviceCCWGroupSubCapability struct {
QEthGeneric *NodeDeviceCCWGroupSubCapabilityQEthGeneric `xml:"-"`
}
type NodeDeviceCCWGroupSubCapabilityQEthGeneric struct {
CardType string `xml:"card_type"`
ChpID string `xml:"chpid"`
}
func (a *NodeDevicePCIAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
marshalUintAttr(&start, "domain", a.Domain, "0x%04x")
marshalUintAttr(&start, "bus", a.Bus, "0x%02x")
marshalUintAttr(&start, "slot", a.Slot, "0x%02x")
marshalUintAttr(&start, "function", a.Function, "0x%x")
e.EncodeToken(start)
e.EncodeToken(start.End())
return nil
}
func (a *NodeDevicePCIAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for _, attr := range start.Attr {
if attr.Name.Local == "domain" {
if err := unmarshalUintAttr(attr.Value, &a.Domain, 0); err != nil {
return err
}
} else if attr.Name.Local == "bus" {
if err := unmarshalUintAttr(attr.Value, &a.Bus, 0); err != nil {
return err
}
} else if attr.Name.Local == "slot" {
if err := unmarshalUintAttr(attr.Value, &a.Slot, 0); err != nil {
return err
}
} else if attr.Name.Local == "function" {
if err := unmarshalUintAttr(attr.Value, &a.Function, 0); err != nil {
return err
}
}
}
d.Skip()
return nil
}
func (c *NodeDeviceCSSSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "mdev_types":
var mdevTypesCaps NodeDeviceCSSMDevTypesCapability
if err := d.DecodeElement(&mdevTypesCaps, &start); err != nil {
return err
}
c.MDevTypes = &mdevTypesCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceCSSSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.MDevTypes != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "mdev_types",
})
return e.EncodeElement(c.MDevTypes, start)
}
return nil
}
func (c *NodeDeviceCCWCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if c.CSSID != nil {
cssid := xml.StartElement{
Name: xml.Name{Local: "cssid"},
}
e.EncodeToken(cssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.CSSID)))
e.EncodeToken(cssid.End())
}
if c.SSID != nil {
ssid := xml.StartElement{
Name: xml.Name{Local: "ssid"},
}
e.EncodeToken(ssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.SSID)))
e.EncodeToken(ssid.End())
}
if c.DevNo != nil {
devno := xml.StartElement{
Name: xml.Name{Local: "devno"},
}
e.EncodeToken(devno)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%04x", *c.DevNo)))
e.EncodeToken(devno.End())
}
if c.Capabilities != nil {
for _, subcap := range c.Capabilities {
start := xml.StartElement{
Name: xml.Name{Local: "capability"},
}
e.EncodeElement(&subcap, start)
}
}
e.EncodeToken(start.End())
return nil
}
func (c *NodeDeviceCCWCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
tok, err := d.Token()
if err == io.EOF {
break
}
if err != nil {
return err
}
switch tok := tok.(type) {
case xml.StartElement:
cdata, err := d.Token()
if err != nil {
return err
}
if tok.Name.Local == "cssid" ||
tok.Name.Local == "ssid" ||
tok.Name.Local == "devno" {
chardata, ok := cdata.(xml.CharData)
if !ok {
return fmt.Errorf("Expected text for CCW '%s'", tok.Name.Local)
}
valstr := strings.TrimPrefix(string(chardata), "0x")
val, err := strconv.ParseUint(valstr, 16, 64)
if err != nil {
return err
}
vali := uint(val)
if tok.Name.Local == "cssid" {
c.CSSID = &vali
} else if tok.Name.Local == "ssid" {
c.SSID = &vali
} else if tok.Name.Local == "devno" {
c.DevNo = &vali
}
} else if tok.Name.Local == "capability" {
subcap := &NodeDeviceCCWSubCapability{}
err := d.DecodeElement(subcap, &tok)
if err != nil {
return err
}
c.Capabilities = append(c.Capabilities, *subcap)
continue
} else {
continue
}
}
}
return nil
}
func (c *NodeDeviceCSSCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if c.CSSID != nil {
cssid := xml.StartElement{
Name: xml.Name{Local: "cssid"},
}
e.EncodeToken(cssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.CSSID)))
e.EncodeToken(cssid.End())
}
if c.SSID != nil {
ssid := xml.StartElement{
Name: xml.Name{Local: "ssid"},
}
e.EncodeToken(ssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.SSID)))
e.EncodeToken(ssid.End())
}
if c.DevNo != nil {
devno := xml.StartElement{
Name: xml.Name{Local: "devno"},
}
e.EncodeToken(devno)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%04x", *c.DevNo)))
e.EncodeToken(devno.End())
}
if c.ChannelDevAddr != nil {
start := xml.StartElement{
Name: xml.Name{Local: "channel_dev_addr"},
}
e.EncodeElement(c.ChannelDevAddr, start)
}
if c.Capabilities != nil {
for _, subcap := range c.Capabilities {
start := xml.StartElement{
Name: xml.Name{Local: "capability"},
}
e.EncodeElement(&subcap, start)
}
}
e.EncodeToken(start.End())
return nil
}
func (c *NodeDeviceCSSCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
tok, err := d.Token()
if err == io.EOF {
break
}
if err != nil {
return err
}
switch tok := tok.(type) {
case xml.StartElement:
cdata, err := d.Token()
if err != nil {
return err
}
if tok.Name.Local == "capability" {
subcap := &NodeDeviceCSSSubCapability{}
err := d.DecodeElement(subcap, &tok)
if err != nil {
return err
}
c.Capabilities = append(c.Capabilities, *subcap)
continue
} else if tok.Name.Local == "channel_dev_addr" {
chandev := &NodeDeviceCSSChannelDevAddr{}
err := d.DecodeElement(chandev, &tok)
if err != nil {
return err
}
c.ChannelDevAddr = chandev
continue
}
if tok.Name.Local != "cssid" &&
tok.Name.Local != "ssid" &&
tok.Name.Local != "devno" {
continue
}
chardata, ok := cdata.(xml.CharData)
if !ok {
return fmt.Errorf("Expected text for CSS '%s'", tok.Name.Local)
}
valstr := strings.TrimPrefix(string(chardata), "0x")
val, err := strconv.ParseUint(valstr, 16, 64)
if err != nil {
return err
}
vali := uint(val)
if tok.Name.Local == "cssid" {
c.CSSID = &vali
} else if tok.Name.Local == "ssid" {
c.SSID = &vali
} else if tok.Name.Local == "devno" {
c.DevNo = &vali
}
}
}
return nil
}
func (c *NodeDeviceCSSChannelDevAddr) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if c.CSSID != nil {
cssid := xml.StartElement{
Name: xml.Name{Local: "cssid"},
}
e.EncodeToken(cssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.CSSID)))
e.EncodeToken(cssid.End())
}
if c.SSID != nil {
ssid := xml.StartElement{
Name: xml.Name{Local: "ssid"},
}
e.EncodeToken(ssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.SSID)))
e.EncodeToken(ssid.End())
}
if c.DevNo != nil {
devno := xml.StartElement{
Name: xml.Name{Local: "devno"},
}
e.EncodeToken(devno)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%04x", *c.DevNo)))
e.EncodeToken(devno.End())
}
e.EncodeToken(start.End())
return nil
}
func (c *NodeDeviceCSSChannelDevAddr) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
tok, err := d.Token()
if err == io.EOF {
break
}
if err != nil {
return err
}
switch tok := tok.(type) {
case xml.StartElement:
cdata, err := d.Token()
if err != nil {
return err
}
if tok.Name.Local != "cssid" &&
tok.Name.Local != "ssid" &&
tok.Name.Local != "devno" {
continue
}
chardata, ok := cdata.(xml.CharData)
if !ok {
return fmt.Errorf("Expected text for CSS '%s'", tok.Name.Local)
}
valstr := strings.TrimPrefix(string(chardata), "0x")
val, err := strconv.ParseUint(valstr, 16, 64)
if err != nil {
return err
}
vali := uint(val)
if tok.Name.Local == "cssid" {
c.CSSID = &vali
} else if tok.Name.Local == "ssid" {
c.SSID = &vali
} else if tok.Name.Local == "devno" {
c.DevNo = &vali
}
}
}
return nil
}
func (c *NodeDevicePCISubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "virt_functions":
var virtFuncCaps NodeDevicePCIVirtFunctionsCapability
if err := d.DecodeElement(&virtFuncCaps, &start); err != nil {
return err
}
c.VirtFunctions = &virtFuncCaps
case "phys_function":
var physFuncCaps NodeDevicePCIPhysFunctionCapability
if err := d.DecodeElement(&physFuncCaps, &start); err != nil {
return err
}
c.PhysFunction = &physFuncCaps
case "mdev_types":
var mdevTypeCaps NodeDevicePCIMDevTypesCapability
if err := d.DecodeElement(&mdevTypeCaps, &start); err != nil {
return err
}
c.MDevTypes = &mdevTypeCaps
case "pci-bridge":
var bridgeCaps NodeDevicePCIBridgeCapability
if err := d.DecodeElement(&bridgeCaps, &start); err != nil {
return err
}
c.Bridge = &bridgeCaps
case "vpd":
var vpdCaps NodeDevicePCIVPDCapability
if err := d.DecodeElement(&vpdCaps, &start); err != nil {
return err
}
c.VPD = &vpdCaps
}
d.Skip()
return nil
}
func (c *NodeDevicePCISubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.VirtFunctions != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "virt_functions",
})
return e.EncodeElement(c.VirtFunctions, start)
} else if c.PhysFunction != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "phys_function",
})
return e.EncodeElement(c.PhysFunction, start)
} else if c.MDevTypes != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "mdev_types",
})
return e.EncodeElement(c.MDevTypes, start)
} else if c.Bridge != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "pci-bridge",
})
return e.EncodeElement(c.Bridge, start)
} else if c.VPD != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "vpd",
})
return e.EncodeElement(c.VPD, start)
}
return nil
}
func (c *NodeDeviceSCSITargetSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "fc_remote_port":
var fcCaps NodeDeviceSCSIFCRemotePortCapability
if err := d.DecodeElement(&fcCaps, &start); err != nil {
return err
}
c.FCRemotePort = &fcCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceSCSITargetSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.FCRemotePort != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "fc_remote_port",
})
return e.EncodeElement(c.FCRemotePort, start)
}
return nil
}
func (c *NodeDeviceSCSIHostSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "fc_host":
var fcCaps NodeDeviceSCSIFCHostCapability
if err := d.DecodeElement(&fcCaps, &start); err != nil {
return err
}
c.FCHost = &fcCaps
case "vport_ops":
var vportCaps NodeDeviceSCSIVPortOpsCapability
if err := d.DecodeElement(&vportCaps, &start); err != nil {
return err
}
c.VPortOps = &vportCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceSCSIHostSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.FCHost != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "fc_host",
})
return e.EncodeElement(c.FCHost, start)
} else if c.VPortOps != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "vport_ops",
})
return e.EncodeElement(c.VPortOps, start)
}
return nil
}
func (c *NodeDeviceStorageSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "removable":
var removeCaps NodeDeviceStorageRemovableCapability
if err := d.DecodeElement(&removeCaps, &start); err != nil {
return err
}
c.Removable = &removeCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceCCWSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.GroupMember != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "ccwgroup_member",
})
return e.EncodeElement(c.GroupMember, start)
}
return nil
}
func (c *NodeDeviceCCWSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "ccwgroup_member":
var groupMemberCaps NodeDeviceCCWGroupMemberCapability
if err := d.DecodeElement(&groupMemberCaps, &start); err != nil {
return err
}
c.GroupMember = &groupMemberCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceStorageSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.Removable != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "removable",
})
return e.EncodeElement(c.Removable, start)
}
return nil
}
func (c *NodeDeviceNetSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "80211":
var wlanCaps NodeDeviceNet80211Capability
if err := d.DecodeElement(&wlanCaps, &start); err != nil {
return err
}
c.Wireless80211 = &wlanCaps
case "80203":
var ethCaps NodeDeviceNet80203Capability
if err := d.DecodeElement(ðCaps, &start); err != nil {
return err
}
c.Ethernet80203 = ðCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceNetSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.Wireless80211 != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "80211",
})
return e.EncodeElement(c.Wireless80211, start)
} else if c.Ethernet80203 != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "80203",
})
return e.EncodeElement(c.Ethernet80203, start)
}
return nil
}
func (c *NodeDeviceAPMatrixSubCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
typ, ok := getAttr(start.Attr, "type")
if !ok {
return fmt.Errorf("Missing node device capability type")
}
switch typ {
case "mdev_types":
var mdevTypeCaps NodeDeviceAPMatrixMDevTypesCapability
if err := d.DecodeElement(&mdevTypeCaps, &start); err != nil {
return err
}
c.MDevTypes = &mdevTypeCaps
}
d.Skip()
return nil
}
func (c *NodeDeviceAPMatrixSubCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.MDevTypes != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "type"}, "mdev_types",
})
return e.EncodeElement(c.MDevTypes, start)
}
return nil
}
type nodeDevicePCIVPDFields struct {
ReadOnly *NodeDevicePCIVPDFieldsRO
ReadWrite *NodeDevicePCIVPDFieldsRW
}
type nodeDevicePCIVPDCapability struct {
Name string `xml:"name,omitempty"`
Fields []nodeDevicePCIVPDFields `xml:"fields"`
}
func (c *nodeDevicePCIVPDFields) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
acc, ok := getAttr(start.Attr, "access")
if !ok {
return fmt.Errorf("Missing node device PCI VPD capability access")
}
switch acc {
case "readonly":
var ro NodeDevicePCIVPDFieldsRO
if err := d.DecodeElement(&ro, &start); err != nil {
return err
}
c.ReadOnly = &ro
case "readwrite":
var rw NodeDevicePCIVPDFieldsRW
if err := d.DecodeElement(&rw, &start); err != nil {
return err
}
c.ReadWrite = &rw
}
d.Skip()
return nil
}
func (c *NodeDevicePCIVPDCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
var ccopy nodeDevicePCIVPDCapability
ccopy.Name = c.Name
if c.ReadOnly != nil {
ccopy.Fields = append(ccopy.Fields, nodeDevicePCIVPDFields{
ReadOnly: c.ReadOnly,
})
}
if c.ReadWrite != nil {
ccopy.Fields = append(ccopy.Fields, nodeDevicePCIVPDFields{
ReadWrite: c.ReadWrite,
})
}
e.EncodeElement(&ccopy, start)
return nil
}
func (c *NodeDevicePCIVPDCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var ccopy nodeDevicePCIVPDCapability
if err := d.DecodeElement(&ccopy, &start); err != nil {
return err
}
c.Name = ccopy.Name
for _, field := range ccopy.Fields {
if field.ReadOnly != nil {
c.ReadOnly = field.ReadOnly
} else if field.ReadWrite != nil {
c.ReadWrite = field.ReadWrite
}
}
return nil
}
func (c *nodeDevicePCIVPDFields) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if c.ReadOnly != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "access"}, "readonly",
})
return e.EncodeElement(c.ReadOnly, start)
} else if c.ReadWrite != nil {
start.Attr = append(start.Attr, xml.Attr{
xml.Name{Local: "access"}, "readwrite",
})
return e.EncodeElement(c.ReadWrite, start)
}
return nil
}
func (c *NodeDeviceCCWGroupCapability) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if c.State != "" {
state := xml.StartElement{
Name: xml.Name{Local: "state"},
}
e.EncodeToken(state)
e.EncodeToken(xml.CharData(c.State))
e.EncodeToken(state.End())
}
if c.CSSID != nil {
cssid := xml.StartElement{
Name: xml.Name{Local: "cssid"},
}
e.EncodeToken(cssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.CSSID)))
e.EncodeToken(cssid.End())
}
if c.SSID != nil {
ssid := xml.StartElement{
Name: xml.Name{Local: "ssid"},
}
e.EncodeToken(ssid)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%x", *c.SSID)))
e.EncodeToken(ssid.End())
}
if c.DevNo != nil {
devno := xml.StartElement{
Name: xml.Name{Local: "devno"},
}
e.EncodeToken(devno)
e.EncodeToken(xml.CharData(fmt.Sprintf("0x%04x", *c.DevNo)))
e.EncodeToken(devno.End())
}
if c.Members != nil {
start := xml.StartElement{
Name: xml.Name{Local: "members"},
}
e.EncodeElement(&c.Members, start)
}
if c.Capabilities != nil {
for _, subcap := range c.Capabilities {
start := xml.StartElement{
Name: xml.Name{Local: "capability"},
}
e.EncodeElement(&subcap, start)
}
}
e.EncodeToken(start.End())
return nil
}
func (c *NodeDeviceCCWGroupCapability) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
tok, err := d.Token()
if err == io.EOF {
break
}
if err != nil {
return err
}
switch tok := tok.(type) {
case xml.StartElement:
cdata, err := d.Token()
if err != nil {
return err
}
if tok.Name.Local == "cssid" ||
tok.Name.Local == "ssid" ||
tok.Name.Local == "devno" {
chardata, ok := cdata.(xml.CharData)
if !ok {
return fmt.Errorf("Expected text for CCW '%s'", tok.Name.Local)
}
valstr := strings.TrimPrefix(string(chardata), "0x")
val, err := strconv.ParseUint(valstr, 16, 64)
if err != nil {
return err
}
vali := uint(val)
if tok.Name.Local == "cssid" {
c.CSSID = &vali
} else if tok.Name.Local == "ssid" {
c.SSID = &vali
} else if tok.Name.Local == "devno" {
c.DevNo = &vali
}
} else if tok.Name.Local == "state" {
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/domain.go | vendor/libvirt.org/go/libvirt/domain.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"fmt"
"os"
"reflect"
"strconv"
"strings"
"unsafe"
)
const (
DOMAIN_SEND_KEY_MAX_KEYS = uint32(C.VIR_DOMAIN_SEND_KEY_MAX_KEYS)
)
type DomainState int
const (
DOMAIN_NOSTATE = DomainState(C.VIR_DOMAIN_NOSTATE)
DOMAIN_RUNNING = DomainState(C.VIR_DOMAIN_RUNNING)
DOMAIN_BLOCKED = DomainState(C.VIR_DOMAIN_BLOCKED)
DOMAIN_PAUSED = DomainState(C.VIR_DOMAIN_PAUSED)
DOMAIN_SHUTDOWN = DomainState(C.VIR_DOMAIN_SHUTDOWN)
DOMAIN_CRASHED = DomainState(C.VIR_DOMAIN_CRASHED)
DOMAIN_PMSUSPENDED = DomainState(C.VIR_DOMAIN_PMSUSPENDED)
DOMAIN_SHUTOFF = DomainState(C.VIR_DOMAIN_SHUTOFF)
)
type DomainMetadataType int
const (
DOMAIN_METADATA_DESCRIPTION = DomainMetadataType(C.VIR_DOMAIN_METADATA_DESCRIPTION)
DOMAIN_METADATA_TITLE = DomainMetadataType(C.VIR_DOMAIN_METADATA_TITLE)
DOMAIN_METADATA_ELEMENT = DomainMetadataType(C.VIR_DOMAIN_METADATA_ELEMENT)
)
type DomainVcpuFlags uint
const (
DOMAIN_VCPU_CONFIG = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_CONFIG)
DOMAIN_VCPU_CURRENT = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_CURRENT)
DOMAIN_VCPU_LIVE = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_LIVE)
DOMAIN_VCPU_MAXIMUM = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_MAXIMUM)
DOMAIN_VCPU_GUEST = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_GUEST)
DOMAIN_VCPU_HOTPLUGGABLE = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_HOTPLUGGABLE)
)
type DomainModificationImpact int
const (
DOMAIN_AFFECT_CONFIG = DomainModificationImpact(C.VIR_DOMAIN_AFFECT_CONFIG)
DOMAIN_AFFECT_CURRENT = DomainModificationImpact(C.VIR_DOMAIN_AFFECT_CURRENT)
DOMAIN_AFFECT_LIVE = DomainModificationImpact(C.VIR_DOMAIN_AFFECT_LIVE)
)
type DomainMemoryModFlags uint
const (
DOMAIN_MEM_CONFIG = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_CONFIG)
DOMAIN_MEM_CURRENT = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_CURRENT)
DOMAIN_MEM_LIVE = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_LIVE)
DOMAIN_MEM_MAXIMUM = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_MAXIMUM)
)
type DomainDestroyFlags uint
const (
DOMAIN_DESTROY_DEFAULT = DomainDestroyFlags(C.VIR_DOMAIN_DESTROY_DEFAULT)
DOMAIN_DESTROY_GRACEFUL = DomainDestroyFlags(C.VIR_DOMAIN_DESTROY_GRACEFUL)
DOMAIN_DESTROY_REMOVE_LOGS = DomainDestroyFlags(C.VIR_DOMAIN_DESTROY_REMOVE_LOGS)
)
type DomainShutdownFlags uint
const (
DOMAIN_SHUTDOWN_DEFAULT = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_DEFAULT)
DOMAIN_SHUTDOWN_ACPI_POWER_BTN = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
DOMAIN_SHUTDOWN_GUEST_AGENT = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)
DOMAIN_SHUTDOWN_INITCTL = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_INITCTL)
DOMAIN_SHUTDOWN_SIGNAL = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_SIGNAL)
DOMAIN_SHUTDOWN_PARAVIRT = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_PARAVIRT)
)
type DomainUndefineFlagsValues int
const (
DOMAIN_UNDEFINE_MANAGED_SAVE = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) // Also remove any managed save
DOMAIN_UNDEFINE_SNAPSHOTS_METADATA = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA) // If last use of domain, then also remove any snapshot metadata
DOMAIN_UNDEFINE_NVRAM = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_NVRAM) // Also remove any nvram file
DOMAIN_UNDEFINE_KEEP_NVRAM = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_KEEP_NVRAM) // Keep nvram file
DOMAIN_UNDEFINE_CHECKPOINTS_METADATA = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA) // If last use of domain, then also remove any checkpoint metadata
DOMAIN_UNDEFINE_TPM = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_TPM) // Also remove any TPM state
DOMAIN_UNDEFINE_KEEP_TPM = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_KEEP_TPM) // Keep TPM state
)
type DomainDeviceModifyFlags uint
const (
DOMAIN_DEVICE_MODIFY_CONFIG = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_CONFIG)
DOMAIN_DEVICE_MODIFY_CURRENT = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_CURRENT)
DOMAIN_DEVICE_MODIFY_LIVE = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_LIVE)
DOMAIN_DEVICE_MODIFY_FORCE = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_FORCE)
)
type DomainCreateFlags uint
const (
DOMAIN_NONE = DomainCreateFlags(C.VIR_DOMAIN_NONE)
DOMAIN_START_PAUSED = DomainCreateFlags(C.VIR_DOMAIN_START_PAUSED)
DOMAIN_START_AUTODESTROY = DomainCreateFlags(C.VIR_DOMAIN_START_AUTODESTROY)
DOMAIN_START_BYPASS_CACHE = DomainCreateFlags(C.VIR_DOMAIN_START_BYPASS_CACHE)
DOMAIN_START_FORCE_BOOT = DomainCreateFlags(C.VIR_DOMAIN_START_FORCE_BOOT)
DOMAIN_START_VALIDATE = DomainCreateFlags(C.VIR_DOMAIN_START_VALIDATE)
DOMAIN_START_RESET_NVRAM = DomainCreateFlags(C.VIR_DOMAIN_START_RESET_NVRAM)
)
const DOMAIN_MEMORY_PARAM_UNLIMITED = C.VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
type DomainEventType int
const (
DOMAIN_EVENT_DEFINED = DomainEventType(C.VIR_DOMAIN_EVENT_DEFINED)
DOMAIN_EVENT_UNDEFINED = DomainEventType(C.VIR_DOMAIN_EVENT_UNDEFINED)
DOMAIN_EVENT_STARTED = DomainEventType(C.VIR_DOMAIN_EVENT_STARTED)
DOMAIN_EVENT_SUSPENDED = DomainEventType(C.VIR_DOMAIN_EVENT_SUSPENDED)
DOMAIN_EVENT_RESUMED = DomainEventType(C.VIR_DOMAIN_EVENT_RESUMED)
DOMAIN_EVENT_STOPPED = DomainEventType(C.VIR_DOMAIN_EVENT_STOPPED)
DOMAIN_EVENT_SHUTDOWN = DomainEventType(C.VIR_DOMAIN_EVENT_SHUTDOWN)
DOMAIN_EVENT_PMSUSPENDED = DomainEventType(C.VIR_DOMAIN_EVENT_PMSUSPENDED)
DOMAIN_EVENT_CRASHED = DomainEventType(C.VIR_DOMAIN_EVENT_CRASHED)
)
type DomainEventWatchdogAction int
// The action that is to be taken due to the watchdog device firing
const (
// No action, watchdog ignored
DOMAIN_EVENT_WATCHDOG_NONE = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_NONE)
// Guest CPUs are paused
DOMAIN_EVENT_WATCHDOG_PAUSE = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_PAUSE)
// Guest CPUs are reset
DOMAIN_EVENT_WATCHDOG_RESET = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_RESET)
// Guest is forcibly powered off
DOMAIN_EVENT_WATCHDOG_POWEROFF = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF)
// Guest is requested to gracefully shutdown
DOMAIN_EVENT_WATCHDOG_SHUTDOWN = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN)
// No action, a debug message logged
DOMAIN_EVENT_WATCHDOG_DEBUG = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_DEBUG)
// Inject a non-maskable interrupt into guest
DOMAIN_EVENT_WATCHDOG_INJECTNMI = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI)
)
type DomainEventIOErrorAction int
// The action that is to be taken due to an IO error occurring
const (
// No action, IO error ignored
DOMAIN_EVENT_IO_ERROR_NONE = DomainEventIOErrorAction(C.VIR_DOMAIN_EVENT_IO_ERROR_NONE)
// Guest CPUs are paused
DOMAIN_EVENT_IO_ERROR_PAUSE = DomainEventIOErrorAction(C.VIR_DOMAIN_EVENT_IO_ERROR_PAUSE)
// IO error reported to guest OS
DOMAIN_EVENT_IO_ERROR_REPORT = DomainEventIOErrorAction(C.VIR_DOMAIN_EVENT_IO_ERROR_REPORT)
)
type DomainEventGraphicsPhase int
// The phase of the graphics client connection
const (
// Initial socket connection established
DOMAIN_EVENT_GRAPHICS_CONNECT = DomainEventGraphicsPhase(C.VIR_DOMAIN_EVENT_GRAPHICS_CONNECT)
// Authentication & setup completed
DOMAIN_EVENT_GRAPHICS_INITIALIZE = DomainEventGraphicsPhase(C.VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE)
// Final socket disconnection
DOMAIN_EVENT_GRAPHICS_DISCONNECT = DomainEventGraphicsPhase(C.VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT)
)
type DomainEventGraphicsAddressType int
const (
// IPv4 address
DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4 = DomainEventGraphicsAddressType(C.VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4)
// IPv6 address
DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6 = DomainEventGraphicsAddressType(C.VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6)
// UNIX socket path
DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX = DomainEventGraphicsAddressType(C.VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX)
)
type DomainBlockJobType int
const (
// Placeholder
DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN)
// Block Pull (virDomainBlockPull, or virDomainBlockRebase without
// flags), job ends on completion
DOMAIN_BLOCK_JOB_TYPE_PULL = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_PULL)
// Block Copy (virDomainBlockCopy, or virDomainBlockRebase with
// flags), job exists as long as mirroring is active
DOMAIN_BLOCK_JOB_TYPE_COPY = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
// Block Commit (virDomainBlockCommit without flags), job ends on
// completion
DOMAIN_BLOCK_JOB_TYPE_COMMIT = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT)
// Active Block Commit (virDomainBlockCommit with flags), job
// exists as long as sync is active
DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT)
// Live disk backup job
DOMAIN_BLOCK_JOB_TYPE_BACKUP = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP)
)
type DomainRunningReason int
const (
DOMAIN_RUNNING_UNKNOWN = DomainRunningReason(C.VIR_DOMAIN_RUNNING_UNKNOWN)
DOMAIN_RUNNING_BOOTED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_BOOTED) /* normal startup from boot */
DOMAIN_RUNNING_MIGRATED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_MIGRATED) /* migrated from another host */
DOMAIN_RUNNING_RESTORED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_RESTORED) /* restored from a state file */
DOMAIN_RUNNING_FROM_SNAPSHOT = DomainRunningReason(C.VIR_DOMAIN_RUNNING_FROM_SNAPSHOT) /* restored from snapshot */
DOMAIN_RUNNING_UNPAUSED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_UNPAUSED) /* returned from paused state */
DOMAIN_RUNNING_MIGRATION_CANCELED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_MIGRATION_CANCELED) /* returned from migration */
DOMAIN_RUNNING_SAVE_CANCELED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_SAVE_CANCELED) /* returned from failed save process */
DOMAIN_RUNNING_WAKEUP = DomainRunningReason(C.VIR_DOMAIN_RUNNING_WAKEUP) /* returned from pmsuspended due to wakeup event */
DOMAIN_RUNNING_CRASHED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_CRASHED) /* resumed from crashed */
DOMAIN_RUNNING_POSTCOPY = DomainRunningReason(C.VIR_DOMAIN_RUNNING_POSTCOPY) /* running in post-copy migration mode */
DOMAIN_RUNNING_POSTCOPY_FAILED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_POSTCOPY_FAILED) /* running in post-copy migration mode after failure */
)
type DomainPausedReason int
const (
DOMAIN_PAUSED_UNKNOWN = DomainPausedReason(C.VIR_DOMAIN_PAUSED_UNKNOWN) /* the reason is unknown */
DOMAIN_PAUSED_USER = DomainPausedReason(C.VIR_DOMAIN_PAUSED_USER) /* paused on user request */
DOMAIN_PAUSED_MIGRATION = DomainPausedReason(C.VIR_DOMAIN_PAUSED_MIGRATION) /* paused for offline migration */
DOMAIN_PAUSED_SAVE = DomainPausedReason(C.VIR_DOMAIN_PAUSED_SAVE) /* paused for save */
DOMAIN_PAUSED_DUMP = DomainPausedReason(C.VIR_DOMAIN_PAUSED_DUMP) /* paused for offline core dump */
DOMAIN_PAUSED_IOERROR = DomainPausedReason(C.VIR_DOMAIN_PAUSED_IOERROR) /* paused due to a disk I/O error */
DOMAIN_PAUSED_WATCHDOG = DomainPausedReason(C.VIR_DOMAIN_PAUSED_WATCHDOG) /* paused due to a watchdog event */
DOMAIN_PAUSED_FROM_SNAPSHOT = DomainPausedReason(C.VIR_DOMAIN_PAUSED_FROM_SNAPSHOT) /* paused after restoring from snapshot */
DOMAIN_PAUSED_SHUTTING_DOWN = DomainPausedReason(C.VIR_DOMAIN_PAUSED_SHUTTING_DOWN) /* paused during shutdown process */
DOMAIN_PAUSED_SNAPSHOT = DomainPausedReason(C.VIR_DOMAIN_PAUSED_SNAPSHOT) /* paused while creating a snapshot */
DOMAIN_PAUSED_CRASHED = DomainPausedReason(C.VIR_DOMAIN_PAUSED_CRASHED) /* paused due to a guest crash */
DOMAIN_PAUSED_STARTING_UP = DomainPausedReason(C.VIR_DOMAIN_PAUSED_STARTING_UP) /* the domainis being started */
DOMAIN_PAUSED_POSTCOPY = DomainPausedReason(C.VIR_DOMAIN_PAUSED_POSTCOPY) /* paused for post-copy migration */
DOMAIN_PAUSED_POSTCOPY_FAILED = DomainPausedReason(C.VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) /* paused after failed post-copy */
DOMAIN_PAUSED_API_ERROR = DomainPausedReason(C.VIR_DOMAIN_PAUSED_API_ERROR) /* Some APIs (e.g., migration, snapshot) internally need to suspend a domain. This paused state reason is used when resume operation at the end of such API fails.*/
)
type DomainXMLFlags uint
const (
DOMAIN_XML_SECURE = DomainXMLFlags(C.VIR_DOMAIN_XML_SECURE) /* dump security sensitive information too */
DOMAIN_XML_INACTIVE = DomainXMLFlags(C.VIR_DOMAIN_XML_INACTIVE) /* dump inactive domain information */
DOMAIN_XML_UPDATE_CPU = DomainXMLFlags(C.VIR_DOMAIN_XML_UPDATE_CPU) /* update guest CPU requirements according to host CPU */
DOMAIN_XML_MIGRATABLE = DomainXMLFlags(C.VIR_DOMAIN_XML_MIGRATABLE) /* dump XML suitable for migration */
)
type DomainEventDefinedDetailType int
const (
DOMAIN_EVENT_DEFINED_ADDED = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_ADDED)
DOMAIN_EVENT_DEFINED_UPDATED = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_UPDATED)
DOMAIN_EVENT_DEFINED_RENAMED = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_RENAMED)
DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT)
)
type DomainEventUndefinedDetailType int
const (
DOMAIN_EVENT_UNDEFINED_REMOVED = DomainEventUndefinedDetailType(C.VIR_DOMAIN_EVENT_UNDEFINED_REMOVED)
DOMAIN_EVENT_UNDEFINED_RENAMED = DomainEventUndefinedDetailType(C.VIR_DOMAIN_EVENT_UNDEFINED_RENAMED)
)
type DomainEventStartedDetailType int
const (
DOMAIN_EVENT_STARTED_BOOTED = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_BOOTED)
DOMAIN_EVENT_STARTED_MIGRATED = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_MIGRATED)
DOMAIN_EVENT_STARTED_RESTORED = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_RESTORED)
DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT)
DOMAIN_EVENT_STARTED_WAKEUP = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_WAKEUP)
)
type DomainEventSuspendedDetailType int
const (
DOMAIN_EVENT_SUSPENDED_PAUSED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_PAUSED)
DOMAIN_EVENT_SUSPENDED_MIGRATED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED)
DOMAIN_EVENT_SUSPENDED_IOERROR = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_IOERROR)
DOMAIN_EVENT_SUSPENDED_WATCHDOG = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG)
DOMAIN_EVENT_SUSPENDED_RESTORED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_RESTORED)
DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT)
DOMAIN_EVENT_SUSPENDED_API_ERROR = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR)
DOMAIN_EVENT_SUSPENDED_POSTCOPY = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY)
DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED)
)
type DomainEventResumedDetailType int
const (
DOMAIN_EVENT_RESUMED_UNPAUSED = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_UNPAUSED)
DOMAIN_EVENT_RESUMED_MIGRATED = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_MIGRATED)
DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT)
DOMAIN_EVENT_RESUMED_POSTCOPY = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_POSTCOPY)
DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_POSTCOPY_FAILED)
)
type DomainEventStoppedDetailType int
const (
DOMAIN_EVENT_STOPPED_SHUTDOWN = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN)
DOMAIN_EVENT_STOPPED_DESTROYED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_DESTROYED)
DOMAIN_EVENT_STOPPED_CRASHED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_CRASHED)
DOMAIN_EVENT_STOPPED_MIGRATED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_MIGRATED)
DOMAIN_EVENT_STOPPED_SAVED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_SAVED)
DOMAIN_EVENT_STOPPED_FAILED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_FAILED)
DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT)
)
type DomainEventShutdownDetailType int
const (
DOMAIN_EVENT_SHUTDOWN_FINISHED = DomainEventShutdownDetailType(C.VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED)
DOMAIN_EVENT_SHUTDOWN_GUEST = DomainEventShutdownDetailType(C.VIR_DOMAIN_EVENT_SHUTDOWN_GUEST)
DOMAIN_EVENT_SHUTDOWN_HOST = DomainEventShutdownDetailType(C.VIR_DOMAIN_EVENT_SHUTDOWN_HOST)
)
type DomainMemoryStatTags int
const (
DOMAIN_MEMORY_STAT_LAST = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_NR)
DOMAIN_MEMORY_STAT_SWAP_IN = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_SWAP_IN)
DOMAIN_MEMORY_STAT_SWAP_OUT = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_SWAP_OUT)
DOMAIN_MEMORY_STAT_MAJOR_FAULT = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT)
DOMAIN_MEMORY_STAT_MINOR_FAULT = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT)
DOMAIN_MEMORY_STAT_UNUSED = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_UNUSED)
DOMAIN_MEMORY_STAT_AVAILABLE = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_AVAILABLE)
DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON)
DOMAIN_MEMORY_STAT_RSS = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_RSS)
DOMAIN_MEMORY_STAT_USABLE = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_USABLE)
DOMAIN_MEMORY_STAT_LAST_UPDATE = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE)
DOMAIN_MEMORY_STAT_DISK_CACHES = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_DISK_CACHES)
DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC)
DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL)
DOMAIN_MEMORY_STAT_NR = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_NR)
)
type DomainCPUStatsTags string
const (
DOMAIN_CPU_STATS_CPUTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_CPUTIME)
DOMAIN_CPU_STATS_SYSTEMTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_SYSTEMTIME)
DOMAIN_CPU_STATS_USERTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_USERTIME)
DOMAIN_CPU_STATS_VCPUTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_VCPUTIME)
)
type DomainInterfaceAddressesSource int
const (
DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE = DomainInterfaceAddressesSource(C.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)
DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT = DomainInterfaceAddressesSource(C.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT)
DOMAIN_INTERFACE_ADDRESSES_SRC_ARP = DomainInterfaceAddressesSource(C.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP)
)
type KeycodeSet int
const (
KEYCODE_SET_LINUX = KeycodeSet(C.VIR_KEYCODE_SET_LINUX)
KEYCODE_SET_XT = KeycodeSet(C.VIR_KEYCODE_SET_XT)
KEYCODE_SET_ATSET1 = KeycodeSet(C.VIR_KEYCODE_SET_ATSET1)
KEYCODE_SET_ATSET2 = KeycodeSet(C.VIR_KEYCODE_SET_ATSET2)
KEYCODE_SET_ATSET3 = KeycodeSet(C.VIR_KEYCODE_SET_ATSET3)
KEYCODE_SET_OSX = KeycodeSet(C.VIR_KEYCODE_SET_OSX)
KEYCODE_SET_XT_KBD = KeycodeSet(C.VIR_KEYCODE_SET_XT_KBD)
KEYCODE_SET_USB = KeycodeSet(C.VIR_KEYCODE_SET_USB)
KEYCODE_SET_WIN32 = KeycodeSet(C.VIR_KEYCODE_SET_WIN32)
KEYCODE_SET_RFB = KeycodeSet(C.VIR_KEYCODE_SET_RFB)
KEYCODE_SET_QNUM = KeycodeSet(C.VIR_KEYCODE_SET_QNUM)
)
type ConnectDomainEventBlockJobStatus int
const (
DOMAIN_BLOCK_JOB_COMPLETED = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_COMPLETED)
DOMAIN_BLOCK_JOB_FAILED = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_FAILED)
DOMAIN_BLOCK_JOB_CANCELED = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_CANCELED)
DOMAIN_BLOCK_JOB_READY = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_READY)
)
type ConnectDomainEventDiskChangeReason int
const (
// OldSrcPath is set
DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = ConnectDomainEventDiskChangeReason(C.VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START)
DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = ConnectDomainEventDiskChangeReason(C.VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START)
)
type ConnectDomainEventTrayChangeReason int
const (
DOMAIN_EVENT_TRAY_CHANGE_OPEN = ConnectDomainEventTrayChangeReason(C.VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN)
DOMAIN_EVENT_TRAY_CHANGE_CLOSE = ConnectDomainEventTrayChangeReason(C.VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE)
)
type DomainProcessSignal int
const (
DOMAIN_PROCESS_SIGNAL_NOP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_NOP)
DOMAIN_PROCESS_SIGNAL_HUP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_HUP)
DOMAIN_PROCESS_SIGNAL_INT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_INT)
DOMAIN_PROCESS_SIGNAL_QUIT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_QUIT)
DOMAIN_PROCESS_SIGNAL_ILL = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_ILL)
DOMAIN_PROCESS_SIGNAL_TRAP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TRAP)
DOMAIN_PROCESS_SIGNAL_ABRT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_ABRT)
DOMAIN_PROCESS_SIGNAL_BUS = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_BUS)
DOMAIN_PROCESS_SIGNAL_FPE = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_FPE)
DOMAIN_PROCESS_SIGNAL_KILL = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_KILL)
DOMAIN_PROCESS_SIGNAL_USR1 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_USR1)
DOMAIN_PROCESS_SIGNAL_SEGV = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_SEGV)
DOMAIN_PROCESS_SIGNAL_USR2 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_USR2)
DOMAIN_PROCESS_SIGNAL_PIPE = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_PIPE)
DOMAIN_PROCESS_SIGNAL_ALRM = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_ALRM)
DOMAIN_PROCESS_SIGNAL_TERM = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TERM)
DOMAIN_PROCESS_SIGNAL_STKFLT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_STKFLT)
DOMAIN_PROCESS_SIGNAL_CHLD = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_CHLD)
DOMAIN_PROCESS_SIGNAL_CONT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_CONT)
DOMAIN_PROCESS_SIGNAL_STOP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_STOP)
DOMAIN_PROCESS_SIGNAL_TSTP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TSTP)
DOMAIN_PROCESS_SIGNAL_TTIN = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TTIN)
DOMAIN_PROCESS_SIGNAL_TTOU = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TTOU)
DOMAIN_PROCESS_SIGNAL_URG = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_URG)
DOMAIN_PROCESS_SIGNAL_XCPU = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_XCPU)
DOMAIN_PROCESS_SIGNAL_XFSZ = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_XFSZ)
DOMAIN_PROCESS_SIGNAL_VTALRM = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_VTALRM)
DOMAIN_PROCESS_SIGNAL_PROF = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_PROF)
DOMAIN_PROCESS_SIGNAL_WINCH = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_WINCH)
DOMAIN_PROCESS_SIGNAL_POLL = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_POLL)
DOMAIN_PROCESS_SIGNAL_PWR = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_PWR)
DOMAIN_PROCESS_SIGNAL_SYS = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_SYS)
DOMAIN_PROCESS_SIGNAL_RT0 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT0)
DOMAIN_PROCESS_SIGNAL_RT1 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT1)
DOMAIN_PROCESS_SIGNAL_RT2 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT2)
DOMAIN_PROCESS_SIGNAL_RT3 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT3)
DOMAIN_PROCESS_SIGNAL_RT4 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT4)
DOMAIN_PROCESS_SIGNAL_RT5 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT5)
DOMAIN_PROCESS_SIGNAL_RT6 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT6)
DOMAIN_PROCESS_SIGNAL_RT7 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT7)
DOMAIN_PROCESS_SIGNAL_RT8 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT8)
DOMAIN_PROCESS_SIGNAL_RT9 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT9)
DOMAIN_PROCESS_SIGNAL_RT10 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT10)
DOMAIN_PROCESS_SIGNAL_RT11 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT11)
DOMAIN_PROCESS_SIGNAL_RT12 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT12)
DOMAIN_PROCESS_SIGNAL_RT13 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT13)
DOMAIN_PROCESS_SIGNAL_RT14 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT14)
DOMAIN_PROCESS_SIGNAL_RT15 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT15)
DOMAIN_PROCESS_SIGNAL_RT16 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT16)
DOMAIN_PROCESS_SIGNAL_RT17 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT17)
DOMAIN_PROCESS_SIGNAL_RT18 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT18)
DOMAIN_PROCESS_SIGNAL_RT19 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT19)
DOMAIN_PROCESS_SIGNAL_RT20 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT20)
DOMAIN_PROCESS_SIGNAL_RT21 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT21)
DOMAIN_PROCESS_SIGNAL_RT22 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT22)
DOMAIN_PROCESS_SIGNAL_RT23 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT23)
DOMAIN_PROCESS_SIGNAL_RT24 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT24)
DOMAIN_PROCESS_SIGNAL_RT25 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT25)
DOMAIN_PROCESS_SIGNAL_RT26 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT26)
DOMAIN_PROCESS_SIGNAL_RT27 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT27)
DOMAIN_PROCESS_SIGNAL_RT28 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT28)
DOMAIN_PROCESS_SIGNAL_RT29 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT29)
DOMAIN_PROCESS_SIGNAL_RT30 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT30)
DOMAIN_PROCESS_SIGNAL_RT31 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT31)
DOMAIN_PROCESS_SIGNAL_RT32 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT32)
)
type DomainBlockedReason int
const (
DOMAIN_BLOCKED_UNKNOWN = DomainBlockedReason(C.VIR_DOMAIN_BLOCKED_UNKNOWN)
)
type DomainControlState int
const (
DOMAIN_CONTROL_OK = DomainControlState(C.VIR_DOMAIN_CONTROL_OK)
DOMAIN_CONTROL_JOB = DomainControlState(C.VIR_DOMAIN_CONTROL_JOB)
DOMAIN_CONTROL_OCCUPIED = DomainControlState(C.VIR_DOMAIN_CONTROL_OCCUPIED)
DOMAIN_CONTROL_ERROR = DomainControlState(C.VIR_DOMAIN_CONTROL_ERROR)
)
type DomainControlErrorReason int
const (
DOMAIN_CONTROL_ERROR_REASON_NONE = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_NONE)
DOMAIN_CONTROL_ERROR_REASON_UNKNOWN = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN)
DOMAIN_CONTROL_ERROR_REASON_MONITOR = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR)
DOMAIN_CONTROL_ERROR_REASON_INTERNAL = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL)
)
type DomainCrashedReason int
const (
DOMAIN_CRASHED_UNKNOWN = DomainCrashedReason(C.VIR_DOMAIN_CRASHED_UNKNOWN)
DOMAIN_CRASHED_PANICKED = DomainCrashedReason(C.VIR_DOMAIN_CRASHED_PANICKED)
)
type DomainEventCrashedDetailType int
const (
DOMAIN_EVENT_CRASHED_PANICKED = DomainEventCrashedDetailType(C.VIR_DOMAIN_EVENT_CRASHED_PANICKED)
DOMAIN_EVENT_CRASHED_CRASHLOADED = DomainEventCrashedDetailType(C.VIR_DOMAIN_EVENT_CRASHED_CRASHLOADED)
)
type DomainEventPMSuspendedDetailType int
const (
DOMAIN_EVENT_PMSUSPENDED_MEMORY = DomainEventPMSuspendedDetailType(C.VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY)
DOMAIN_EVENT_PMSUSPENDED_DISK = DomainEventPMSuspendedDetailType(C.VIR_DOMAIN_EVENT_PMSUSPENDED_DISK)
)
type DomainNostateReason int
const (
DOMAIN_NOSTATE_UNKNOWN = DomainNostateReason(C.VIR_DOMAIN_NOSTATE_UNKNOWN)
)
type DomainPMSuspendedReason int
const (
DOMAIN_PMSUSPENDED_UNKNOWN = DomainPMSuspendedReason(C.VIR_DOMAIN_PMSUSPENDED_UNKNOWN)
)
type DomainPMSuspendedDiskReason int
const (
DOMAIN_PMSUSPENDED_DISK_UNKNOWN = DomainPMSuspendedDiskReason(C.VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN)
)
type DomainShutdownReason int
const (
DOMAIN_SHUTDOWN_UNKNOWN = DomainShutdownReason(C.VIR_DOMAIN_SHUTDOWN_UNKNOWN)
DOMAIN_SHUTDOWN_USER = DomainShutdownReason(C.VIR_DOMAIN_SHUTDOWN_USER)
)
type DomainShutoffReason int
const (
DOMAIN_SHUTOFF_UNKNOWN = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_UNKNOWN)
DOMAIN_SHUTOFF_SHUTDOWN = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_SHUTDOWN)
DOMAIN_SHUTOFF_DESTROYED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_DESTROYED)
DOMAIN_SHUTOFF_CRASHED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_CRASHED)
DOMAIN_SHUTOFF_MIGRATED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_MIGRATED)
DOMAIN_SHUTOFF_SAVED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_SAVED)
DOMAIN_SHUTOFF_FAILED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_FAILED)
DOMAIN_SHUTOFF_FROM_SNAPSHOT = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT)
DOMAIN_SHUTOFF_DAEMON = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_DAEMON)
)
type DomainBlockCommitFlags uint
const (
DOMAIN_BLOCK_COMMIT_SHALLOW = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_SHALLOW)
DOMAIN_BLOCK_COMMIT_DELETE = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_DELETE)
DOMAIN_BLOCK_COMMIT_ACTIVE = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_ACTIVE)
DOMAIN_BLOCK_COMMIT_RELATIVE = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_RELATIVE)
DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES)
)
type DomainBlockCopyFlags uint
const (
DOMAIN_BLOCK_COPY_SHALLOW = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_SHALLOW)
DOMAIN_BLOCK_COPY_REUSE_EXT = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)
DOMAIN_BLOCK_COPY_TRANSIENT_JOB = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB)
DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES)
)
type DomainBlockRebaseFlags uint
const (
DOMAIN_BLOCK_REBASE_SHALLOW = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_SHALLOW)
DOMAIN_BLOCK_REBASE_REUSE_EXT = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
DOMAIN_BLOCK_REBASE_COPY_RAW = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
DOMAIN_BLOCK_REBASE_COPY = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_COPY)
DOMAIN_BLOCK_REBASE_RELATIVE = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_RELATIVE)
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_domain_snapshot.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_domain_snapshot.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virDomainHasCurrentSnapshotFuncType)(virDomainPtr domain,
unsigned int flags);
int
virDomainHasCurrentSnapshotWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainHasCurrentSnapshotFuncType virDomainHasCurrentSnapshotSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainHasCurrentSnapshot",
(void**)&virDomainHasCurrentSnapshotSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainHasCurrentSnapshotSymbol(domain,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainListAllSnapshotsFuncType)(virDomainPtr domain,
virDomainSnapshotPtr ** snaps,
unsigned int flags);
int
virDomainListAllSnapshotsWrapper(virDomainPtr domain,
virDomainSnapshotPtr ** snaps,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainListAllSnapshotsFuncType virDomainListAllSnapshotsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainListAllSnapshots",
(void**)&virDomainListAllSnapshotsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainListAllSnapshotsSymbol(domain,
snaps,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainRevertToSnapshotFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
int
virDomainRevertToSnapshotWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainRevertToSnapshotFuncType virDomainRevertToSnapshotSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainRevertToSnapshot",
(void**)&virDomainRevertToSnapshotSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainRevertToSnapshotSymbol(snapshot,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainSnapshotPtr
(*virDomainSnapshotCreateXMLFuncType)(virDomainPtr domain,
const char * xmlDesc,
unsigned int flags);
virDomainSnapshotPtr
virDomainSnapshotCreateXMLWrapper(virDomainPtr domain,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
static virDomainSnapshotCreateXMLFuncType virDomainSnapshotCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotCreateXML",
(void**)&virDomainSnapshotCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotCreateXMLSymbol(domain,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainSnapshotPtr
(*virDomainSnapshotCurrentFuncType)(virDomainPtr domain,
unsigned int flags);
virDomainSnapshotPtr
virDomainSnapshotCurrentWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
static virDomainSnapshotCurrentFuncType virDomainSnapshotCurrentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotCurrent",
(void**)&virDomainSnapshotCurrentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotCurrentSymbol(domain,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotDeleteFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
int
virDomainSnapshotDeleteWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotDeleteFuncType virDomainSnapshotDeleteSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotDelete",
(void**)&virDomainSnapshotDeleteSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotDeleteSymbol(snapshot,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotFreeFuncType)(virDomainSnapshotPtr snapshot);
int
virDomainSnapshotFreeWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotFreeFuncType virDomainSnapshotFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotFree",
(void**)&virDomainSnapshotFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotFreeSymbol(snapshot);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virDomainSnapshotGetConnectFuncType)(virDomainSnapshotPtr snapshot);
virConnectPtr
virDomainSnapshotGetConnectWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virDomainSnapshotGetConnectFuncType virDomainSnapshotGetConnectSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotGetConnect",
(void**)&virDomainSnapshotGetConnectSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotGetConnectSymbol(snapshot);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainPtr
(*virDomainSnapshotGetDomainFuncType)(virDomainSnapshotPtr snapshot);
virDomainPtr
virDomainSnapshotGetDomainWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
virDomainPtr ret = NULL;
static virDomainSnapshotGetDomainFuncType virDomainSnapshotGetDomainSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotGetDomain",
(void**)&virDomainSnapshotGetDomainSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotGetDomainSymbol(snapshot);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virDomainSnapshotGetNameFuncType)(virDomainSnapshotPtr snapshot);
const char *
virDomainSnapshotGetNameWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
const char * ret = NULL;
static virDomainSnapshotGetNameFuncType virDomainSnapshotGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotGetName",
(void**)&virDomainSnapshotGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotGetNameSymbol(snapshot);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainSnapshotPtr
(*virDomainSnapshotGetParentFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
virDomainSnapshotPtr
virDomainSnapshotGetParentWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
static virDomainSnapshotGetParentFuncType virDomainSnapshotGetParentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotGetParent",
(void**)&virDomainSnapshotGetParentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotGetParentSymbol(snapshot,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virDomainSnapshotGetXMLDescFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
char *
virDomainSnapshotGetXMLDescWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virDomainSnapshotGetXMLDescFuncType virDomainSnapshotGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotGetXMLDesc",
(void**)&virDomainSnapshotGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotGetXMLDescSymbol(snapshot,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotHasMetadataFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
int
virDomainSnapshotHasMetadataWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotHasMetadataFuncType virDomainSnapshotHasMetadataSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotHasMetadata",
(void**)&virDomainSnapshotHasMetadataSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotHasMetadataSymbol(snapshot,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotIsCurrentFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
int
virDomainSnapshotIsCurrentWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotIsCurrentFuncType virDomainSnapshotIsCurrentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotIsCurrent",
(void**)&virDomainSnapshotIsCurrentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotIsCurrentSymbol(snapshot,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotListAllChildrenFuncType)(virDomainSnapshotPtr snapshot,
virDomainSnapshotPtr ** snaps,
unsigned int flags);
int
virDomainSnapshotListAllChildrenWrapper(virDomainSnapshotPtr snapshot,
virDomainSnapshotPtr ** snaps,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotListAllChildrenFuncType virDomainSnapshotListAllChildrenSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotListAllChildren",
(void**)&virDomainSnapshotListAllChildrenSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotListAllChildrenSymbol(snapshot,
snaps,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotListChildrenNamesFuncType)(virDomainSnapshotPtr snapshot,
char ** names,
int nameslen,
unsigned int flags);
int
virDomainSnapshotListChildrenNamesWrapper(virDomainSnapshotPtr snapshot,
char ** names,
int nameslen,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotListChildrenNamesFuncType virDomainSnapshotListChildrenNamesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotListChildrenNames",
(void**)&virDomainSnapshotListChildrenNamesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotListChildrenNamesSymbol(snapshot,
names,
nameslen,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotListNamesFuncType)(virDomainPtr domain,
char ** names,
int nameslen,
unsigned int flags);
int
virDomainSnapshotListNamesWrapper(virDomainPtr domain,
char ** names,
int nameslen,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotListNamesFuncType virDomainSnapshotListNamesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotListNames",
(void**)&virDomainSnapshotListNamesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotListNamesSymbol(domain,
names,
nameslen,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainSnapshotPtr
(*virDomainSnapshotLookupByNameFuncType)(virDomainPtr domain,
const char * name,
unsigned int flags);
virDomainSnapshotPtr
virDomainSnapshotLookupByNameWrapper(virDomainPtr domain,
const char * name,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
static virDomainSnapshotLookupByNameFuncType virDomainSnapshotLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotLookupByName",
(void**)&virDomainSnapshotLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotLookupByNameSymbol(domain,
name,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotNumFuncType)(virDomainPtr domain,
unsigned int flags);
int
virDomainSnapshotNumWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotNumFuncType virDomainSnapshotNumSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotNum",
(void**)&virDomainSnapshotNumSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotNumSymbol(domain,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotNumChildrenFuncType)(virDomainSnapshotPtr snapshot,
unsigned int flags);
int
virDomainSnapshotNumChildrenWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotNumChildrenFuncType virDomainSnapshotNumChildrenSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotNumChildren",
(void**)&virDomainSnapshotNumChildrenSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotNumChildrenSymbol(snapshot,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainSnapshotRefFuncType)(virDomainSnapshotPtr snapshot);
int
virDomainSnapshotRefWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
int ret = -1;
static virDomainSnapshotRefFuncType virDomainSnapshotRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainSnapshotRef",
(void**)&virDomainSnapshotRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainSnapshotRefSymbol(snapshot);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_nwfilter.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_nwfilter.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectListAllNWFilterBindingsFuncType)(virConnectPtr conn,
virNWFilterBindingPtr ** bindings,
unsigned int flags);
int
virConnectListAllNWFilterBindingsWrapper(virConnectPtr conn,
virNWFilterBindingPtr ** bindings,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllNWFilterBindingsFuncType virConnectListAllNWFilterBindingsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllNWFilterBindings",
(void**)&virConnectListAllNWFilterBindingsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllNWFilterBindingsSymbol(conn,
bindings,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListAllNWFiltersFuncType)(virConnectPtr conn,
virNWFilterPtr ** filters,
unsigned int flags);
int
virConnectListAllNWFiltersWrapper(virConnectPtr conn,
virNWFilterPtr ** filters,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllNWFiltersFuncType virConnectListAllNWFiltersSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllNWFilters",
(void**)&virConnectListAllNWFiltersSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllNWFiltersSymbol(conn,
filters,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListNWFiltersFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListNWFiltersWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListNWFiltersFuncType virConnectListNWFiltersSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListNWFilters",
(void**)&virConnectListNWFiltersSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListNWFiltersSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfNWFiltersFuncType)(virConnectPtr conn);
int
virConnectNumOfNWFiltersWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfNWFiltersFuncType virConnectNumOfNWFiltersSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfNWFilters",
(void**)&virConnectNumOfNWFiltersSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfNWFiltersSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterBindingPtr
(*virNWFilterBindingCreateXMLFuncType)(virConnectPtr conn,
const char * xml,
unsigned int flags);
virNWFilterBindingPtr
virNWFilterBindingCreateXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virNWFilterBindingPtr ret = NULL;
static virNWFilterBindingCreateXMLFuncType virNWFilterBindingCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingCreateXML",
(void**)&virNWFilterBindingCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingCreateXMLSymbol(conn,
xml,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterBindingDeleteFuncType)(virNWFilterBindingPtr binding);
int
virNWFilterBindingDeleteWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
int ret = -1;
static virNWFilterBindingDeleteFuncType virNWFilterBindingDeleteSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingDelete",
(void**)&virNWFilterBindingDeleteSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingDeleteSymbol(binding);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterBindingFreeFuncType)(virNWFilterBindingPtr binding);
int
virNWFilterBindingFreeWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
int ret = -1;
static virNWFilterBindingFreeFuncType virNWFilterBindingFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingFree",
(void**)&virNWFilterBindingFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingFreeSymbol(binding);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virNWFilterBindingGetFilterNameFuncType)(virNWFilterBindingPtr binding);
const char *
virNWFilterBindingGetFilterNameWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
const char * ret = NULL;
static virNWFilterBindingGetFilterNameFuncType virNWFilterBindingGetFilterNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingGetFilterName",
(void**)&virNWFilterBindingGetFilterNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingGetFilterNameSymbol(binding);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virNWFilterBindingGetPortDevFuncType)(virNWFilterBindingPtr binding);
const char *
virNWFilterBindingGetPortDevWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
const char * ret = NULL;
static virNWFilterBindingGetPortDevFuncType virNWFilterBindingGetPortDevSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingGetPortDev",
(void**)&virNWFilterBindingGetPortDevSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingGetPortDevSymbol(binding);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virNWFilterBindingGetXMLDescFuncType)(virNWFilterBindingPtr binding,
unsigned int flags);
char *
virNWFilterBindingGetXMLDescWrapper(virNWFilterBindingPtr binding,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virNWFilterBindingGetXMLDescFuncType virNWFilterBindingGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingGetXMLDesc",
(void**)&virNWFilterBindingGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingGetXMLDescSymbol(binding,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterBindingPtr
(*virNWFilterBindingLookupByPortDevFuncType)(virConnectPtr conn,
const char * portdev);
virNWFilterBindingPtr
virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
const char * portdev,
virErrorPtr err)
{
virNWFilterBindingPtr ret = NULL;
static virNWFilterBindingLookupByPortDevFuncType virNWFilterBindingLookupByPortDevSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingLookupByPortDev",
(void**)&virNWFilterBindingLookupByPortDevSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingLookupByPortDevSymbol(conn,
portdev);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterBindingRefFuncType)(virNWFilterBindingPtr binding);
int
virNWFilterBindingRefWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
int ret = -1;
static virNWFilterBindingRefFuncType virNWFilterBindingRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterBindingRef",
(void**)&virNWFilterBindingRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterBindingRefSymbol(binding);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterPtr
(*virNWFilterDefineXMLFuncType)(virConnectPtr conn,
const char * xmlDesc);
virNWFilterPtr
virNWFilterDefineXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
static virNWFilterDefineXMLFuncType virNWFilterDefineXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterDefineXML",
(void**)&virNWFilterDefineXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterDefineXMLSymbol(conn,
xmlDesc);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterPtr
(*virNWFilterDefineXMLFlagsFuncType)(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags);
virNWFilterPtr
virNWFilterDefineXMLFlagsWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
static virNWFilterDefineXMLFlagsFuncType virNWFilterDefineXMLFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterDefineXMLFlags",
(void**)&virNWFilterDefineXMLFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterDefineXMLFlagsSymbol(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterFreeFuncType)(virNWFilterPtr nwfilter);
int
virNWFilterFreeWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
int ret = -1;
static virNWFilterFreeFuncType virNWFilterFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterFree",
(void**)&virNWFilterFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterFreeSymbol(nwfilter);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virNWFilterGetNameFuncType)(virNWFilterPtr nwfilter);
const char *
virNWFilterGetNameWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
const char * ret = NULL;
static virNWFilterGetNameFuncType virNWFilterGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterGetName",
(void**)&virNWFilterGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterGetNameSymbol(nwfilter);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterGetUUIDFuncType)(virNWFilterPtr nwfilter,
unsigned char * uuid);
int
virNWFilterGetUUIDWrapper(virNWFilterPtr nwfilter,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
static virNWFilterGetUUIDFuncType virNWFilterGetUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterGetUUID",
(void**)&virNWFilterGetUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterGetUUIDSymbol(nwfilter,
uuid);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterGetUUIDStringFuncType)(virNWFilterPtr nwfilter,
char * buf);
int
virNWFilterGetUUIDStringWrapper(virNWFilterPtr nwfilter,
char * buf,
virErrorPtr err)
{
int ret = -1;
static virNWFilterGetUUIDStringFuncType virNWFilterGetUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterGetUUIDString",
(void**)&virNWFilterGetUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterGetUUIDStringSymbol(nwfilter,
buf);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virNWFilterGetXMLDescFuncType)(virNWFilterPtr nwfilter,
unsigned int flags);
char *
virNWFilterGetXMLDescWrapper(virNWFilterPtr nwfilter,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virNWFilterGetXMLDescFuncType virNWFilterGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterGetXMLDesc",
(void**)&virNWFilterGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterGetXMLDescSymbol(nwfilter,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterPtr
(*virNWFilterLookupByNameFuncType)(virConnectPtr conn,
const char * name);
virNWFilterPtr
virNWFilterLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
static virNWFilterLookupByNameFuncType virNWFilterLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterLookupByName",
(void**)&virNWFilterLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterLookupByNameSymbol(conn,
name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterPtr
(*virNWFilterLookupByUUIDFuncType)(virConnectPtr conn,
const unsigned char * uuid);
virNWFilterPtr
virNWFilterLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
static virNWFilterLookupByUUIDFuncType virNWFilterLookupByUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterLookupByUUID",
(void**)&virNWFilterLookupByUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterLookupByUUIDSymbol(conn,
uuid);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNWFilterPtr
(*virNWFilterLookupByUUIDStringFuncType)(virConnectPtr conn,
const char * uuidstr);
virNWFilterPtr
virNWFilterLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
static virNWFilterLookupByUUIDStringFuncType virNWFilterLookupByUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterLookupByUUIDString",
(void**)&virNWFilterLookupByUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterLookupByUUIDStringSymbol(conn,
uuidstr);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterRefFuncType)(virNWFilterPtr nwfilter);
int
virNWFilterRefWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
int ret = -1;
static virNWFilterRefFuncType virNWFilterRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterRef",
(void**)&virNWFilterRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterRefSymbol(nwfilter);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNWFilterUndefineFuncType)(virNWFilterPtr nwfilter);
int
virNWFilterUndefineWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
int ret = -1;
static virNWFilterUndefineFuncType virNWFilterUndefineSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNWFilterUndefine",
(void**)&virNWFilterUndefineSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNWFilterUndefineSymbol(nwfilter);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/network.go | vendor/libvirt.org/go/libvirt/network.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"fmt"
"reflect"
"time"
"unsafe"
)
type IPAddrType int
const (
IP_ADDR_TYPE_IPV4 = IPAddrType(C.VIR_IP_ADDR_TYPE_IPV4)
IP_ADDR_TYPE_IPV6 = IPAddrType(C.VIR_IP_ADDR_TYPE_IPV6)
)
type NetworkXMLFlags uint
const (
NETWORK_XML_INACTIVE = NetworkXMLFlags(C.VIR_NETWORK_XML_INACTIVE)
)
type NetworkCreateFlags uint
const (
NETWORK_CREATE_VALIDATE = NetworkCreateFlags(C.VIR_NETWORK_CREATE_VALIDATE)
)
type NetworkDefineFlags uint
const (
NETWORK_DEFINE_VALIDATE = NetworkDefineFlags(C.VIR_NETWORK_DEFINE_VALIDATE)
)
type NetworkUpdateCommand int
const (
NETWORK_UPDATE_COMMAND_NONE = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_NONE)
NETWORK_UPDATE_COMMAND_MODIFY = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_MODIFY)
NETWORK_UPDATE_COMMAND_DELETE = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_DELETE)
NETWORK_UPDATE_COMMAND_ADD_LAST = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)
NETWORK_UPDATE_COMMAND_ADD_FIRST = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST)
)
type NetworkUpdateSection int
const (
NETWORK_SECTION_NONE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_NONE)
NETWORK_SECTION_BRIDGE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_BRIDGE)
NETWORK_SECTION_DOMAIN = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DOMAIN)
NETWORK_SECTION_IP = NetworkUpdateSection(C.VIR_NETWORK_SECTION_IP)
NETWORK_SECTION_IP_DHCP_HOST = NetworkUpdateSection(C.VIR_NETWORK_SECTION_IP_DHCP_HOST)
NETWORK_SECTION_IP_DHCP_RANGE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_IP_DHCP_RANGE)
NETWORK_SECTION_FORWARD = NetworkUpdateSection(C.VIR_NETWORK_SECTION_FORWARD)
NETWORK_SECTION_FORWARD_INTERFACE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_FORWARD_INTERFACE)
NETWORK_SECTION_FORWARD_PF = NetworkUpdateSection(C.VIR_NETWORK_SECTION_FORWARD_PF)
NETWORK_SECTION_PORTGROUP = NetworkUpdateSection(C.VIR_NETWORK_SECTION_PORTGROUP)
NETWORK_SECTION_DNS_HOST = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DNS_HOST)
NETWORK_SECTION_DNS_TXT = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DNS_TXT)
NETWORK_SECTION_DNS_SRV = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DNS_SRV)
)
type NetworkUpdateFlags uint
const (
NETWORK_UPDATE_AFFECT_CURRENT = NetworkUpdateFlags(C.VIR_NETWORK_UPDATE_AFFECT_CURRENT)
NETWORK_UPDATE_AFFECT_LIVE = NetworkUpdateFlags(C.VIR_NETWORK_UPDATE_AFFECT_LIVE)
NETWORK_UPDATE_AFFECT_CONFIG = NetworkUpdateFlags(C.VIR_NETWORK_UPDATE_AFFECT_CONFIG)
)
type NetworkEventLifecycleType int
const (
NETWORK_EVENT_DEFINED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_DEFINED)
NETWORK_EVENT_UNDEFINED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_UNDEFINED)
NETWORK_EVENT_STARTED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_STARTED)
NETWORK_EVENT_STOPPED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_STOPPED)
)
type NetworkEventID int
const (
NETWORK_EVENT_ID_LIFECYCLE = NetworkEventID(C.VIR_NETWORK_EVENT_ID_LIFECYCLE)
NETWORK_EVENT_ID_METADATA_CHANGE = NetworkEventID(C.VIR_NETWORK_EVENT_ID_METADATA_CHANGE)
)
type NetworkMetadataType int
const (
NETWORK_METADATA_DESCRIPTION = NetworkMetadataType(C.VIR_NETWORK_METADATA_DESCRIPTION)
NETWORK_METADATA_TITLE = NetworkMetadataType(C.VIR_NETWORK_METADATA_TITLE)
NETWORK_METADATA_ELEMENT = NetworkMetadataType(C.VIR_NETWORK_METADATA_ELEMENT)
)
type Network struct {
ptr C.virNetworkPtr
}
type NetworkDHCPLease struct {
Iface string
ExpiryTime time.Time
Type IPAddrType
Mac string
Iaid string
IPaddr string
Prefix uint
Hostname string
Clientid string
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkFree
func (n *Network) Free() error {
var err C.virError
ret := C.virNetworkFreeWrapper(n.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkRef
func (c *Network) Ref() error {
var err C.virError
ret := C.virNetworkRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkCreate
func (n *Network) Create() error {
var err C.virError
result := C.virNetworkCreateWrapper(n.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkDestroy
func (n *Network) Destroy() error {
var err C.virError
result := C.virNetworkDestroyWrapper(n.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkIsActive
func (n *Network) IsActive() (bool, error) {
var err C.virError
result := C.virNetworkIsActiveWrapper(n.ptr, &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkIsPersistent
func (n *Network) IsPersistent() (bool, error) {
var err C.virError
result := C.virNetworkIsPersistentWrapper(n.ptr, &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetAutostart
func (n *Network) GetAutostart() (bool, error) {
var out C.int
var err C.virError
result := C.virNetworkGetAutostartWrapper(n.ptr, (*C.int)(unsafe.Pointer(&out)), &err)
if result == -1 {
return false, makeError(&err)
}
switch out {
case 1:
return true, nil
default:
return false, nil
}
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkSetAutostart
func (n *Network) SetAutostart(autostart bool) error {
var cAutostart C.int
switch autostart {
case true:
cAutostart = 1
default:
cAutostart = 0
}
var err C.virError
result := C.virNetworkSetAutostartWrapper(n.ptr, cAutostart, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetName
func (n *Network) GetName() (string, error) {
var err C.virError
name := C.virNetworkGetNameWrapper(n.ptr, &err)
if name == nil {
return "", makeError(&err)
}
return C.GoString(name), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetUUID
func (n *Network) GetUUID() ([]byte, error) {
var cUuid [C.VIR_UUID_BUFLEN](byte)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virNetworkGetUUIDWrapper(n.ptr, (*C.uchar)(cuidPtr), &err)
if result != 0 {
return []byte{}, makeError(&err)
}
return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetUUIDString
func (n *Network) GetUUIDString() (string, error) {
var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virNetworkGetUUIDStringWrapper(n.ptr, (*C.char)(cuidPtr), &err)
if result != 0 {
return "", makeError(&err)
}
return C.GoString((*C.char)(cuidPtr)), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetBridgeName
func (n *Network) GetBridgeName() (string, error) {
var err C.virError
result := C.virNetworkGetBridgeNameWrapper(n.ptr, &err)
if result == nil {
return "", makeError(&err)
}
bridge := C.GoString(result)
C.free(unsafe.Pointer(result))
return bridge, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetXMLDesc
func (n *Network) GetXMLDesc(flags NetworkXMLFlags) (string, error) {
var err C.virError
result := C.virNetworkGetXMLDescWrapper(n.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkUndefine
func (n *Network) Undefine() error {
var err C.virError
result := C.virNetworkUndefineWrapper(n.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkUpdate
func (n *Network) Update(cmd NetworkUpdateCommand, section NetworkUpdateSection, parentIndex int, xml string, flags NetworkUpdateFlags) error {
cxml := C.CString(xml)
defer C.free(unsafe.Pointer(cxml))
var err C.virError
result := C.virNetworkUpdateWrapper(n.ptr, C.uint(cmd), C.uint(section), C.int(parentIndex), cxml, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetDHCPLeases
func (n *Network) GetDHCPLeases() ([]NetworkDHCPLease, error) {
var cLeases *C.virNetworkDHCPLeasePtr
var err C.virError
numLeases := C.virNetworkGetDHCPLeasesWrapper(n.ptr, nil, (**C.virNetworkDHCPLeasePtr)(&cLeases), C.uint(0), &err)
if numLeases == -1 {
return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cLeases)),
Len: int(numLeases),
Cap: int(numLeases),
}
var leases []NetworkDHCPLease
slice := *(*[]C.virNetworkDHCPLeasePtr)(unsafe.Pointer(&hdr))
for _, clease := range slice {
leases = append(leases, NetworkDHCPLease{
Iface: C.GoString(clease.iface),
ExpiryTime: time.Unix(int64(clease.expirytime), 0),
Type: IPAddrType(clease._type),
Mac: C.GoString(clease.mac),
Iaid: C.GoString(clease.iaid),
IPaddr: C.GoString(clease.ipaddr),
Prefix: uint(clease.prefix),
Hostname: C.GoString(clease.hostname),
Clientid: C.GoString(clease.clientid),
})
C.virNetworkDHCPLeaseFreeWrapper(clease)
}
C.free(unsafe.Pointer(cLeases))
return leases, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortLookupByUUIDString
func (n *Network) LookupNetworkPortByUUIDString(uuid string) (*NetworkPort, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
var err C.virError
ptr := C.virNetworkPortLookupByUUIDStringWrapper(n.ptr, cUuid, &err)
if ptr == nil {
return nil, makeError(&err)
}
return &NetworkPort{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortLookupByUUID
func (n *Network) LookupNetworkPortByUUID(uuid []byte) (*NetworkPort, error) {
if len(uuid) != C.VIR_UUID_BUFLEN {
return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
int(C.VIR_UUID_BUFLEN))
}
cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
cUuid[i] = C.uchar(uuid[i])
}
var err C.virError
ptr := C.virNetworkPortLookupByUUIDWrapper(n.ptr, &cUuid[0], &err)
if ptr == nil {
return nil, makeError(&err)
}
return &NetworkPort{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortCreateXML
func (n *Network) PortCreateXML(xmlConfig string, flags uint32) (*NetworkPort, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
var err C.virError
ptr := C.virNetworkPortCreateXMLWrapper(n.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
return nil, makeError(&err)
}
return &NetworkPort{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkListAllPorts
func (n *Network) ListAllPorts(flags uint32) ([]NetworkPort, error) {
var cList *C.virNetworkPortPtr
var err C.virError
numPorts := C.virNetworkListAllPortsWrapper(n.ptr, (**C.virNetworkPortPtr)(&cList), C.uint(flags), &err)
if numPorts == -1 {
return []NetworkPort{}, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
Len: int(numPorts),
Cap: int(numPorts),
}
var ports []NetworkPort
slice := *(*[]C.virNetworkPortPtr)(unsafe.Pointer(&hdr))
for _, ptr := range slice {
ports = append(ports, NetworkPort{ptr})
}
C.free(unsafe.Pointer(cList))
return ports, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetMetadata
func (n *Network) GetMetadata(metadataType NetworkMetadataType, uri string, flags NetworkUpdateFlags) (string, error) {
var cUri *C.char
if uri != "" {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
var err C.virError
result := C.virNetworkGetMetadataWrapper(n.ptr, C.int(metadataType), cUri, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
defer C.free(unsafe.Pointer(result))
return C.GoString(result), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkSetMetadata
func (n *Network) SetMetadata(metadataType NetworkMetadataType, metaDataCont, uriKey, uri string, flags NetworkUpdateFlags) error {
var cMetaDataCont *C.char
var cUriKey *C.char
var cUri *C.char
if metaDataCont != "" {
cMetaDataCont = C.CString(metaDataCont)
defer C.free(unsafe.Pointer(cMetaDataCont))
}
if metadataType == NETWORK_METADATA_ELEMENT {
if uriKey != "" {
cUriKey = C.CString(uriKey)
defer C.free(unsafe.Pointer(cUriKey))
}
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
var err C.virError
result := C.virNetworkSetMetadataWrapper(n.ptr, C.int(metadataType), cMetaDataCont, cUriKey, cUri, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_virterror.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_virterror.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnCopyLastErrorFuncType)(virConnectPtr conn,
virErrorPtr to);
int
virConnCopyLastErrorWrapper(virConnectPtr conn,
virErrorPtr to,
virErrorPtr err)
{
int ret = -1;
static virConnCopyLastErrorFuncType virConnCopyLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnCopyLastError",
(void**)&virConnCopyLastErrorSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnCopyLastErrorSymbol(conn,
to);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virErrorPtr
(*virConnGetLastErrorFuncType)(virConnectPtr conn);
virErrorPtr
virConnGetLastErrorWrapper(virConnectPtr conn,
virErrorPtr err)
{
virErrorPtr ret = NULL;
static virConnGetLastErrorFuncType virConnGetLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnGetLastError",
(void**)&virConnGetLastErrorSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnGetLastErrorSymbol(conn);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virConnResetLastErrorFuncType)(virConnectPtr conn);
void
virConnResetLastErrorWrapper(virConnectPtr conn)
{
static virConnResetLastErrorFuncType virConnResetLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnResetLastError",
(void**)&virConnResetLastErrorSymbol,
&once,
&success,
NULL)) {
return;
}
virConnResetLastErrorSymbol(conn);
}
typedef void
(*virConnSetErrorFuncFuncType)(virConnectPtr conn,
void * userData,
virErrorFunc handler);
void
virConnSetErrorFuncWrapper(virConnectPtr conn,
void * userData,
virErrorFunc handler)
{
static virConnSetErrorFuncFuncType virConnSetErrorFuncSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnSetErrorFunc",
(void**)&virConnSetErrorFuncSymbol,
&once,
&success,
NULL)) {
return;
}
virConnSetErrorFuncSymbol(conn,
userData,
handler);
}
typedef int
(*virCopyLastErrorFuncType)(virErrorPtr to);
int
virCopyLastErrorWrapper(virErrorPtr to)
{
int ret = -1;
static virCopyLastErrorFuncType virCopyLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virCopyLastError",
(void**)&virCopyLastErrorSymbol,
&once,
&success,
NULL)) {
return ret;
}
ret = virCopyLastErrorSymbol(to);
if (ret < 0) {
setVirError(to, "Failed to copy last error");
}
return ret;
}
typedef void
(*virDefaultErrorFuncFuncType)(virErrorPtr err);
void
virDefaultErrorFuncWrapper(virErrorPtr err)
{
static virDefaultErrorFuncFuncType virDefaultErrorFuncSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDefaultErrorFunc",
(void**)&virDefaultErrorFuncSymbol,
&once,
&success,
NULL)) {
return;
}
virDefaultErrorFuncSymbol(err);
}
typedef void
(*virFreeErrorFuncType)(virErrorPtr err);
void
virFreeErrorWrapper(virErrorPtr err)
{
static virFreeErrorFuncType virFreeErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virFreeError",
(void**)&virFreeErrorSymbol,
&once,
&success,
NULL)) {
return;
}
virFreeErrorSymbol(err);
}
typedef virErrorPtr
(*virGetLastErrorFuncType)(void);
virErrorPtr
virGetLastErrorWrapper(virErrorPtr err)
{
virErrorPtr ret = NULL;
static virGetLastErrorFuncType virGetLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virGetLastError",
(void**)&virGetLastErrorSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virGetLastErrorSymbol();
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virGetLastErrorCodeFuncType)(void);
int
virGetLastErrorCodeWrapper(virErrorPtr err)
{
int ret = -1;
static virGetLastErrorCodeFuncType virGetLastErrorCodeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virGetLastErrorCode",
(void**)&virGetLastErrorCodeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virGetLastErrorCodeSymbol();
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virGetLastErrorDomainFuncType)(void);
int
virGetLastErrorDomainWrapper(virErrorPtr err)
{
int ret = -1;
static virGetLastErrorDomainFuncType virGetLastErrorDomainSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virGetLastErrorDomain",
(void**)&virGetLastErrorDomainSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virGetLastErrorDomainSymbol();
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virGetLastErrorMessageFuncType)(void);
const char *
virGetLastErrorMessageWrapper(virErrorPtr err)
{
const char * ret = NULL;
static virGetLastErrorMessageFuncType virGetLastErrorMessageSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virGetLastErrorMessage",
(void**)&virGetLastErrorMessageSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virGetLastErrorMessageSymbol();
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virResetErrorFuncType)(virErrorPtr err);
void
virResetErrorWrapper(virErrorPtr err)
{
static virResetErrorFuncType virResetErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virResetError",
(void**)&virResetErrorSymbol,
&once,
&success,
NULL)) {
return;
}
virResetErrorSymbol(err);
}
typedef void
(*virResetLastErrorFuncType)(void);
void
virResetLastErrorWrapper(void)
{
static virResetLastErrorFuncType virResetLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virResetLastError",
(void**)&virResetLastErrorSymbol,
&once,
&success,
NULL)) {
return;
}
virResetLastErrorSymbol();
}
typedef virErrorPtr
(*virSaveLastErrorFuncType)(void);
virErrorPtr
virSaveLastErrorWrapper(virErrorPtr err)
{
virErrorPtr ret = NULL;
static virSaveLastErrorFuncType virSaveLastErrorSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSaveLastError",
(void**)&virSaveLastErrorSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSaveLastErrorSymbol();
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virSetErrorFuncFuncType)(void * userData,
virErrorFunc handler);
void
virSetErrorFuncWrapper(void * userData,
virErrorFunc handler)
{
static virSetErrorFuncFuncType virSetErrorFuncSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSetErrorFunc",
(void**)&virSetErrorFuncSymbol,
&once,
&success,
NULL)) {
return;
}
virSetErrorFuncSymbol(userData,
handler);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/storage_pool_events_helper.go | vendor/libvirt.org/go/libvirt/storage_pool_events_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdint.h>
#include "storage_pool_events_helper.h"
#include "callbacks_helper.h"
extern void storagePoolEventLifecycleCallback(virConnectPtr, virStoragePoolPtr, int, int, int);
void storagePoolEventLifecycleCallbackHelper(virConnectPtr conn, virStoragePoolPtr pool,
int event, int detail, void *data)
{
storagePoolEventLifecycleCallback(conn, pool, event, detail, (int)(intptr_t)data);
}
extern void storagePoolEventGenericCallback(virConnectPtr, virStoragePoolPtr, int);
void storagePoolEventGenericCallbackHelper(virConnectPtr conn, virStoragePoolPtr pool,
void *data)
{
storagePoolEventGenericCallback(conn, pool, (int)(intptr_t)data);
}
int
virConnectStoragePoolEventRegisterAnyHelper(virConnectPtr conn,
virStoragePoolPtr pool,
int eventID,
virConnectStoragePoolEventGenericCallback cb,
long goCallbackId,
virErrorPtr err)
{
void *id = (void *)goCallbackId;
return virConnectStoragePoolEventRegisterAnyWrapper(conn, pool, eventID, cb, id,
freeGoCallbackHelper, err);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_domain_checkpoint.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_domain_checkpoint.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
virDomainCheckpointPtr
virDomainCheckpointCreateXMLWrapper(virDomainPtr domain,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virDomainCheckpointPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointCreateXML not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointCreateXML(domain,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCheckpointDeleteWrapper(virDomainCheckpointPtr checkpoint,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointDelete not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointDelete(checkpoint,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCheckpointFreeWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointFree not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointFree(checkpoint);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virDomainCheckpointGetConnectWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointGetConnect not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointGetConnect(checkpoint);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainCheckpointGetDomainWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointGetDomain not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointGetDomain(checkpoint);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virDomainCheckpointGetNameWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointGetName not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointGetName(checkpoint);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainCheckpointPtr
virDomainCheckpointGetParentWrapper(virDomainCheckpointPtr checkpoint,
unsigned int flags,
virErrorPtr err)
{
virDomainCheckpointPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointGetParent not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointGetParent(checkpoint,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virDomainCheckpointGetXMLDescWrapper(virDomainCheckpointPtr checkpoint,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointGetXMLDesc not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointGetXMLDesc(checkpoint,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCheckpointListAllChildrenWrapper(virDomainCheckpointPtr checkpoint,
virDomainCheckpointPtr ** children,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointListAllChildren not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointListAllChildren(checkpoint,
children,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainCheckpointPtr
virDomainCheckpointLookupByNameWrapper(virDomainPtr domain,
const char * name,
unsigned int flags,
virErrorPtr err)
{
virDomainCheckpointPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointLookupByName not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointLookupByName(domain,
name,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCheckpointRefWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainCheckpointRef not available prior to libvirt version 5.6.0");
#else
ret = virDomainCheckpointRef(checkpoint);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainListAllCheckpointsWrapper(virDomainPtr domain,
virDomainCheckpointPtr ** checkpoints,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 6, 0)
setVirError(err, "Function virDomainListAllCheckpoints not available prior to libvirt version 5.6.0");
#else
ret = virDomainListAllCheckpoints(domain,
checkpoints,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/stream.go | vendor/libvirt.org/go/libvirt/stream.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "stream_helper.h"
*/
import "C"
import (
"io"
"unsafe"
)
type StreamFlags uint
const (
STREAM_NONBLOCK = StreamFlags(C.VIR_STREAM_NONBLOCK)
)
type StreamEventType int
const (
STREAM_EVENT_READABLE = StreamEventType(C.VIR_STREAM_EVENT_READABLE)
STREAM_EVENT_WRITABLE = StreamEventType(C.VIR_STREAM_EVENT_WRITABLE)
STREAM_EVENT_ERROR = StreamEventType(C.VIR_STREAM_EVENT_ERROR)
STREAM_EVENT_HANGUP = StreamEventType(C.VIR_STREAM_EVENT_HANGUP)
)
type StreamRecvFlagsValues int
const (
STREAM_RECV_STOP_AT_HOLE = StreamRecvFlagsValues(C.VIR_STREAM_RECV_STOP_AT_HOLE)
)
type Stream struct {
ptr C.virStreamPtr
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamAbort
func (v *Stream) Abort() error {
var err C.virError
result := C.virStreamAbortWrapper(v.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamFinish
func (v *Stream) Finish() error {
var err C.virError
result := C.virStreamFinishWrapper(v.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamFree
func (v *Stream) Free() error {
var err C.virError
ret := C.virStreamFreeWrapper(v.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRef
func (c *Stream) Ref() error {
var err C.virError
ret := C.virStreamRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecv
func (v *Stream) Recv(p []byte) (int, error) {
np := len(p)
var err C.virError
var pPtr *C.char = nil
if np > 0 {
pPtr = (*C.char)(unsafe.Pointer(&p[0]))
}
n := C.virStreamRecvWrapper(v.ptr, pPtr, C.size_t(np), &err)
if n < 0 {
return 0, makeError(&err)
}
if n == 0 {
return 0, io.EOF
}
return int(n), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvFlags
func (v *Stream) RecvFlags(p []byte, flags StreamRecvFlagsValues) (int, error) {
np := len(p)
var err C.virError
var pPtr *C.char = nil
if np > 0 {
pPtr = (*C.char)(unsafe.Pointer(&p[0]))
}
n := C.virStreamRecvFlagsWrapper(v.ptr, pPtr, C.size_t(np), C.uint(flags), &err)
if n < 0 {
return 0, makeError(&err)
}
if n == 0 {
return 0, io.EOF
}
return int(n), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvHole
func (v *Stream) RecvHole(flags uint32) (int64, error) {
var len C.longlong
var err C.virError
ret := C.virStreamRecvHoleWrapper(v.ptr, &len, C.uint(flags), &err)
if ret < 0 {
return 0, makeError(&err)
}
return int64(len), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSend
func (v *Stream) Send(p []byte) (int, error) {
np := len(p)
var err C.virError
var pPtr *C.char = nil
if np > 0 {
pPtr = (*C.char)(unsafe.Pointer(&p[0]))
}
n := C.virStreamSendWrapper(v.ptr, pPtr, C.size_t(np), &err)
if n < 0 {
return 0, makeError(&err)
}
if n == 0 {
return 0, io.EOF
}
return int(n), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSendHole
func (v *Stream) SendHole(len int64, flags uint32) error {
var err C.virError
ret := C.virStreamSendHoleWrapper(v.ptr, C.longlong(len), C.uint(flags), &err)
if ret < 0 {
return makeError(&err)
}
return nil
}
type StreamSinkFunc func(*Stream, []byte) (int, error)
type StreamSinkHoleFunc func(*Stream, int64) error
//export streamSinkCallback
func streamSinkCallback(stream C.virStreamPtr, cdata *C.char, nbytes C.size_t, callbackID int) int {
callbackFunc := getCallbackId(callbackID)
callback, ok := callbackFunc.(StreamSinkFunc)
if !ok {
panic("Incorrect stream sink func callback")
}
data := make([]byte, int(nbytes))
for i := 0; i < int(nbytes); i++ {
cdatabyte := (*C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cdata)) + (unsafe.Sizeof(*cdata) * uintptr(i))))
data[i] = (byte)(*cdatabyte)
}
retnbytes, err := callback(&Stream{ptr: stream}, data)
if err != nil {
return -1
}
return retnbytes
}
//export streamSinkHoleCallback
func streamSinkHoleCallback(stream C.virStreamPtr, length C.longlong, callbackID int) int {
callbackFunc := getCallbackId(callbackID)
callback, ok := callbackFunc.(StreamSinkHoleFunc)
if !ok {
panic("Incorrect stream sink hole func callback")
}
err := callback(&Stream{ptr: stream}, int64(length))
if err != nil {
return -1
}
return 0
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvAll
func (v *Stream) RecvAll(handler StreamSinkFunc) error {
callbackID := registerCallbackId(handler)
var err C.virError
ret := C.virStreamRecvAllHelper(v.ptr, (C.int)(callbackID), &err)
freeCallbackId(callbackID)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSparseRecvAll
func (v *Stream) SparseRecvAll(handler StreamSinkFunc, holeHandler StreamSinkHoleFunc) error {
callbackID := registerCallbackId(handler)
holeCallbackID := registerCallbackId(holeHandler)
var err C.virError
ret := C.virStreamSparseRecvAllHelper(v.ptr, (C.int)(callbackID), (C.int)(holeCallbackID), &err)
freeCallbackId(callbackID)
freeCallbackId(holeCallbackID)
if ret == -1 {
return makeError(&err)
}
return nil
}
type StreamSourceFunc func(*Stream, int) ([]byte, error)
type StreamSourceHoleFunc func(*Stream) (bool, int64, error)
type StreamSourceSkipFunc func(*Stream, int64) error
//export streamSourceCallback
func streamSourceCallback(stream C.virStreamPtr, cdata *C.char, nbytes C.size_t, callbackID int) int {
callbackFunc := getCallbackId(callbackID)
callback, ok := callbackFunc.(StreamSourceFunc)
if !ok {
panic("Incorrect stream sink func callback")
}
data, err := callback(&Stream{ptr: stream}, (int)(nbytes))
if err != nil {
return -1
}
nretbytes := int(nbytes)
if len(data) < nretbytes {
nretbytes = len(data)
}
for i := 0; i < nretbytes; i++ {
cdatabyte := (*C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cdata)) + (unsafe.Sizeof(*cdata) * uintptr(i))))
*cdatabyte = (C.char)(data[i])
}
return nretbytes
}
//export streamSourceHoleCallback
func streamSourceHoleCallback(stream C.virStreamPtr, cinData *C.int, clength *C.longlong, callbackID int) int {
callbackFunc := getCallbackId(callbackID)
callback, ok := callbackFunc.(StreamSourceHoleFunc)
if !ok {
panic("Incorrect stream sink hole func callback")
}
inData, length, err := callback(&Stream{ptr: stream})
if err != nil {
return -1
}
if inData {
*cinData = 1
} else {
*cinData = 0
}
*clength = C.longlong(length)
return 0
}
//export streamSourceSkipCallback
func streamSourceSkipCallback(stream C.virStreamPtr, length C.longlong, callbackID int) int {
callbackFunc := getCallbackId(callbackID)
callback, ok := callbackFunc.(StreamSourceSkipFunc)
if !ok {
panic("Incorrect stream sink skip func callback")
}
err := callback(&Stream{ptr: stream}, int64(length))
if err != nil {
return -1
}
return 0
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSendAll
func (v *Stream) SendAll(handler StreamSourceFunc) error {
callbackID := registerCallbackId(handler)
var err C.virError
ret := C.virStreamSendAllHelper(v.ptr, (C.int)(callbackID), &err)
freeCallbackId(callbackID)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSparseSendAll
func (v *Stream) SparseSendAll(handler StreamSourceFunc, holeHandler StreamSourceHoleFunc, skipHandler StreamSourceSkipFunc) error {
callbackID := registerCallbackId(handler)
holeCallbackID := registerCallbackId(holeHandler)
skipCallbackID := registerCallbackId(skipHandler)
var err C.virError
ret := C.virStreamSparseSendAllHelper(v.ptr, (C.int)(callbackID), (C.int)(holeCallbackID), (C.int)(skipCallbackID), &err)
freeCallbackId(callbackID)
freeCallbackId(holeCallbackID)
freeCallbackId(skipCallbackID)
if ret == -1 {
return makeError(&err)
}
return nil
}
type StreamEventCallback func(*Stream, StreamEventType)
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventAddCallback
func (v *Stream) EventAddCallback(events StreamEventType, callback StreamEventCallback) error {
callbackID := registerCallbackId(callback)
var err C.virError
ret := C.virStreamEventAddCallbackHelper(v.ptr, (C.int)(events), (C.int)(callbackID), &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
//export streamEventCallback
func streamEventCallback(st C.virStreamPtr, events int, callbackID int) {
callbackFunc := getCallbackId(callbackID)
callback, ok := callbackFunc.(StreamEventCallback)
if !ok {
panic("Incorrect stream event func callback")
}
callback(&Stream{ptr: st}, StreamEventType(events))
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventUpdateCallback
func (v *Stream) EventUpdateCallback(events StreamEventType) error {
var err C.virError
ret := C.virStreamEventUpdateCallbackWrapper(v.ptr, (C.int)(events), &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventRemoveCallback
func (v *Stream) EventRemoveCallback() error {
var err C.virError
ret := C.virStreamEventRemoveCallbackWrapper(v.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/connect_helper.go | vendor/libvirt.org/go/libvirt/connect_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "connect_helper.h"
#include "callbacks_helper.h"
extern void closeCallback(virConnectPtr, int, long);
void closeCallbackHelper(virConnectPtr conn, int reason, void *opaque)
{
closeCallback(conn, reason, (long)opaque);
}
extern int connectAuthCallback(virConnectCredentialPtr, unsigned int, int);
int connectAuthCallbackHelper(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata)
{
int *callbackID = cbdata;
return connectAuthCallback(cred, ncred, *callbackID);
}
virConnectPtr
virConnectOpenAuthHelper(const char *name,
int *credtype,
unsigned int ncredtype,
int callbackID,
unsigned int flags,
virErrorPtr err)
{
virConnectAuth auth = {
.credtype = credtype,
.ncredtype = ncredtype,
.cb = connectAuthCallbackHelper,
.cbdata = &callbackID,
};
return virConnectOpenAuthWrapper(name, &auth, flags, err);
}
virConnectPtr
virConnectOpenAuthDefaultHelper(const char *name,
unsigned int flags,
virErrorPtr err)
{
return virConnectOpenAuthWrapper(name, *virConnectAuthPtrDefaultVar, flags, err);
}
int
virConnectRegisterCloseCallbackHelper(virConnectPtr conn,
long goCallbackId,
virErrorPtr err)
{
void *id = (void *)goCallbackId;
return virConnectRegisterCloseCallbackWrapper(conn, closeCallbackHelper, id,
freeGoCallbackHelper, err);
}
int
virConnectUnregisterCloseCallbackHelper(virConnectPtr conn,
virErrorPtr err)
{
return virConnectUnregisterCloseCallbackWrapper(conn, closeCallbackHelper, err);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/error.go | vendor/libvirt.org/go/libvirt/error.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "libvirt_generated.h"
void ignoreErrorFunc(void *userData, virErrorPtr error) {
// no-op
}
*/
import "C"
import (
"fmt"
)
func init() {
C.virSetErrorFuncWrapper(nil, (C.virErrorFunc)(C.ignoreErrorFunc))
}
type ErrorLevel int
const (
ERR_NONE = ErrorLevel(C.VIR_ERR_NONE)
ERR_WARNING = ErrorLevel(C.VIR_ERR_WARNING)
ERR_ERROR = ErrorLevel(C.VIR_ERR_ERROR)
)
type ErrorNumber int
func (err ErrorNumber) Error() string {
return fmt.Sprintf("virErrCode(%d)", err)
}
const (
ERR_OK = ErrorNumber(C.VIR_ERR_OK)
// internal error
ERR_INTERNAL_ERROR = ErrorNumber(C.VIR_ERR_INTERNAL_ERROR)
// memory allocation failure
ERR_NO_MEMORY = ErrorNumber(C.VIR_ERR_NO_MEMORY)
// no support for this function
ERR_NO_SUPPORT = ErrorNumber(C.VIR_ERR_NO_SUPPORT)
// could not resolve hostname
ERR_UNKNOWN_HOST = ErrorNumber(C.VIR_ERR_UNKNOWN_HOST)
// can't connect to hypervisor
ERR_NO_CONNECT = ErrorNumber(C.VIR_ERR_NO_CONNECT)
// invalid connection object
ERR_INVALID_CONN = ErrorNumber(C.VIR_ERR_INVALID_CONN)
// invalid domain object
ERR_INVALID_DOMAIN = ErrorNumber(C.VIR_ERR_INVALID_DOMAIN)
// invalid function argument
ERR_INVALID_ARG = ErrorNumber(C.VIR_ERR_INVALID_ARG)
// a command to hypervisor failed
ERR_OPERATION_FAILED = ErrorNumber(C.VIR_ERR_OPERATION_FAILED)
// a HTTP GET command to failed
ERR_GET_FAILED = ErrorNumber(C.VIR_ERR_GET_FAILED)
// a HTTP POST command to failed
ERR_POST_FAILED = ErrorNumber(C.VIR_ERR_POST_FAILED)
// unexpected HTTP error code
ERR_HTTP_ERROR = ErrorNumber(C.VIR_ERR_HTTP_ERROR)
// failure to serialize an S-Expr
ERR_SEXPR_SERIAL = ErrorNumber(C.VIR_ERR_SEXPR_SERIAL)
// could not open Xen hypervisor control
ERR_NO_XEN = ErrorNumber(C.VIR_ERR_NO_XEN)
// failure doing an hypervisor call
ERR_XEN_CALL = ErrorNumber(C.VIR_ERR_XEN_CALL)
// unknown OS type
ERR_OS_TYPE = ErrorNumber(C.VIR_ERR_OS_TYPE)
// missing kernel information
ERR_NO_KERNEL = ErrorNumber(C.VIR_ERR_NO_KERNEL)
// missing root device information
ERR_NO_ROOT = ErrorNumber(C.VIR_ERR_NO_ROOT)
// missing source device information
ERR_NO_SOURCE = ErrorNumber(C.VIR_ERR_NO_SOURCE)
// missing target device information
ERR_NO_TARGET = ErrorNumber(C.VIR_ERR_NO_TARGET)
// missing domain name information
ERR_NO_NAME = ErrorNumber(C.VIR_ERR_NO_NAME)
// missing domain OS information
ERR_NO_OS = ErrorNumber(C.VIR_ERR_NO_OS)
// missing domain devices information
ERR_NO_DEVICE = ErrorNumber(C.VIR_ERR_NO_DEVICE)
// could not open Xen Store control
ERR_NO_XENSTORE = ErrorNumber(C.VIR_ERR_NO_XENSTORE)
// too many drivers registered
ERR_DRIVER_FULL = ErrorNumber(C.VIR_ERR_DRIVER_FULL)
// not supported by the drivers (DEPRECATED)
ERR_CALL_FAILED = ErrorNumber(C.VIR_ERR_CALL_FAILED)
// an XML description is not well formed or broken
ERR_XML_ERROR = ErrorNumber(C.VIR_ERR_XML_ERROR)
// the domain already exist
ERR_DOM_EXIST = ErrorNumber(C.VIR_ERR_DOM_EXIST)
// operation forbidden on read-only connections
ERR_OPERATION_DENIED = ErrorNumber(C.VIR_ERR_OPERATION_DENIED)
// failed to open a conf file
ERR_OPEN_FAILED = ErrorNumber(C.VIR_ERR_OPEN_FAILED)
// failed to read a conf file
ERR_READ_FAILED = ErrorNumber(C.VIR_ERR_READ_FAILED)
// failed to parse a conf file
ERR_PARSE_FAILED = ErrorNumber(C.VIR_ERR_PARSE_FAILED)
// failed to parse the syntax of a conf file
ERR_CONF_SYNTAX = ErrorNumber(C.VIR_ERR_CONF_SYNTAX)
// failed to write a conf file
ERR_WRITE_FAILED = ErrorNumber(C.VIR_ERR_WRITE_FAILED)
// detail of an XML error
ERR_XML_DETAIL = ErrorNumber(C.VIR_ERR_XML_DETAIL)
// invalid network object
ERR_INVALID_NETWORK = ErrorNumber(C.VIR_ERR_INVALID_NETWORK)
// the network already exist
ERR_NETWORK_EXIST = ErrorNumber(C.VIR_ERR_NETWORK_EXIST)
// general system call failure
ERR_SYSTEM_ERROR = ErrorNumber(C.VIR_ERR_SYSTEM_ERROR)
// some sort of RPC error
ERR_RPC = ErrorNumber(C.VIR_ERR_RPC)
// error from a GNUTLS call
ERR_GNUTLS_ERROR = ErrorNumber(C.VIR_ERR_GNUTLS_ERROR)
// failed to start network
WAR_NO_NETWORK = ErrorNumber(C.VIR_WAR_NO_NETWORK)
// domain not found or unexpectedly disappeared
ERR_NO_DOMAIN = ErrorNumber(C.VIR_ERR_NO_DOMAIN)
// network not found
ERR_NO_NETWORK = ErrorNumber(C.VIR_ERR_NO_NETWORK)
// invalid MAC address
ERR_INVALID_MAC = ErrorNumber(C.VIR_ERR_INVALID_MAC)
// authentication failed
ERR_AUTH_FAILED = ErrorNumber(C.VIR_ERR_AUTH_FAILED)
// invalid storage pool object
ERR_INVALID_STORAGE_POOL = ErrorNumber(C.VIR_ERR_INVALID_STORAGE_POOL)
// invalid storage vol object
ERR_INVALID_STORAGE_VOL = ErrorNumber(C.VIR_ERR_INVALID_STORAGE_VOL)
// failed to start storage
WAR_NO_STORAGE = ErrorNumber(C.VIR_WAR_NO_STORAGE)
// storage pool not found
ERR_NO_STORAGE_POOL = ErrorNumber(C.VIR_ERR_NO_STORAGE_POOL)
// storage volume not found
ERR_NO_STORAGE_VOL = ErrorNumber(C.VIR_ERR_NO_STORAGE_VOL)
// failed to start node driver
WAR_NO_NODE = ErrorNumber(C.VIR_WAR_NO_NODE)
// invalid node device object
ERR_INVALID_NODE_DEVICE = ErrorNumber(C.VIR_ERR_INVALID_NODE_DEVICE)
// node device not found
ERR_NO_NODE_DEVICE = ErrorNumber(C.VIR_ERR_NO_NODE_DEVICE)
// security model not found
ERR_NO_SECURITY_MODEL = ErrorNumber(C.VIR_ERR_NO_SECURITY_MODEL)
// operation is not applicable at this time
ERR_OPERATION_INVALID = ErrorNumber(C.VIR_ERR_OPERATION_INVALID)
// failed to start interface driver
WAR_NO_INTERFACE = ErrorNumber(C.VIR_WAR_NO_INTERFACE)
// interface driver not running
ERR_NO_INTERFACE = ErrorNumber(C.VIR_ERR_NO_INTERFACE)
// invalid interface object
ERR_INVALID_INTERFACE = ErrorNumber(C.VIR_ERR_INVALID_INTERFACE)
// more than one matching interface found
ERR_MULTIPLE_INTERFACES = ErrorNumber(C.VIR_ERR_MULTIPLE_INTERFACES)
// failed to start nwfilter driver
WAR_NO_NWFILTER = ErrorNumber(C.VIR_WAR_NO_NWFILTER)
// invalid nwfilter object
ERR_INVALID_NWFILTER = ErrorNumber(C.VIR_ERR_INVALID_NWFILTER)
// nw filter pool not found
ERR_NO_NWFILTER = ErrorNumber(C.VIR_ERR_NO_NWFILTER)
// nw filter pool not found
ERR_BUILD_FIREWALL = ErrorNumber(C.VIR_ERR_BUILD_FIREWALL)
// failed to start secret storage
WAR_NO_SECRET = ErrorNumber(C.VIR_WAR_NO_SECRET)
// invalid secret
ERR_INVALID_SECRET = ErrorNumber(C.VIR_ERR_INVALID_SECRET)
// secret not found
ERR_NO_SECRET = ErrorNumber(C.VIR_ERR_NO_SECRET)
// unsupported configuration construct
ERR_CONFIG_UNSUPPORTED = ErrorNumber(C.VIR_ERR_CONFIG_UNSUPPORTED)
// timeout occurred during operation
ERR_OPERATION_TIMEOUT = ErrorNumber(C.VIR_ERR_OPERATION_TIMEOUT)
// a migration worked, but making the VM persist on the dest host failed
ERR_MIGRATE_PERSIST_FAILED = ErrorNumber(C.VIR_ERR_MIGRATE_PERSIST_FAILED)
// a synchronous hook script failed
ERR_HOOK_SCRIPT_FAILED = ErrorNumber(C.VIR_ERR_HOOK_SCRIPT_FAILED)
// invalid domain snapshot
ERR_INVALID_DOMAIN_SNAPSHOT = ErrorNumber(C.VIR_ERR_INVALID_DOMAIN_SNAPSHOT)
// domain snapshot not found
ERR_NO_DOMAIN_SNAPSHOT = ErrorNumber(C.VIR_ERR_NO_DOMAIN_SNAPSHOT)
// stream pointer not valid
ERR_INVALID_STREAM = ErrorNumber(C.VIR_ERR_INVALID_STREAM)
// valid API use but unsupported by the given driver
ERR_ARGUMENT_UNSUPPORTED = ErrorNumber(C.VIR_ERR_ARGUMENT_UNSUPPORTED)
// storage pool probe failed
ERR_STORAGE_PROBE_FAILED = ErrorNumber(C.VIR_ERR_STORAGE_PROBE_FAILED)
// storage pool already built
ERR_STORAGE_POOL_BUILT = ErrorNumber(C.VIR_ERR_STORAGE_POOL_BUILT)
// force was not requested for a risky domain snapshot revert
ERR_SNAPSHOT_REVERT_RISKY = ErrorNumber(C.VIR_ERR_SNAPSHOT_REVERT_RISKY)
// operation on a domain was canceled/aborted by user
ERR_OPERATION_ABORTED = ErrorNumber(C.VIR_ERR_OPERATION_ABORTED)
// authentication cancelled
ERR_AUTH_CANCELLED = ErrorNumber(C.VIR_ERR_AUTH_CANCELLED)
// The metadata is not present
ERR_NO_DOMAIN_METADATA = ErrorNumber(C.VIR_ERR_NO_DOMAIN_METADATA)
// Migration is not safe
ERR_MIGRATE_UNSAFE = ErrorNumber(C.VIR_ERR_MIGRATE_UNSAFE)
// integer overflow
ERR_OVERFLOW = ErrorNumber(C.VIR_ERR_OVERFLOW)
// action prevented by block copy job
ERR_BLOCK_COPY_ACTIVE = ErrorNumber(C.VIR_ERR_BLOCK_COPY_ACTIVE)
// The requested operation is not supported
ERR_OPERATION_UNSUPPORTED = ErrorNumber(C.VIR_ERR_OPERATION_UNSUPPORTED)
// error in ssh transport driver
ERR_SSH = ErrorNumber(C.VIR_ERR_SSH)
// guest agent is unresponsive, not running or not usable
ERR_AGENT_UNRESPONSIVE = ErrorNumber(C.VIR_ERR_AGENT_UNRESPONSIVE)
// resource is already in use
ERR_RESOURCE_BUSY = ErrorNumber(C.VIR_ERR_RESOURCE_BUSY)
// operation on the object/resource was denied
ERR_ACCESS_DENIED = ErrorNumber(C.VIR_ERR_ACCESS_DENIED)
// error from a dbus service
ERR_DBUS_SERVICE = ErrorNumber(C.VIR_ERR_DBUS_SERVICE)
// the storage vol already exists
ERR_STORAGE_VOL_EXIST = ErrorNumber(C.VIR_ERR_STORAGE_VOL_EXIST)
// given CPU is incompatible with host CPU
ERR_CPU_INCOMPATIBLE = ErrorNumber(C.VIR_ERR_CPU_INCOMPATIBLE)
// XML document doesn't validate against schema
ERR_XML_INVALID_SCHEMA = ErrorNumber(C.VIR_ERR_XML_INVALID_SCHEMA)
// Finish API succeeded but it is expected to return NULL */
ERR_MIGRATE_FINISH_OK = ErrorNumber(C.VIR_ERR_MIGRATE_FINISH_OK)
// authentication unavailable
ERR_AUTH_UNAVAILABLE = ErrorNumber(C.VIR_ERR_AUTH_UNAVAILABLE)
// Server was not found
ERR_NO_SERVER = ErrorNumber(C.VIR_ERR_NO_SERVER)
// Client was not found
ERR_NO_CLIENT = ErrorNumber(C.VIR_ERR_NO_CLIENT)
// guest agent replies with wrong id to guest sync command
ERR_AGENT_UNSYNCED = ErrorNumber(C.VIR_ERR_AGENT_UNSYNCED)
// error in libssh transport driver
ERR_LIBSSH = ErrorNumber(C.VIR_ERR_LIBSSH)
// libvirt fail to find the desired device
ERR_DEVICE_MISSING = ErrorNumber(C.VIR_ERR_DEVICE_MISSING)
// Invalid nwfilter binding object
ERR_INVALID_NWFILTER_BINDING = ErrorNumber(C.VIR_ERR_INVALID_NWFILTER_BINDING)
// Requested nwfilter binding does not exist
ERR_NO_NWFILTER_BINDING = ErrorNumber(C.VIR_ERR_NO_NWFILTER_BINDING)
// invalid domain checkpoint
ERR_INVALID_DOMAIN_CHECKPOINT = ErrorNumber(C.VIR_ERR_INVALID_DOMAIN_CHECKPOINT)
// domain checkpoint not found
ERR_NO_DOMAIN_CHECKPOINT = ErrorNumber(C.VIR_ERR_NO_DOMAIN_CHECKPOINT)
// domain backup job id not found *
ERR_NO_DOMAIN_BACKUP = ErrorNumber(C.VIR_ERR_NO_DOMAIN_BACKUP)
// invalid network port object
ERR_INVALID_NETWORK_PORT = ErrorNumber(C.VIR_ERR_INVALID_NETWORK_PORT)
// network port already exists
ERR_NETWORK_PORT_EXIST = ErrorNumber(C.VIR_ERR_NETWORK_PORT_EXIST)
// network port not found
ERR_NO_NETWORK_PORT = ErrorNumber(C.VIR_ERR_NO_NETWORK_PORT)
// no domain's hostname found
ERR_NO_HOSTNAME = ErrorNumber(C.VIR_ERR_NO_HOSTNAME)
// checkpoint is inconsistent
ERR_CHECKPOINT_INCONSISTENT = ErrorNumber(C.VIR_ERR_CHECKPOINT_INCONSISTENT)
// more than one matching domain found
ERR_MULTIPLE_DOMAINS = ErrorNumber(C.VIR_ERR_MULTIPLE_DOMAINS)
// The metadata is not present
ERR_NO_NETWORK_METADATA = ErrorNumber(C.VIR_ERR_NO_NETWORK_METADATA)
)
type ErrorDomain int
const (
FROM_NONE = ErrorDomain(C.VIR_FROM_NONE)
// Error at Xen hypervisor layer
FROM_XEN = ErrorDomain(C.VIR_FROM_XEN)
// Error at connection with xend daemon
FROM_XEND = ErrorDomain(C.VIR_FROM_XEND)
// Error at connection with xen store
FROM_XENSTORE = ErrorDomain(C.VIR_FROM_XENSTORE)
// Error in the S-Expression code
FROM_SEXPR = ErrorDomain(C.VIR_FROM_SEXPR)
// Error in the XML code
FROM_XML = ErrorDomain(C.VIR_FROM_XML)
// Error when operating on a domain
FROM_DOM = ErrorDomain(C.VIR_FROM_DOM)
// Error in the XML-RPC code
FROM_RPC = ErrorDomain(C.VIR_FROM_RPC)
// Error in the proxy code; unused since 0.8.6
FROM_PROXY = ErrorDomain(C.VIR_FROM_PROXY)
// Error in the configuration file handling
FROM_CONF = ErrorDomain(C.VIR_FROM_CONF)
// Error at the QEMU daemon
FROM_QEMU = ErrorDomain(C.VIR_FROM_QEMU)
// Error when operating on a network
FROM_NET = ErrorDomain(C.VIR_FROM_NET)
// Error from test driver
FROM_TEST = ErrorDomain(C.VIR_FROM_TEST)
// Error from remote driver
FROM_REMOTE = ErrorDomain(C.VIR_FROM_REMOTE)
// Error from OpenVZ driver
FROM_OPENVZ = ErrorDomain(C.VIR_FROM_OPENVZ)
// Error at Xen XM layer
FROM_XENXM = ErrorDomain(C.VIR_FROM_XENXM)
// Error in the Linux Stats code
FROM_STATS_LINUX = ErrorDomain(C.VIR_FROM_STATS_LINUX)
// Error from Linux Container driver
FROM_LXC = ErrorDomain(C.VIR_FROM_LXC)
// Error from storage driver
FROM_STORAGE = ErrorDomain(C.VIR_FROM_STORAGE)
// Error from network config
FROM_NETWORK = ErrorDomain(C.VIR_FROM_NETWORK)
// Error from domain config
FROM_DOMAIN = ErrorDomain(C.VIR_FROM_DOMAIN)
// Error at the UML driver
FROM_UML = ErrorDomain(C.VIR_FROM_UML)
// Error from node device monitor
FROM_NODEDEV = ErrorDomain(C.VIR_FROM_NODEDEV)
// Error from xen inotify layer
FROM_XEN_INOTIFY = ErrorDomain(C.VIR_FROM_XEN_INOTIFY)
// Error from security framework
FROM_SECURITY = ErrorDomain(C.VIR_FROM_SECURITY)
// Error from VirtualBox driver
FROM_VBOX = ErrorDomain(C.VIR_FROM_VBOX)
// Error when operating on an interface
FROM_INTERFACE = ErrorDomain(C.VIR_FROM_INTERFACE)
// The OpenNebula driver no longer exists. Retained for ABI/API compat only
FROM_ONE = ErrorDomain(C.VIR_FROM_ONE)
// Error from ESX driver
FROM_ESX = ErrorDomain(C.VIR_FROM_ESX)
// Error from IBM power hypervisor
FROM_PHYP = ErrorDomain(C.VIR_FROM_PHYP)
// Error from secret storage
FROM_SECRET = ErrorDomain(C.VIR_FROM_SECRET)
// Error from CPU driver
FROM_CPU = ErrorDomain(C.VIR_FROM_CPU)
// Error from XenAPI
FROM_XENAPI = ErrorDomain(C.VIR_FROM_XENAPI)
// Error from network filter driver
FROM_NWFILTER = ErrorDomain(C.VIR_FROM_NWFILTER)
// Error from Synchronous hooks
FROM_HOOK = ErrorDomain(C.VIR_FROM_HOOK)
// Error from domain snapshot
FROM_DOMAIN_SNAPSHOT = ErrorDomain(C.VIR_FROM_DOMAIN_SNAPSHOT)
// Error from auditing subsystem
FROM_AUDIT = ErrorDomain(C.VIR_FROM_AUDIT)
// Error from sysinfo/SMBIOS
FROM_SYSINFO = ErrorDomain(C.VIR_FROM_SYSINFO)
// Error from I/O streams
FROM_STREAMS = ErrorDomain(C.VIR_FROM_STREAMS)
// Error from VMware driver
FROM_VMWARE = ErrorDomain(C.VIR_FROM_VMWARE)
// Error from event loop impl
FROM_EVENT = ErrorDomain(C.VIR_FROM_EVENT)
// Error from libxenlight driver
FROM_LIBXL = ErrorDomain(C.VIR_FROM_LIBXL)
// Error from lock manager
FROM_LOCKING = ErrorDomain(C.VIR_FROM_LOCKING)
// Error from Hyper-V driver
FROM_HYPERV = ErrorDomain(C.VIR_FROM_HYPERV)
// Error from capabilities
FROM_CAPABILITIES = ErrorDomain(C.VIR_FROM_CAPABILITIES)
// Error from URI handling
FROM_URI = ErrorDomain(C.VIR_FROM_URI)
// Error from auth handling
FROM_AUTH = ErrorDomain(C.VIR_FROM_AUTH)
// Error from DBus
FROM_DBUS = ErrorDomain(C.VIR_FROM_DBUS)
// Error from Parallels
FROM_PARALLELS = ErrorDomain(C.VIR_FROM_PARALLELS)
// Error from Device
FROM_DEVICE = ErrorDomain(C.VIR_FROM_DEVICE)
// Error from libssh2 connection transport
FROM_SSH = ErrorDomain(C.VIR_FROM_SSH)
// Error from lockspace
FROM_LOCKSPACE = ErrorDomain(C.VIR_FROM_LOCKSPACE)
// Error from initctl device communication
FROM_INITCTL = ErrorDomain(C.VIR_FROM_INITCTL)
// Error from identity code
FROM_IDENTITY = ErrorDomain(C.VIR_FROM_IDENTITY)
// Error from cgroups
FROM_CGROUP = ErrorDomain(C.VIR_FROM_CGROUP)
// Error from access control manager
FROM_ACCESS = ErrorDomain(C.VIR_FROM_ACCESS)
// Error from systemd code
FROM_SYSTEMD = ErrorDomain(C.VIR_FROM_SYSTEMD)
// Error from bhyve driver
FROM_BHYVE = ErrorDomain(C.VIR_FROM_BHYVE)
// Error from crypto code
FROM_CRYPTO = ErrorDomain(C.VIR_FROM_CRYPTO)
// Error from firewall
FROM_FIREWALL = ErrorDomain(C.VIR_FROM_FIREWALL)
// Erorr from polkit code
FROM_POLKIT = ErrorDomain(C.VIR_FROM_POLKIT)
// Error from thread utils
FROM_THREAD = ErrorDomain(C.VIR_FROM_THREAD)
// Error from admin backend
FROM_ADMIN = ErrorDomain(C.VIR_FROM_ADMIN)
// Error from log manager
FROM_LOGGING = ErrorDomain(C.VIR_FROM_LOGGING)
// Error from Xen xl config code
FROM_XENXL = ErrorDomain(C.VIR_FROM_XENXL)
// Error from perf
FROM_PERF = ErrorDomain(C.VIR_FROM_PERF)
// Error from libssh
FROM_LIBSSH = ErrorDomain(C.VIR_FROM_LIBSSH)
// Error from resoruce control
FROM_RESCTRL = ErrorDomain(C.VIR_FROM_RESCTRL)
// Error from firewalld
FROM_FIREWALLD = ErrorDomain(C.VIR_FROM_FIREWALLD)
// Error from domain checkpoint
FROM_DOMAIN_CHECKPOINT = ErrorDomain(C.VIR_FROM_DOMAIN_CHECKPOINT)
// Error from TPM
FROM_TPM = ErrorDomain(C.VIR_FROM_TPM)
// Error from BPF
FROM_BPF = ErrorDomain(C.VIR_FROM_BPF)
// Error from Cloud Hypervisor
FROM_CH = ErrorDomain(C.VIR_FROM_CH)
)
type Error struct {
Code ErrorNumber
Domain ErrorDomain
Message string
Level ErrorLevel
}
func (err Error) Error() string {
return fmt.Sprintf("virError(Code=%d, Domain=%d, Message='%s')",
err.Code, err.Domain, err.Message)
}
func (err Error) Is(target error) bool {
n, ok := target.(ErrorNumber)
if !ok {
return false
}
return err.Code == n
}
func makeError(err *C.virError) Error {
ret := Error{
Code: ErrorNumber(err.code),
Domain: ErrorDomain(err.domain),
Message: C.GoString(err.message),
Level: ErrorLevel(err.level),
}
C.virResetErrorWrapper(err)
return ret
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/qemu_helper.go | vendor/libvirt.org/go/libvirt/qemu_helper.go | //go:build !libvirt_without_qemu
// +build !libvirt_without_qemu
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
// Can't rely on pkg-config for libvirt-qemu since it was not
// installed until 2.6.0 onwards
#cgo !libvirt_dlopen LDFLAGS: -lvirt-qemu
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdint.h>
#include "qemu_helper.h"
#include "callbacks_helper.h"
extern void domainQemuMonitorEventCallback(virConnectPtr, virDomainPtr, const char *, long long, unsigned int, const char *, int);
void domainQemuMonitorEventCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *event, long long secs,
unsigned int micros, const char *details, void *data)
{
domainQemuMonitorEventCallback(conn, dom, event, secs, micros, details, (int)(intptr_t)data);
}
int
virConnectDomainQemuMonitorEventRegisterHelper(virConnectPtr conn,
virDomainPtr dom,
const char *event,
long goCallbackId,
unsigned int flags,
virErrorPtr err)
{
void *id = (void *)goCallbackId;
return virConnectDomainQemuMonitorEventRegisterWrapper(conn, dom, event,
domainQemuMonitorEventCallbackHelper,
id, freeGoCallbackHelper, flags, err);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/node_device_events_helper.go | vendor/libvirt.org/go/libvirt/node_device_events_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdint.h>
#include "node_device_events_helper.h"
#include "callbacks_helper.h"
extern void nodeDeviceEventLifecycleCallback(virConnectPtr, virNodeDevicePtr, int, int, int);
void nodeDeviceEventLifecycleCallbackHelper(virConnectPtr conn, virNodeDevicePtr dev,
int event, int detail, void *data)
{
nodeDeviceEventLifecycleCallback(conn, dev, event, detail, (int)(intptr_t)data);
}
extern void nodeDeviceEventGenericCallback(virConnectPtr, virNodeDevicePtr, int);
void nodeDeviceEventGenericCallbackHelper(virConnectPtr conn, virNodeDevicePtr dev, void *data)
{
nodeDeviceEventGenericCallback(conn, dev, (int)(intptr_t)data);
}
int
virConnectNodeDeviceEventRegisterAnyHelper(virConnectPtr conn,
virNodeDevicePtr dev,
int eventID,
virConnectNodeDeviceEventGenericCallback cb,
long goCallbackId,
virErrorPtr err)
{
void *id = (void *)goCallbackId;
return virConnectNodeDeviceEventRegisterAnyWrapper(conn, dev, eventID, cb, id,
freeGoCallbackHelper, err);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/network_port.go | vendor/libvirt.org/go/libvirt/network_port.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2019 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"unsafe"
)
type NetworkPortCreateFlags uint
const (
NETWORK_PORT_CREATE_RECLAIM = NetworkPortCreateFlags(C.VIR_NETWORK_PORT_CREATE_RECLAIM)
NETWORK_PORT_CREATE_VALIDATE = NetworkPortCreateFlags(C.VIR_NETWORK_PORT_CREATE_VALIDATE)
)
type NetworkPort struct {
ptr C.virNetworkPortPtr
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortFree
func (n *NetworkPort) Free() error {
var err C.virError
ret := C.virNetworkPortFreeWrapper(n.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortRef
func (c *NetworkPort) Ref() error {
var err C.virError
ret := C.virNetworkPortRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortGetNetwork
//
// Contrary to the native C API behaviour, the Go API will
// acquire a reference on the returned Network, which must
// be released by calling Free()
func (n *NetworkPort) GetNetwork() (*Network, error) {
var err C.virError
ptr := C.virNetworkPortGetNetworkWrapper(n.ptr, &err)
if ptr == nil {
return nil, makeError(&err)
}
ret := C.virNetworkRefWrapper(ptr, &err)
if ret == -1 {
return nil, makeError(&err)
}
return &Network{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortGetUUID
func (n *NetworkPort) GetUUID() ([]byte, error) {
var cUuid [C.VIR_UUID_BUFLEN](byte)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virNetworkPortGetUUIDWrapper(n.ptr, (*C.uchar)(cuidPtr), &err)
if result != 0 {
return []byte{}, makeError(&err)
}
return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortGetUUIDString
func (n *NetworkPort) GetUUIDString() (string, error) {
var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virNetworkPortGetUUIDStringWrapper(n.ptr, (*C.char)(cuidPtr), &err)
if result != 0 {
return "", makeError(&err)
}
return C.GoString((*C.char)(cuidPtr)), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortDelete
func (n *NetworkPort) Delete(flags uint32) error {
var err C.virError
result := C.virNetworkPortDeleteWrapper(n.ptr, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortGetXMLDesc
func (d *NetworkPort) GetXMLDesc(flags uint32) (string, error) {
var err C.virError
result := C.virNetworkPortGetXMLDescWrapper(d.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
type NetworkPortParameters struct {
BandwidthInAverageSet bool
BandwidthInAverage uint
BandwidthInPeakSet bool
BandwidthInPeak uint
BandwidthInBurstSet bool
BandwidthInBurst uint
BandwidthInFloorSet bool
BandwidthInFloor uint
BandwidthOutAverageSet bool
BandwidthOutAverage uint
BandwidthOutPeakSet bool
BandwidthOutPeak uint
BandwidthOutBurstSet bool
BandwidthOutBurst uint
}
func getNetworkPortParametersFieldInfo(params *NetworkPortParameters) map[string]typedParamsFieldInfo {
return map[string]typedParamsFieldInfo{
C.VIR_NETWORK_PORT_BANDWIDTH_IN_AVERAGE: typedParamsFieldInfo{
set: ¶ms.BandwidthInAverageSet,
ui: ¶ms.BandwidthInAverage,
},
C.VIR_NETWORK_PORT_BANDWIDTH_IN_PEAK: typedParamsFieldInfo{
set: ¶ms.BandwidthInPeakSet,
ui: ¶ms.BandwidthInPeak,
},
C.VIR_NETWORK_PORT_BANDWIDTH_IN_BURST: typedParamsFieldInfo{
set: ¶ms.BandwidthInBurstSet,
ui: ¶ms.BandwidthInBurst,
},
C.VIR_NETWORK_PORT_BANDWIDTH_IN_FLOOR: typedParamsFieldInfo{
set: ¶ms.BandwidthInFloorSet,
ui: ¶ms.BandwidthInFloor,
},
C.VIR_NETWORK_PORT_BANDWIDTH_OUT_AVERAGE: typedParamsFieldInfo{
set: ¶ms.BandwidthOutAverageSet,
ui: ¶ms.BandwidthOutAverage,
},
C.VIR_NETWORK_PORT_BANDWIDTH_OUT_PEAK: typedParamsFieldInfo{
set: ¶ms.BandwidthOutPeakSet,
ui: ¶ms.BandwidthOutPeak,
},
C.VIR_NETWORK_PORT_BANDWIDTH_OUT_BURST: typedParamsFieldInfo{
set: ¶ms.BandwidthOutBurstSet,
ui: ¶ms.BandwidthOutBurst,
},
}
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortGetParameters
func (d *NetworkPort) GetParameters(flags uint32) (*NetworkPortParameters, error) {
params := &NetworkPortParameters{}
info := getNetworkPortParametersFieldInfo(params)
var cparams C.virTypedParameterPtr
var cnparams C.int
var err C.virError
ret := C.virNetworkPortGetParametersWrapper(d.ptr, &cparams, &cnparams, C.uint(flags), &err)
if ret == -1 {
return nil, makeError(&err)
}
defer C.virTypedParamsFreeWrapper(cparams, cnparams)
_, gerr := typedParamsUnpack(cparams, cnparams, info)
if gerr != nil {
return nil, gerr
}
return params, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortSetParameters
func (d *NetworkPort) SetParameters(params *NetworkPortParameters, flags uint32) error {
info := getNetworkPortParametersFieldInfo(params)
cparams, cnparams, gerr := typedParamsPackNew(info)
if gerr != nil {
return gerr
}
defer C.virTypedParamsFreeWrapper(cparams, cnparams)
var err C.virError
ret := C.virNetworkPortSetParametersWrapper(d.ptr, cparams, cnparams, C.uint(flags), &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_lxc_generated_functions_dlopen.go | vendor/libvirt.org/go/libvirt/libvirt_lxc_generated_functions_dlopen.go | //go:build !libvirt_without_lxc && libvirt_dlopen
// +build !libvirt_without_lxc,libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_lxc_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virDomainLxcEnterCGroupFuncType)(virDomainPtr domain,
unsigned int flags);
int
virDomainLxcEnterCGroupWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainLxcEnterCGroupFuncType virDomainLxcEnterCGroupSymbol;
static bool once;
static bool success;
if (!libvirtLxcSymbol("virDomainLxcEnterCGroup",
(void**)&virDomainLxcEnterCGroupSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainLxcEnterCGroupSymbol(domain,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainLxcEnterNamespaceFuncType)(virDomainPtr domain,
unsigned int nfdlist,
int * fdlist,
unsigned int * noldfdlist,
int ** oldfdlist,
unsigned int flags);
int
virDomainLxcEnterNamespaceWrapper(virDomainPtr domain,
unsigned int nfdlist,
int * fdlist,
unsigned int * noldfdlist,
int ** oldfdlist,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainLxcEnterNamespaceFuncType virDomainLxcEnterNamespaceSymbol;
static bool once;
static bool success;
if (!libvirtLxcSymbol("virDomainLxcEnterNamespace",
(void**)&virDomainLxcEnterNamespaceSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainLxcEnterNamespaceSymbol(domain,
nfdlist,
fdlist,
noldfdlist,
oldfdlist,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainLxcEnterSecurityLabelFuncType)(virSecurityModelPtr model,
virSecurityLabelPtr label,
virSecurityLabelPtr oldlabel,
unsigned int flags);
int
virDomainLxcEnterSecurityLabelWrapper(virSecurityModelPtr model,
virSecurityLabelPtr label,
virSecurityLabelPtr oldlabel,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainLxcEnterSecurityLabelFuncType virDomainLxcEnterSecurityLabelSymbol;
static bool once;
static bool success;
if (!libvirtLxcSymbol("virDomainLxcEnterSecurityLabel",
(void**)&virDomainLxcEnterSecurityLabelSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainLxcEnterSecurityLabelSymbol(model,
label,
oldlabel,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainLxcOpenNamespaceFuncType)(virDomainPtr domain,
int ** fdlist,
unsigned int flags);
int
virDomainLxcOpenNamespaceWrapper(virDomainPtr domain,
int ** fdlist,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainLxcOpenNamespaceFuncType virDomainLxcOpenNamespaceSymbol;
static bool once;
static bool success;
if (!libvirtLxcSymbol("virDomainLxcOpenNamespace",
(void**)&virDomainLxcOpenNamespaceSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainLxcOpenNamespaceSymbol(domain,
fdlist,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/callbacks_helper.go | vendor/libvirt.org/go/libvirt/callbacks_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "callbacks_helper.h"
extern void freeCallbackId(long);
void freeGoCallbackHelper(void *goCallbackId) {
freeCallbackId((long)goCallbackId);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_host.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_host.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef char *
(*virConnectBaselineCPUFuncType)(virConnectPtr conn,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags);
char *
virConnectBaselineCPUWrapper(virConnectPtr conn,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectBaselineCPUFuncType virConnectBaselineCPUSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectBaselineCPU",
(void**)&virConnectBaselineCPUSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectBaselineCPUSymbol(conn,
xmlCPUs,
ncpus,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectBaselineHypervisorCPUFuncType)(virConnectPtr conn,
const char * emulator,
const char * arch,
const char * machine,
const char * virttype,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags);
char *
virConnectBaselineHypervisorCPUWrapper(virConnectPtr conn,
const char * emulator,
const char * arch,
const char * machine,
const char * virttype,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectBaselineHypervisorCPUFuncType virConnectBaselineHypervisorCPUSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectBaselineHypervisorCPU",
(void**)&virConnectBaselineHypervisorCPUSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectBaselineHypervisorCPUSymbol(conn,
emulator,
arch,
machine,
virttype,
xmlCPUs,
ncpus,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectCloseFuncType)(virConnectPtr conn);
int
virConnectCloseWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectCloseFuncType virConnectCloseSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectClose",
(void**)&virConnectCloseSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectCloseSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectCompareCPUFuncType)(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags);
int
virConnectCompareCPUWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectCompareCPUFuncType virConnectCompareCPUSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectCompareCPU",
(void**)&virConnectCompareCPUSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectCompareCPUSymbol(conn,
xmlDesc,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectCompareHypervisorCPUFuncType)(virConnectPtr conn,
const char * emulator,
const char * arch,
const char * machine,
const char * virttype,
const char * xmlCPU,
unsigned int flags);
int
virConnectCompareHypervisorCPUWrapper(virConnectPtr conn,
const char * emulator,
const char * arch,
const char * machine,
const char * virttype,
const char * xmlCPU,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectCompareHypervisorCPUFuncType virConnectCompareHypervisorCPUSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectCompareHypervisorCPU",
(void**)&virConnectCompareHypervisorCPUSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectCompareHypervisorCPUSymbol(conn,
emulator,
arch,
machine,
virttype,
xmlCPU,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectGetCPUModelNamesFuncType)(virConnectPtr conn,
const char * arch,
char *** models,
unsigned int flags);
int
virConnectGetCPUModelNamesWrapper(virConnectPtr conn,
const char * arch,
char *** models,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectGetCPUModelNamesFuncType virConnectGetCPUModelNamesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetCPUModelNames",
(void**)&virConnectGetCPUModelNamesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetCPUModelNamesSymbol(conn,
arch,
models,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectGetCapabilitiesFuncType)(virConnectPtr conn);
char *
virConnectGetCapabilitiesWrapper(virConnectPtr conn,
virErrorPtr err)
{
char * ret = NULL;
static virConnectGetCapabilitiesFuncType virConnectGetCapabilitiesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetCapabilities",
(void**)&virConnectGetCapabilitiesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetCapabilitiesSymbol(conn);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectGetHostnameFuncType)(virConnectPtr conn);
char *
virConnectGetHostnameWrapper(virConnectPtr conn,
virErrorPtr err)
{
char * ret = NULL;
static virConnectGetHostnameFuncType virConnectGetHostnameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetHostname",
(void**)&virConnectGetHostnameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetHostnameSymbol(conn);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectGetLibVersionFuncType)(virConnectPtr conn,
unsigned long * libVer);
int
virConnectGetLibVersionWrapper(virConnectPtr conn,
unsigned long * libVer,
virErrorPtr err)
{
int ret = -1;
static virConnectGetLibVersionFuncType virConnectGetLibVersionSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetLibVersion",
(void**)&virConnectGetLibVersionSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetLibVersionSymbol(conn,
libVer);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectGetMaxVcpusFuncType)(virConnectPtr conn,
const char * type);
int
virConnectGetMaxVcpusWrapper(virConnectPtr conn,
const char * type,
virErrorPtr err)
{
int ret = -1;
static virConnectGetMaxVcpusFuncType virConnectGetMaxVcpusSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetMaxVcpus",
(void**)&virConnectGetMaxVcpusSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetMaxVcpusSymbol(conn,
type);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectGetSysinfoFuncType)(virConnectPtr conn,
unsigned int flags);
char *
virConnectGetSysinfoWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectGetSysinfoFuncType virConnectGetSysinfoSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetSysinfo",
(void**)&virConnectGetSysinfoSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetSysinfoSymbol(conn,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virConnectGetTypeFuncType)(virConnectPtr conn);
const char *
virConnectGetTypeWrapper(virConnectPtr conn,
virErrorPtr err)
{
const char * ret = NULL;
static virConnectGetTypeFuncType virConnectGetTypeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetType",
(void**)&virConnectGetTypeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetTypeSymbol(conn);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectGetURIFuncType)(virConnectPtr conn);
char *
virConnectGetURIWrapper(virConnectPtr conn,
virErrorPtr err)
{
char * ret = NULL;
static virConnectGetURIFuncType virConnectGetURISymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetURI",
(void**)&virConnectGetURISymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetURISymbol(conn);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectGetVersionFuncType)(virConnectPtr conn,
unsigned long * hvVer);
int
virConnectGetVersionWrapper(virConnectPtr conn,
unsigned long * hvVer,
virErrorPtr err)
{
int ret = -1;
static virConnectGetVersionFuncType virConnectGetVersionSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetVersion",
(void**)&virConnectGetVersionSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetVersionSymbol(conn,
hvVer);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectIsAliveFuncType)(virConnectPtr conn);
int
virConnectIsAliveWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectIsAliveFuncType virConnectIsAliveSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectIsAlive",
(void**)&virConnectIsAliveSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectIsAliveSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectIsEncryptedFuncType)(virConnectPtr conn);
int
virConnectIsEncryptedWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectIsEncryptedFuncType virConnectIsEncryptedSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectIsEncrypted",
(void**)&virConnectIsEncryptedSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectIsEncryptedSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectIsSecureFuncType)(virConnectPtr conn);
int
virConnectIsSecureWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectIsSecureFuncType virConnectIsSecureSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectIsSecure",
(void**)&virConnectIsSecureSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectIsSecureSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virConnectOpenFuncType)(const char * name);
virConnectPtr
virConnectOpenWrapper(const char * name,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virConnectOpenFuncType virConnectOpenSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectOpen",
(void**)&virConnectOpenSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectOpenSymbol(name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virConnectOpenAuthFuncType)(const char * name,
virConnectAuthPtr auth,
unsigned int flags);
virConnectPtr
virConnectOpenAuthWrapper(const char * name,
virConnectAuthPtr auth,
unsigned int flags,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virConnectOpenAuthFuncType virConnectOpenAuthSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectOpenAuth",
(void**)&virConnectOpenAuthSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectOpenAuthSymbol(name,
auth,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virConnectOpenReadOnlyFuncType)(const char * name);
virConnectPtr
virConnectOpenReadOnlyWrapper(const char * name,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virConnectOpenReadOnlyFuncType virConnectOpenReadOnlySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectOpenReadOnly",
(void**)&virConnectOpenReadOnlySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectOpenReadOnlySymbol(name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectRefFuncType)(virConnectPtr conn);
int
virConnectRefWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectRefFuncType virConnectRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectRef",
(void**)&virConnectRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectRefSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectRegisterCloseCallbackFuncType)(virConnectPtr conn,
virConnectCloseFunc cb,
void * opaque,
virFreeCallback freecb);
int
virConnectRegisterCloseCallbackWrapper(virConnectPtr conn,
virConnectCloseFunc cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectRegisterCloseCallbackFuncType virConnectRegisterCloseCallbackSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectRegisterCloseCallback",
(void**)&virConnectRegisterCloseCallbackSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectRegisterCloseCallbackSymbol(conn,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectSetIdentityFuncType)(virConnectPtr conn,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
int
virConnectSetIdentityWrapper(virConnectPtr conn,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectSetIdentityFuncType virConnectSetIdentitySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectSetIdentity",
(void**)&virConnectSetIdentitySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectSetIdentitySymbol(conn,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectSetKeepAliveFuncType)(virConnectPtr conn,
int interval,
unsigned int count);
int
virConnectSetKeepAliveWrapper(virConnectPtr conn,
int interval,
unsigned int count,
virErrorPtr err)
{
int ret = -1;
static virConnectSetKeepAliveFuncType virConnectSetKeepAliveSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectSetKeepAlive",
(void**)&virConnectSetKeepAliveSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectSetKeepAliveSymbol(conn,
interval,
count);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectUnregisterCloseCallbackFuncType)(virConnectPtr conn,
virConnectCloseFunc cb);
int
virConnectUnregisterCloseCallbackWrapper(virConnectPtr conn,
virConnectCloseFunc cb,
virErrorPtr err)
{
int ret = -1;
static virConnectUnregisterCloseCallbackFuncType virConnectUnregisterCloseCallbackSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectUnregisterCloseCallback",
(void**)&virConnectUnregisterCloseCallbackSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectUnregisterCloseCallbackSymbol(conn,
cb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virGetVersionFuncType)(unsigned long * libVer,
const char * type,
unsigned long * typeVer);
int
virGetVersionWrapper(unsigned long * libVer,
const char * type,
unsigned long * typeVer,
virErrorPtr err)
{
int ret = -1;
static virGetVersionFuncType virGetVersionSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virGetVersion",
(void**)&virGetVersionSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virGetVersionSymbol(libVer,
type,
typeVer);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInitializeFuncType)(void);
int
virInitializeWrapper(virErrorPtr err)
{
int ret = -1;
static virInitializeFuncType virInitializeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInitialize",
(void**)&virInitializeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInitializeSymbol();
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeAllocPagesFuncType)(virConnectPtr conn,
unsigned int npages,
unsigned int * pageSizes,
unsigned long long * pageCounts,
int startCell,
unsigned int cellCount,
unsigned int flags);
int
virNodeAllocPagesWrapper(virConnectPtr conn,
unsigned int npages,
unsigned int * pageSizes,
unsigned long long * pageCounts,
int startCell,
unsigned int cellCount,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeAllocPagesFuncType virNodeAllocPagesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeAllocPages",
(void**)&virNodeAllocPagesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeAllocPagesSymbol(conn,
npages,
pageSizes,
pageCounts,
startCell,
cellCount,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeGetCPUMapFuncType)(virConnectPtr conn,
unsigned char ** cpumap,
unsigned int * online,
unsigned int flags);
int
virNodeGetCPUMapWrapper(virConnectPtr conn,
unsigned char ** cpumap,
unsigned int * online,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeGetCPUMapFuncType virNodeGetCPUMapSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeGetCPUMap",
(void**)&virNodeGetCPUMapSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeGetCPUMapSymbol(conn,
cpumap,
online,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeGetCPUStatsFuncType)(virConnectPtr conn,
int cpuNum,
virNodeCPUStatsPtr params,
int * nparams,
unsigned int flags);
int
virNodeGetCPUStatsWrapper(virConnectPtr conn,
int cpuNum,
virNodeCPUStatsPtr params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeGetCPUStatsFuncType virNodeGetCPUStatsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeGetCPUStats",
(void**)&virNodeGetCPUStatsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeGetCPUStatsSymbol(conn,
cpuNum,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeGetCellsFreeMemoryFuncType)(virConnectPtr conn,
unsigned long long * freeMems,
int startCell,
int maxCells);
int
virNodeGetCellsFreeMemoryWrapper(virConnectPtr conn,
unsigned long long * freeMems,
int startCell,
int maxCells,
virErrorPtr err)
{
int ret = -1;
static virNodeGetCellsFreeMemoryFuncType virNodeGetCellsFreeMemorySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeGetCellsFreeMemory",
(void**)&virNodeGetCellsFreeMemorySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeGetCellsFreeMemorySymbol(conn,
freeMems,
startCell,
maxCells);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef unsigned long long
(*virNodeGetFreeMemoryFuncType)(virConnectPtr conn);
unsigned long long
virNodeGetFreeMemoryWrapper(virConnectPtr conn,
virErrorPtr err)
{
unsigned long long ret = 0;
static virNodeGetFreeMemoryFuncType virNodeGetFreeMemorySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeGetFreeMemory",
(void**)&virNodeGetFreeMemorySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeGetFreeMemorySymbol(conn);
if (ret == 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeGetFreePagesFuncType)(virConnectPtr conn,
unsigned int npages,
unsigned int * pages,
int startCell,
unsigned int cellCount,
unsigned long long * counts,
unsigned int flags);
int
virNodeGetFreePagesWrapper(virConnectPtr conn,
unsigned int npages,
unsigned int * pages,
int startCell,
unsigned int cellCount,
unsigned long long * counts,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeGetFreePagesFuncType virNodeGetFreePagesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeGetFreePages",
(void**)&virNodeGetFreePagesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeGetFreePagesSymbol(conn,
npages,
pages,
startCell,
cellCount,
counts,
flags);
if (ret < 0) {
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/network_events.go | vendor/libvirt.org/go/libvirt/network_events.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
import (
"fmt"
"unsafe"
)
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "network_events_helper.h"
*/
import "C"
type NetworkEventLifecycle struct {
Event NetworkEventLifecycleType
// TODO: we can make Detail typesafe somehow ?
Detail int
}
type NetworkEventLifecycleCallback func(c *Connect, n *Network, event *NetworkEventLifecycle)
type NetworkEventMetadataChange struct {
Type NetworkMetadataType
NSURI string
}
type NetworkEventMetadataChangeCallback func(c *Connect, n *Network, event *NetworkEventMetadataChange)
//export networkEventLifecycleCallback
func networkEventLifecycleCallback(c C.virConnectPtr, n C.virNetworkPtr,
event int, detail int,
goCallbackId int) {
network := &Network{ptr: n}
connection := &Connect{ptr: c}
eventDetails := &NetworkEventLifecycle{
Event: NetworkEventLifecycleType(event),
Detail: detail,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(NetworkEventLifecycleCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, network, eventDetails)
}
//export networkEventMetadataChangeCallback
func networkEventMetadataChangeCallback(c C.virConnectPtr, d C.virNetworkPtr,
mtype int, nsuri *C.char, goCallbackId int) {
network := &Network{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &NetworkEventMetadataChange{
Type: NetworkMetadataType(mtype),
NSURI: C.GoString(nsuri),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(NetworkEventMetadataChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, network, eventDetails)
}
func (c *Connect) NetworkEventLifecycleRegister(net *Network, callback NetworkEventLifecycleCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.networkEventLifecycleCallbackHelper)
var cnet C.virNetworkPtr
if net != nil {
cnet = net.ptr
}
var err C.virError
ret := C.virConnectNetworkEventRegisterAnyHelper(c.ptr, cnet,
C.VIR_NETWORK_EVENT_ID_LIFECYCLE,
C.virConnectNetworkEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) NetworkEventMetadataChangeRegister(net *Network, callback NetworkEventMetadataChangeCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.networkEventMetadataChangeCallbackHelper)
var cnet C.virNetworkPtr
if net != nil {
cnet = net.ptr
}
var err C.virError
ret := C.virConnectNetworkEventRegisterAnyHelper(c.ptr, cnet,
C.VIR_NETWORK_EVENT_ID_METADATA_CHANGE,
C.virConnectNetworkEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) NetworkEventDeregister(callbackId int) error {
// Deregister the callback
var err C.virError
ret := int(C.virConnectNetworkEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
if ret < 0 {
return makeError(&err)
}
return nil
}
func (e NetworkEventLifecycle) String() string {
var event string
switch e.Event {
case NETWORK_EVENT_DEFINED:
event = "defined"
case NETWORK_EVENT_UNDEFINED:
event = "undefined"
case NETWORK_EVENT_STARTED:
event = "started"
case NETWORK_EVENT_STOPPED:
event = "stopped"
default:
event = "unknown"
}
return fmt.Sprintf("Network event=%q", event)
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_virterror.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_virterror.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnCopyLastErrorWrapper(virConnectPtr conn,
virErrorPtr to,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(err, "Function virConnCopyLastError not available prior to libvirt version 0.1.0");
#else
ret = virConnCopyLastError(conn,
to);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virErrorPtr
virConnGetLastErrorWrapper(virConnectPtr conn,
virErrorPtr err)
{
virErrorPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(err, "Function virConnGetLastError not available prior to libvirt version 0.1.0");
#else
ret = virConnGetLastError(conn);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
void
virConnResetLastErrorWrapper(virConnectPtr conn)
{
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(NULL, "Function virConnResetLastError not available prior to libvirt version 0.1.0");
#else
virConnResetLastError(conn);
#endif
return;
}
void
virConnSetErrorFuncWrapper(virConnectPtr conn,
void * userData,
virErrorFunc handler)
{
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(NULL, "Function virConnSetErrorFunc not available prior to libvirt version 0.1.0");
#else
virConnSetErrorFunc(conn,
userData,
handler);
#endif
return;
}
void
virDefaultErrorFuncWrapper(virErrorPtr err)
{
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(NULL, "Function virDefaultErrorFunc not available prior to libvirt version 0.1.0");
#else
virDefaultErrorFunc(err);
#endif
return;
}
void
virFreeErrorWrapper(virErrorPtr err)
{
#if !LIBVIR_CHECK_VERSION(0, 6, 1)
setVirError(NULL, "Function virFreeError not available prior to libvirt version 0.6.1");
#else
virFreeError(err);
#endif
return;
}
virErrorPtr
virGetLastErrorWrapper(virErrorPtr err)
{
virErrorPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(err, "Function virGetLastError not available prior to libvirt version 0.1.0");
#else
ret = virGetLastError();
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virGetLastErrorCodeWrapper(virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virGetLastErrorCode not available prior to libvirt version 4.5.0");
#else
ret = virGetLastErrorCode();
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virGetLastErrorDomainWrapper(virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virGetLastErrorDomain not available prior to libvirt version 4.5.0");
#else
ret = virGetLastErrorDomain();
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virGetLastErrorMessageWrapper(virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(1, 0, 6)
setVirError(err, "Function virGetLastErrorMessage not available prior to libvirt version 1.0.6");
#else
ret = virGetLastErrorMessage();
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
void
virResetErrorWrapper(virErrorPtr err)
{
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(NULL, "Function virResetError not available prior to libvirt version 0.1.0");
#else
virResetError(err);
#endif
return;
}
void
virResetLastErrorWrapper(void)
{
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(NULL, "Function virResetLastError not available prior to libvirt version 0.1.0");
#else
virResetLastError();
#endif
return;
}
virErrorPtr
virSaveLastErrorWrapper(virErrorPtr err)
{
virErrorPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 1)
setVirError(err, "Function virSaveLastError not available prior to libvirt version 0.6.1");
#else
ret = virSaveLastError();
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
void
virSetErrorFuncWrapper(void * userData,
virErrorFunc handler)
{
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(NULL, "Function virSetErrorFunc not available prior to libvirt version 0.1.0");
#else
virSetErrorFunc(userData,
handler);
#endif
return;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_interface.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_interface.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnectListAllInterfacesWrapper(virConnectPtr conn,
virInterfacePtr ** ifaces,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virConnectListAllInterfaces not available prior to libvirt version 0.10.2");
#else
ret = virConnectListAllInterfaces(conn,
ifaces,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListDefinedInterfacesWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 0)
setVirError(err, "Function virConnectListDefinedInterfaces not available prior to libvirt version 0.7.0");
#else
ret = virConnectListDefinedInterfaces(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListInterfacesWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virConnectListInterfaces not available prior to libvirt version 0.6.4");
#else
ret = virConnectListInterfaces(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfDefinedInterfacesWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 0)
setVirError(err, "Function virConnectNumOfDefinedInterfaces not available prior to libvirt version 0.7.0");
#else
ret = virConnectNumOfDefinedInterfaces(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfInterfacesWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virConnectNumOfInterfaces not available prior to libvirt version 0.6.4");
#else
ret = virConnectNumOfInterfaces(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceChangeBeginWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 2)
setVirError(err, "Function virInterfaceChangeBegin not available prior to libvirt version 0.9.2");
#else
ret = virInterfaceChangeBegin(conn,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceChangeCommitWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 2)
setVirError(err, "Function virInterfaceChangeCommit not available prior to libvirt version 0.9.2");
#else
ret = virInterfaceChangeCommit(conn,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceChangeRollbackWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 2)
setVirError(err, "Function virInterfaceChangeRollback not available prior to libvirt version 0.9.2");
#else
ret = virInterfaceChangeRollback(conn,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceCreateWrapper(virInterfacePtr iface,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceCreate not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceCreate(iface,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virInterfacePtr
virInterfaceDefineXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virInterfacePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceDefineXML not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceDefineXML(conn,
xml,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceDestroyWrapper(virInterfacePtr iface,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceDestroy not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceDestroy(iface,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceFreeWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceFree not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceFree(iface);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virInterfaceGetConnectWrapper(virInterfacePtr iface,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceGetConnect not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceGetConnect(iface);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virInterfaceGetMACStringWrapper(virInterfacePtr iface,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceGetMACString not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceGetMACString(iface);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virInterfaceGetNameWrapper(virInterfacePtr iface,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceGetName not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceGetName(iface);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virInterfaceGetXMLDescWrapper(virInterfacePtr iface,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceGetXMLDesc not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceGetXMLDesc(iface,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceIsActiveWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 3)
setVirError(err, "Function virInterfaceIsActive not available prior to libvirt version 0.7.3");
#else
ret = virInterfaceIsActive(iface);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virInterfacePtr
virInterfaceLookupByMACStringWrapper(virConnectPtr conn,
const char * macstr,
virErrorPtr err)
{
virInterfacePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceLookupByMACString not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceLookupByMACString(conn,
macstr);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virInterfacePtr
virInterfaceLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virInterfacePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceLookupByName not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceLookupByName(conn,
name);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceRefWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceRef not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceRef(iface);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInterfaceUndefineWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virInterfaceUndefine not available prior to libvirt version 0.6.4");
#else
ret = virInterfaceUndefine(iface);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_nwfilter.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_nwfilter.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnectListAllNWFilterBindingsWrapper(virConnectPtr conn,
virNWFilterBindingPtr ** bindings,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virConnectListAllNWFilterBindings not available prior to libvirt version 4.5.0");
#else
ret = virConnectListAllNWFilterBindings(conn,
bindings,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListAllNWFiltersWrapper(virConnectPtr conn,
virNWFilterPtr ** filters,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virConnectListAllNWFilters not available prior to libvirt version 0.10.2");
#else
ret = virConnectListAllNWFilters(conn,
filters,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListNWFiltersWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virConnectListNWFilters not available prior to libvirt version 0.8.0");
#else
ret = virConnectListNWFilters(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfNWFiltersWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virConnectNumOfNWFilters not available prior to libvirt version 0.8.0");
#else
ret = virConnectNumOfNWFilters(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterBindingPtr
virNWFilterBindingCreateXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virNWFilterBindingPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingCreateXML not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingCreateXML(conn,
xml,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterBindingDeleteWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingDelete not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingDelete(binding);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterBindingFreeWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingFree not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingFree(binding);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virNWFilterBindingGetFilterNameWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingGetFilterName not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingGetFilterName(binding);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virNWFilterBindingGetPortDevWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingGetPortDev not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingGetPortDev(binding);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNWFilterBindingGetXMLDescWrapper(virNWFilterBindingPtr binding,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingGetXMLDesc not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingGetXMLDesc(binding,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterBindingPtr
virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
const char * portdev,
virErrorPtr err)
{
virNWFilterBindingPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingLookupByPortDev not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingLookupByPortDev(conn,
portdev);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterBindingRefWrapper(virNWFilterBindingPtr binding,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNWFilterBindingRef not available prior to libvirt version 4.5.0");
#else
ret = virNWFilterBindingRef(binding);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterPtr
virNWFilterDefineXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterDefineXML not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterDefineXML(conn,
xmlDesc);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterPtr
virNWFilterDefineXMLFlagsWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(7, 7, 0)
setVirError(err, "Function virNWFilterDefineXMLFlags not available prior to libvirt version 7.7.0");
#else
ret = virNWFilterDefineXMLFlags(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterFreeWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterFree not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterFree(nwfilter);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virNWFilterGetNameWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterGetName not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterGetName(nwfilter);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterGetUUIDWrapper(virNWFilterPtr nwfilter,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterGetUUID not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterGetUUID(nwfilter,
uuid);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterGetUUIDStringWrapper(virNWFilterPtr nwfilter,
char * buf,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterGetUUIDString not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterGetUUIDString(nwfilter,
buf);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNWFilterGetXMLDescWrapper(virNWFilterPtr nwfilter,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterGetXMLDesc not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterGetXMLDesc(nwfilter,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterPtr
virNWFilterLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterLookupByName not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterLookupByName(conn,
name);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterPtr
virNWFilterLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterLookupByUUID not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterLookupByUUID(conn,
uuid);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNWFilterPtr
virNWFilterLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virNWFilterPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterLookupByUUIDString not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterLookupByUUIDString(conn,
uuidstr);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterRefWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterRef not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterRef(nwfilter);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNWFilterUndefineWrapper(virNWFilterPtr nwfilter,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virNWFilterUndefine not available prior to libvirt version 0.8.0");
#else
ret = virNWFilterUndefine(nwfilter);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_common.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_common.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virTypedParamsAddBooleanFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int value);
int
virTypedParamsAddBooleanWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddBooleanFuncType virTypedParamsAddBooleanSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddBoolean",
(void**)&virTypedParamsAddBooleanSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddBooleanSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddDoubleFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
double value);
int
virTypedParamsAddDoubleWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
double value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddDoubleFuncType virTypedParamsAddDoubleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddDouble",
(void**)&virTypedParamsAddDoubleSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddDoubleSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddFromStringFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int type,
const char * value);
int
virTypedParamsAddFromStringWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int type,
const char * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddFromStringFuncType virTypedParamsAddFromStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddFromString",
(void**)&virTypedParamsAddFromStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddFromStringSymbol(params,
nparams,
maxparams,
name,
type,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddIntFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int value);
int
virTypedParamsAddIntWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
int value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddIntFuncType virTypedParamsAddIntSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddInt",
(void**)&virTypedParamsAddIntSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddIntSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddLLongFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
long long value);
int
virTypedParamsAddLLongWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
long long value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddLLongFuncType virTypedParamsAddLLongSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddLLong",
(void**)&virTypedParamsAddLLongSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddLLongSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddStringFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
const char * value);
int
virTypedParamsAddStringWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
const char * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddStringFuncType virTypedParamsAddStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddString",
(void**)&virTypedParamsAddStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddStringSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddStringListFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
const char ** values);
int
virTypedParamsAddStringListWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
const char ** values,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddStringListFuncType virTypedParamsAddStringListSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddStringList",
(void**)&virTypedParamsAddStringListSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddStringListSymbol(params,
nparams,
maxparams,
name,
values);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddUIntFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
unsigned int value);
int
virTypedParamsAddUIntWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
unsigned int value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddUIntFuncType virTypedParamsAddUIntSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddUInt",
(void**)&virTypedParamsAddUIntSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddUIntSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsAddULLongFuncType)(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
unsigned long long value);
int
virTypedParamsAddULLongWrapper(virTypedParameterPtr * params,
int * nparams,
int * maxparams,
const char * name,
unsigned long long value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsAddULLongFuncType virTypedParamsAddULLongSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsAddULLong",
(void**)&virTypedParamsAddULLongSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsAddULLongSymbol(params,
nparams,
maxparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virTypedParamsClearFuncType)(virTypedParameterPtr params,
int nparams);
void
virTypedParamsClearWrapper(virTypedParameterPtr params,
int nparams)
{
static virTypedParamsClearFuncType virTypedParamsClearSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsClear",
(void**)&virTypedParamsClearSymbol,
&once,
&success,
NULL)) {
return;
}
virTypedParamsClearSymbol(params,
nparams);
}
typedef void
(*virTypedParamsFreeFuncType)(virTypedParameterPtr params,
int nparams);
void
virTypedParamsFreeWrapper(virTypedParameterPtr params,
int nparams)
{
static virTypedParamsFreeFuncType virTypedParamsFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsFree",
(void**)&virTypedParamsFreeSymbol,
&once,
&success,
NULL)) {
return;
}
virTypedParamsFreeSymbol(params,
nparams);
}
typedef virTypedParameterPtr
(*virTypedParamsGetFuncType)(virTypedParameterPtr params,
int nparams,
const char * name);
virTypedParameterPtr
virTypedParamsGetWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
virErrorPtr err)
{
virTypedParameterPtr ret = NULL;
static virTypedParamsGetFuncType virTypedParamsGetSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGet",
(void**)&virTypedParamsGetSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetSymbol(params,
nparams,
name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetBooleanFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
int * value);
int
virTypedParamsGetBooleanWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
int * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetBooleanFuncType virTypedParamsGetBooleanSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetBoolean",
(void**)&virTypedParamsGetBooleanSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetBooleanSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetDoubleFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
double * value);
int
virTypedParamsGetDoubleWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
double * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetDoubleFuncType virTypedParamsGetDoubleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetDouble",
(void**)&virTypedParamsGetDoubleSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetDoubleSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetIntFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
int * value);
int
virTypedParamsGetIntWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
int * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetIntFuncType virTypedParamsGetIntSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetInt",
(void**)&virTypedParamsGetIntSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetIntSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetLLongFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
long long * value);
int
virTypedParamsGetLLongWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
long long * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetLLongFuncType virTypedParamsGetLLongSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetLLong",
(void**)&virTypedParamsGetLLongSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetLLongSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetStringFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
const char ** value);
int
virTypedParamsGetStringWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
const char ** value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetStringFuncType virTypedParamsGetStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetString",
(void**)&virTypedParamsGetStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetStringSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetUIntFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
unsigned int * value);
int
virTypedParamsGetUIntWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
unsigned int * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetUIntFuncType virTypedParamsGetUIntSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetUInt",
(void**)&virTypedParamsGetUIntSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetUIntSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virTypedParamsGetULLongFuncType)(virTypedParameterPtr params,
int nparams,
const char * name,
unsigned long long * value);
int
virTypedParamsGetULLongWrapper(virTypedParameterPtr params,
int nparams,
const char * name,
unsigned long long * value,
virErrorPtr err)
{
int ret = -1;
static virTypedParamsGetULLongFuncType virTypedParamsGetULLongSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virTypedParamsGetULLong",
(void**)&virTypedParamsGetULLongSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virTypedParamsGetULLongSymbol(params,
nparams,
name,
value);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/interface.go | vendor/libvirt.org/go/libvirt/interface.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"unsafe"
)
type InterfaceXMLFlags uint
const (
INTERFACE_XML_INACTIVE = InterfaceXMLFlags(C.VIR_INTERFACE_XML_INACTIVE)
)
type InterfaceDefineFlags uint
const (
INTERFACE_DEFINE_VALIDATE = InterfaceDefineFlags(C.VIR_INTERFACE_DEFINE_VALIDATE)
)
type Interface struct {
ptr C.virInterfacePtr
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceCreate
func (n *Interface) Create(flags uint32) error {
var err C.virError
result := C.virInterfaceCreateWrapper(n.ptr, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy
func (n *Interface) Destroy(flags uint32) error {
var err C.virError
result := C.virInterfaceDestroyWrapper(n.ptr, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceIsActive
func (n *Interface) IsActive() (bool, error) {
var err C.virError
result := C.virInterfaceIsActiveWrapper(n.ptr, &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetMACString
func (n *Interface) GetMACString() (string, error) {
var err C.virError
result := C.virInterfaceGetMACStringWrapper(n.ptr, &err)
if result == nil {
return "", makeError(&err)
}
mac := C.GoString(result)
return mac, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetName
func (n *Interface) GetName() (string, error) {
var err C.virError
result := C.virInterfaceGetNameWrapper(n.ptr, &err)
if result == nil {
return "", makeError(&err)
}
name := C.GoString(result)
return name, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetXMLDesc
func (n *Interface) GetXMLDesc(flags InterfaceXMLFlags) (string, error) {
var err C.virError
result := C.virInterfaceGetXMLDescWrapper(n.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndefine
func (n *Interface) Undefine() error {
var err C.virError
result := C.virInterfaceUndefineWrapper(n.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceFree
func (n *Interface) Free() error {
var err C.virError
ret := C.virInterfaceFreeWrapper(n.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceRef
func (c *Interface) Ref() error {
var err C.virError
ret := C.virInterfaceRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/secret_events.go | vendor/libvirt.org/go/libvirt/secret_events.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
import (
"fmt"
"unsafe"
)
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "secret_events_helper.h"
*/
import "C"
type SecretEventLifecycle struct {
Event SecretEventLifecycleType
// TODO: we can make Detail typesafe somehow ?
Detail int
}
type SecretEventLifecycleCallback func(c *Connect, n *Secret, event *SecretEventLifecycle)
type SecretEventGenericCallback func(c *Connect, n *Secret)
//export secretEventLifecycleCallback
func secretEventLifecycleCallback(c C.virConnectPtr, n C.virSecretPtr,
event int, detail int,
goCallbackId int) {
secret := &Secret{ptr: n}
connection := &Connect{ptr: c}
eventDetails := &SecretEventLifecycle{
Event: SecretEventLifecycleType(event),
Detail: detail,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(SecretEventLifecycleCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, secret, eventDetails)
}
//export secretEventGenericCallback
func secretEventGenericCallback(c C.virConnectPtr, n C.virSecretPtr,
goCallbackId int) {
secret := &Secret{ptr: n}
connection := &Connect{ptr: c}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(SecretEventGenericCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, secret)
}
func (c *Connect) SecretEventLifecycleRegister(secret *Secret, callback SecretEventLifecycleCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.secretEventLifecycleCallbackHelper)
var csecret C.virSecretPtr
if secret != nil {
csecret = secret.ptr
}
var err C.virError
ret := C.virConnectSecretEventRegisterAnyHelper(c.ptr, csecret,
C.VIR_SECRET_EVENT_ID_LIFECYCLE,
C.virConnectSecretEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) SecretEventValueChangedRegister(secret *Secret, callback SecretEventGenericCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.secretEventGenericCallbackHelper)
var csecret C.virSecretPtr
if secret != nil {
csecret = secret.ptr
}
var err C.virError
ret := C.virConnectSecretEventRegisterAnyHelper(c.ptr, csecret,
C.VIR_SECRET_EVENT_ID_VALUE_CHANGED,
C.virConnectSecretEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) SecretEventDeregister(callbackId int) error {
// Deregister the callback
var err C.virError
ret := int(C.virConnectSecretEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
if ret < 0 {
return makeError(&err)
}
return nil
}
func (e SecretEventLifecycle) String() string {
var event string
switch e.Event {
case SECRET_EVENT_DEFINED:
event = "defined"
case SECRET_EVENT_UNDEFINED:
event = "undefined"
default:
event = "unknown"
}
return fmt.Sprintf("Secret event=%q", event)
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/lxc.go | vendor/libvirt.org/go/libvirt/lxc.go | //go:build !libvirt_without_lxc
// +build !libvirt_without_lxc
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
// Can't rely on pkg-config for libvirt-lxc since it was not
// installed until 2.6.0 onwards
#cgo !libvirt_dlopen LDFLAGS: -lvirt-lxc
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include <string.h>
#include "libvirt_lxc_generated.h"
*/
import "C"
import (
"os"
"unsafe"
)
func (d *Domain) LxcOpenNamespace(flags uint32) ([]os.File, error) {
var cfdlist *C.int
var err C.virError
ret := C.virDomainLxcOpenNamespaceWrapper(d.ptr, &cfdlist, C.uint(flags), &err)
if ret == -1 {
return []os.File{}, makeError(&err)
}
fdlist := make([]os.File, ret)
for i := 0; i < int(ret); i++ {
var cfd C.int
cfd = *(*C.int)(unsafe.Pointer(uintptr(unsafe.Pointer(cfdlist)) + (unsafe.Sizeof(cfd) * uintptr(i))))
fdlist[i] = *os.NewFile(uintptr(cfd), "namespace")
}
defer C.free(unsafe.Pointer(cfdlist))
return fdlist, nil
}
func (d *Domain) LxcEnterNamespace(fdlist []os.File, flags uint32) ([]os.File, error) {
var coldfdlist *C.int
var ncoldfdlist C.uint
nfdlist := len(fdlist)
cfdlist := make([]C.int, nfdlist)
for i := 0; i < nfdlist; i++ {
cfdlist[i] = C.int(fdlist[i].Fd())
}
var err C.virError
var cfdlistPtr *C.int = nil
if nfdlist > 0 {
cfdlistPtr = &cfdlist[0]
}
ret := C.virDomainLxcEnterNamespaceWrapper(d.ptr, C.uint(nfdlist), cfdlistPtr, &ncoldfdlist, &coldfdlist, C.uint(flags), &err)
if ret == -1 {
return []os.File{}, makeError(&err)
}
oldfdlist := make([]os.File, ncoldfdlist)
for i := 0; i < int(ncoldfdlist); i++ {
var cfd C.int
cfd = *(*C.int)(unsafe.Pointer(uintptr(unsafe.Pointer(coldfdlist)) + (unsafe.Sizeof(cfd) * uintptr(i))))
oldfdlist[i] = *os.NewFile(uintptr(cfd), "namespace")
}
defer C.free(unsafe.Pointer(coldfdlist))
return oldfdlist, nil
}
func DomainLxcEnterSecurityLabel(model *NodeSecurityModel, label *SecurityLabel, flags uint32) (*SecurityLabel, error) {
var cmodel C.virSecurityModel
var clabel C.virSecurityLabel
var coldlabel C.virSecurityLabel
cmodelstrlen := len(model.Model)
if cmodelstrlen > (C.VIR_SECURITY_MODEL_BUFLEN - 1) {
cmodelstrlen = C.VIR_SECURITY_MODEL_BUFLEN - 1
}
cmodelstr := C.CString(model.Model)
defer C.free(unsafe.Pointer(cmodelstr))
cdoistrlen := len(model.Doi)
if cdoistrlen >= (C.VIR_SECURITY_DOI_BUFLEN - 1) {
cdoistrlen = C.VIR_SECURITY_DOI_BUFLEN - 1
}
cdoistr := C.CString(model.Doi)
defer C.free(unsafe.Pointer(cdoistr))
C.memcpy(unsafe.Pointer(&cmodel.model), unsafe.Pointer(cmodelstr), C.size_t(cmodelstrlen))
C.memcpy(unsafe.Pointer(&cmodel.doi), unsafe.Pointer(cdoistr), C.size_t(cdoistrlen))
clabelstrlen := len(label.Label)
if clabelstrlen > (C.VIR_SECURITY_LABEL_BUFLEN - 1) {
clabelstrlen = C.VIR_SECURITY_LABEL_BUFLEN - 1
}
clabelstr := C.CString(label.Label)
defer C.free(unsafe.Pointer(clabelstr))
C.memcpy(unsafe.Pointer(&clabel.label), unsafe.Pointer(clabelstr), C.size_t(clabelstrlen))
if label.Enforcing {
clabel.enforcing = 1
} else {
clabel.enforcing = 0
}
var err C.virError
ret := C.virDomainLxcEnterSecurityLabelWrapper(&cmodel, &clabel, &coldlabel, C.uint(flags), &err)
if ret == -1 {
return nil, makeError(&err)
}
var oldlabel SecurityLabel
oldlabel.Label = C.GoString((*C.char)(unsafe.Pointer(&coldlabel.label)))
if coldlabel.enforcing != 0 {
oldlabel.Enforcing = true
} else {
oldlabel.Enforcing = false
}
return &oldlabel, nil
}
func (d *Domain) DomainLxcEnterCGroup(flags uint32) error {
var err C.virError
ret := C.virDomainLxcEnterCGroupWrapper(d.ptr, C.uint(flags), &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_domain_checkpoint.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_domain_checkpoint.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef virDomainCheckpointPtr
(*virDomainCheckpointCreateXMLFuncType)(virDomainPtr domain,
const char * xmlDesc,
unsigned int flags);
virDomainCheckpointPtr
virDomainCheckpointCreateXMLWrapper(virDomainPtr domain,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virDomainCheckpointPtr ret = NULL;
static virDomainCheckpointCreateXMLFuncType virDomainCheckpointCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointCreateXML",
(void**)&virDomainCheckpointCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointCreateXMLSymbol(domain,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainCheckpointDeleteFuncType)(virDomainCheckpointPtr checkpoint,
unsigned int flags);
int
virDomainCheckpointDeleteWrapper(virDomainCheckpointPtr checkpoint,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainCheckpointDeleteFuncType virDomainCheckpointDeleteSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointDelete",
(void**)&virDomainCheckpointDeleteSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointDeleteSymbol(checkpoint,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainCheckpointFreeFuncType)(virDomainCheckpointPtr checkpoint);
int
virDomainCheckpointFreeWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
int ret = -1;
static virDomainCheckpointFreeFuncType virDomainCheckpointFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointFree",
(void**)&virDomainCheckpointFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointFreeSymbol(checkpoint);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virDomainCheckpointGetConnectFuncType)(virDomainCheckpointPtr checkpoint);
virConnectPtr
virDomainCheckpointGetConnectWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virDomainCheckpointGetConnectFuncType virDomainCheckpointGetConnectSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointGetConnect",
(void**)&virDomainCheckpointGetConnectSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointGetConnectSymbol(checkpoint);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainPtr
(*virDomainCheckpointGetDomainFuncType)(virDomainCheckpointPtr checkpoint);
virDomainPtr
virDomainCheckpointGetDomainWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
virDomainPtr ret = NULL;
static virDomainCheckpointGetDomainFuncType virDomainCheckpointGetDomainSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointGetDomain",
(void**)&virDomainCheckpointGetDomainSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointGetDomainSymbol(checkpoint);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virDomainCheckpointGetNameFuncType)(virDomainCheckpointPtr checkpoint);
const char *
virDomainCheckpointGetNameWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
const char * ret = NULL;
static virDomainCheckpointGetNameFuncType virDomainCheckpointGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointGetName",
(void**)&virDomainCheckpointGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointGetNameSymbol(checkpoint);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainCheckpointPtr
(*virDomainCheckpointGetParentFuncType)(virDomainCheckpointPtr checkpoint,
unsigned int flags);
virDomainCheckpointPtr
virDomainCheckpointGetParentWrapper(virDomainCheckpointPtr checkpoint,
unsigned int flags,
virErrorPtr err)
{
virDomainCheckpointPtr ret = NULL;
static virDomainCheckpointGetParentFuncType virDomainCheckpointGetParentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointGetParent",
(void**)&virDomainCheckpointGetParentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointGetParentSymbol(checkpoint,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virDomainCheckpointGetXMLDescFuncType)(virDomainCheckpointPtr checkpoint,
unsigned int flags);
char *
virDomainCheckpointGetXMLDescWrapper(virDomainCheckpointPtr checkpoint,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virDomainCheckpointGetXMLDescFuncType virDomainCheckpointGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointGetXMLDesc",
(void**)&virDomainCheckpointGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointGetXMLDescSymbol(checkpoint,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainCheckpointListAllChildrenFuncType)(virDomainCheckpointPtr checkpoint,
virDomainCheckpointPtr ** children,
unsigned int flags);
int
virDomainCheckpointListAllChildrenWrapper(virDomainCheckpointPtr checkpoint,
virDomainCheckpointPtr ** children,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainCheckpointListAllChildrenFuncType virDomainCheckpointListAllChildrenSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointListAllChildren",
(void**)&virDomainCheckpointListAllChildrenSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointListAllChildrenSymbol(checkpoint,
children,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainCheckpointPtr
(*virDomainCheckpointLookupByNameFuncType)(virDomainPtr domain,
const char * name,
unsigned int flags);
virDomainCheckpointPtr
virDomainCheckpointLookupByNameWrapper(virDomainPtr domain,
const char * name,
unsigned int flags,
virErrorPtr err)
{
virDomainCheckpointPtr ret = NULL;
static virDomainCheckpointLookupByNameFuncType virDomainCheckpointLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointLookupByName",
(void**)&virDomainCheckpointLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointLookupByNameSymbol(domain,
name,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainCheckpointRefFuncType)(virDomainCheckpointPtr checkpoint);
int
virDomainCheckpointRefWrapper(virDomainCheckpointPtr checkpoint,
virErrorPtr err)
{
int ret = -1;
static virDomainCheckpointRefFuncType virDomainCheckpointRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainCheckpointRef",
(void**)&virDomainCheckpointRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainCheckpointRefSymbol(checkpoint);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainListAllCheckpointsFuncType)(virDomainPtr domain,
virDomainCheckpointPtr ** checkpoints,
unsigned int flags);
int
virDomainListAllCheckpointsWrapper(virDomainPtr domain,
virDomainCheckpointPtr ** checkpoints,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainListAllCheckpointsFuncType virDomainListAllCheckpointsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainListAllCheckpoints",
(void**)&virDomainListAllCheckpointsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainListAllCheckpointsSymbol(domain,
checkpoints,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_storage.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_storage.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef char *
(*virConnectFindStoragePoolSourcesFuncType)(virConnectPtr conn,
const char * type,
const char * srcSpec,
unsigned int flags);
char *
virConnectFindStoragePoolSourcesWrapper(virConnectPtr conn,
const char * type,
const char * srcSpec,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectFindStoragePoolSourcesFuncType virConnectFindStoragePoolSourcesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectFindStoragePoolSources",
(void**)&virConnectFindStoragePoolSourcesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectFindStoragePoolSourcesSymbol(conn,
type,
srcSpec,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectGetStoragePoolCapabilitiesFuncType)(virConnectPtr conn,
unsigned int flags);
char *
virConnectGetStoragePoolCapabilitiesWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectGetStoragePoolCapabilitiesFuncType virConnectGetStoragePoolCapabilitiesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetStoragePoolCapabilities",
(void**)&virConnectGetStoragePoolCapabilitiesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetStoragePoolCapabilitiesSymbol(conn,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListAllStoragePoolsFuncType)(virConnectPtr conn,
virStoragePoolPtr ** pools,
unsigned int flags);
int
virConnectListAllStoragePoolsWrapper(virConnectPtr conn,
virStoragePoolPtr ** pools,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllStoragePoolsFuncType virConnectListAllStoragePoolsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllStoragePools",
(void**)&virConnectListAllStoragePoolsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllStoragePoolsSymbol(conn,
pools,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListDefinedStoragePoolsFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListDefinedStoragePoolsWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListDefinedStoragePoolsFuncType virConnectListDefinedStoragePoolsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListDefinedStoragePools",
(void**)&virConnectListDefinedStoragePoolsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListDefinedStoragePoolsSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListStoragePoolsFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListStoragePoolsWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListStoragePoolsFuncType virConnectListStoragePoolsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListStoragePools",
(void**)&virConnectListStoragePoolsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListStoragePoolsSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfDefinedStoragePoolsFuncType)(virConnectPtr conn);
int
virConnectNumOfDefinedStoragePoolsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfDefinedStoragePoolsFuncType virConnectNumOfDefinedStoragePoolsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfDefinedStoragePools",
(void**)&virConnectNumOfDefinedStoragePoolsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfDefinedStoragePoolsSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfStoragePoolsFuncType)(virConnectPtr conn);
int
virConnectNumOfStoragePoolsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfStoragePoolsFuncType virConnectNumOfStoragePoolsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfStoragePools",
(void**)&virConnectNumOfStoragePoolsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfStoragePoolsSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectStoragePoolEventDeregisterAnyFuncType)(virConnectPtr conn,
int callbackID);
int
virConnectStoragePoolEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
static virConnectStoragePoolEventDeregisterAnyFuncType virConnectStoragePoolEventDeregisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectStoragePoolEventDeregisterAny",
(void**)&virConnectStoragePoolEventDeregisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectStoragePoolEventDeregisterAnySymbol(conn,
callbackID);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectStoragePoolEventRegisterAnyFuncType)(virConnectPtr conn,
virStoragePoolPtr pool,
int eventID,
virConnectStoragePoolEventGenericCallback cb,
void * opaque,
virFreeCallback freecb);
int
virConnectStoragePoolEventRegisterAnyWrapper(virConnectPtr conn,
virStoragePoolPtr pool,
int eventID,
virConnectStoragePoolEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectStoragePoolEventRegisterAnyFuncType virConnectStoragePoolEventRegisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectStoragePoolEventRegisterAny",
(void**)&virConnectStoragePoolEventRegisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectStoragePoolEventRegisterAnySymbol(conn,
pool,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolBuildFuncType)(virStoragePoolPtr pool,
unsigned int flags);
int
virStoragePoolBuildWrapper(virStoragePoolPtr pool,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolBuildFuncType virStoragePoolBuildSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolBuild",
(void**)&virStoragePoolBuildSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolBuildSymbol(pool,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolCreateFuncType)(virStoragePoolPtr pool,
unsigned int flags);
int
virStoragePoolCreateWrapper(virStoragePoolPtr pool,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolCreateFuncType virStoragePoolCreateSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolCreate",
(void**)&virStoragePoolCreateSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolCreateSymbol(pool,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolCreateXMLFuncType)(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags);
virStoragePoolPtr
virStoragePoolCreateXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolCreateXMLFuncType virStoragePoolCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolCreateXML",
(void**)&virStoragePoolCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolCreateXMLSymbol(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolDefineXMLFuncType)(virConnectPtr conn,
const char * xml,
unsigned int flags);
virStoragePoolPtr
virStoragePoolDefineXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolDefineXMLFuncType virStoragePoolDefineXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolDefineXML",
(void**)&virStoragePoolDefineXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolDefineXMLSymbol(conn,
xml,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolDeleteFuncType)(virStoragePoolPtr pool,
unsigned int flags);
int
virStoragePoolDeleteWrapper(virStoragePoolPtr pool,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolDeleteFuncType virStoragePoolDeleteSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolDelete",
(void**)&virStoragePoolDeleteSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolDeleteSymbol(pool,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolDestroyFuncType)(virStoragePoolPtr pool);
int
virStoragePoolDestroyWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolDestroyFuncType virStoragePoolDestroySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolDestroy",
(void**)&virStoragePoolDestroySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolDestroySymbol(pool);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolFreeFuncType)(virStoragePoolPtr pool);
int
virStoragePoolFreeWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolFreeFuncType virStoragePoolFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolFree",
(void**)&virStoragePoolFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolFreeSymbol(pool);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolGetAutostartFuncType)(virStoragePoolPtr pool,
int * autostart);
int
virStoragePoolGetAutostartWrapper(virStoragePoolPtr pool,
int * autostart,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolGetAutostartFuncType virStoragePoolGetAutostartSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetAutostart",
(void**)&virStoragePoolGetAutostartSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetAutostartSymbol(pool,
autostart);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virStoragePoolGetConnectFuncType)(virStoragePoolPtr pool);
virConnectPtr
virStoragePoolGetConnectWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virStoragePoolGetConnectFuncType virStoragePoolGetConnectSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetConnect",
(void**)&virStoragePoolGetConnectSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetConnectSymbol(pool);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolGetInfoFuncType)(virStoragePoolPtr pool,
virStoragePoolInfoPtr info);
int
virStoragePoolGetInfoWrapper(virStoragePoolPtr pool,
virStoragePoolInfoPtr info,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolGetInfoFuncType virStoragePoolGetInfoSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetInfo",
(void**)&virStoragePoolGetInfoSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetInfoSymbol(pool,
info);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virStoragePoolGetNameFuncType)(virStoragePoolPtr pool);
const char *
virStoragePoolGetNameWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
const char * ret = NULL;
static virStoragePoolGetNameFuncType virStoragePoolGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetName",
(void**)&virStoragePoolGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetNameSymbol(pool);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolGetUUIDFuncType)(virStoragePoolPtr pool,
unsigned char * uuid);
int
virStoragePoolGetUUIDWrapper(virStoragePoolPtr pool,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolGetUUIDFuncType virStoragePoolGetUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetUUID",
(void**)&virStoragePoolGetUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetUUIDSymbol(pool,
uuid);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolGetUUIDStringFuncType)(virStoragePoolPtr pool,
char * buf);
int
virStoragePoolGetUUIDStringWrapper(virStoragePoolPtr pool,
char * buf,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolGetUUIDStringFuncType virStoragePoolGetUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetUUIDString",
(void**)&virStoragePoolGetUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetUUIDStringSymbol(pool,
buf);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virStoragePoolGetXMLDescFuncType)(virStoragePoolPtr pool,
unsigned int flags);
char *
virStoragePoolGetXMLDescWrapper(virStoragePoolPtr pool,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virStoragePoolGetXMLDescFuncType virStoragePoolGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolGetXMLDesc",
(void**)&virStoragePoolGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolGetXMLDescSymbol(pool,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolIsActiveFuncType)(virStoragePoolPtr pool);
int
virStoragePoolIsActiveWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolIsActiveFuncType virStoragePoolIsActiveSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolIsActive",
(void**)&virStoragePoolIsActiveSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolIsActiveSymbol(pool);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolIsPersistentFuncType)(virStoragePoolPtr pool);
int
virStoragePoolIsPersistentWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolIsPersistentFuncType virStoragePoolIsPersistentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolIsPersistent",
(void**)&virStoragePoolIsPersistentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolIsPersistentSymbol(pool);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolListAllVolumesFuncType)(virStoragePoolPtr pool,
virStorageVolPtr ** vols,
unsigned int flags);
int
virStoragePoolListAllVolumesWrapper(virStoragePoolPtr pool,
virStorageVolPtr ** vols,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolListAllVolumesFuncType virStoragePoolListAllVolumesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolListAllVolumes",
(void**)&virStoragePoolListAllVolumesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolListAllVolumesSymbol(pool,
vols,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolListVolumesFuncType)(virStoragePoolPtr pool,
char ** const names,
int maxnames);
int
virStoragePoolListVolumesWrapper(virStoragePoolPtr pool,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolListVolumesFuncType virStoragePoolListVolumesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolListVolumes",
(void**)&virStoragePoolListVolumesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolListVolumesSymbol(pool,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolLookupByNameFuncType)(virConnectPtr conn,
const char * name);
virStoragePoolPtr
virStoragePoolLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolLookupByNameFuncType virStoragePoolLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolLookupByName",
(void**)&virStoragePoolLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolLookupByNameSymbol(conn,
name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolLookupByTargetPathFuncType)(virConnectPtr conn,
const char * path);
virStoragePoolPtr
virStoragePoolLookupByTargetPathWrapper(virConnectPtr conn,
const char * path,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolLookupByTargetPathFuncType virStoragePoolLookupByTargetPathSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolLookupByTargetPath",
(void**)&virStoragePoolLookupByTargetPathSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolLookupByTargetPathSymbol(conn,
path);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolLookupByUUIDFuncType)(virConnectPtr conn,
const unsigned char * uuid);
virStoragePoolPtr
virStoragePoolLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolLookupByUUIDFuncType virStoragePoolLookupByUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolLookupByUUID",
(void**)&virStoragePoolLookupByUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolLookupByUUIDSymbol(conn,
uuid);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolLookupByUUIDStringFuncType)(virConnectPtr conn,
const char * uuidstr);
virStoragePoolPtr
virStoragePoolLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolLookupByUUIDStringFuncType virStoragePoolLookupByUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolLookupByUUIDString",
(void**)&virStoragePoolLookupByUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolLookupByUUIDStringSymbol(conn,
uuidstr);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStoragePoolPtr
(*virStoragePoolLookupByVolumeFuncType)(virStorageVolPtr vol);
virStoragePoolPtr
virStoragePoolLookupByVolumeWrapper(virStorageVolPtr vol,
virErrorPtr err)
{
virStoragePoolPtr ret = NULL;
static virStoragePoolLookupByVolumeFuncType virStoragePoolLookupByVolumeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolLookupByVolume",
(void**)&virStoragePoolLookupByVolumeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolLookupByVolumeSymbol(vol);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolNumOfVolumesFuncType)(virStoragePoolPtr pool);
int
virStoragePoolNumOfVolumesWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolNumOfVolumesFuncType virStoragePoolNumOfVolumesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolNumOfVolumes",
(void**)&virStoragePoolNumOfVolumesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolNumOfVolumesSymbol(pool);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolRefFuncType)(virStoragePoolPtr pool);
int
virStoragePoolRefWrapper(virStoragePoolPtr pool,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolRefFuncType virStoragePoolRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolRef",
(void**)&virStoragePoolRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStoragePoolRefSymbol(pool);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStoragePoolRefreshFuncType)(virStoragePoolPtr pool,
unsigned int flags);
int
virStoragePoolRefreshWrapper(virStoragePoolPtr pool,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStoragePoolRefreshFuncType virStoragePoolRefreshSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStoragePoolRefresh",
(void**)&virStoragePoolRefreshSymbol,
&once,
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/domain_snapshot.go | vendor/libvirt.org/go/libvirt/domain_snapshot.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"reflect"
"unsafe"
)
type DomainSnapshotCreateFlags uint
const (
DOMAIN_SNAPSHOT_CREATE_REDEFINE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)
DOMAIN_SNAPSHOT_CREATE_CURRENT = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)
DOMAIN_SNAPSHOT_CREATE_NO_METADATA = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)
DOMAIN_SNAPSHOT_CREATE_HALT = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_HALT)
DOMAIN_SNAPSHOT_CREATE_DISK_ONLY = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
DOMAIN_SNAPSHOT_CREATE_REUSE_EXT = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT)
DOMAIN_SNAPSHOT_CREATE_QUIESCE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE)
DOMAIN_SNAPSHOT_CREATE_ATOMIC = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC)
DOMAIN_SNAPSHOT_CREATE_LIVE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_LIVE)
DOMAIN_SNAPSHOT_CREATE_VALIDATE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE)
)
type DomainSnapshotListFlags uint
const (
DOMAIN_SNAPSHOT_LIST_ROOTS = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_ROOTS)
DOMAIN_SNAPSHOT_LIST_DESCENDANTS = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS)
DOMAIN_SNAPSHOT_LIST_LEAVES = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_LEAVES)
DOMAIN_SNAPSHOT_LIST_NO_LEAVES = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
DOMAIN_SNAPSHOT_LIST_METADATA = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_METADATA)
DOMAIN_SNAPSHOT_LIST_NO_METADATA = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
DOMAIN_SNAPSHOT_LIST_INACTIVE = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE)
DOMAIN_SNAPSHOT_LIST_ACTIVE = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE)
DOMAIN_SNAPSHOT_LIST_DISK_ONLY = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
DOMAIN_SNAPSHOT_LIST_INTERNAL = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL)
DOMAIN_SNAPSHOT_LIST_EXTERNAL = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL)
)
type DomainSnapshotRevertFlags uint
const (
DOMAIN_SNAPSHOT_REVERT_RUNNING = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING)
DOMAIN_SNAPSHOT_REVERT_PAUSED = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)
DOMAIN_SNAPSHOT_REVERT_FORCE = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)
DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM)
)
type DomainSnapshotDeleteFlags uint
const (
DOMAIN_SNAPSHOT_DELETE_CHILDREN = DomainSnapshotDeleteFlags(C.VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)
DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY = DomainSnapshotDeleteFlags(C.VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY)
DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY = DomainSnapshotDeleteFlags(C.VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)
)
type DomainSnapshotXMLFlags uint
const (
DOMAIN_SNAPSHOT_XML_SECURE = DomainSnapshotXMLFlags(C.VIR_DOMAIN_SNAPSHOT_XML_SECURE)
)
type DomainSnapshot struct {
ptr C.virDomainSnapshotPtr
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotFree
func (s *DomainSnapshot) Free() error {
var err C.virError
ret := C.virDomainSnapshotFreeWrapper(s.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotRef
func (c *DomainSnapshot) Ref() error {
var err C.virError
ret := C.virDomainSnapshotRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotDelete
func (s *DomainSnapshot) Delete(flags DomainSnapshotDeleteFlags) error {
var err C.virError
result := C.virDomainSnapshotDeleteWrapper(s.ptr, C.uint(flags), &err)
if result != 0 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainRevertToSnapshot
func (s *DomainSnapshot) RevertToSnapshot(flags DomainSnapshotRevertFlags) error {
var err C.virError
result := C.virDomainRevertToSnapshotWrapper(s.ptr, C.uint(flags), &err)
if result != 0 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotIsCurrent
func (s *DomainSnapshot) IsCurrent(flags uint32) (bool, error) {
var err C.virError
result := C.virDomainSnapshotIsCurrentWrapper(s.ptr, C.uint(flags), &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotHasMetadata
func (s *DomainSnapshot) HasMetadata(flags uint32) (bool, error) {
var err C.virError
result := C.virDomainSnapshotHasMetadataWrapper(s.ptr, C.uint(flags), &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotGetXMLDesc
func (s *DomainSnapshot) GetXMLDesc(flags DomainSnapshotXMLFlags) (string, error) {
var err C.virError
result := C.virDomainSnapshotGetXMLDescWrapper(s.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotGetName
func (s *DomainSnapshot) GetName() (string, error) {
var err C.virError
name := C.virDomainSnapshotGetNameWrapper(s.ptr, &err)
if name == nil {
return "", makeError(&err)
}
return C.GoString(name), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotGetParent
func (s *DomainSnapshot) GetParent(flags uint32) (*DomainSnapshot, error) {
var err C.virError
ptr := C.virDomainSnapshotGetParentWrapper(s.ptr, C.uint(flags), &err)
if ptr == nil {
return nil, makeError(&err)
}
return &DomainSnapshot{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotNumChildren
func (s *DomainSnapshot) NumChildren(flags DomainSnapshotListFlags) (int, error) {
var err C.virError
result := int(C.virDomainSnapshotNumChildrenWrapper(s.ptr, C.uint(flags), &err))
if result == -1 {
return 0, makeError(&err)
}
return result, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotListChildrenNames
func (s *DomainSnapshot) ListChildrenNames(flags DomainSnapshotListFlags) ([]string, error) {
const maxNames = 1024
var names [maxNames](*C.char)
namesPtr := unsafe.Pointer(&names)
var err C.virError
numNames := C.virDomainSnapshotListChildrenNamesWrapper(
s.ptr,
(**C.char)(namesPtr),
maxNames, C.uint(flags), &err)
if numNames == -1 {
return nil, makeError(&err)
}
goNames := make([]string, numNames)
for k := 0; k < int(numNames); k++ {
goNames[k] = C.GoString(names[k])
C.free(unsafe.Pointer(names[k]))
}
return goNames, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotListAllChildren
func (d *DomainSnapshot) ListAllChildren(flags DomainSnapshotListFlags) ([]DomainSnapshot, error) {
var cList *C.virDomainSnapshotPtr
var err C.virError
numVols := C.virDomainSnapshotListAllChildrenWrapper(d.ptr, (**C.virDomainSnapshotPtr)(&cList), C.uint(flags), &err)
if numVols == -1 {
return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
Len: int(numVols),
Cap: int(numVols),
}
var pools []DomainSnapshot
slice := *(*[]C.virDomainSnapshotPtr)(unsafe.Pointer(&hdr))
for _, ptr := range slice {
pools = append(pools, DomainSnapshot{ptr})
}
C.free(unsafe.Pointer(cList))
return pools, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/error_helper.go | vendor/libvirt.org/go/libvirt/error_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <string.h>
#include "libvirt_generated.h"
void
setVirError(virErrorPtr err, const char *message)
{
if (err == NULL) {
return;
}
memset(err, 0, sizeof(*err));
err->code = VIR_ERR_INTERNAL_ERROR;
err->domain = VIR_FROM_NONE;
err->message = strdup(message);
err->level = VIR_ERR_ERROR;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/storage_volume.go | vendor/libvirt.org/go/libvirt/storage_volume.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"unsafe"
)
type StorageVolCreateFlags uint
const (
STORAGE_VOL_CREATE_PREALLOC_METADATA = StorageVolCreateFlags(C.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA)
STORAGE_VOL_CREATE_REFLINK = StorageVolCreateFlags(C.VIR_STORAGE_VOL_CREATE_REFLINK)
STORAGE_VOL_CREATE_VALIDATE = StorageVolCreateFlags(C.VIR_STORAGE_VOL_CREATE_VALIDATE)
)
type StorageVolDeleteFlags uint
const (
STORAGE_VOL_DELETE_NORMAL = StorageVolDeleteFlags(C.VIR_STORAGE_VOL_DELETE_NORMAL) // Delete metadata only (fast)
STORAGE_VOL_DELETE_ZEROED = StorageVolDeleteFlags(C.VIR_STORAGE_VOL_DELETE_ZEROED) // Clear all data to zeros (slow)
STORAGE_VOL_DELETE_WITH_SNAPSHOTS = StorageVolDeleteFlags(C.VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS) // Force removal of volume, even if in use
)
type StorageVolResizeFlags uint
const (
STORAGE_VOL_RESIZE_ALLOCATE = StorageVolResizeFlags(C.VIR_STORAGE_VOL_RESIZE_ALLOCATE) // force allocation of new size
STORAGE_VOL_RESIZE_DELTA = StorageVolResizeFlags(C.VIR_STORAGE_VOL_RESIZE_DELTA) // size is relative to current
STORAGE_VOL_RESIZE_SHRINK = StorageVolResizeFlags(C.VIR_STORAGE_VOL_RESIZE_SHRINK) // allow decrease in capacity
)
type StorageVolType int
const (
STORAGE_VOL_FILE = StorageVolType(C.VIR_STORAGE_VOL_FILE) // Regular file based volumes
STORAGE_VOL_BLOCK = StorageVolType(C.VIR_STORAGE_VOL_BLOCK) // Block based volumes
STORAGE_VOL_DIR = StorageVolType(C.VIR_STORAGE_VOL_DIR) // Directory-passthrough based volume
STORAGE_VOL_NETWORK = StorageVolType(C.VIR_STORAGE_VOL_NETWORK) //Network volumes like RBD (RADOS Block Device)
STORAGE_VOL_NETDIR = StorageVolType(C.VIR_STORAGE_VOL_NETDIR) // Network accessible directory that can contain other network volumes
STORAGE_VOL_PLOOP = StorageVolType(C.VIR_STORAGE_VOL_PLOOP) // Ploop directory based volumes
)
type StorageVolWipeAlgorithm int
const (
STORAGE_VOL_WIPE_ALG_ZERO = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_ZERO) // 1-pass, all zeroes
STORAGE_VOL_WIPE_ALG_NNSA = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_NNSA) // 4-pass NNSA Policy Letter NAP-14.1-C (XVI-8)
STORAGE_VOL_WIPE_ALG_DOD = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_DOD) // 4-pass DoD 5220.22-M section 8-306 procedure
STORAGE_VOL_WIPE_ALG_BSI = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_BSI) // 9-pass method recommended by the German Center of Security in Information Technologies
STORAGE_VOL_WIPE_ALG_GUTMANN = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_GUTMANN) // The canonical 35-pass sequence
STORAGE_VOL_WIPE_ALG_SCHNEIER = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER) // 7-pass method described by Bruce Schneier in "Applied Cryptography" (1996)
STORAGE_VOL_WIPE_ALG_PFITZNER7 = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7) // 7-pass random
STORAGE_VOL_WIPE_ALG_PFITZNER33 = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33) // 33-pass random
STORAGE_VOL_WIPE_ALG_RANDOM = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_RANDOM) // 1-pass random
STORAGE_VOL_WIPE_ALG_TRIM = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_TRIM) // Trim the underlying storage
)
type StorageXMLFlags uint
const (
STORAGE_XML_INACTIVE = StorageXMLFlags(C.VIR_STORAGE_XML_INACTIVE)
)
type StorageVolInfoFlags uint
const (
STORAGE_VOL_USE_ALLOCATION = StorageVolInfoFlags(C.VIR_STORAGE_VOL_USE_ALLOCATION)
STORAGE_VOL_GET_PHYSICAL = StorageVolInfoFlags(C.VIR_STORAGE_VOL_GET_PHYSICAL)
)
type StorageVolUploadFlags uint
const (
STORAGE_VOL_UPLOAD_SPARSE_STREAM = StorageVolUploadFlags(C.VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM)
)
type StorageVolDownloadFlags uint
const (
STORAGE_VOL_DOWNLOAD_SPARSE_STREAM = StorageVolDownloadFlags(C.VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM)
)
type StorageVol struct {
ptr C.virStorageVolPtr
}
type StorageVolInfo struct {
Type StorageVolType
Capacity uint64
Allocation uint64
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDelete
func (v *StorageVol) Delete(flags StorageVolDeleteFlags) error {
var err C.virError
result := C.virStorageVolDeleteWrapper(v.ptr, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolFree
func (v *StorageVol) Free() error {
var err C.virError
ret := C.virStorageVolFreeWrapper(v.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolRef
func (c *StorageVol) Ref() error {
var err C.virError
ret := C.virStorageVolRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfo
func (v *StorageVol) GetInfo() (*StorageVolInfo, error) {
var cinfo C.virStorageVolInfo
var err C.virError
result := C.virStorageVolGetInfoWrapper(v.ptr, &cinfo, &err)
if result == -1 {
return nil, makeError(&err)
}
return &StorageVolInfo{
Type: StorageVolType(cinfo._type),
Capacity: uint64(cinfo.capacity),
Allocation: uint64(cinfo.allocation),
}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfoFlags
func (v *StorageVol) GetInfoFlags(flags StorageVolInfoFlags) (*StorageVolInfo, error) {
var cinfo C.virStorageVolInfo
var err C.virError
result := C.virStorageVolGetInfoFlagsWrapper(v.ptr, &cinfo, C.uint(flags), &err)
if result == -1 {
return nil, makeError(&err)
}
return &StorageVolInfo{
Type: StorageVolType(cinfo._type),
Capacity: uint64(cinfo.capacity),
Allocation: uint64(cinfo.allocation),
}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetKey
func (v *StorageVol) GetKey() (string, error) {
var err C.virError
key := C.virStorageVolGetKeyWrapper(v.ptr, &err)
if key == nil {
return "", makeError(&err)
}
return C.GoString(key), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetName
func (v *StorageVol) GetName() (string, error) {
var err C.virError
name := C.virStorageVolGetNameWrapper(v.ptr, &err)
if name == nil {
return "", makeError(&err)
}
return C.GoString(name), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetPath
func (v *StorageVol) GetPath() (string, error) {
var err C.virError
result := C.virStorageVolGetPathWrapper(v.ptr, &err)
if result == nil {
return "", makeError(&err)
}
path := C.GoString(result)
C.free(unsafe.Pointer(result))
return path, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetXMLDesc
func (v *StorageVol) GetXMLDesc(flags uint32) (string, error) {
var err C.virError
result := C.virStorageVolGetXMLDescWrapper(v.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolResize
func (v *StorageVol) Resize(capacity uint64, flags StorageVolResizeFlags) error {
var err C.virError
result := C.virStorageVolResizeWrapper(v.ptr, C.ulonglong(capacity), C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipe
func (v *StorageVol) Wipe(flags uint32) error {
var err C.virError
result := C.virStorageVolWipeWrapper(v.ptr, C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipePattern
func (v *StorageVol) WipePattern(algorithm StorageVolWipeAlgorithm, flags uint32) error {
var err C.virError
result := C.virStorageVolWipePatternWrapper(v.ptr, C.uint(algorithm), C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolUpload
func (v *StorageVol) Upload(stream *Stream, offset, length uint64, flags StorageVolUploadFlags) error {
var err C.virError
if C.virStorageVolUploadWrapper(v.ptr, stream.ptr, C.ulonglong(offset),
C.ulonglong(length), C.uint(flags), &err) == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDownload
func (v *StorageVol) Download(stream *Stream, offset, length uint64, flags StorageVolDownloadFlags) error {
var err C.virError
if C.virStorageVolDownloadWrapper(v.ptr, stream.ptr, C.ulonglong(offset),
C.ulonglong(length), C.uint(flags), &err) == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByVolume
func (v *StorageVol) LookupPoolByVolume() (*StoragePool, error) {
var err C.virError
poolPtr := C.virStoragePoolLookupByVolumeWrapper(v.ptr, &err)
if poolPtr == nil {
return nil, makeError(&err)
}
return &StoragePool{ptr: poolPtr}, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_event.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_event.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virEventAddHandleWrapper(int fd,
int events,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(err, "Function virEventAddHandle not available prior to libvirt version 0.9.3");
#else
ret = virEventAddHandle(fd,
events,
cb,
opaque,
ff);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virEventAddTimeoutWrapper(int timeout,
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(err, "Function virEventAddTimeout not available prior to libvirt version 0.9.3");
#else
ret = virEventAddTimeout(timeout,
cb,
opaque,
ff);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virEventRegisterDefaultImplWrapper(virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 0)
setVirError(err, "Function virEventRegisterDefaultImpl not available prior to libvirt version 0.9.0");
#else
ret = virEventRegisterDefaultImpl();
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
void
virEventRegisterImplWrapper(virEventAddHandleFunc addHandle,
virEventUpdateHandleFunc updateHandle,
virEventRemoveHandleFunc removeHandle,
virEventAddTimeoutFunc addTimeout,
virEventUpdateTimeoutFunc updateTimeout,
virEventRemoveTimeoutFunc removeTimeout)
{
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(NULL, "Function virEventRegisterImpl not available prior to libvirt version 0.5.0");
#else
virEventRegisterImpl(addHandle,
updateHandle,
removeHandle,
addTimeout,
updateTimeout,
removeTimeout);
#endif
return;
}
int
virEventRemoveHandleWrapper(int watch,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(err, "Function virEventRemoveHandle not available prior to libvirt version 0.9.3");
#else
ret = virEventRemoveHandle(watch);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virEventRemoveTimeoutWrapper(int timer,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(err, "Function virEventRemoveTimeout not available prior to libvirt version 0.9.3");
#else
ret = virEventRemoveTimeout(timer);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virEventRunDefaultImplWrapper(virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 0)
setVirError(err, "Function virEventRunDefaultImpl not available prior to libvirt version 0.9.0");
#else
ret = virEventRunDefaultImpl();
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
void
virEventUpdateHandleWrapper(int watch,
int events)
{
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(NULL, "Function virEventUpdateHandle not available prior to libvirt version 0.9.3");
#else
virEventUpdateHandle(watch,
events);
#endif
return;
}
void
virEventUpdateTimeoutWrapper(int timer,
int timeout)
{
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(NULL, "Function virEventUpdateTimeout not available prior to libvirt version 0.9.3");
#else
virEventUpdateTimeout(timer,
timeout);
#endif
return;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_stream.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_stream.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virStreamAbortFuncType)(virStreamPtr stream);
int
virStreamAbortWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
static virStreamAbortFuncType virStreamAbortSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamAbort",
(void**)&virStreamAbortSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamAbortSymbol(stream);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamEventAddCallbackFuncType)(virStreamPtr stream,
int events,
virStreamEventCallback cb,
void * opaque,
virFreeCallback ff);
int
virStreamEventAddCallbackWrapper(virStreamPtr stream,
int events,
virStreamEventCallback cb,
void * opaque,
virFreeCallback ff,
virErrorPtr err)
{
int ret = -1;
static virStreamEventAddCallbackFuncType virStreamEventAddCallbackSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamEventAddCallback",
(void**)&virStreamEventAddCallbackSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamEventAddCallbackSymbol(stream,
events,
cb,
opaque,
ff);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamEventRemoveCallbackFuncType)(virStreamPtr stream);
int
virStreamEventRemoveCallbackWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
static virStreamEventRemoveCallbackFuncType virStreamEventRemoveCallbackSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamEventRemoveCallback",
(void**)&virStreamEventRemoveCallbackSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamEventRemoveCallbackSymbol(stream);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamEventUpdateCallbackFuncType)(virStreamPtr stream,
int events);
int
virStreamEventUpdateCallbackWrapper(virStreamPtr stream,
int events,
virErrorPtr err)
{
int ret = -1;
static virStreamEventUpdateCallbackFuncType virStreamEventUpdateCallbackSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamEventUpdateCallback",
(void**)&virStreamEventUpdateCallbackSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamEventUpdateCallbackSymbol(stream,
events);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamFinishFuncType)(virStreamPtr stream);
int
virStreamFinishWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
static virStreamFinishFuncType virStreamFinishSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamFinish",
(void**)&virStreamFinishSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamFinishSymbol(stream);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamFreeFuncType)(virStreamPtr stream);
int
virStreamFreeWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
static virStreamFreeFuncType virStreamFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamFree",
(void**)&virStreamFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamFreeSymbol(stream);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virStreamPtr
(*virStreamNewFuncType)(virConnectPtr conn,
unsigned int flags);
virStreamPtr
virStreamNewWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
virStreamPtr ret = NULL;
static virStreamNewFuncType virStreamNewSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamNew",
(void**)&virStreamNewSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamNewSymbol(conn,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamRecvFuncType)(virStreamPtr stream,
char * data,
size_t nbytes);
int
virStreamRecvWrapper(virStreamPtr stream,
char * data,
size_t nbytes,
virErrorPtr err)
{
int ret = -1;
static virStreamRecvFuncType virStreamRecvSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamRecv",
(void**)&virStreamRecvSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamRecvSymbol(stream,
data,
nbytes);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamRecvAllFuncType)(virStreamPtr stream,
virStreamSinkFunc handler,
void * opaque);
int
virStreamRecvAllWrapper(virStreamPtr stream,
virStreamSinkFunc handler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
static virStreamRecvAllFuncType virStreamRecvAllSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamRecvAll",
(void**)&virStreamRecvAllSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamRecvAllSymbol(stream,
handler,
opaque);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamRecvFlagsFuncType)(virStreamPtr stream,
char * data,
size_t nbytes,
unsigned int flags);
int
virStreamRecvFlagsWrapper(virStreamPtr stream,
char * data,
size_t nbytes,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStreamRecvFlagsFuncType virStreamRecvFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamRecvFlags",
(void**)&virStreamRecvFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamRecvFlagsSymbol(stream,
data,
nbytes,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamRecvHoleFuncType)(virStreamPtr stream,
long long * length,
unsigned int flags);
int
virStreamRecvHoleWrapper(virStreamPtr stream,
long long * length,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStreamRecvHoleFuncType virStreamRecvHoleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamRecvHole",
(void**)&virStreamRecvHoleSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamRecvHoleSymbol(stream,
length,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamRefFuncType)(virStreamPtr stream);
int
virStreamRefWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
static virStreamRefFuncType virStreamRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamRef",
(void**)&virStreamRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamRefSymbol(stream);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamSendFuncType)(virStreamPtr stream,
const char * data,
size_t nbytes);
int
virStreamSendWrapper(virStreamPtr stream,
const char * data,
size_t nbytes,
virErrorPtr err)
{
int ret = -1;
static virStreamSendFuncType virStreamSendSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamSend",
(void**)&virStreamSendSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamSendSymbol(stream,
data,
nbytes);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamSendAllFuncType)(virStreamPtr stream,
virStreamSourceFunc handler,
void * opaque);
int
virStreamSendAllWrapper(virStreamPtr stream,
virStreamSourceFunc handler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
static virStreamSendAllFuncType virStreamSendAllSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamSendAll",
(void**)&virStreamSendAllSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamSendAllSymbol(stream,
handler,
opaque);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamSendHoleFuncType)(virStreamPtr stream,
long long length,
unsigned int flags);
int
virStreamSendHoleWrapper(virStreamPtr stream,
long long length,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virStreamSendHoleFuncType virStreamSendHoleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamSendHole",
(void**)&virStreamSendHoleSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamSendHoleSymbol(stream,
length,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamSparseRecvAllFuncType)(virStreamPtr stream,
virStreamSinkFunc handler,
virStreamSinkHoleFunc holeHandler,
void * opaque);
int
virStreamSparseRecvAllWrapper(virStreamPtr stream,
virStreamSinkFunc handler,
virStreamSinkHoleFunc holeHandler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
static virStreamSparseRecvAllFuncType virStreamSparseRecvAllSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamSparseRecvAll",
(void**)&virStreamSparseRecvAllSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamSparseRecvAllSymbol(stream,
handler,
holeHandler,
opaque);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virStreamSparseSendAllFuncType)(virStreamPtr stream,
virStreamSourceFunc handler,
virStreamSourceHoleFunc holeHandler,
virStreamSourceSkipFunc skipHandler,
void * opaque);
int
virStreamSparseSendAllWrapper(virStreamPtr stream,
virStreamSourceFunc handler,
virStreamSourceHoleFunc holeHandler,
virStreamSourceSkipFunc skipHandler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
static virStreamSparseSendAllFuncType virStreamSparseSendAllSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virStreamSparseSendAll",
(void**)&virStreamSparseSendAllSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virStreamSparseSendAllSymbol(stream,
handler,
holeHandler,
skipHandler,
opaque);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/domain_events_helper.go | vendor/libvirt.org/go/libvirt/domain_events_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdint.h>
#include "domain_events_helper.h"
#include "callbacks_helper.h"
extern void domainEventLifecycleCallback(virConnectPtr, virDomainPtr, int, int, int);
void domainEventLifecycleCallbackHelper(virConnectPtr conn, virDomainPtr dom,
int event, int detail, void *data)
{
domainEventLifecycleCallback(conn, dom, event, detail, (int)(intptr_t)data);
}
extern void domainEventGenericCallback(virConnectPtr, virDomainPtr, int);
void domainEventGenericCallbackHelper(virConnectPtr conn, virDomainPtr dom, void *data)
{
domainEventGenericCallback(conn, dom, (int)(intptr_t)data);
}
extern void domainEventRTCChangeCallback(virConnectPtr, virDomainPtr, long long, int);
void domainEventRTCChangeCallbackHelper(virConnectPtr conn, virDomainPtr dom,
long long utcoffset, void *data)
{
domainEventRTCChangeCallback(conn, dom, utcoffset, (int)(intptr_t)data);
}
extern void domainEventWatchdogCallback(virConnectPtr, virDomainPtr, int, int);
void domainEventWatchdogCallbackHelper(virConnectPtr conn, virDomainPtr dom,
int action, void *data)
{
domainEventWatchdogCallback(conn, dom, action, (int)(intptr_t)data);
}
extern void domainEventIOErrorCallback(virConnectPtr, virDomainPtr, const char *, const char *, int, int);
void domainEventIOErrorCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *srcPath, const char *devAlias,
int action, void *data)
{
domainEventIOErrorCallback(conn, dom, srcPath, devAlias, action, (int)(intptr_t)data);
}
extern void domainEventGraphicsCallback(virConnectPtr, virDomainPtr, int, const virDomainEventGraphicsAddress *,
const virDomainEventGraphicsAddress *, const char *,
const virDomainEventGraphicsSubject *, int);
void domainEventGraphicsCallbackHelper(virConnectPtr conn, virDomainPtr dom,
int phase, const virDomainEventGraphicsAddress *local,
const virDomainEventGraphicsAddress *remote,
const char *authScheme,
const virDomainEventGraphicsSubject *subject, void *data)
{
domainEventGraphicsCallback(conn, dom, phase, local, remote, authScheme, subject, (int)(intptr_t)data);
}
extern void domainEventIOErrorReasonCallback(virConnectPtr, virDomainPtr, const char *, const char *,
int, const char *, int);
void domainEventIOErrorReasonCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *srcPath, const char *devAlias,
int action, const char *reason, void *data)
{
domainEventIOErrorReasonCallback(conn, dom, srcPath, devAlias, action, reason, (int)(intptr_t)data);
}
extern void domainEventBlockJobCallback(virConnectPtr, virDomainPtr, const char *, int, int, int);
void domainEventBlockJobCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *disk, int type, int status, void *data)
{
domainEventBlockJobCallback(conn, dom, disk, type, status, (int)(intptr_t)data);
}
extern void domainEventDiskChangeCallback(virConnectPtr, virDomainPtr, const char *, const char *,
const char *, int, int);
void domainEventDiskChangeCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *oldSrcPath, const char *newSrcPath,
const char *devAlias, int reason, void *data)
{
domainEventDiskChangeCallback(conn, dom, oldSrcPath, newSrcPath, devAlias, reason, (int)(intptr_t)data);
}
extern void domainEventTrayChangeCallback(virConnectPtr, virDomainPtr, const char *, int, int);
void domainEventTrayChangeCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *devAlias, int reason, void *data)
{
domainEventTrayChangeCallback(conn, dom, devAlias, reason, (int)(intptr_t)data);
}
extern void domainEventPMSuspendCallback(virConnectPtr, virDomainPtr, int, int);
void domainEventPMSuspendCallbackHelper(virConnectPtr conn, virDomainPtr dom,
int reason, void *data)
{
domainEventPMSuspendCallback(conn, dom, reason, (int)(intptr_t)data);
}
extern void domainEventPMWakeupCallback(virConnectPtr, virDomainPtr, int, int);
void domainEventPMWakeupCallbackHelper(virConnectPtr conn, virDomainPtr dom,
int reason, void *data)
{
domainEventPMWakeupCallback(conn, dom, reason, (int)(intptr_t)data);
}
extern void domainEventPMSuspendDiskCallback(virConnectPtr, virDomainPtr, int, int);
void domainEventPMSuspendDiskCallbackHelper(virConnectPtr conn, virDomainPtr dom,
int reason, void *data)
{
domainEventPMSuspendDiskCallback(conn, dom, reason, (int)(intptr_t)data);
}
extern void domainEventBalloonChangeCallback(virConnectPtr, virDomainPtr, unsigned long long, int);
void domainEventBalloonChangeCallbackHelper(virConnectPtr conn, virDomainPtr dom,
unsigned long long actual, void *data)
{
domainEventBalloonChangeCallback(conn, dom, actual, (int)(intptr_t)data);
}
extern void domainEventDeviceRemovedCallback(virConnectPtr, virDomainPtr, const char *, int);
void domainEventDeviceRemovedCallbackHelper(virConnectPtr conn, virDomainPtr dom,
const char *devAlias, void *data)
{
domainEventDeviceRemovedCallback(conn, dom, devAlias, (int)(intptr_t)data);
}
extern void domainEventTunableCallback(virConnectPtr, virDomainPtr, virTypedParameterPtr, int, int);
void domainEventTunableCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
void *opaque)
{
domainEventTunableCallback(conn, dom, params, nparams, (int)(intptr_t)opaque);
}
extern void domainEventAgentLifecycleCallback(virConnectPtr, virDomainPtr, int, int, int);
void domainEventAgentLifecycleCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
int state,
int reason,
void *opaque)
{
domainEventAgentLifecycleCallback(conn, dom, state, reason, (int)(intptr_t)opaque);
}
extern void domainEventDeviceAddedCallback(virConnectPtr, virDomainPtr, const char *, int);
void domainEventDeviceAddedCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
const char *devAlias,
void *opaque)
{
domainEventDeviceAddedCallback(conn, dom, devAlias, (int)(intptr_t)opaque);
}
extern void domainEventMigrationIterationCallback(virConnectPtr, virDomainPtr, int, int);
void domainEventMigrationIterationCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
int iteration,
void *opaque)
{
domainEventMigrationIterationCallback(conn, dom, iteration, (int)(intptr_t)opaque);
}
extern void domainEventJobCompletedCallback(virConnectPtr, virDomainPtr, virTypedParameterPtr, int, int);
void domainEventJobCompletedCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
void *opaque)
{
domainEventJobCompletedCallback(conn, dom, params, nparams, (int)(intptr_t)opaque);
}
extern void domainEventDeviceRemovalFailedCallback(virConnectPtr, virDomainPtr, const char *, int);
void domainEventDeviceRemovalFailedCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
const char *devAlias,
void *opaque)
{
domainEventDeviceRemovalFailedCallback(conn, dom, devAlias, (int)(intptr_t)opaque);
}
extern void domainEventMetadataChangeCallback(virConnectPtr, virDomainPtr, int, const char *, int);
void domainEventMetadataChangeCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
int type,
const char *nsuri,
void *opaque)
{
domainEventMetadataChangeCallback(conn, dom, type, nsuri, (int)(intptr_t)opaque);
}
extern void domainEventBlockThresholdCallback(virConnectPtr, virDomainPtr, const char *, const char *, unsigned long long, unsigned long long, int);
void domainEventBlockThresholdCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
const char *dev,
const char *path,
unsigned long long threshold,
unsigned long long excess,
void *opaque)
{
domainEventBlockThresholdCallback(conn, dom, dev, path, threshold, excess, (int)(intptr_t)opaque);
}
extern void domainEventMemoryFailureCallback(virConnectPtr, virDomainPtr, int, int, unsigned int, int);
void domainEventMemoryFailureCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
int recipient,
int action,
unsigned int flags,
void *opaque)
{
domainEventMemoryFailureCallback(conn, dom, recipient, action, flags, (int)(intptr_t)opaque);
}
extern void domainEventMemoryDeviceSizeChangeCallback(virConnectPtr, virDomainPtr, const char *, unsigned long long, int);
void domainEventMemoryDeviceSizeChangeCallbackHelper(virConnectPtr conn,
virDomainPtr dom,
const char *alias,
unsigned long long size,
void *opaque)
{
domainEventMemoryDeviceSizeChangeCallback(conn, dom, alias, size, (int)(intptr_t)opaque);
}
int
virConnectDomainEventRegisterAnyHelper(virConnectPtr conn,
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
long goCallbackId,
virErrorPtr err)
{
void *id = (void *)goCallbackId;
return virConnectDomainEventRegisterAnyWrapper(conn, dom, eventID, cb, id,
freeGoCallbackHelper, err);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_nodedev.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_nodedev.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnectListAllNodeDevicesWrapper(virConnectPtr conn,
virNodeDevicePtr ** devices,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virConnectListAllNodeDevices not available prior to libvirt version 0.10.2");
#else
ret = virConnectListAllNodeDevices(conn,
devices,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNodeDeviceEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(2, 2, 0)
setVirError(err, "Function virConnectNodeDeviceEventDeregisterAny not available prior to libvirt version 2.2.0");
#else
ret = virConnectNodeDeviceEventDeregisterAny(conn,
callbackID);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNodeDeviceEventRegisterAnyWrapper(virConnectPtr conn,
virNodeDevicePtr dev,
int eventID,
virConnectNodeDeviceEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(2, 2, 0)
setVirError(err, "Function virConnectNodeDeviceEventRegisterAny not available prior to libvirt version 2.2.0");
#else
ret = virConnectNodeDeviceEventRegisterAny(conn,
dev,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceCreateWrapper(virNodeDevicePtr dev,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(7, 3, 0)
setVirError(err, "Function virNodeDeviceCreate not available prior to libvirt version 7.3.0");
#else
ret = virNodeDeviceCreate(dev,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNodeDevicePtr
virNodeDeviceCreateXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 3)
setVirError(err, "Function virNodeDeviceCreateXML not available prior to libvirt version 0.6.3");
#else
ret = virNodeDeviceCreateXML(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNodeDevicePtr
virNodeDeviceDefineXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(7, 3, 0)
setVirError(err, "Function virNodeDeviceDefineXML not available prior to libvirt version 7.3.0");
#else
ret = virNodeDeviceDefineXML(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceDestroyWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 3)
setVirError(err, "Function virNodeDeviceDestroy not available prior to libvirt version 0.6.3");
#else
ret = virNodeDeviceDestroy(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceDetachFlagsWrapper(virNodeDevicePtr dev,
const char * driverName,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 0, 5)
setVirError(err, "Function virNodeDeviceDetachFlags not available prior to libvirt version 1.0.5");
#else
ret = virNodeDeviceDetachFlags(dev,
driverName,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceDettachWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 1)
setVirError(err, "Function virNodeDeviceDettach not available prior to libvirt version 0.6.1");
#else
ret = virNodeDeviceDettach(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceFreeWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceFree not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceFree(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceGetAutostartWrapper(virNodeDevicePtr dev,
int * autostart,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(7, 8, 0)
setVirError(err, "Function virNodeDeviceGetAutostart not available prior to libvirt version 7.8.0");
#else
ret = virNodeDeviceGetAutostart(dev,
autostart);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virNodeDeviceGetNameWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceGetName not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceGetName(dev);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virNodeDeviceGetParentWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceGetParent not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceGetParent(dev);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNodeDeviceGetXMLDescWrapper(virNodeDevicePtr dev,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceGetXMLDesc not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceGetXMLDesc(dev,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceIsActiveWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(7, 8, 0)
setVirError(err, "Function virNodeDeviceIsActive not available prior to libvirt version 7.8.0");
#else
ret = virNodeDeviceIsActive(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceIsPersistentWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(7, 8, 0)
setVirError(err, "Function virNodeDeviceIsPersistent not available prior to libvirt version 7.8.0");
#else
ret = virNodeDeviceIsPersistent(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceListCapsWrapper(virNodeDevicePtr dev,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceListCaps not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceListCaps(dev,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNodeDevicePtr
virNodeDeviceLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceLookupByName not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceLookupByName(conn,
name);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNodeDevicePtr
virNodeDeviceLookupSCSIHostByWWNWrapper(virConnectPtr conn,
const char * wwnn,
const char * wwpn,
unsigned int flags,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(1, 0, 3)
setVirError(err, "Function virNodeDeviceLookupSCSIHostByWWN not available prior to libvirt version 1.0.3");
#else
ret = virNodeDeviceLookupSCSIHostByWWN(conn,
wwnn,
wwpn,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceNumOfCapsWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeDeviceNumOfCaps not available prior to libvirt version 0.5.0");
#else
ret = virNodeDeviceNumOfCaps(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceReAttachWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 1)
setVirError(err, "Function virNodeDeviceReAttach not available prior to libvirt version 0.6.1");
#else
ret = virNodeDeviceReAttach(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceRefWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 0)
setVirError(err, "Function virNodeDeviceRef not available prior to libvirt version 0.6.0");
#else
ret = virNodeDeviceRef(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceResetWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 1)
setVirError(err, "Function virNodeDeviceReset not available prior to libvirt version 0.6.1");
#else
ret = virNodeDeviceReset(dev);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceSetAutostartWrapper(virNodeDevicePtr dev,
int autostart,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(7, 8, 0)
setVirError(err, "Function virNodeDeviceSetAutostart not available prior to libvirt version 7.8.0");
#else
ret = virNodeDeviceSetAutostart(dev,
autostart);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceUndefineWrapper(virNodeDevicePtr dev,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(7, 3, 0)
setVirError(err, "Function virNodeDeviceUndefine not available prior to libvirt version 7.3.0");
#else
ret = virNodeDeviceUndefine(dev,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeDeviceUpdateWrapper(virNodeDevicePtr dev,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(10, 1, 0)
setVirError(err, "Function virNodeDeviceUpdate not available prior to libvirt version 10.1.0");
#else
ret = virNodeDeviceUpdate(dev,
xmlDesc,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeListDevicesWrapper(virConnectPtr conn,
const char * cap,
char ** const names,
int maxnames,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeListDevices not available prior to libvirt version 0.5.0");
#else
ret = virNodeListDevices(conn,
cap,
names,
maxnames,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeNumOfDevicesWrapper(virConnectPtr conn,
const char * cap,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virNodeNumOfDevices not available prior to libvirt version 0.5.0");
#else
ret = virNodeNumOfDevices(conn,
cap,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/domain_events.go | vendor/libvirt.org/go/libvirt/domain_events.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
import (
"fmt"
"unsafe"
)
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "domain_events_helper.h"
*/
import "C"
type DomainEventGenericCallback func(c *Connect, d *Domain)
type DomainEventLifecycle struct {
Event DomainEventType
// TODO: we can make Detail typesafe somehow ?
Detail int
}
type DomainEventLifecycleCallback func(c *Connect, d *Domain, event *DomainEventLifecycle)
type DomainEventRTCChange struct {
Utcoffset int64
}
type DomainEventRTCChangeCallback func(c *Connect, d *Domain, event *DomainEventRTCChange)
type DomainEventWatchdog struct {
Action DomainEventWatchdogAction
}
type DomainEventWatchdogCallback func(c *Connect, d *Domain, event *DomainEventWatchdog)
type DomainEventIOError struct {
SrcPath string
DevAlias string
Action DomainEventIOErrorAction
}
type DomainEventIOErrorCallback func(c *Connect, d *Domain, event *DomainEventIOError)
type DomainEventGraphicsAddress struct {
Family DomainEventGraphicsAddressType
Node string
Service string
}
type DomainEventGraphicsSubjectIdentity struct {
Type string
Name string
}
type DomainEventGraphics struct {
Phase DomainEventGraphicsPhase
Local DomainEventGraphicsAddress
Remote DomainEventGraphicsAddress
AuthScheme string
Subject []DomainEventGraphicsSubjectIdentity
}
type DomainEventGraphicsCallback func(c *Connect, d *Domain, event *DomainEventGraphics)
type DomainEventIOErrorReason struct {
SrcPath string
DevAlias string
Action DomainEventIOErrorAction
Reason string
}
type DomainEventIOErrorReasonCallback func(c *Connect, d *Domain, event *DomainEventIOErrorReason)
type DomainEventBlockJob struct {
Disk string
Type DomainBlockJobType
Status ConnectDomainEventBlockJobStatus
}
type DomainEventBlockJobCallback func(c *Connect, d *Domain, event *DomainEventBlockJob)
type DomainEventDiskChange struct {
OldSrcPath string
NewSrcPath string
DevAlias string
Reason ConnectDomainEventDiskChangeReason
}
type DomainEventDiskChangeCallback func(c *Connect, d *Domain, event *DomainEventDiskChange)
type DomainEventTrayChange struct {
DevAlias string
Reason ConnectDomainEventTrayChangeReason
}
type DomainEventTrayChangeCallback func(c *Connect, d *Domain, event *DomainEventTrayChange)
type DomainEventPMSuspend struct {
Reason int
}
type DomainEventPMSuspendCallback func(c *Connect, d *Domain, event *DomainEventPMSuspend)
type DomainEventPMWakeup struct {
Reason int
}
type DomainEventPMWakeupCallback func(c *Connect, d *Domain, event *DomainEventPMWakeup)
type DomainEventPMSuspendDisk struct {
Reason int
}
type DomainEventPMSuspendDiskCallback func(c *Connect, d *Domain, event *DomainEventPMSuspendDisk)
type DomainEventBalloonChange struct {
Actual uint64
}
type DomainEventBalloonChangeCallback func(c *Connect, d *Domain, event *DomainEventBalloonChange)
type DomainEventDeviceRemoved struct {
DevAlias string
}
type DomainEventDeviceRemovedCallback func(c *Connect, d *Domain, event *DomainEventDeviceRemoved)
type DomainEventTunableCpuPin struct {
VcpuPinSet bool
VcpuPin [][]bool
EmulatorPinSet bool
EmulatorPin []bool
IOThreadPinSet bool
IOThreadPin [][]bool
}
type DomainEventTunable struct {
CpuSched *DomainSchedulerParameters
CpuPin *DomainEventTunableCpuPin
BlkdevDiskSet bool
BlkdevDisk string
BlkdevTune *DomainBlockIoTuneParameters
}
type DomainEventTunableCallback func(c *Connect, d *Domain, event *DomainEventTunable)
type DomainEventAgentLifecycle struct {
State ConnectDomainEventAgentLifecycleState
Reason ConnectDomainEventAgentLifecycleReason
}
type DomainEventAgentLifecycleCallback func(c *Connect, d *Domain, event *DomainEventAgentLifecycle)
type DomainEventDeviceAdded struct {
DevAlias string
}
type DomainEventDeviceAddedCallback func(c *Connect, d *Domain, event *DomainEventDeviceAdded)
type DomainEventMigrationIteration struct {
Iteration int
}
type DomainEventMigrationIterationCallback func(c *Connect, d *Domain, event *DomainEventMigrationIteration)
type DomainEventJobCompleted struct {
Info DomainJobInfo
}
type DomainEventJobCompletedCallback func(c *Connect, d *Domain, event *DomainEventJobCompleted)
type DomainEventDeviceRemovalFailed struct {
DevAlias string
}
type DomainEventDeviceRemovalFailedCallback func(c *Connect, d *Domain, event *DomainEventDeviceRemovalFailed)
type DomainEventMetadataChange struct {
Type DomainMetadataType
NSURI string
}
type DomainEventMetadataChangeCallback func(c *Connect, d *Domain, event *DomainEventMetadataChange)
type DomainEventBlockThreshold struct {
Dev string
Path string
Threshold uint64
Excess uint64
}
type DomainEventBlockThresholdCallback func(c *Connect, d *Domain, event *DomainEventBlockThreshold)
type DomainEventMemoryFailure struct {
Recipient DomainMemoryFailureRecipientType
Action DomainMemoryFailureActionType
Flags DomainMemoryFailureFlags
}
type DomainEventMemoryFailureCallback func(c *Connect, d *Domain, event *DomainEventMemoryFailure)
type DomainEventMemoryDeviceSizeChange struct {
Alias string
Size uint64
Flags uint
}
type DomainEventMemoryDeviceSizeChangeCallback func(c *Connect, d *Domain, event *DomainEventMemoryDeviceSizeChange)
//export domainEventLifecycleCallback
func domainEventLifecycleCallback(c C.virConnectPtr, d C.virDomainPtr,
event int, detail int,
goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventLifecycle{
Event: DomainEventType(event),
Detail: detail,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventLifecycleCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventGenericCallback
func domainEventGenericCallback(c C.virConnectPtr, d C.virDomainPtr,
goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventGenericCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain)
}
//export domainEventRTCChangeCallback
func domainEventRTCChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
utcoffset int64, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventRTCChange{
Utcoffset: utcoffset,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventRTCChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventWatchdogCallback
func domainEventWatchdogCallback(c C.virConnectPtr, d C.virDomainPtr,
action int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventWatchdog{
Action: DomainEventWatchdogAction(action),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventWatchdogCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventIOErrorCallback
func domainEventIOErrorCallback(c C.virConnectPtr, d C.virDomainPtr,
srcPath *C.char, devAlias *C.char, action int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventIOError{
SrcPath: C.GoString(srcPath),
DevAlias: C.GoString(devAlias),
Action: DomainEventIOErrorAction(action),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventIOErrorCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventGraphicsCallback
func domainEventGraphicsCallback(c C.virConnectPtr, d C.virDomainPtr,
phase int,
local C.virDomainEventGraphicsAddressPtr,
remote C.virDomainEventGraphicsAddressPtr,
authScheme *C.char,
subject C.virDomainEventGraphicsSubjectPtr,
goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
subjectGo := make([]DomainEventGraphicsSubjectIdentity, 0)
for i := 0; i < int(subject.nidentity); i++ {
cidentity := *(**C.virDomainEventGraphicsSubjectIdentity)(unsafe.Pointer(uintptr(unsafe.Pointer(subject.identities)) + (unsafe.Sizeof(*subject.identities) * uintptr(i))))
subjectGo = append(subjectGo,
DomainEventGraphicsSubjectIdentity{
Type: C.GoString(cidentity._type),
Name: C.GoString(cidentity.name),
},
)
}
eventDetails := &DomainEventGraphics{
Phase: DomainEventGraphicsPhase(phase),
Local: DomainEventGraphicsAddress{
Family: DomainEventGraphicsAddressType(local.family),
Node: C.GoString(local.node),
Service: C.GoString(local.service),
},
Remote: DomainEventGraphicsAddress{
Family: DomainEventGraphicsAddressType(remote.family),
Node: C.GoString(remote.node),
Service: C.GoString(remote.service),
},
AuthScheme: C.GoString(authScheme),
Subject: subjectGo,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventGraphicsCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventIOErrorReasonCallback
func domainEventIOErrorReasonCallback(c C.virConnectPtr, d C.virDomainPtr,
srcPath *C.char, devAlias *C.char, action int, reason *C.char,
goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventIOErrorReason{
SrcPath: C.GoString(srcPath),
DevAlias: C.GoString(devAlias),
Action: DomainEventIOErrorAction(action),
Reason: C.GoString(reason),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventIOErrorReasonCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventBlockJobCallback
func domainEventBlockJobCallback(c C.virConnectPtr, d C.virDomainPtr,
disk *C.char, _type int, status int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventBlockJob{
Disk: C.GoString(disk),
Type: DomainBlockJobType(_type),
Status: ConnectDomainEventBlockJobStatus(status),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventBlockJobCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventDiskChangeCallback
func domainEventDiskChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
oldSrcPath *C.char, newSrcPath *C.char, devAlias *C.char,
reason int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventDiskChange{
OldSrcPath: C.GoString(oldSrcPath),
NewSrcPath: C.GoString(newSrcPath),
DevAlias: C.GoString(devAlias),
Reason: ConnectDomainEventDiskChangeReason(reason),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventDiskChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventTrayChangeCallback
func domainEventTrayChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
devAlias *C.char, reason int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventTrayChange{
DevAlias: C.GoString(devAlias),
Reason: ConnectDomainEventTrayChangeReason(reason),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventTrayChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventPMSuspendCallback
func domainEventPMSuspendCallback(c C.virConnectPtr, d C.virDomainPtr,
reason int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventPMSuspend{
Reason: reason,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventPMSuspendCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventPMWakeupCallback
func domainEventPMWakeupCallback(c C.virConnectPtr, d C.virDomainPtr,
reason int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventPMWakeup{
Reason: reason,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventPMWakeupCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventPMSuspendDiskCallback
func domainEventPMSuspendDiskCallback(c C.virConnectPtr, d C.virDomainPtr,
reason int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventPMSuspendDisk{
Reason: reason,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventPMSuspendDiskCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventBalloonChangeCallback
func domainEventBalloonChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
actual uint64, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventBalloonChange{
Actual: actual,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventBalloonChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventDeviceRemovedCallback
func domainEventDeviceRemovedCallback(c C.virConnectPtr, d C.virDomainPtr,
devAlias *C.char, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventDeviceRemoved{
DevAlias: C.GoString(devAlias),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventDeviceRemovedCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventMetadataChangeCallback
func domainEventMetadataChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
mtype int, nsuri *C.char, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventMetadataChange{
Type: DomainMetadataType(mtype),
NSURI: C.GoString(nsuri),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventMetadataChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
func getDomainTuneSchedulerParametersFieldInfo(params *DomainSchedulerParameters) map[string]typedParamsFieldInfo {
return map[string]typedParamsFieldInfo{
C.VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES: typedParamsFieldInfo{
set: ¶ms.CpuSharesSet,
ul: ¶ms.CpuShares,
},
C.VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD: typedParamsFieldInfo{
set: ¶ms.GlobalPeriodSet,
ul: ¶ms.GlobalPeriod,
},
C.VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA: typedParamsFieldInfo{
set: ¶ms.GlobalQuotaSet,
l: ¶ms.GlobalQuota,
},
C.VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD: typedParamsFieldInfo{
set: ¶ms.EmulatorPeriodSet,
ul: ¶ms.EmulatorPeriod,
},
C.VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA: typedParamsFieldInfo{
set: ¶ms.EmulatorQuotaSet,
l: ¶ms.EmulatorQuota,
},
C.VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD: typedParamsFieldInfo{
set: ¶ms.VcpuPeriodSet,
ul: ¶ms.VcpuPeriod,
},
C.VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA: typedParamsFieldInfo{
set: ¶ms.VcpuQuotaSet,
l: ¶ms.VcpuQuota,
},
C.VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD: typedParamsFieldInfo{
set: ¶ms.IothreadPeriodSet,
ul: ¶ms.IothreadPeriod,
},
C.VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA: typedParamsFieldInfo{
set: ¶ms.IothreadQuotaSet,
l: ¶ms.IothreadQuota,
},
}
}
func getTuneBlockIoTuneParametersFieldInfo(params *DomainBlockIoTuneParameters) map[string]typedParamsFieldInfo {
return map[string]typedParamsFieldInfo{
C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC: typedParamsFieldInfo{
set: ¶ms.TotalBytesSecSet,
ul: ¶ms.TotalBytesSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC: typedParamsFieldInfo{
set: ¶ms.ReadBytesSecSet,
ul: ¶ms.ReadBytesSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC: typedParamsFieldInfo{
set: ¶ms.WriteBytesSecSet,
ul: ¶ms.WriteBytesSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC: typedParamsFieldInfo{
set: ¶ms.TotalIopsSecSet,
ul: ¶ms.TotalIopsSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC: typedParamsFieldInfo{
set: ¶ms.ReadIopsSecSet,
ul: ¶ms.ReadIopsSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC: typedParamsFieldInfo{
set: ¶ms.WriteIopsSecSet,
ul: ¶ms.WriteIopsSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX: typedParamsFieldInfo{
set: ¶ms.TotalBytesSecMaxSet,
ul: ¶ms.TotalBytesSecMax,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX: typedParamsFieldInfo{
set: ¶ms.ReadBytesSecMaxSet,
ul: ¶ms.ReadBytesSecMax,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX: typedParamsFieldInfo{
set: ¶ms.WriteBytesSecMaxSet,
ul: ¶ms.WriteBytesSecMax,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX: typedParamsFieldInfo{
set: ¶ms.TotalIopsSecMaxSet,
ul: ¶ms.TotalIopsSecMax,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX: typedParamsFieldInfo{
set: ¶ms.ReadIopsSecMaxSet,
ul: ¶ms.ReadIopsSecMax,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX: typedParamsFieldInfo{
set: ¶ms.WriteIopsSecMaxSet,
ul: ¶ms.WriteIopsSecMax,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
set: ¶ms.TotalBytesSecMaxLengthSet,
ul: ¶ms.TotalBytesSecMaxLength,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
set: ¶ms.ReadBytesSecMaxLengthSet,
ul: ¶ms.ReadBytesSecMaxLength,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
set: ¶ms.WriteBytesSecMaxLengthSet,
ul: ¶ms.WriteBytesSecMaxLength,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
set: ¶ms.TotalIopsSecMaxLengthSet,
ul: ¶ms.TotalIopsSecMaxLength,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
set: ¶ms.ReadIopsSecMaxLengthSet,
ul: ¶ms.ReadIopsSecMaxLength,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
set: ¶ms.WriteIopsSecMaxLengthSet,
ul: ¶ms.WriteIopsSecMaxLength,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC: typedParamsFieldInfo{
set: ¶ms.SizeIopsSecSet,
ul: ¶ms.SizeIopsSec,
},
C.VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME: typedParamsFieldInfo{
set: ¶ms.GroupNameSet,
s: ¶ms.GroupName,
},
}
}
type domainEventTunablePinTemp struct {
VcpuPinSet bool
VcpuPin []string
EmulatorPinSet bool
EmulatorPin string
IOThreadPinSet bool
IOThreadPin []string
}
func getDomainPinTempFieldInfo(numvcpu int, numiothread int, params *domainEventTunablePinTemp) map[string]typedParamsFieldInfo {
ret := map[string]typedParamsFieldInfo{
C.VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN: typedParamsFieldInfo{
set: ¶ms.EmulatorPinSet,
s: ¶ms.EmulatorPin,
},
}
for i := 0; i < numvcpu; i++ {
ret[fmt.Sprintf("cputune.vcpupin%d", i)] = typedParamsFieldInfo{
s: ¶ms.VcpuPin[i],
}
}
for i := 0; i < numiothread; i++ {
ret[fmt.Sprintf("cputune.iothreadpin%d", i)] = typedParamsFieldInfo{
s: ¶ms.IOThreadPin[i],
}
}
return ret
}
func countPinInfo(cparams C.virTypedParameterPtr, nparams C.int) (int, int) {
maxvcpus := 0
maxiothreads := 0
for i := 0; i < int(nparams); i++ {
var cparam *C.virTypedParameter
cparam = (*C.virTypedParameter)(unsafe.Pointer(uintptr(unsafe.Pointer(cparams)) + unsafe.Sizeof(*cparam)*uintptr(i)))
name := C.GoString((*C.char)(unsafe.Pointer(&cparam.field)))
var vcpu int
_, err := fmt.Scanf(name, "cputune.vcpupin%d", &vcpu)
if err == nil {
if vcpu > maxvcpus {
maxvcpus = vcpu
}
}
var iothread int
_, err = fmt.Scanf(name, "cputune.iothreadpin%d", &iothread)
if err == nil {
if iothread > maxiothreads {
maxiothreads = iothread
}
}
}
return maxvcpus + 1, maxiothreads + 1
}
func domainEventTunableGetPin(params C.virTypedParameterPtr, cnparams C.int) *DomainEventTunableCpuPin {
var pin domainEventTunablePinTemp
numvcpus, numiothreads := countPinInfo(params, cnparams)
pinInfo := getDomainPinTempFieldInfo(numvcpus, numiothreads, &pin)
num, err := typedParamsUnpack(params, cnparams, pinInfo)
if num == 0 || err != nil {
return nil
}
info := &DomainEventTunableCpuPin{}
if pin.VcpuPinSet {
info.VcpuPinSet = true
info.VcpuPin = make([][]bool, len(pin.VcpuPin))
for i := 0; i < len(pin.VcpuPin); i++ {
bits, err := parseCPUString(pin.VcpuPin[i])
if err == nil {
info.VcpuPin[i] = bits
}
}
}
if pin.EmulatorPinSet {
bits, err := parseCPUString(pin.EmulatorPin)
if err == nil {
info.EmulatorPinSet = true
info.EmulatorPin = bits
}
}
if pin.IOThreadPinSet {
info.IOThreadPinSet = true
info.IOThreadPin = make([][]bool, len(pin.IOThreadPin))
for i := 0; i < len(pin.IOThreadPin); i++ {
bits, err := parseCPUString(pin.IOThreadPin[i])
if err == nil {
info.IOThreadPin[i] = bits
}
}
}
return info
}
//export domainEventTunableCallback
func domainEventTunableCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, cnparams C.int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventTunable{}
pin := domainEventTunableGetPin(params, cnparams)
if pin != nil {
eventDetails.CpuPin = pin
}
var sched DomainSchedulerParameters
schedInfo := getDomainTuneSchedulerParametersFieldInfo(&sched)
num, _ := typedParamsUnpack(params, cnparams, schedInfo)
if num > 0 {
eventDetails.CpuSched = &sched
}
blknameInfo := map[string]typedParamsFieldInfo{
C.VIR_DOMAIN_TUNABLE_BLKDEV_DISK: typedParamsFieldInfo{
set: &eventDetails.BlkdevDiskSet,
s: &eventDetails.BlkdevDisk,
},
}
typedParamsUnpack(params, cnparams, blknameInfo)
var blktune DomainBlockIoTuneParameters
blktuneInfo := getTuneBlockIoTuneParametersFieldInfo(&blktune)
num, _ = typedParamsUnpack(params, cnparams, blktuneInfo)
if num > 0 {
eventDetails.BlkdevTune = &blktune
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventTunableCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventAgentLifecycleCallback
func domainEventAgentLifecycleCallback(c C.virConnectPtr, d C.virDomainPtr, state C.int, reason C.int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventAgentLifecycle{
State: ConnectDomainEventAgentLifecycleState(state),
Reason: ConnectDomainEventAgentLifecycleReason(reason),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventAgentLifecycleCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventDeviceAddedCallback
func domainEventDeviceAddedCallback(c C.virConnectPtr, d C.virDomainPtr, devalias *C.char, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventDeviceAdded{
DevAlias: C.GoString(devalias),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventDeviceAddedCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventMigrationIterationCallback
func domainEventMigrationIterationCallback(c C.virConnectPtr, d C.virDomainPtr, iteration C.int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventMigrationIteration{
Iteration: int(iteration),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventMigrationIterationCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventJobCompletedCallback
func domainEventJobCompletedCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, cnparams C.int, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventJobCompleted{}
info := getDomainJobInfoFieldInfo(&eventDetails.Info)
typedParamsUnpack(params, cnparams, info)
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventJobCompletedCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventDeviceRemovalFailedCallback
func domainEventDeviceRemovalFailedCallback(c C.virConnectPtr, d C.virDomainPtr, devalias *C.char, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventDeviceRemovalFailed{
DevAlias: C.GoString(devalias),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventDeviceRemovalFailedCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventBlockThresholdCallback
func domainEventBlockThresholdCallback(c C.virConnectPtr, d C.virDomainPtr, dev *C.char, path *C.char, threshold C.ulonglong, excess C.ulonglong, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventBlockThreshold{
Dev: C.GoString(dev),
Path: C.GoString(path),
Threshold: uint64(threshold),
Excess: uint64(excess),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventBlockThresholdCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventMemoryFailureCallback
func domainEventMemoryFailureCallback(c C.virConnectPtr, d C.virDomainPtr, recipient C.int, action C.int, flags C.uint, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventMemoryFailure{
Recipient: DomainMemoryFailureRecipientType(recipient),
Action: DomainMemoryFailureActionType(action),
Flags: DomainMemoryFailureFlags(flags),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventMemoryFailureCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
//export domainEventMemoryDeviceSizeChangeCallback
func domainEventMemoryDeviceSizeChangeCallback(c C.virConnectPtr, d C.virDomainPtr, alias *C.char, size C.ulonglong, goCallbackId int) {
domain := &Domain{ptr: d}
connection := &Connect{ptr: c}
eventDetails := &DomainEventMemoryDeviceSizeChange{
Alias: C.GoString(alias),
Size: uint64(size),
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(DomainEventMemoryDeviceSizeChangeCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, domain, eventDetails)
}
func (c *Connect) DomainEventLifecycleRegister(dom *Domain, callback DomainEventLifecycleCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.domainEventLifecycleCallbackHelper)
var cdom C.virDomainPtr
if dom != nil {
cdom = dom.ptr
}
var err C.virError
ret := C.virConnectDomainEventRegisterAnyHelper(c.ptr, cdom,
C.VIR_DOMAIN_EVENT_ID_LIFECYCLE,
C.virConnectDomainEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) DomainEventRebootRegister(dom *Domain, callback DomainEventGenericCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.domainEventGenericCallbackHelper)
var cdom C.virDomainPtr
if dom != nil {
cdom = dom.ptr
}
var err C.virError
ret := C.virConnectDomainEventRegisterAnyHelper(c.ptr, cdom,
C.VIR_DOMAIN_EVENT_ID_REBOOT,
C.virConnectDomainEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) DomainEventRTCChangeRegister(dom *Domain, callback DomainEventRTCChangeCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.domainEventRTCChangeCallbackHelper)
var cdom C.virDomainPtr
if dom != nil {
cdom = dom.ptr
}
var err C.virError
ret := C.virConnectDomainEventRegisterAnyHelper(c.ptr, cdom,
C.VIR_DOMAIN_EVENT_ID_RTC_CHANGE,
C.virConnectDomainEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) DomainEventWatchdogRegister(dom *Domain, callback DomainEventWatchdogCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.domainEventWatchdogCallbackHelper)
var cdom C.virDomainPtr
if dom != nil {
cdom = dom.ptr
}
var err C.virError
ret := C.virConnectDomainEventRegisterAnyHelper(c.ptr, cdom,
C.VIR_DOMAIN_EVENT_ID_WATCHDOG,
C.virConnectDomainEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) DomainEventIOErrorRegister(dom *Domain, callback DomainEventIOErrorCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.domainEventIOErrorCallbackHelper)
var cdom C.virDomainPtr
if dom != nil {
cdom = dom.ptr
}
var err C.virError
ret := C.virConnectDomainEventRegisterAnyHelper(c.ptr, cdom,
C.VIR_DOMAIN_EVENT_ID_IO_ERROR,
C.virConnectDomainEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) DomainEventGraphicsRegister(dom *Domain, callback DomainEventGraphicsCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.domainEventGraphicsCallbackHelper)
var cdom C.virDomainPtr
if dom != nil {
cdom = dom.ptr
}
var err C.virError
ret := C.virConnectDomainEventRegisterAnyHelper(c.ptr, cdom,
C.VIR_DOMAIN_EVENT_ID_GRAPHICS,
C.virConnectDomainEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_secret.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_secret.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectListAllSecretsFuncType)(virConnectPtr conn,
virSecretPtr ** secrets,
unsigned int flags);
int
virConnectListAllSecretsWrapper(virConnectPtr conn,
virSecretPtr ** secrets,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllSecretsFuncType virConnectListAllSecretsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllSecrets",
(void**)&virConnectListAllSecretsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllSecretsSymbol(conn,
secrets,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListSecretsFuncType)(virConnectPtr conn,
char ** uuids,
int maxuuids);
int
virConnectListSecretsWrapper(virConnectPtr conn,
char ** uuids,
int maxuuids,
virErrorPtr err)
{
int ret = -1;
static virConnectListSecretsFuncType virConnectListSecretsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListSecrets",
(void**)&virConnectListSecretsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListSecretsSymbol(conn,
uuids,
maxuuids);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfSecretsFuncType)(virConnectPtr conn);
int
virConnectNumOfSecretsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfSecretsFuncType virConnectNumOfSecretsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfSecrets",
(void**)&virConnectNumOfSecretsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfSecretsSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectSecretEventDeregisterAnyFuncType)(virConnectPtr conn,
int callbackID);
int
virConnectSecretEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
static virConnectSecretEventDeregisterAnyFuncType virConnectSecretEventDeregisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectSecretEventDeregisterAny",
(void**)&virConnectSecretEventDeregisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectSecretEventDeregisterAnySymbol(conn,
callbackID);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectSecretEventRegisterAnyFuncType)(virConnectPtr conn,
virSecretPtr secret,
int eventID,
virConnectSecretEventGenericCallback cb,
void * opaque,
virFreeCallback freecb);
int
virConnectSecretEventRegisterAnyWrapper(virConnectPtr conn,
virSecretPtr secret,
int eventID,
virConnectSecretEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectSecretEventRegisterAnyFuncType virConnectSecretEventRegisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectSecretEventRegisterAny",
(void**)&virConnectSecretEventRegisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectSecretEventRegisterAnySymbol(conn,
secret,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virSecretPtr
(*virSecretDefineXMLFuncType)(virConnectPtr conn,
const char * xml,
unsigned int flags);
virSecretPtr
virSecretDefineXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virSecretPtr ret = NULL;
static virSecretDefineXMLFuncType virSecretDefineXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretDefineXML",
(void**)&virSecretDefineXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretDefineXMLSymbol(conn,
xml,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretFreeFuncType)(virSecretPtr secret);
int
virSecretFreeWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
static virSecretFreeFuncType virSecretFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretFree",
(void**)&virSecretFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretFreeSymbol(secret);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virSecretGetConnectFuncType)(virSecretPtr secret);
virConnectPtr
virSecretGetConnectWrapper(virSecretPtr secret,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virSecretGetConnectFuncType virSecretGetConnectSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetConnect",
(void**)&virSecretGetConnectSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetConnectSymbol(secret);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretGetUUIDFuncType)(virSecretPtr secret,
unsigned char * uuid);
int
virSecretGetUUIDWrapper(virSecretPtr secret,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
static virSecretGetUUIDFuncType virSecretGetUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetUUID",
(void**)&virSecretGetUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetUUIDSymbol(secret,
uuid);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretGetUUIDStringFuncType)(virSecretPtr secret,
char * buf);
int
virSecretGetUUIDStringWrapper(virSecretPtr secret,
char * buf,
virErrorPtr err)
{
int ret = -1;
static virSecretGetUUIDStringFuncType virSecretGetUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetUUIDString",
(void**)&virSecretGetUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetUUIDStringSymbol(secret,
buf);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virSecretGetUsageIDFuncType)(virSecretPtr secret);
const char *
virSecretGetUsageIDWrapper(virSecretPtr secret,
virErrorPtr err)
{
const char * ret = NULL;
static virSecretGetUsageIDFuncType virSecretGetUsageIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetUsageID",
(void**)&virSecretGetUsageIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetUsageIDSymbol(secret);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretGetUsageTypeFuncType)(virSecretPtr secret);
int
virSecretGetUsageTypeWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
static virSecretGetUsageTypeFuncType virSecretGetUsageTypeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetUsageType",
(void**)&virSecretGetUsageTypeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetUsageTypeSymbol(secret);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef unsigned char *
(*virSecretGetValueFuncType)(virSecretPtr secret,
size_t * value_size,
unsigned int flags);
unsigned char *
virSecretGetValueWrapper(virSecretPtr secret,
size_t * value_size,
unsigned int flags,
virErrorPtr err)
{
unsigned char * ret = NULL;
static virSecretGetValueFuncType virSecretGetValueSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetValue",
(void**)&virSecretGetValueSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetValueSymbol(secret,
value_size,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virSecretGetXMLDescFuncType)(virSecretPtr secret,
unsigned int flags);
char *
virSecretGetXMLDescWrapper(virSecretPtr secret,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virSecretGetXMLDescFuncType virSecretGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretGetXMLDesc",
(void**)&virSecretGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretGetXMLDescSymbol(secret,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virSecretPtr
(*virSecretLookupByUUIDFuncType)(virConnectPtr conn,
const unsigned char * uuid);
virSecretPtr
virSecretLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virSecretPtr ret = NULL;
static virSecretLookupByUUIDFuncType virSecretLookupByUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretLookupByUUID",
(void**)&virSecretLookupByUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretLookupByUUIDSymbol(conn,
uuid);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virSecretPtr
(*virSecretLookupByUUIDStringFuncType)(virConnectPtr conn,
const char * uuidstr);
virSecretPtr
virSecretLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virSecretPtr ret = NULL;
static virSecretLookupByUUIDStringFuncType virSecretLookupByUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretLookupByUUIDString",
(void**)&virSecretLookupByUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretLookupByUUIDStringSymbol(conn,
uuidstr);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virSecretPtr
(*virSecretLookupByUsageFuncType)(virConnectPtr conn,
int usageType,
const char * usageID);
virSecretPtr
virSecretLookupByUsageWrapper(virConnectPtr conn,
int usageType,
const char * usageID,
virErrorPtr err)
{
virSecretPtr ret = NULL;
static virSecretLookupByUsageFuncType virSecretLookupByUsageSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretLookupByUsage",
(void**)&virSecretLookupByUsageSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretLookupByUsageSymbol(conn,
usageType,
usageID);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretRefFuncType)(virSecretPtr secret);
int
virSecretRefWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
static virSecretRefFuncType virSecretRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretRef",
(void**)&virSecretRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretRefSymbol(secret);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretSetValueFuncType)(virSecretPtr secret,
const unsigned char * value,
size_t value_size,
unsigned int flags);
int
virSecretSetValueWrapper(virSecretPtr secret,
const unsigned char * value,
size_t value_size,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virSecretSetValueFuncType virSecretSetValueSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretSetValue",
(void**)&virSecretSetValueSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretSetValueSymbol(secret,
value,
value_size,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virSecretUndefineFuncType)(virSecretPtr secret);
int
virSecretUndefineWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
static virSecretUndefineFuncType virSecretUndefineSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virSecretUndefine",
(void**)&virSecretUndefineSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virSecretUndefineSymbol(secret);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/storage_pool_events.go | vendor/libvirt.org/go/libvirt/storage_pool_events.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
import (
"fmt"
"unsafe"
)
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include "storage_pool_events_helper.h"
*/
import "C"
type StoragePoolEventLifecycle struct {
Event StoragePoolEventLifecycleType
// TODO: we can make Detail typesafe somehow ?
Detail int
}
type StoragePoolEventLifecycleCallback func(c *Connect, n *StoragePool, event *StoragePoolEventLifecycle)
type StoragePoolEventGenericCallback func(c *Connect, n *StoragePool)
//export storagePoolEventLifecycleCallback
func storagePoolEventLifecycleCallback(c C.virConnectPtr, s C.virStoragePoolPtr,
event int, detail int,
goCallbackId int) {
storage_pool := &StoragePool{ptr: s}
connection := &Connect{ptr: c}
eventDetails := &StoragePoolEventLifecycle{
Event: StoragePoolEventLifecycleType(event),
Detail: detail,
}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(StoragePoolEventLifecycleCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, storage_pool, eventDetails)
}
//export storagePoolEventGenericCallback
func storagePoolEventGenericCallback(c C.virConnectPtr, s C.virStoragePoolPtr,
goCallbackId int) {
storage_pool := &StoragePool{ptr: s}
connection := &Connect{ptr: c}
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(StoragePoolEventGenericCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(connection, storage_pool)
}
func (c *Connect) StoragePoolEventLifecycleRegister(pool *StoragePool, callback StoragePoolEventLifecycleCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.storagePoolEventLifecycleCallbackHelper)
var cpool C.virStoragePoolPtr
if pool != nil {
cpool = pool.ptr
}
var err C.virError
ret := C.virConnectStoragePoolEventRegisterAnyHelper(c.ptr, cpool,
C.VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
C.virConnectStoragePoolEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) StoragePoolEventRefreshRegister(pool *StoragePool, callback StoragePoolEventGenericCallback) (int, error) {
goCallBackId := registerCallbackId(callback)
callbackPtr := unsafe.Pointer(C.storagePoolEventGenericCallbackHelper)
var cpool C.virStoragePoolPtr
if pool != nil {
cpool = pool.ptr
}
var err C.virError
ret := C.virConnectStoragePoolEventRegisterAnyHelper(c.ptr, cpool,
C.VIR_STORAGE_POOL_EVENT_ID_REFRESH,
C.virConnectStoragePoolEventGenericCallback(callbackPtr),
C.long(goCallBackId), &err)
if ret == -1 {
freeCallbackId(goCallBackId)
return 0, makeError(&err)
}
return int(ret), nil
}
func (c *Connect) StoragePoolEventDeregister(callbackId int) error {
// Deregister the callback
var err C.virError
ret := int(C.virConnectStoragePoolEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
if ret < 0 {
return makeError(&err)
}
return nil
}
func (e StoragePoolEventLifecycle) String() string {
var event string
switch e.Event {
case STORAGE_POOL_EVENT_DEFINED:
event = "defined"
case STORAGE_POOL_EVENT_UNDEFINED:
event = "undefined"
case STORAGE_POOL_EVENT_STARTED:
event = "started"
case STORAGE_POOL_EVENT_STOPPED:
event = "stopped"
case STORAGE_POOL_EVENT_CREATED:
event = "created"
case STORAGE_POOL_EVENT_DELETED:
event = "deleted"
default:
event = "unknown"
}
return fmt.Sprintf("StoragePool event=%q", event)
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_interface.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_interface.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectListAllInterfacesFuncType)(virConnectPtr conn,
virInterfacePtr ** ifaces,
unsigned int flags);
int
virConnectListAllInterfacesWrapper(virConnectPtr conn,
virInterfacePtr ** ifaces,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllInterfacesFuncType virConnectListAllInterfacesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllInterfaces",
(void**)&virConnectListAllInterfacesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllInterfacesSymbol(conn,
ifaces,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListDefinedInterfacesFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListDefinedInterfacesWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListDefinedInterfacesFuncType virConnectListDefinedInterfacesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListDefinedInterfaces",
(void**)&virConnectListDefinedInterfacesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListDefinedInterfacesSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListInterfacesFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListInterfacesWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListInterfacesFuncType virConnectListInterfacesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListInterfaces",
(void**)&virConnectListInterfacesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListInterfacesSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfDefinedInterfacesFuncType)(virConnectPtr conn);
int
virConnectNumOfDefinedInterfacesWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfDefinedInterfacesFuncType virConnectNumOfDefinedInterfacesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfDefinedInterfaces",
(void**)&virConnectNumOfDefinedInterfacesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfDefinedInterfacesSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfInterfacesFuncType)(virConnectPtr conn);
int
virConnectNumOfInterfacesWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfInterfacesFuncType virConnectNumOfInterfacesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfInterfaces",
(void**)&virConnectNumOfInterfacesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfInterfacesSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceChangeBeginFuncType)(virConnectPtr conn,
unsigned int flags);
int
virInterfaceChangeBeginWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virInterfaceChangeBeginFuncType virInterfaceChangeBeginSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceChangeBegin",
(void**)&virInterfaceChangeBeginSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceChangeBeginSymbol(conn,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceChangeCommitFuncType)(virConnectPtr conn,
unsigned int flags);
int
virInterfaceChangeCommitWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virInterfaceChangeCommitFuncType virInterfaceChangeCommitSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceChangeCommit",
(void**)&virInterfaceChangeCommitSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceChangeCommitSymbol(conn,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceChangeRollbackFuncType)(virConnectPtr conn,
unsigned int flags);
int
virInterfaceChangeRollbackWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virInterfaceChangeRollbackFuncType virInterfaceChangeRollbackSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceChangeRollback",
(void**)&virInterfaceChangeRollbackSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceChangeRollbackSymbol(conn,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceCreateFuncType)(virInterfacePtr iface,
unsigned int flags);
int
virInterfaceCreateWrapper(virInterfacePtr iface,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virInterfaceCreateFuncType virInterfaceCreateSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceCreate",
(void**)&virInterfaceCreateSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceCreateSymbol(iface,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virInterfacePtr
(*virInterfaceDefineXMLFuncType)(virConnectPtr conn,
const char * xml,
unsigned int flags);
virInterfacePtr
virInterfaceDefineXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virInterfacePtr ret = NULL;
static virInterfaceDefineXMLFuncType virInterfaceDefineXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceDefineXML",
(void**)&virInterfaceDefineXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceDefineXMLSymbol(conn,
xml,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceDestroyFuncType)(virInterfacePtr iface,
unsigned int flags);
int
virInterfaceDestroyWrapper(virInterfacePtr iface,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virInterfaceDestroyFuncType virInterfaceDestroySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceDestroy",
(void**)&virInterfaceDestroySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceDestroySymbol(iface,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceFreeFuncType)(virInterfacePtr iface);
int
virInterfaceFreeWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
static virInterfaceFreeFuncType virInterfaceFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceFree",
(void**)&virInterfaceFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceFreeSymbol(iface);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virInterfaceGetConnectFuncType)(virInterfacePtr iface);
virConnectPtr
virInterfaceGetConnectWrapper(virInterfacePtr iface,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virInterfaceGetConnectFuncType virInterfaceGetConnectSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceGetConnect",
(void**)&virInterfaceGetConnectSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceGetConnectSymbol(iface);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virInterfaceGetMACStringFuncType)(virInterfacePtr iface);
const char *
virInterfaceGetMACStringWrapper(virInterfacePtr iface,
virErrorPtr err)
{
const char * ret = NULL;
static virInterfaceGetMACStringFuncType virInterfaceGetMACStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceGetMACString",
(void**)&virInterfaceGetMACStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceGetMACStringSymbol(iface);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virInterfaceGetNameFuncType)(virInterfacePtr iface);
const char *
virInterfaceGetNameWrapper(virInterfacePtr iface,
virErrorPtr err)
{
const char * ret = NULL;
static virInterfaceGetNameFuncType virInterfaceGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceGetName",
(void**)&virInterfaceGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceGetNameSymbol(iface);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virInterfaceGetXMLDescFuncType)(virInterfacePtr iface,
unsigned int flags);
char *
virInterfaceGetXMLDescWrapper(virInterfacePtr iface,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virInterfaceGetXMLDescFuncType virInterfaceGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceGetXMLDesc",
(void**)&virInterfaceGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceGetXMLDescSymbol(iface,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceIsActiveFuncType)(virInterfacePtr iface);
int
virInterfaceIsActiveWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
static virInterfaceIsActiveFuncType virInterfaceIsActiveSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceIsActive",
(void**)&virInterfaceIsActiveSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceIsActiveSymbol(iface);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virInterfacePtr
(*virInterfaceLookupByMACStringFuncType)(virConnectPtr conn,
const char * macstr);
virInterfacePtr
virInterfaceLookupByMACStringWrapper(virConnectPtr conn,
const char * macstr,
virErrorPtr err)
{
virInterfacePtr ret = NULL;
static virInterfaceLookupByMACStringFuncType virInterfaceLookupByMACStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceLookupByMACString",
(void**)&virInterfaceLookupByMACStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceLookupByMACStringSymbol(conn,
macstr);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virInterfacePtr
(*virInterfaceLookupByNameFuncType)(virConnectPtr conn,
const char * name);
virInterfacePtr
virInterfaceLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virInterfacePtr ret = NULL;
static virInterfaceLookupByNameFuncType virInterfaceLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceLookupByName",
(void**)&virInterfaceLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceLookupByNameSymbol(conn,
name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceRefFuncType)(virInterfacePtr iface);
int
virInterfaceRefWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
static virInterfaceRefFuncType virInterfaceRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceRef",
(void**)&virInterfaceRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceRefSymbol(iface);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virInterfaceUndefineFuncType)(virInterfacePtr iface);
int
virInterfaceUndefineWrapper(virInterfacePtr iface,
virErrorPtr err)
{
int ret = -1;
static virInterfaceUndefineFuncType virInterfaceUndefineSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virInterfaceUndefine",
(void**)&virInterfaceUndefineSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virInterfaceUndefineSymbol(iface);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/stream_helper.go | vendor/libvirt.org/go/libvirt/stream_helper.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdint.h>
#include "stream_helper.h"
int streamSourceCallback(virStreamPtr st, char *cdata, size_t nbytes, int callbackID);
int streamSourceHoleCallback(virStreamPtr st, int *inData, long long *length, int callbackID);
int streamSourceSkipCallback(virStreamPtr st, long long length, int callbackID);
int streamSinkCallback(virStreamPtr st, const char *cdata, size_t nbytes, int callbackID);
int streamSinkHoleCallback(virStreamPtr st, long long length, int callbackID);
struct CallbackData {
int callbackID;
int holeCallbackID;
int skipCallbackID;
};
static int streamSourceCallbackHelper(virStreamPtr st, char *data, size_t nbytes, void *opaque)
{
struct CallbackData *cbdata = opaque;
return streamSourceCallback(st, data, nbytes, cbdata->callbackID);
}
static int streamSourceHoleCallbackHelper(virStreamPtr st, int *inData, long long *length, void *opaque)
{
struct CallbackData *cbdata = opaque;
return streamSourceHoleCallback(st, inData, length, cbdata->holeCallbackID);
}
static int streamSourceSkipCallbackHelper(virStreamPtr st, long long length, void *opaque)
{
struct CallbackData *cbdata = opaque;
return streamSourceSkipCallback(st, length, cbdata->skipCallbackID);
}
static int streamSinkCallbackHelper(virStreamPtr st, const char *data, size_t nbytes, void *opaque)
{
struct CallbackData *cbdata = opaque;
return streamSinkCallback(st, data, nbytes, cbdata->callbackID);
}
static int streamSinkHoleCallbackHelper(virStreamPtr st, long long length, void *opaque)
{
struct CallbackData *cbdata = opaque;
return streamSinkHoleCallback(st, length, cbdata->holeCallbackID);
}
void
streamEventCallback(virStreamPtr st, int events, int callbackID);
static void
streamEventCallbackHelper(virStreamPtr st, int events, void *opaque)
{
streamEventCallback(st, events, (int)(intptr_t)opaque);
}
int
virStreamEventAddCallbackHelper(virStreamPtr stream,
int events,
int callbackID,
virErrorPtr err)
{
return virStreamEventAddCallbackWrapper(stream, events, streamEventCallbackHelper,
(void *)(intptr_t)callbackID, NULL, err);
}
int
virStreamRecvAllHelper(virStreamPtr stream,
int callbackID,
virErrorPtr err)
{
struct CallbackData cbdata = { .callbackID = callbackID };
return virStreamRecvAllWrapper(stream, streamSinkCallbackHelper, &cbdata, err);
}
int
virStreamSendAllHelper(virStreamPtr stream,
int callbackID,
virErrorPtr err)
{
struct CallbackData cbdata = { .callbackID = callbackID };
return virStreamSendAllWrapper(stream, streamSourceCallbackHelper, &cbdata, err);
}
int
virStreamSparseRecvAllHelper(virStreamPtr stream,
int callbackID,
int holeCallbackID,
virErrorPtr err)
{
struct CallbackData cbdata = { .callbackID = callbackID,
.holeCallbackID = holeCallbackID };
return virStreamSparseRecvAllWrapper(stream, streamSinkCallbackHelper,
streamSinkHoleCallbackHelper,
&cbdata, err);
}
int
virStreamSparseSendAllHelper(virStreamPtr stream,
int callbackID,
int holeCallbackID,
int skipCallbackID,
virErrorPtr err)
{
struct CallbackData cbdata = { .callbackID = callbackID,
.holeCallbackID = holeCallbackID,
.skipCallbackID = skipCallbackID };
return virStreamSparseSendAllWrapper(stream, streamSourceCallbackHelper,
streamSourceHoleCallbackHelper,
streamSourceSkipCallbackHelper,
&cbdata, err);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_network.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_network.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnectListAllNetworksWrapper(virConnectPtr conn,
virNetworkPtr ** nets,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virConnectListAllNetworks not available prior to libvirt version 0.10.2");
#else
ret = virConnectListAllNetworks(conn,
nets,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListDefinedNetworksWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virConnectListDefinedNetworks not available prior to libvirt version 0.2.0");
#else
ret = virConnectListDefinedNetworks(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListNetworksWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virConnectListNetworks not available prior to libvirt version 0.2.0");
#else
ret = virConnectListNetworks(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 1)
setVirError(err, "Function virConnectNetworkEventDeregisterAny not available prior to libvirt version 1.2.1");
#else
ret = virConnectNetworkEventDeregisterAny(conn,
callbackID);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNetworkEventRegisterAnyWrapper(virConnectPtr conn,
virNetworkPtr net,
int eventID,
virConnectNetworkEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 1)
setVirError(err, "Function virConnectNetworkEventRegisterAny not available prior to libvirt version 1.2.1");
#else
ret = virConnectNetworkEventRegisterAny(conn,
net,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfDefinedNetworksWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virConnectNumOfDefinedNetworks not available prior to libvirt version 0.2.0");
#else
ret = virConnectNumOfDefinedNetworks(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfNetworksWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virConnectNumOfNetworks not available prior to libvirt version 0.2.0");
#else
ret = virConnectNumOfNetworks(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkCreateWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkCreate not available prior to libvirt version 0.2.0");
#else
ret = virNetworkCreate(network);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkCreateXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkCreateXML not available prior to libvirt version 0.2.0");
#else
ret = virNetworkCreateXML(conn,
xmlDesc);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkCreateXMLFlagsWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(7, 8, 0)
setVirError(err, "Function virNetworkCreateXMLFlags not available prior to libvirt version 7.8.0");
#else
ret = virNetworkCreateXMLFlags(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
void
virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease)
{
#if !LIBVIR_CHECK_VERSION(1, 2, 6)
setVirError(NULL, "Function virNetworkDHCPLeaseFree not available prior to libvirt version 1.2.6");
#else
virNetworkDHCPLeaseFree(lease);
#endif
return;
}
virNetworkPtr
virNetworkDefineXMLWrapper(virConnectPtr conn,
const char * xml,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkDefineXML not available prior to libvirt version 0.2.0");
#else
ret = virNetworkDefineXML(conn,
xml);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkDefineXMLFlagsWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(7, 7, 0)
setVirError(err, "Function virNetworkDefineXMLFlags not available prior to libvirt version 7.7.0");
#else
ret = virNetworkDefineXMLFlags(conn,
xml,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkDestroyWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkDestroy not available prior to libvirt version 0.2.0");
#else
ret = virNetworkDestroy(network);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkFreeWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkFree not available prior to libvirt version 0.2.0");
#else
ret = virNetworkFree(network);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkGetAutostartWrapper(virNetworkPtr network,
int * autostart,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 1)
setVirError(err, "Function virNetworkGetAutostart not available prior to libvirt version 0.2.1");
#else
ret = virNetworkGetAutostart(network,
autostart);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNetworkGetBridgeNameWrapper(virNetworkPtr network,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkGetBridgeName not available prior to libvirt version 0.2.0");
#else
ret = virNetworkGetBridgeName(network);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virNetworkGetConnectWrapper(virNetworkPtr net,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 3, 0)
setVirError(err, "Function virNetworkGetConnect not available prior to libvirt version 0.3.0");
#else
ret = virNetworkGetConnect(net);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkGetDHCPLeasesWrapper(virNetworkPtr network,
const char * mac,
virNetworkDHCPLeasePtr ** leases,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 6)
setVirError(err, "Function virNetworkGetDHCPLeases not available prior to libvirt version 1.2.6");
#else
ret = virNetworkGetDHCPLeases(network,
mac,
leases,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNetworkGetMetadataWrapper(virNetworkPtr network,
int type,
const char * uri,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(9, 7, 0)
setVirError(err, "Function virNetworkGetMetadata not available prior to libvirt version 9.7.0");
#else
ret = virNetworkGetMetadata(network,
type,
uri,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virNetworkGetNameWrapper(virNetworkPtr network,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkGetName not available prior to libvirt version 0.2.0");
#else
ret = virNetworkGetName(network);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkGetUUIDWrapper(virNetworkPtr network,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkGetUUID not available prior to libvirt version 0.2.0");
#else
ret = virNetworkGetUUID(network,
uuid);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkGetUUIDStringWrapper(virNetworkPtr network,
char * buf,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkGetUUIDString not available prior to libvirt version 0.2.0");
#else
ret = virNetworkGetUUIDString(network,
buf);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNetworkGetXMLDescWrapper(virNetworkPtr network,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkGetXMLDesc not available prior to libvirt version 0.2.0");
#else
ret = virNetworkGetXMLDesc(network,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkIsActiveWrapper(virNetworkPtr net,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 3)
setVirError(err, "Function virNetworkIsActive not available prior to libvirt version 0.7.3");
#else
ret = virNetworkIsActive(net);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkIsPersistentWrapper(virNetworkPtr net,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 3)
setVirError(err, "Function virNetworkIsPersistent not available prior to libvirt version 0.7.3");
#else
ret = virNetworkIsPersistent(net);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkListAllPortsWrapper(virNetworkPtr network,
virNetworkPortPtr ** ports,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkListAllPorts not available prior to libvirt version 5.5.0");
#else
ret = virNetworkListAllPorts(network,
ports,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkLookupByName not available prior to libvirt version 0.2.0");
#else
ret = virNetworkLookupByName(conn,
name);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkLookupByUUID not available prior to libvirt version 0.2.0");
#else
ret = virNetworkLookupByUUID(conn,
uuid);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkLookupByUUIDString not available prior to libvirt version 0.2.0");
#else
ret = virNetworkLookupByUUIDString(conn,
uuidstr);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPortPtr
virNetworkPortCreateXMLWrapper(virNetworkPtr net,
const char * xmldesc,
unsigned int flags,
virErrorPtr err)
{
virNetworkPortPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortCreateXML not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortCreateXML(net,
xmldesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortDeleteWrapper(virNetworkPortPtr port,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortDelete not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortDelete(port,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortFreeWrapper(virNetworkPortPtr port,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortFree not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortFree(port);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPtr
virNetworkPortGetNetworkWrapper(virNetworkPortPtr port,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortGetNetwork not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortGetNetwork(port);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortGetParametersWrapper(virNetworkPortPtr port,
virTypedParameterPtr * params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortGetParameters not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortGetParameters(port,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortGetUUIDWrapper(virNetworkPortPtr port,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortGetUUID not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortGetUUID(port,
uuid);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortGetUUIDStringWrapper(virNetworkPortPtr port,
char * buf,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortGetUUIDString not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortGetUUIDString(port,
buf);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virNetworkPortGetXMLDescWrapper(virNetworkPortPtr port,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortGetXMLDesc not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortGetXMLDesc(port,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPortPtr
virNetworkPortLookupByUUIDWrapper(virNetworkPtr net,
const unsigned char * uuid,
virErrorPtr err)
{
virNetworkPortPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortLookupByUUID not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortLookupByUUID(net,
uuid);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virNetworkPortPtr
virNetworkPortLookupByUUIDStringWrapper(virNetworkPtr net,
const char * uuidstr,
virErrorPtr err)
{
virNetworkPortPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortLookupByUUIDString not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortLookupByUUIDString(net,
uuidstr);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortRefWrapper(virNetworkPortPtr port,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortRef not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortRef(port);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkPortSetParametersWrapper(virNetworkPortPtr port,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 5, 0)
setVirError(err, "Function virNetworkPortSetParameters not available prior to libvirt version 5.5.0");
#else
ret = virNetworkPortSetParameters(port,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkRefWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 0)
setVirError(err, "Function virNetworkRef not available prior to libvirt version 0.6.0");
#else
ret = virNetworkRef(network);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkSetAutostartWrapper(virNetworkPtr network,
int autostart,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 1)
setVirError(err, "Function virNetworkSetAutostart not available prior to libvirt version 0.2.1");
#else
ret = virNetworkSetAutostart(network,
autostart);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkSetMetadataWrapper(virNetworkPtr network,
int type,
const char * metadata,
const char * key,
const char * uri,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(9, 7, 0)
setVirError(err, "Function virNetworkSetMetadata not available prior to libvirt version 9.7.0");
#else
ret = virNetworkSetMetadata(network,
type,
metadata,
key,
uri,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkUndefineWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 0)
setVirError(err, "Function virNetworkUndefine not available prior to libvirt version 0.2.0");
#else
ret = virNetworkUndefine(network);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNetworkUpdateWrapper(virNetworkPtr network,
unsigned int command,
unsigned int section,
int parentIndex,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virNetworkUpdate not available prior to libvirt version 0.10.2");
#else
ret = virNetworkUpdate(network,
command,
section,
parentIndex,
xml,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/nwfilter_binding.go | vendor/libvirt.org/go/libvirt/nwfilter_binding.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2018 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"unsafe"
)
type NWFilterBinding struct {
ptr C.virNWFilterBindingPtr
}
type NWFilterBindingCreateFlags uint
const (
NWFILTER_BINDING_CREATE_VALIDATE = NetworkPortCreateFlags(C.VIR_NWFILTER_BINDING_CREATE_VALIDATE)
)
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingFree
func (f *NWFilterBinding) Free() error {
var err C.virError
ret := C.virNWFilterBindingFreeWrapper(f.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingRef
func (c *NWFilterBinding) Ref() error {
var err C.virError
ret := C.virNWFilterBindingRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingDelete
func (f *NWFilterBinding) Delete() error {
var err C.virError
result := C.virNWFilterBindingDeleteWrapper(f.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingGetPortDev
func (f *NWFilterBinding) GetPortDev() (string, error) {
var err C.virError
result := C.virNWFilterBindingGetPortDevWrapper(f.ptr, &err)
if result == nil {
return "", makeError(&err)
}
name := C.GoString(result)
C.free(unsafe.Pointer(result))
return name, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingGetFilterName
func (f *NWFilterBinding) GetFilterName() (string, error) {
var err C.virError
result := C.virNWFilterBindingGetFilterNameWrapper(f.ptr, &err)
if result == nil {
return "", makeError(&err)
}
name := C.GoString(result)
C.free(unsafe.Pointer(result))
return name, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingGetXMLDesc
func (f *NWFilterBinding) GetXMLDesc(flags uint32) (string, error) {
var err C.virError
result := C.virNWFilterBindingGetXMLDescWrapper(f.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/secret.go | vendor/libvirt.org/go/libvirt/secret.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"unsafe"
)
type SecretUsageType int
const (
SECRET_USAGE_TYPE_NONE = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_NONE)
SECRET_USAGE_TYPE_VOLUME = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_VOLUME)
SECRET_USAGE_TYPE_CEPH = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_CEPH)
SECRET_USAGE_TYPE_ISCSI = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_ISCSI)
SECRET_USAGE_TYPE_TLS = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_TLS)
SECRET_USAGE_TYPE_VTPM = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_VTPM)
)
type SecretDefineFlags uint
const (
SECRET_DEFINE_VALIDATE = SecretDefineFlags(C.VIR_SECRET_DEFINE_VALIDATE)
)
type SecretEventLifecycleType int
const (
SECRET_EVENT_DEFINED = SecretEventLifecycleType(C.VIR_SECRET_EVENT_DEFINED)
SECRET_EVENT_UNDEFINED = SecretEventLifecycleType(C.VIR_SECRET_EVENT_UNDEFINED)
)
type SecretEventID int
const (
SECRET_EVENT_ID_LIFECYCLE = SecretEventID(C.VIR_SECRET_EVENT_ID_LIFECYCLE)
SECRET_EVENT_ID_VALUE_CHANGED = SecretEventID(C.VIR_SECRET_EVENT_ID_VALUE_CHANGED)
)
type Secret struct {
ptr C.virSecretPtr
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretFree
func (s *Secret) Free() error {
var err C.virError
ret := C.virSecretFreeWrapper(s.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretRef
func (c *Secret) Ref() error {
var err C.virError
ret := C.virSecretRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretUndefine
func (s *Secret) Undefine() error {
var err C.virError
result := C.virSecretUndefineWrapper(s.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUUID
func (s *Secret) GetUUID() ([]byte, error) {
var cUuid [C.VIR_UUID_BUFLEN](byte)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virSecretGetUUIDWrapper(s.ptr, (*C.uchar)(cuidPtr), &err)
if result != 0 {
return []byte{}, makeError(&err)
}
return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUUIDString
func (s *Secret) GetUUIDString() (string, error) {
var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virSecretGetUUIDStringWrapper(s.ptr, (*C.char)(cuidPtr), &err)
if result != 0 {
return "", makeError(&err)
}
return C.GoString((*C.char)(cuidPtr)), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageID
func (s *Secret) GetUsageID() (string, error) {
var err C.virError
result := C.virSecretGetUsageIDWrapper(s.ptr, &err)
if result == nil {
return "", makeError(&err)
}
return C.GoString(result), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageType
func (s *Secret) GetUsageType() (SecretUsageType, error) {
var err C.virError
result := SecretUsageType(C.virSecretGetUsageTypeWrapper(s.ptr, &err))
if result == -1 {
return 0, makeError(&err)
}
return result, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetXMLDesc
func (s *Secret) GetXMLDesc(flags uint32) (string, error) {
var err C.virError
result := C.virSecretGetXMLDescWrapper(s.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetValue
func (s *Secret) GetValue(flags uint32) ([]byte, error) {
var cvalue_size C.size_t
var err C.virError
cvalue := C.virSecretGetValueWrapper(s.ptr, &cvalue_size, C.uint(flags), &err)
if cvalue == nil {
return nil, makeError(&err)
}
defer C.free(unsafe.Pointer(cvalue))
ret := C.GoBytes(unsafe.Pointer(cvalue), C.int(cvalue_size))
return ret, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretSetValue
func (s *Secret) SetValue(value []byte, flags uint32) error {
nvalue := len(value)
cvalue := make([]C.uchar, nvalue)
for i := 0; i < nvalue; i++ {
cvalue[i] = C.uchar(value[i])
}
var err C.virError
var cvaluePtr *C.uchar = nil
if nvalue > 0 {
cvaluePtr = &cvalue[0]
}
result := C.virSecretSetValueWrapper(s.ptr, cvaluePtr, C.size_t(nvalue), C.uint(flags), &err)
if result == -1 {
return makeError(&err)
}
return nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_nodedev.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_nodedev.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectListAllNodeDevicesFuncType)(virConnectPtr conn,
virNodeDevicePtr ** devices,
unsigned int flags);
int
virConnectListAllNodeDevicesWrapper(virConnectPtr conn,
virNodeDevicePtr ** devices,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllNodeDevicesFuncType virConnectListAllNodeDevicesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllNodeDevices",
(void**)&virConnectListAllNodeDevicesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllNodeDevicesSymbol(conn,
devices,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNodeDeviceEventDeregisterAnyFuncType)(virConnectPtr conn,
int callbackID);
int
virConnectNodeDeviceEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
static virConnectNodeDeviceEventDeregisterAnyFuncType virConnectNodeDeviceEventDeregisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNodeDeviceEventDeregisterAny",
(void**)&virConnectNodeDeviceEventDeregisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNodeDeviceEventDeregisterAnySymbol(conn,
callbackID);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNodeDeviceEventRegisterAnyFuncType)(virConnectPtr conn,
virNodeDevicePtr dev,
int eventID,
virConnectNodeDeviceEventGenericCallback cb,
void * opaque,
virFreeCallback freecb);
int
virConnectNodeDeviceEventRegisterAnyWrapper(virConnectPtr conn,
virNodeDevicePtr dev,
int eventID,
virConnectNodeDeviceEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectNodeDeviceEventRegisterAnyFuncType virConnectNodeDeviceEventRegisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNodeDeviceEventRegisterAny",
(void**)&virConnectNodeDeviceEventRegisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNodeDeviceEventRegisterAnySymbol(conn,
dev,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceCreateFuncType)(virNodeDevicePtr dev,
unsigned int flags);
int
virNodeDeviceCreateWrapper(virNodeDevicePtr dev,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceCreateFuncType virNodeDeviceCreateSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceCreate",
(void**)&virNodeDeviceCreateSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceCreateSymbol(dev,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNodeDevicePtr
(*virNodeDeviceCreateXMLFuncType)(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags);
virNodeDevicePtr
virNodeDeviceCreateXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
static virNodeDeviceCreateXMLFuncType virNodeDeviceCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceCreateXML",
(void**)&virNodeDeviceCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceCreateXMLSymbol(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNodeDevicePtr
(*virNodeDeviceDefineXMLFuncType)(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags);
virNodeDevicePtr
virNodeDeviceDefineXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
static virNodeDeviceDefineXMLFuncType virNodeDeviceDefineXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceDefineXML",
(void**)&virNodeDeviceDefineXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceDefineXMLSymbol(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceDestroyFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceDestroyWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceDestroyFuncType virNodeDeviceDestroySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceDestroy",
(void**)&virNodeDeviceDestroySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceDestroySymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceDetachFlagsFuncType)(virNodeDevicePtr dev,
const char * driverName,
unsigned int flags);
int
virNodeDeviceDetachFlagsWrapper(virNodeDevicePtr dev,
const char * driverName,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceDetachFlagsFuncType virNodeDeviceDetachFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceDetachFlags",
(void**)&virNodeDeviceDetachFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceDetachFlagsSymbol(dev,
driverName,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceDettachFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceDettachWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceDettachFuncType virNodeDeviceDettachSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceDettach",
(void**)&virNodeDeviceDettachSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceDettachSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceFreeFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceFreeWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceFreeFuncType virNodeDeviceFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceFree",
(void**)&virNodeDeviceFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceFreeSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceGetAutostartFuncType)(virNodeDevicePtr dev,
int * autostart);
int
virNodeDeviceGetAutostartWrapper(virNodeDevicePtr dev,
int * autostart,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceGetAutostartFuncType virNodeDeviceGetAutostartSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceGetAutostart",
(void**)&virNodeDeviceGetAutostartSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceGetAutostartSymbol(dev,
autostart);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virNodeDeviceGetNameFuncType)(virNodeDevicePtr dev);
const char *
virNodeDeviceGetNameWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
const char * ret = NULL;
static virNodeDeviceGetNameFuncType virNodeDeviceGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceGetName",
(void**)&virNodeDeviceGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceGetNameSymbol(dev);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virNodeDeviceGetParentFuncType)(virNodeDevicePtr dev);
const char *
virNodeDeviceGetParentWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
const char * ret = NULL;
static virNodeDeviceGetParentFuncType virNodeDeviceGetParentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceGetParent",
(void**)&virNodeDeviceGetParentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceGetParentSymbol(dev);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virNodeDeviceGetXMLDescFuncType)(virNodeDevicePtr dev,
unsigned int flags);
char *
virNodeDeviceGetXMLDescWrapper(virNodeDevicePtr dev,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virNodeDeviceGetXMLDescFuncType virNodeDeviceGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceGetXMLDesc",
(void**)&virNodeDeviceGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceGetXMLDescSymbol(dev,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceIsActiveFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceIsActiveWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceIsActiveFuncType virNodeDeviceIsActiveSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceIsActive",
(void**)&virNodeDeviceIsActiveSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceIsActiveSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceIsPersistentFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceIsPersistentWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceIsPersistentFuncType virNodeDeviceIsPersistentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceIsPersistent",
(void**)&virNodeDeviceIsPersistentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceIsPersistentSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceListCapsFuncType)(virNodeDevicePtr dev,
char ** const names,
int maxnames);
int
virNodeDeviceListCapsWrapper(virNodeDevicePtr dev,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceListCapsFuncType virNodeDeviceListCapsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceListCaps",
(void**)&virNodeDeviceListCapsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceListCapsSymbol(dev,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNodeDevicePtr
(*virNodeDeviceLookupByNameFuncType)(virConnectPtr conn,
const char * name);
virNodeDevicePtr
virNodeDeviceLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
static virNodeDeviceLookupByNameFuncType virNodeDeviceLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceLookupByName",
(void**)&virNodeDeviceLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceLookupByNameSymbol(conn,
name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNodeDevicePtr
(*virNodeDeviceLookupSCSIHostByWWNFuncType)(virConnectPtr conn,
const char * wwnn,
const char * wwpn,
unsigned int flags);
virNodeDevicePtr
virNodeDeviceLookupSCSIHostByWWNWrapper(virConnectPtr conn,
const char * wwnn,
const char * wwpn,
unsigned int flags,
virErrorPtr err)
{
virNodeDevicePtr ret = NULL;
static virNodeDeviceLookupSCSIHostByWWNFuncType virNodeDeviceLookupSCSIHostByWWNSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceLookupSCSIHostByWWN",
(void**)&virNodeDeviceLookupSCSIHostByWWNSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceLookupSCSIHostByWWNSymbol(conn,
wwnn,
wwpn,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceNumOfCapsFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceNumOfCapsWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceNumOfCapsFuncType virNodeDeviceNumOfCapsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceNumOfCaps",
(void**)&virNodeDeviceNumOfCapsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceNumOfCapsSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceReAttachFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceReAttachWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceReAttachFuncType virNodeDeviceReAttachSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceReAttach",
(void**)&virNodeDeviceReAttachSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceReAttachSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceRefFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceRefWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceRefFuncType virNodeDeviceRefSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceRef",
(void**)&virNodeDeviceRefSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceRefSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceResetFuncType)(virNodeDevicePtr dev);
int
virNodeDeviceResetWrapper(virNodeDevicePtr dev,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceResetFuncType virNodeDeviceResetSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceReset",
(void**)&virNodeDeviceResetSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceResetSymbol(dev);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceSetAutostartFuncType)(virNodeDevicePtr dev,
int autostart);
int
virNodeDeviceSetAutostartWrapper(virNodeDevicePtr dev,
int autostart,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceSetAutostartFuncType virNodeDeviceSetAutostartSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceSetAutostart",
(void**)&virNodeDeviceSetAutostartSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceSetAutostartSymbol(dev,
autostart);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceUndefineFuncType)(virNodeDevicePtr dev,
unsigned int flags);
int
virNodeDeviceUndefineWrapper(virNodeDevicePtr dev,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceUndefineFuncType virNodeDeviceUndefineSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceUndefine",
(void**)&virNodeDeviceUndefineSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceUndefineSymbol(dev,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeDeviceUpdateFuncType)(virNodeDevicePtr dev,
const char * xmlDesc,
unsigned int flags);
int
virNodeDeviceUpdateWrapper(virNodeDevicePtr dev,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeDeviceUpdateFuncType virNodeDeviceUpdateSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeDeviceUpdate",
(void**)&virNodeDeviceUpdateSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeDeviceUpdateSymbol(dev,
xmlDesc,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeListDevicesFuncType)(virConnectPtr conn,
const char * cap,
char ** const names,
int maxnames,
unsigned int flags);
int
virNodeListDevicesWrapper(virConnectPtr conn,
const char * cap,
char ** const names,
int maxnames,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeListDevicesFuncType virNodeListDevicesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeListDevices",
(void**)&virNodeListDevicesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeListDevicesSymbol(conn,
cap,
names,
maxnames,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNodeNumOfDevicesFuncType)(virConnectPtr conn,
const char * cap,
unsigned int flags);
int
virNodeNumOfDevicesWrapper(virConnectPtr conn,
const char * cap,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNodeNumOfDevicesFuncType virNodeNumOfDevicesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNodeNumOfDevices",
(void**)&virNodeNumOfDevicesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNodeNumOfDevicesSymbol(conn,
cap,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_domain_snapshot.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_domain_snapshot.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virDomainHasCurrentSnapshotWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainHasCurrentSnapshot not available prior to libvirt version 0.8.0");
#else
ret = virDomainHasCurrentSnapshot(domain,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainListAllSnapshotsWrapper(virDomainPtr domain,
virDomainSnapshotPtr ** snaps,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 13)
setVirError(err, "Function virDomainListAllSnapshots not available prior to libvirt version 0.9.13");
#else
ret = virDomainListAllSnapshots(domain,
snaps,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainRevertToSnapshotWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainRevertToSnapshot not available prior to libvirt version 0.8.0");
#else
ret = virDomainRevertToSnapshot(snapshot,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainSnapshotPtr
virDomainSnapshotCreateXMLWrapper(virDomainPtr domain,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotCreateXML not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotCreateXML(domain,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainSnapshotPtr
virDomainSnapshotCurrentWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotCurrent not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotCurrent(domain,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotDeleteWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotDelete not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotDelete(snapshot,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotFreeWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotFree not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotFree(snapshot);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virDomainSnapshotGetConnectWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 9, 5)
setVirError(err, "Function virDomainSnapshotGetConnect not available prior to libvirt version 0.9.5");
#else
ret = virDomainSnapshotGetConnect(snapshot);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainSnapshotGetDomainWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 9, 5)
setVirError(err, "Function virDomainSnapshotGetDomain not available prior to libvirt version 0.9.5");
#else
ret = virDomainSnapshotGetDomain(snapshot);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virDomainSnapshotGetNameWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 9, 5)
setVirError(err, "Function virDomainSnapshotGetName not available prior to libvirt version 0.9.5");
#else
ret = virDomainSnapshotGetName(snapshot);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainSnapshotPtr
virDomainSnapshotGetParentWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 9, 7)
setVirError(err, "Function virDomainSnapshotGetParent not available prior to libvirt version 0.9.7");
#else
ret = virDomainSnapshotGetParent(snapshot,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virDomainSnapshotGetXMLDescWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotGetXMLDesc not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotGetXMLDesc(snapshot,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotHasMetadataWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 13)
setVirError(err, "Function virDomainSnapshotHasMetadata not available prior to libvirt version 0.9.13");
#else
ret = virDomainSnapshotHasMetadata(snapshot,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotIsCurrentWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 13)
setVirError(err, "Function virDomainSnapshotIsCurrent not available prior to libvirt version 0.9.13");
#else
ret = virDomainSnapshotIsCurrent(snapshot,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotListAllChildrenWrapper(virDomainSnapshotPtr snapshot,
virDomainSnapshotPtr ** snaps,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 13)
setVirError(err, "Function virDomainSnapshotListAllChildren not available prior to libvirt version 0.9.13");
#else
ret = virDomainSnapshotListAllChildren(snapshot,
snaps,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotListChildrenNamesWrapper(virDomainSnapshotPtr snapshot,
char ** names,
int nameslen,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 7)
setVirError(err, "Function virDomainSnapshotListChildrenNames not available prior to libvirt version 0.9.7");
#else
ret = virDomainSnapshotListChildrenNames(snapshot,
names,
nameslen,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotListNamesWrapper(virDomainPtr domain,
char ** names,
int nameslen,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotListNames not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotListNames(domain,
names,
nameslen,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainSnapshotPtr
virDomainSnapshotLookupByNameWrapper(virDomainPtr domain,
const char * name,
unsigned int flags,
virErrorPtr err)
{
virDomainSnapshotPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotLookupByName not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotLookupByName(domain,
name,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotNumWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virDomainSnapshotNum not available prior to libvirt version 0.8.0");
#else
ret = virDomainSnapshotNum(domain,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotNumChildrenWrapper(virDomainSnapshotPtr snapshot,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 7)
setVirError(err, "Function virDomainSnapshotNumChildren not available prior to libvirt version 0.9.7");
#else
ret = virDomainSnapshotNumChildren(snapshot,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainSnapshotRefWrapper(virDomainSnapshotPtr snapshot,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 13)
setVirError(err, "Function virDomainSnapshotRef not available prior to libvirt version 0.9.13");
#else
ret = virDomainSnapshotRef(snapshot);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_lxc_generated_functions_static.go | vendor/libvirt.org/go/libvirt/libvirt_lxc_generated_functions_static.go | //go:build !libvirt_without_lxc && !libvirt_dlopen
// +build !libvirt_without_lxc,!libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt-lxc
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_lxc_generated.h"
#include "error_helper.h"
int
virDomainLxcEnterCGroupWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(2, 0, 0)
setVirError(err, "Function virDomainLxcEnterCGroup not available prior to libvirt version 2.0.0");
#else
ret = virDomainLxcEnterCGroup(domain,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainLxcEnterNamespaceWrapper(virDomainPtr domain,
unsigned int nfdlist,
int * fdlist,
unsigned int * noldfdlist,
int ** oldfdlist,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 0, 2)
setVirError(err, "Function virDomainLxcEnterNamespace not available prior to libvirt version 1.0.2");
#else
ret = virDomainLxcEnterNamespace(domain,
nfdlist,
fdlist,
noldfdlist,
oldfdlist,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainLxcEnterSecurityLabelWrapper(virSecurityModelPtr model,
virSecurityLabelPtr label,
virSecurityLabelPtr oldlabel,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 0, 4)
setVirError(err, "Function virDomainLxcEnterSecurityLabel not available prior to libvirt version 1.0.4");
#else
ret = virDomainLxcEnterSecurityLabel(model,
label,
oldlabel,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainLxcOpenNamespaceWrapper(virDomainPtr domain,
int ** fdlist,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 0, 2)
setVirError(err, "Function virDomainLxcOpenNamespace not available prior to libvirt version 1.0.2");
#else
ret = virDomainLxcOpenNamespace(domain,
fdlist,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/domain_checkpoint.go | vendor/libvirt.org/go/libvirt/domain_checkpoint.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016-2019 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"reflect"
"unsafe"
)
type DomainCheckpointCreateFlags uint
const (
DOMAIN_CHECKPOINT_CREATE_REDEFINE = DomainCheckpointCreateFlags(C.VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE)
DOMAIN_CHECKPOINT_CREATE_QUIESCE = DomainCheckpointCreateFlags(C.VIR_DOMAIN_CHECKPOINT_CREATE_QUIESCE)
DOMAIN_CHECKPOINT_CREATE_REDEFINE_VALIDATE = DomainCheckpointCreateFlags(C.VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE_VALIDATE)
)
type DomainCheckpointListFlags uint
const (
DOMAIN_CHECKPOINT_LIST_ROOTS = DomainCheckpointListFlags(C.VIR_DOMAIN_CHECKPOINT_LIST_ROOTS)
DOMAIN_CHECKPOINT_LIST_DESCENDANTS = DomainCheckpointListFlags(C.VIR_DOMAIN_CHECKPOINT_LIST_DESCENDANTS)
DOMAIN_CHECKPOINT_LIST_LEAVES = DomainCheckpointListFlags(C.VIR_DOMAIN_CHECKPOINT_LIST_LEAVES)
DOMAIN_CHECKPOINT_LIST_NO_LEAVES = DomainCheckpointListFlags(C.VIR_DOMAIN_CHECKPOINT_LIST_NO_LEAVES)
DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL = DomainCheckpointListFlags(C.VIR_DOMAIN_CHECKPOINT_LIST_TOPOLOGICAL)
)
type DomainCheckpointDeleteFlags uint
const (
DOMAIN_CHECKPOINT_DELETE_CHILDREN = DomainCheckpointDeleteFlags(C.VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN)
DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY = DomainCheckpointDeleteFlags(C.VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY)
DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY = DomainCheckpointDeleteFlags(C.VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY)
)
type DomainCheckpointXMLFlags uint
const (
DOMAIN_CHECKPOINT_XML_SECURE = DomainCheckpointXMLFlags(C.VIR_DOMAIN_CHECKPOINT_XML_SECURE)
DOMAIN_CHECKPOINT_XML_NO_DOMAIN = DomainCheckpointXMLFlags(C.VIR_DOMAIN_CHECKPOINT_XML_NO_DOMAIN)
DOMAIN_CHECKPOINT_XML_SIZE = DomainCheckpointXMLFlags(C.VIR_DOMAIN_CHECKPOINT_XML_SIZE)
)
type DomainCheckpoint struct {
ptr C.virDomainCheckpointPtr
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointFree
func (s *DomainCheckpoint) Free() error {
var err C.virError
ret := C.virDomainCheckpointFreeWrapper(s.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointRef
func (c *DomainCheckpoint) Ref() error {
var err C.virError
ret := C.virDomainCheckpointRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointDelete
func (s *DomainCheckpoint) Delete(flags DomainCheckpointDeleteFlags) error {
var err C.virError
result := C.virDomainCheckpointDeleteWrapper(s.ptr, C.uint(flags), &err)
if result != 0 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointGetXMLDesc
func (s *DomainCheckpoint) GetXMLDesc(flags DomainCheckpointXMLFlags) (string, error) {
var err C.virError
result := C.virDomainCheckpointGetXMLDescWrapper(s.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointGetName
func (s *DomainCheckpoint) GetName() (string, error) {
var err C.virError
name := C.virDomainCheckpointGetNameWrapper(s.ptr, &err)
if name == nil {
return "", makeError(&err)
}
return C.GoString(name), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointGetParent
func (s *DomainCheckpoint) GetParent(flags uint32) (*DomainCheckpoint, error) {
var err C.virError
ptr := C.virDomainCheckpointGetParentWrapper(s.ptr, C.uint(flags), &err)
if ptr == nil {
return nil, makeError(&err)
}
return &DomainCheckpoint{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointListAllChildren
func (d *DomainCheckpoint) ListAllChildren(flags DomainCheckpointListFlags) ([]DomainCheckpoint, error) {
var cList *C.virDomainCheckpointPtr
var err C.virError
numVols := C.virDomainCheckpointListAllChildrenWrapper(d.ptr, (**C.virDomainCheckpointPtr)(&cList), C.uint(flags), &err)
if numVols == -1 {
return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
Len: int(numVols),
Cap: int(numVols),
}
var pools []DomainCheckpoint
slice := *(*[]C.virDomainCheckpointPtr)(unsafe.Pointer(&hdr))
for _, ptr := range slice {
pools = append(pools, DomainCheckpoint{ptr})
}
C.free(unsafe.Pointer(cList))
return pools, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_secret.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_secret.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnectListAllSecretsWrapper(virConnectPtr conn,
virSecretPtr ** secrets,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virConnectListAllSecrets not available prior to libvirt version 0.10.2");
#else
ret = virConnectListAllSecrets(conn,
secrets,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListSecretsWrapper(virConnectPtr conn,
char ** uuids,
int maxuuids,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virConnectListSecrets not available prior to libvirt version 0.7.1");
#else
ret = virConnectListSecrets(conn,
uuids,
maxuuids);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfSecretsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virConnectNumOfSecrets not available prior to libvirt version 0.7.1");
#else
ret = virConnectNumOfSecrets(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectSecretEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 0, 0)
setVirError(err, "Function virConnectSecretEventDeregisterAny not available prior to libvirt version 3.0.0");
#else
ret = virConnectSecretEventDeregisterAny(conn,
callbackID);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectSecretEventRegisterAnyWrapper(virConnectPtr conn,
virSecretPtr secret,
int eventID,
virConnectSecretEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 0, 0)
setVirError(err, "Function virConnectSecretEventRegisterAny not available prior to libvirt version 3.0.0");
#else
ret = virConnectSecretEventRegisterAny(conn,
secret,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virSecretPtr
virSecretDefineXMLWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virSecretPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretDefineXML not available prior to libvirt version 0.7.1");
#else
ret = virSecretDefineXML(conn,
xml,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretFreeWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretFree not available prior to libvirt version 0.7.1");
#else
ret = virSecretFree(secret);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virSecretGetConnectWrapper(virSecretPtr secret,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetConnect not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetConnect(secret);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretGetUUIDWrapper(virSecretPtr secret,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetUUID not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetUUID(secret,
uuid);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretGetUUIDStringWrapper(virSecretPtr secret,
char * buf,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetUUIDString not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetUUIDString(secret,
buf);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virSecretGetUsageIDWrapper(virSecretPtr secret,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetUsageID not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetUsageID(secret);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretGetUsageTypeWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetUsageType not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetUsageType(secret);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
unsigned char *
virSecretGetValueWrapper(virSecretPtr secret,
size_t * value_size,
unsigned int flags,
virErrorPtr err)
{
unsigned char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetValue not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetValue(secret,
value_size,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virSecretGetXMLDescWrapper(virSecretPtr secret,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretGetXMLDesc not available prior to libvirt version 0.7.1");
#else
ret = virSecretGetXMLDesc(secret,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virSecretPtr
virSecretLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virSecretPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretLookupByUUID not available prior to libvirt version 0.7.1");
#else
ret = virSecretLookupByUUID(conn,
uuid);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virSecretPtr
virSecretLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virSecretPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretLookupByUUIDString not available prior to libvirt version 0.7.1");
#else
ret = virSecretLookupByUUIDString(conn,
uuidstr);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virSecretPtr
virSecretLookupByUsageWrapper(virConnectPtr conn,
int usageType,
const char * usageID,
virErrorPtr err)
{
virSecretPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretLookupByUsage not available prior to libvirt version 0.7.1");
#else
ret = virSecretLookupByUsage(conn,
usageType,
usageID);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretRefWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretRef not available prior to libvirt version 0.7.1");
#else
ret = virSecretRef(secret);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretSetValueWrapper(virSecretPtr secret,
const unsigned char * value,
size_t value_size,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretSetValue not available prior to libvirt version 0.7.1");
#else
ret = virSecretSetValue(secret,
value,
value_size,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virSecretUndefineWrapper(virSecretPtr secret,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 1)
setVirError(err, "Function virSecretUndefine not available prior to libvirt version 0.7.1");
#else
ret = virSecretUndefine(secret);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_event.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_event.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virEventAddHandleFuncType)(int fd,
int events,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff);
int
virEventAddHandleWrapper(int fd,
int events,
virEventHandleCallback cb,
void * opaque,
virFreeCallback ff,
virErrorPtr err)
{
int ret = -1;
static virEventAddHandleFuncType virEventAddHandleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventAddHandle",
(void**)&virEventAddHandleSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virEventAddHandleSymbol(fd,
events,
cb,
opaque,
ff);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virEventAddTimeoutFuncType)(int timeout,
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff);
int
virEventAddTimeoutWrapper(int timeout,
virEventTimeoutCallback cb,
void * opaque,
virFreeCallback ff,
virErrorPtr err)
{
int ret = -1;
static virEventAddTimeoutFuncType virEventAddTimeoutSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventAddTimeout",
(void**)&virEventAddTimeoutSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virEventAddTimeoutSymbol(timeout,
cb,
opaque,
ff);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virEventRegisterDefaultImplFuncType)(void);
int
virEventRegisterDefaultImplWrapper(virErrorPtr err)
{
int ret = -1;
static virEventRegisterDefaultImplFuncType virEventRegisterDefaultImplSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventRegisterDefaultImpl",
(void**)&virEventRegisterDefaultImplSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virEventRegisterDefaultImplSymbol();
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virEventRegisterImplFuncType)(virEventAddHandleFunc addHandle,
virEventUpdateHandleFunc updateHandle,
virEventRemoveHandleFunc removeHandle,
virEventAddTimeoutFunc addTimeout,
virEventUpdateTimeoutFunc updateTimeout,
virEventRemoveTimeoutFunc removeTimeout);
void
virEventRegisterImplWrapper(virEventAddHandleFunc addHandle,
virEventUpdateHandleFunc updateHandle,
virEventRemoveHandleFunc removeHandle,
virEventAddTimeoutFunc addTimeout,
virEventUpdateTimeoutFunc updateTimeout,
virEventRemoveTimeoutFunc removeTimeout)
{
static virEventRegisterImplFuncType virEventRegisterImplSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventRegisterImpl",
(void**)&virEventRegisterImplSymbol,
&once,
&success,
NULL)) {
return;
}
virEventRegisterImplSymbol(addHandle,
updateHandle,
removeHandle,
addTimeout,
updateTimeout,
removeTimeout);
}
typedef int
(*virEventRemoveHandleFuncType)(int watch);
int
virEventRemoveHandleWrapper(int watch,
virErrorPtr err)
{
int ret = -1;
static virEventRemoveHandleFuncType virEventRemoveHandleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventRemoveHandle",
(void**)&virEventRemoveHandleSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virEventRemoveHandleSymbol(watch);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virEventRemoveTimeoutFuncType)(int timer);
int
virEventRemoveTimeoutWrapper(int timer,
virErrorPtr err)
{
int ret = -1;
static virEventRemoveTimeoutFuncType virEventRemoveTimeoutSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventRemoveTimeout",
(void**)&virEventRemoveTimeoutSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virEventRemoveTimeoutSymbol(timer);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virEventRunDefaultImplFuncType)(void);
int
virEventRunDefaultImplWrapper(virErrorPtr err)
{
int ret = -1;
static virEventRunDefaultImplFuncType virEventRunDefaultImplSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventRunDefaultImpl",
(void**)&virEventRunDefaultImplSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virEventRunDefaultImplSymbol();
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virEventUpdateHandleFuncType)(int watch,
int events);
void
virEventUpdateHandleWrapper(int watch,
int events)
{
static virEventUpdateHandleFuncType virEventUpdateHandleSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventUpdateHandle",
(void**)&virEventUpdateHandleSymbol,
&once,
&success,
NULL)) {
return;
}
virEventUpdateHandleSymbol(watch,
events);
}
typedef void
(*virEventUpdateTimeoutFuncType)(int timer,
int timeout);
void
virEventUpdateTimeoutWrapper(int timer,
int timeout)
{
static virEventUpdateTimeoutFuncType virEventUpdateTimeoutSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virEventUpdateTimeout",
(void**)&virEventUpdateTimeoutSymbol,
&once,
&success,
NULL)) {
return;
}
virEventUpdateTimeoutSymbol(timer,
timeout);
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_qemu_generated_functions_dlopen.go | vendor/libvirt.org/go/libvirt/libvirt_qemu_generated_functions_dlopen.go | //go:build !libvirt_without_qemu && libvirt_dlopen
// +build !libvirt_without_qemu,libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_qemu_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectDomainQemuMonitorEventDeregisterFuncType)(virConnectPtr conn,
int callbackID);
int
virConnectDomainQemuMonitorEventDeregisterWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
static virConnectDomainQemuMonitorEventDeregisterFuncType virConnectDomainQemuMonitorEventDeregisterSymbol;
static bool once;
static bool success;
if (!libvirtQemuSymbol("virConnectDomainQemuMonitorEventDeregister",
(void**)&virConnectDomainQemuMonitorEventDeregisterSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainQemuMonitorEventDeregisterSymbol(conn,
callbackID);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectDomainQemuMonitorEventRegisterFuncType)(virConnectPtr conn,
virDomainPtr dom,
const char * event,
virConnectDomainQemuMonitorEventCallback cb,
void * opaque,
virFreeCallback freecb,
unsigned int flags);
int
virConnectDomainQemuMonitorEventRegisterWrapper(virConnectPtr conn,
virDomainPtr dom,
const char * event,
virConnectDomainQemuMonitorEventCallback cb,
void * opaque,
virFreeCallback freecb,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectDomainQemuMonitorEventRegisterFuncType virConnectDomainQemuMonitorEventRegisterSymbol;
static bool once;
static bool success;
if (!libvirtQemuSymbol("virConnectDomainQemuMonitorEventRegister",
(void**)&virConnectDomainQemuMonitorEventRegisterSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainQemuMonitorEventRegisterSymbol(conn,
dom,
event,
cb,
opaque,
freecb,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virDomainQemuAgentCommandFuncType)(virDomainPtr domain,
const char * cmd,
int timeout,
unsigned int flags);
char *
virDomainQemuAgentCommandWrapper(virDomainPtr domain,
const char * cmd,
int timeout,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virDomainQemuAgentCommandFuncType virDomainQemuAgentCommandSymbol;
static bool once;
static bool success;
if (!libvirtQemuSymbol("virDomainQemuAgentCommand",
(void**)&virDomainQemuAgentCommandSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainQemuAgentCommandSymbol(domain,
cmd,
timeout,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virDomainPtr
(*virDomainQemuAttachFuncType)(virConnectPtr conn,
unsigned int pid_value,
unsigned int flags);
virDomainPtr
virDomainQemuAttachWrapper(virConnectPtr conn,
unsigned int pid_value,
unsigned int flags,
virErrorPtr err)
{
virDomainPtr ret = NULL;
static virDomainQemuAttachFuncType virDomainQemuAttachSymbol;
static bool once;
static bool success;
if (!libvirtQemuSymbol("virDomainQemuAttach",
(void**)&virDomainQemuAttachSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainQemuAttachSymbol(conn,
pid_value,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainQemuMonitorCommandFuncType)(virDomainPtr domain,
const char * cmd,
char ** result,
unsigned int flags);
int
virDomainQemuMonitorCommandWrapper(virDomainPtr domain,
const char * cmd,
char ** result,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainQemuMonitorCommandFuncType virDomainQemuMonitorCommandSymbol;
static bool once;
static bool success;
if (!libvirtQemuSymbol("virDomainQemuMonitorCommand",
(void**)&virDomainQemuMonitorCommandSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainQemuMonitorCommandSymbol(domain,
cmd,
result,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainQemuMonitorCommandWithFilesFuncType)(virDomainPtr domain,
const char * cmd,
unsigned int ninfiles,
int * infiles,
unsigned int * noutfiles,
int ** outfiles,
char ** result,
unsigned int flags);
int
virDomainQemuMonitorCommandWithFilesWrapper(virDomainPtr domain,
const char * cmd,
unsigned int ninfiles,
int * infiles,
unsigned int * noutfiles,
int ** outfiles,
char ** result,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainQemuMonitorCommandWithFilesFuncType virDomainQemuMonitorCommandWithFilesSymbol;
static bool once;
static bool success;
if (!libvirtQemuSymbol("virDomainQemuMonitorCommandWithFiles",
(void**)&virDomainQemuMonitorCommandWithFilesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainQemuMonitorCommandWithFilesSymbol(domain,
cmd,
ninfiles,
infiles,
noutfiles,
outfiles,
result,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_domain.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_domain.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virConnectDomainEventDeregisterWrapper(virConnectPtr conn,
virConnectDomainEventCallback cb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virConnectDomainEventDeregister not available prior to libvirt version 0.5.0");
#else
ret = virConnectDomainEventDeregister(conn,
cb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectDomainEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virConnectDomainEventDeregisterAny not available prior to libvirt version 0.8.0");
#else
ret = virConnectDomainEventDeregisterAny(conn,
callbackID);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectDomainEventRegisterWrapper(virConnectPtr conn,
virConnectDomainEventCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virConnectDomainEventRegister not available prior to libvirt version 0.5.0");
#else
ret = virConnectDomainEventRegister(conn,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectDomainEventRegisterAnyWrapper(virConnectPtr conn,
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 0)
setVirError(err, "Function virConnectDomainEventRegisterAny not available prior to libvirt version 0.8.0");
#else
ret = virConnectDomainEventRegisterAny(conn,
dom,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectDomainXMLFromNativeWrapper(virConnectPtr conn,
const char * nativeFormat,
const char * nativeConfig,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virConnectDomainXMLFromNative not available prior to libvirt version 0.6.4");
#else
ret = virConnectDomainXMLFromNative(conn,
nativeFormat,
nativeConfig,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectDomainXMLToNativeWrapper(virConnectPtr conn,
const char * nativeFormat,
const char * domainXml,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 6, 4)
setVirError(err, "Function virConnectDomainXMLToNative not available prior to libvirt version 0.6.4");
#else
ret = virConnectDomainXMLToNative(conn,
nativeFormat,
domainXml,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectGetAllDomainStatsWrapper(virConnectPtr conn,
unsigned int stats,
virDomainStatsRecordPtr ** retStats,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 8)
setVirError(err, "Function virConnectGetAllDomainStats not available prior to libvirt version 1.2.8");
#else
ret = virConnectGetAllDomainStats(conn,
stats,
retStats,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectGetDomainCapabilitiesWrapper(virConnectPtr conn,
const char * emulatorbin,
const char * arch,
const char * machine,
const char * virttype,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(1, 2, 7)
setVirError(err, "Function virConnectGetDomainCapabilities not available prior to libvirt version 1.2.7");
#else
ret = virConnectGetDomainCapabilities(conn,
emulatorbin,
arch,
machine,
virttype,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListAllDomainsWrapper(virConnectPtr conn,
virDomainPtr ** domains,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 13)
setVirError(err, "Function virConnectListAllDomains not available prior to libvirt version 0.9.13");
#else
ret = virConnectListAllDomains(conn,
domains,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListDefinedDomainsWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 1)
setVirError(err, "Function virConnectListDefinedDomains not available prior to libvirt version 0.1.1");
#else
ret = virConnectListDefinedDomains(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectListDomainsWrapper(virConnectPtr conn,
int * ids,
int maxids,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectListDomains not available prior to libvirt version 0.0.3");
#else
ret = virConnectListDomains(conn,
ids,
maxids);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfDefinedDomainsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 5)
setVirError(err, "Function virConnectNumOfDefinedDomains not available prior to libvirt version 0.1.5");
#else
ret = virConnectNumOfDefinedDomains(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectNumOfDomainsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectNumOfDomains not available prior to libvirt version 0.0.3");
#else
ret = virConnectNumOfDomains(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAbortJobWrapper(virDomainPtr domain,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 7)
setVirError(err, "Function virDomainAbortJob not available prior to libvirt version 0.7.7");
#else
ret = virDomainAbortJob(domain);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAbortJobFlagsWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(8, 5, 0)
setVirError(err, "Function virDomainAbortJobFlags not available prior to libvirt version 8.5.0");
#else
ret = virDomainAbortJobFlags(domain,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAddIOThreadWrapper(virDomainPtr domain,
unsigned int iothread_id,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 15)
setVirError(err, "Function virDomainAddIOThread not available prior to libvirt version 1.2.15");
#else
ret = virDomainAddIOThread(domain,
iothread_id,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAgentSetResponseTimeoutWrapper(virDomainPtr domain,
int timeout,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 10, 0)
setVirError(err, "Function virDomainAgentSetResponseTimeout not available prior to libvirt version 5.10.0");
#else
ret = virDomainAgentSetResponseTimeout(domain,
timeout,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAttachDeviceWrapper(virDomainPtr domain,
const char * xml,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 9)
setVirError(err, "Function virDomainAttachDevice not available prior to libvirt version 0.1.9");
#else
ret = virDomainAttachDevice(domain,
xml);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAttachDeviceFlagsWrapper(virDomainPtr domain,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 7)
setVirError(err, "Function virDomainAttachDeviceFlags not available prior to libvirt version 0.7.7");
#else
ret = virDomainAttachDeviceFlags(domain,
xml,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAuthorizedSSHKeysGetWrapper(virDomainPtr domain,
const char * user,
char *** keys,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(6, 10, 0)
setVirError(err, "Function virDomainAuthorizedSSHKeysGet not available prior to libvirt version 6.10.0");
#else
ret = virDomainAuthorizedSSHKeysGet(domain,
user,
keys,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainAuthorizedSSHKeysSetWrapper(virDomainPtr domain,
const char * user,
const char ** keys,
unsigned int nkeys,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(6, 10, 0)
setVirError(err, "Function virDomainAuthorizedSSHKeysSet not available prior to libvirt version 6.10.0");
#else
ret = virDomainAuthorizedSSHKeysSet(domain,
user,
keys,
nkeys,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBackupBeginWrapper(virDomainPtr domain,
const char * backupXML,
const char * checkpointXML,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(6, 0, 0)
setVirError(err, "Function virDomainBackupBegin not available prior to libvirt version 6.0.0");
#else
ret = virDomainBackupBegin(domain,
backupXML,
checkpointXML,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virDomainBackupGetXMLDescWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(6, 0, 0)
setVirError(err, "Function virDomainBackupGetXMLDesc not available prior to libvirt version 6.0.0");
#else
ret = virDomainBackupGetXMLDesc(domain,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockCommitWrapper(virDomainPtr dom,
const char * disk,
const char * base,
const char * top,
unsigned long bandwidth,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virDomainBlockCommit not available prior to libvirt version 0.10.2");
#else
ret = virDomainBlockCommit(dom,
disk,
base,
top,
bandwidth,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockCopyWrapper(virDomainPtr dom,
const char * disk,
const char * destxml,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 8)
setVirError(err, "Function virDomainBlockCopy not available prior to libvirt version 1.2.8");
#else
ret = virDomainBlockCopy(dom,
disk,
destxml,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockJobAbortWrapper(virDomainPtr dom,
const char * disk,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 4)
setVirError(err, "Function virDomainBlockJobAbort not available prior to libvirt version 0.9.4");
#else
ret = virDomainBlockJobAbort(dom,
disk,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockJobSetSpeedWrapper(virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 4)
setVirError(err, "Function virDomainBlockJobSetSpeed not available prior to libvirt version 0.9.4");
#else
ret = virDomainBlockJobSetSpeed(dom,
disk,
bandwidth,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockPeekWrapper(virDomainPtr dom,
const char * disk,
unsigned long long offset,
size_t size,
void * buffer,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 4, 2)
setVirError(err, "Function virDomainBlockPeek not available prior to libvirt version 0.4.2");
#else
ret = virDomainBlockPeek(dom,
disk,
offset,
size,
buffer,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockPullWrapper(virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 4)
setVirError(err, "Function virDomainBlockPull not available prior to libvirt version 0.9.4");
#else
ret = virDomainBlockPull(dom,
disk,
bandwidth,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockRebaseWrapper(virDomainPtr dom,
const char * disk,
const char * base,
unsigned long bandwidth,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 10)
setVirError(err, "Function virDomainBlockRebase not available prior to libvirt version 0.9.10");
#else
ret = virDomainBlockRebase(dom,
disk,
base,
bandwidth,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockResizeWrapper(virDomainPtr dom,
const char * disk,
unsigned long long size,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 8)
setVirError(err, "Function virDomainBlockResize not available prior to libvirt version 0.9.8");
#else
ret = virDomainBlockResize(dom,
disk,
size,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockStatsWrapper(virDomainPtr dom,
const char * disk,
virDomainBlockStatsPtr stats,
size_t size,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 3, 2)
setVirError(err, "Function virDomainBlockStats not available prior to libvirt version 0.3.2");
#else
ret = virDomainBlockStats(dom,
disk,
stats,
size);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainBlockStatsFlagsWrapper(virDomainPtr dom,
const char * disk,
virTypedParameterPtr params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 5)
setVirError(err, "Function virDomainBlockStatsFlags not available prior to libvirt version 0.9.5");
#else
ret = virDomainBlockStatsFlags(dom,
disk,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCoreDumpWrapper(virDomainPtr domain,
const char * to,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 9)
setVirError(err, "Function virDomainCoreDump not available prior to libvirt version 0.1.9");
#else
ret = virDomainCoreDump(domain,
to,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCoreDumpWithFormatWrapper(virDomainPtr domain,
const char * to,
unsigned int dumpformat,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 3)
setVirError(err, "Function virDomainCoreDumpWithFormat not available prior to libvirt version 1.2.3");
#else
ret = virDomainCoreDumpWithFormat(domain,
to,
dumpformat,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCreateWrapper(virDomainPtr domain,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 1)
setVirError(err, "Function virDomainCreate not available prior to libvirt version 0.1.1");
#else
ret = virDomainCreate(domain);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainCreateLinuxWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virDomainCreateLinux not available prior to libvirt version 0.0.3");
#else
ret = virDomainCreateLinux(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCreateWithFilesWrapper(virDomainPtr domain,
unsigned int nfiles,
int * files,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 1, 1)
setVirError(err, "Function virDomainCreateWithFiles not available prior to libvirt version 1.1.1");
#else
ret = virDomainCreateWithFiles(domain,
nfiles,
files,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainCreateWithFlagsWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 8, 2)
setVirError(err, "Function virDomainCreateWithFlags not available prior to libvirt version 0.8.2");
#else
ret = virDomainCreateWithFlags(domain,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainCreateXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 5, 0)
setVirError(err, "Function virDomainCreateXML not available prior to libvirt version 0.5.0");
#else
ret = virDomainCreateXML(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainCreateXMLWithFilesWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int nfiles,
int * files,
unsigned int flags,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(1, 1, 1)
setVirError(err, "Function virDomainCreateXMLWithFiles not available prior to libvirt version 1.1.1");
#else
ret = virDomainCreateXMLWithFiles(conn,
xmlDesc,
nfiles,
files,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainDefineXMLWrapper(virConnectPtr conn,
const char * xml,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 1, 1)
setVirError(err, "Function virDomainDefineXML not available prior to libvirt version 0.1.1");
#else
ret = virDomainDefineXML(conn,
xml);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virDomainPtr
virDomainDefineXMLFlagsWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virDomainPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(1, 2, 12)
setVirError(err, "Function virDomainDefineXMLFlags not available prior to libvirt version 1.2.12");
#else
ret = virDomainDefineXMLFlags(conn,
xml,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainDelIOThreadWrapper(virDomainPtr domain,
unsigned int iothread_id,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 15)
setVirError(err, "Function virDomainDelIOThread not available prior to libvirt version 1.2.15");
#else
ret = virDomainDelIOThread(domain,
iothread_id,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainDestroyWrapper(virDomainPtr domain,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virDomainDestroy not available prior to libvirt version 0.0.3");
#else
ret = virDomainDestroy(domain);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainDestroyFlagsWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 4)
setVirError(err, "Function virDomainDestroyFlags not available prior to libvirt version 0.9.4");
#else
ret = virDomainDestroyFlags(domain,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainDetachDeviceWrapper(virDomainPtr domain,
const char * xml,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 9)
setVirError(err, "Function virDomainDetachDevice not available prior to libvirt version 0.1.9");
#else
ret = virDomainDetachDevice(domain,
xml);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainDetachDeviceAliasWrapper(virDomainPtr domain,
const char * alias,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 4, 0)
setVirError(err, "Function virDomainDetachDeviceAlias not available prior to libvirt version 4.4.0");
#else
ret = virDomainDetachDeviceAlias(domain,
alias,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainDetachDeviceFlagsWrapper(virDomainPtr domain,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 7)
setVirError(err, "Function virDomainDetachDeviceFlags not available prior to libvirt version 0.7.7");
#else
ret = virDomainDetachDeviceFlags(domain,
xml,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainFDAssociateWrapper(virDomainPtr domain,
const char * name,
unsigned int nfds,
int * fds,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(9, 0, 0)
setVirError(err, "Function virDomainFDAssociate not available prior to libvirt version 9.0.0");
#else
ret = virDomainFDAssociate(domain,
name,
nfds,
fds,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virDomainFSFreezeWrapper(virDomainPtr dom,
const char ** mountpoints,
unsigned int nmountpoints,
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/nwfilter.go | vendor/libvirt.org/go/libvirt/nwfilter.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"unsafe"
)
type NWFilterDefineFlags uint
const (
NWFILTER_DEFINE_VALIDATE = NWFilterDefineFlags(C.VIR_NWFILTER_DEFINE_VALIDATE)
)
type NWFilter struct {
ptr C.virNWFilterPtr
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterFree
func (f *NWFilter) Free() error {
var err C.virError
ret := C.virNWFilterFreeWrapper(f.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterRef
func (c *NWFilter) Ref() error {
var err C.virError
ret := C.virNWFilterRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetName
func (f *NWFilter) GetName() (string, error) {
var err C.virError
name := C.virNWFilterGetNameWrapper(f.ptr, &err)
if name == nil {
return "", makeError(&err)
}
return C.GoString(name), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterUndefine
func (f *NWFilter) Undefine() error {
var err C.virError
result := C.virNWFilterUndefineWrapper(f.ptr, &err)
if result == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUID
func (f *NWFilter) GetUUID() ([]byte, error) {
var cUuid [C.VIR_UUID_BUFLEN](byte)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virNWFilterGetUUIDWrapper(f.ptr, (*C.uchar)(cuidPtr), &err)
if result != 0 {
return []byte{}, makeError(&err)
}
return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUIDString
func (f *NWFilter) GetUUIDString() (string, error) {
var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
cuidPtr := unsafe.Pointer(&cUuid)
var err C.virError
result := C.virNWFilterGetUUIDStringWrapper(f.ptr, (*C.char)(cuidPtr), &err)
if result != 0 {
return "", makeError(&err)
}
return C.GoString((*C.char)(cuidPtr)), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetXMLDesc
func (f *NWFilter) GetXMLDesc(flags uint32) (string, error) {
var err C.virError
result := C.virNWFilterGetXMLDescWrapper(f.ptr, C.uint(flags), &err)
if result == nil {
return "", makeError(&err)
}
xml := C.GoString(result)
C.free(unsafe.Pointer(result))
return xml, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_stream.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_stream.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
int
virStreamAbortWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamAbort not available prior to libvirt version 0.7.2");
#else
ret = virStreamAbort(stream);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamEventAddCallbackWrapper(virStreamPtr stream,
int events,
virStreamEventCallback cb,
void * opaque,
virFreeCallback ff,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamEventAddCallback not available prior to libvirt version 0.7.2");
#else
ret = virStreamEventAddCallback(stream,
events,
cb,
opaque,
ff);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamEventRemoveCallbackWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamEventRemoveCallback not available prior to libvirt version 0.7.2");
#else
ret = virStreamEventRemoveCallback(stream);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamEventUpdateCallbackWrapper(virStreamPtr stream,
int events,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamEventUpdateCallback not available prior to libvirt version 0.7.2");
#else
ret = virStreamEventUpdateCallback(stream,
events);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamFinishWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamFinish not available prior to libvirt version 0.7.2");
#else
ret = virStreamFinish(stream);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamFreeWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamFree not available prior to libvirt version 0.7.2");
#else
ret = virStreamFree(stream);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virStreamPtr
virStreamNewWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
virStreamPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamNew not available prior to libvirt version 0.7.2");
#else
ret = virStreamNew(conn,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamRecvWrapper(virStreamPtr stream,
char * data,
size_t nbytes,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamRecv not available prior to libvirt version 0.7.2");
#else
ret = virStreamRecv(stream,
data,
nbytes);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamRecvAllWrapper(virStreamPtr stream,
virStreamSinkFunc handler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamRecvAll not available prior to libvirt version 0.7.2");
#else
ret = virStreamRecvAll(stream,
handler,
opaque);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamRecvFlagsWrapper(virStreamPtr stream,
char * data,
size_t nbytes,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 4, 0)
setVirError(err, "Function virStreamRecvFlags not available prior to libvirt version 3.4.0");
#else
ret = virStreamRecvFlags(stream,
data,
nbytes,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamRecvHoleWrapper(virStreamPtr stream,
long long * length,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 4, 0)
setVirError(err, "Function virStreamRecvHole not available prior to libvirt version 3.4.0");
#else
ret = virStreamRecvHole(stream,
length,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamRefWrapper(virStreamPtr stream,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamRef not available prior to libvirt version 0.7.2");
#else
ret = virStreamRef(stream);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamSendWrapper(virStreamPtr stream,
const char * data,
size_t nbytes,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamSend not available prior to libvirt version 0.7.2");
#else
ret = virStreamSend(stream,
data,
nbytes);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamSendAllWrapper(virStreamPtr stream,
virStreamSourceFunc handler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 2)
setVirError(err, "Function virStreamSendAll not available prior to libvirt version 0.7.2");
#else
ret = virStreamSendAll(stream,
handler,
opaque);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamSendHoleWrapper(virStreamPtr stream,
long long length,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 4, 0)
setVirError(err, "Function virStreamSendHole not available prior to libvirt version 3.4.0");
#else
ret = virStreamSendHole(stream,
length,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamSparseRecvAllWrapper(virStreamPtr stream,
virStreamSinkFunc handler,
virStreamSinkHoleFunc holeHandler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 4, 0)
setVirError(err, "Function virStreamSparseRecvAll not available prior to libvirt version 3.4.0");
#else
ret = virStreamSparseRecvAll(stream,
handler,
holeHandler,
opaque);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virStreamSparseSendAllWrapper(virStreamPtr stream,
virStreamSourceFunc handler,
virStreamSourceHoleFunc holeHandler,
virStreamSourceSkipFunc skipHandler,
void * opaque,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(3, 4, 0)
setVirError(err, "Function virStreamSparseSendAll not available prior to libvirt version 3.4.0");
#else
ret = virStreamSparseSendAll(stream,
handler,
holeHandler,
skipHandler,
opaque);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/typedparams.go | vendor/libvirt.org/go/libvirt/typedparams.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include <string.h>
#include "libvirt_generated.h"
*/
import "C"
import (
"fmt"
"strings"
"unsafe"
)
type TypedParamValue struct {
Name string
Int *int
UInt *uint
Long *int64
ULong *uint64
Bool *bool
Float *float64
String *string
}
func (val *TypedParamValue) ValueString() string {
if val.Int != nil {
return fmt.Sprintf("%d", *val.Int)
} else if val.UInt != nil {
return fmt.Sprintf("%d", *val.UInt)
} else if val.Long != nil {
return fmt.Sprintf("%d", *val.Long)
} else if val.ULong != nil {
return fmt.Sprintf("%d", *val.ULong)
} else if val.Bool != nil {
return fmt.Sprintf("%t", *val.Bool)
} else if val.Float != nil {
return fmt.Sprintf("%f", *val.Float)
} else if val.Float != nil {
return *val.String
} else {
return "<nil>"
}
}
type typedParamsFieldInfo struct {
set *bool
i *int
ui *uint
l *int64
ul *uint64
b *bool
d *float64
s *string
sl *[]string
}
func typedParamsUnpackRaw(prefix string, cparams *C.virTypedParameter, cnparams C.int) ([]TypedParamValue, error) {
ret := []TypedParamValue{}
for n := 0; n < int(cnparams); n++ {
var param TypedParamValue
var cparam *C.virTypedParameter
cparam = (*C.virTypedParameter)(unsafe.Pointer(uintptr(unsafe.Pointer(cparams)) +
(unsafe.Sizeof(*cparam) * uintptr(n))))
name := C.GoString(&cparam.field[0])
if !strings.HasPrefix(name, prefix) {
continue
}
param.Name = name[len(prefix):]
// A union is exposed by CGo as a byte array
value := cparam.value
valueptr := unsafe.Pointer(&value[0])
switch cparam._type {
case C.VIR_TYPED_PARAM_INT:
i := int(*(*C.int)(valueptr))
param.Int = &i
case C.VIR_TYPED_PARAM_UINT:
ui := uint(*(*C.uint)(valueptr))
param.UInt = &ui
case C.VIR_TYPED_PARAM_LLONG:
l := int64(*(*C.longlong)(valueptr))
param.Long = &l
case C.VIR_TYPED_PARAM_ULLONG:
ul := uint64(*(*C.ulonglong)(valueptr))
param.ULong = &ul
case C.VIR_TYPED_PARAM_BOOLEAN:
b := bool(*(*C.char)(valueptr) != 0)
param.Bool = &b
case C.VIR_TYPED_PARAM_DOUBLE:
f := float64(*(*C.double)(valueptr))
param.Float = &f
case C.VIR_TYPED_PARAM_STRING:
s := C.GoString(*(**C.char)(valueptr))
param.String = &s
}
ret = append(ret, param)
}
return ret, nil
}
func typedParamsUnpack(cparams *C.virTypedParameter, cnparams C.int, infomap map[string]typedParamsFieldInfo) (uint, error) {
count := uint(0)
for name, value := range infomap {
var err C.virError
var ret C.int
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
if value.sl != nil {
for i := 0; i < int(cnparams); i++ {
var cparam *C.virTypedParameter
cparam = (*C.virTypedParameter)(unsafe.Pointer(uintptr(unsafe.Pointer(cparams)) +
(unsafe.Sizeof(*cparam) * uintptr(i))))
var cs *C.char
ret = C.virTypedParamsGetStringWrapper(cparam, 1, cname, &cs, &err)
if ret == 1 {
*value.sl = append(*value.sl, C.GoString(cs))
*value.set = true
count++
} else if ret < 0 {
break
}
}
} else {
if value.i != nil {
var ci C.int
ret = C.virTypedParamsGetIntWrapper(cparams, cnparams, cname, &ci, &err)
if ret == 1 {
*value.i = int(ci)
}
} else if value.ui != nil {
var cui C.uint
ret = C.virTypedParamsGetUIntWrapper(cparams, cnparams, cname, &cui, &err)
if ret == 1 {
*value.ui = uint(cui)
}
} else if value.l != nil {
var cl C.longlong
ret = C.virTypedParamsGetLLongWrapper(cparams, cnparams, cname, &cl, &err)
if ret == 1 {
*value.l = int64(cl)
}
} else if value.ul != nil {
var cul C.ulonglong
ret = C.virTypedParamsGetULLongWrapper(cparams, cnparams, cname, &cul, &err)
if ret == 1 {
*value.ul = uint64(cul)
}
} else if value.d != nil {
var cd C.double
ret = C.virTypedParamsGetDoubleWrapper(cparams, cnparams, cname, &cd, &err)
if ret == 1 {
*value.d = float64(cd)
}
} else if value.b != nil {
var cb C.int
ret = C.virTypedParamsGetBooleanWrapper(cparams, cnparams, cname, &cb, &err)
if ret == 1 {
if cb == 1 {
*value.b = true
} else {
*value.b = false
}
}
} else if value.s != nil {
var cs *C.char
ret = C.virTypedParamsGetStringWrapper(cparams, cnparams, cname, &cs, &err)
if ret == 1 {
*value.s = C.GoString(cs)
}
}
if ret == 1 {
*value.set = true
count++
}
}
if ret < 0 {
return count, makeError(&err)
}
}
return count, nil
}
func typedParamsNew(nparams C.int) *C.virTypedParameter {
var cparams *C.virTypedParameter
memlen := C.size_t(unsafe.Sizeof(*cparams) * uintptr(nparams))
cparams = (*C.virTypedParameter)(C.malloc(memlen))
if cparams == nil {
C.abort()
}
C.memset(unsafe.Pointer(cparams), 0, memlen)
return cparams
}
func typedParamsPackNew(infomap map[string]typedParamsFieldInfo) (*C.virTypedParameter, C.int, error) {
var cparams C.virTypedParameterPtr
var nparams C.int
var maxparams C.int
defer C.virTypedParamsFreeWrapper(cparams, nparams)
for name, value := range infomap {
if !*value.set {
continue
}
cname := C.CString(name)
defer C.free(unsafe.Pointer(cname))
if value.sl != nil {
/* We're not actually using virTypedParamsAddStringList, as it is
* easier to avoid creating a 'char **' in Go to hold all the strings.
*/
for i := 0; i < len(*value.sl); i++ {
cvalue := C.CString((*value.sl)[i])
defer C.free(unsafe.Pointer(cvalue))
var err C.virError
ret := C.virTypedParamsAddStringWrapper(&cparams, &nparams, &maxparams, cname, cvalue, &err)
if ret < 0 {
return nil, 0, makeError(&err)
}
}
} else {
var err C.virError
var ret C.int
if value.i != nil {
ret = C.virTypedParamsAddIntWrapper(&cparams, &nparams, &maxparams, cname, C.int(*value.i), &err)
} else if value.ui != nil {
ret = C.virTypedParamsAddUIntWrapper(&cparams, &nparams, &maxparams, cname, C.uint(*value.ui), &err)
} else if value.l != nil {
ret = C.virTypedParamsAddLLongWrapper(&cparams, &nparams, &maxparams, cname, C.longlong(*value.l), &err)
} else if value.ul != nil {
ret = C.virTypedParamsAddULLongWrapper(&cparams, &nparams, &maxparams, cname, C.ulonglong(*value.ul), &err)
} else if value.b != nil {
v := 0
if *value.b {
v = 1
}
ret = C.virTypedParamsAddBooleanWrapper(&cparams, &nparams, &maxparams, cname, C.int(v), &err)
} else if value.d != nil {
ret = C.virTypedParamsAddDoubleWrapper(&cparams, &nparams, &maxparams, cname, C.double(*value.d), &err)
} else if value.s != nil {
cvalue := C.CString(*value.s)
defer C.free(unsafe.Pointer(cvalue))
ret = C.virTypedParamsAddStringWrapper(&cparams, &nparams, &maxparams, cname, cvalue, &err)
} else {
return nil, 0, fmt.Errorf("No typed parameter value set for field '%s'", name)
}
if ret < 0 {
return nil, 0, makeError(&err)
}
}
}
return cparams, nparams, nil
}
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/connect.go | vendor/libvirt.org/go/libvirt/connect.go | /*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (c) 2013 Alex Zorin
* Copyright (C) 2016 Red Hat, Inc.
*
*/
package libvirt
import (
"fmt"
"os"
"reflect"
"sync"
"unsafe"
)
/*
#cgo !libvirt_dlopen pkg-config: libvirt
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <stdlib.h>
#include "connect_helper.h"
*/
import "C"
const (
VERSION_NUMBER = uint32(C.LIBVIR_VERSION_NUMBER)
)
type ConnectCloseReason int
const (
CONNECT_CLOSE_REASON_ERROR = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_ERROR)
CONNECT_CLOSE_REASON_EOF = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_EOF)
CONNECT_CLOSE_REASON_KEEPALIVE = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_KEEPALIVE)
CONNECT_CLOSE_REASON_CLIENT = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_CLIENT)
)
type ConnectListAllDomainsFlags uint
const (
CONNECT_LIST_DOMAINS_ACTIVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_ACTIVE)
CONNECT_LIST_DOMAINS_INACTIVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_INACTIVE)
CONNECT_LIST_DOMAINS_PERSISTENT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_PERSISTENT)
CONNECT_LIST_DOMAINS_TRANSIENT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_TRANSIENT)
CONNECT_LIST_DOMAINS_RUNNING = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_RUNNING)
CONNECT_LIST_DOMAINS_PAUSED = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_PAUSED)
CONNECT_LIST_DOMAINS_SHUTOFF = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_SHUTOFF)
CONNECT_LIST_DOMAINS_OTHER = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_OTHER)
CONNECT_LIST_DOMAINS_MANAGEDSAVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE)
CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE)
CONNECT_LIST_DOMAINS_AUTOSTART = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_AUTOSTART)
CONNECT_LIST_DOMAINS_NO_AUTOSTART = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)
CONNECT_LIST_DOMAINS_HAS_SNAPSHOT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT)
CONNECT_LIST_DOMAINS_NO_SNAPSHOT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT)
CONNECT_LIST_DOMAINS_HAS_CHECKPOINT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT)
CONNECT_LIST_DOMAINS_NO_CHECKPOINT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_CHECKPOINT)
)
type ConnectListAllNetworksFlags uint
const (
CONNECT_LIST_NETWORKS_INACTIVE = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_INACTIVE)
CONNECT_LIST_NETWORKS_ACTIVE = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_ACTIVE)
CONNECT_LIST_NETWORKS_PERSISTENT = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_PERSISTENT)
CONNECT_LIST_NETWORKS_TRANSIENT = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_TRANSIENT)
CONNECT_LIST_NETWORKS_AUTOSTART = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_AUTOSTART)
CONNECT_LIST_NETWORKS_NO_AUTOSTART = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART)
)
type ConnectListAllStoragePoolsFlags uint
const (
CONNECT_LIST_STORAGE_POOLS_INACTIVE = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE)
CONNECT_LIST_STORAGE_POOLS_ACTIVE = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)
CONNECT_LIST_STORAGE_POOLS_PERSISTENT = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT)
CONNECT_LIST_STORAGE_POOLS_TRANSIENT = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT)
CONNECT_LIST_STORAGE_POOLS_AUTOSTART = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART)
CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART)
CONNECT_LIST_STORAGE_POOLS_DIR = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_DIR)
CONNECT_LIST_STORAGE_POOLS_FS = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_FS)
CONNECT_LIST_STORAGE_POOLS_NETFS = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_NETFS)
CONNECT_LIST_STORAGE_POOLS_LOGICAL = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL)
CONNECT_LIST_STORAGE_POOLS_DISK = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_DISK)
CONNECT_LIST_STORAGE_POOLS_ISCSI = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI)
CONNECT_LIST_STORAGE_POOLS_SCSI = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_SCSI)
CONNECT_LIST_STORAGE_POOLS_MPATH = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_MPATH)
CONNECT_LIST_STORAGE_POOLS_RBD = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_RBD)
CONNECT_LIST_STORAGE_POOLS_SHEEPDOG = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG)
CONNECT_LIST_STORAGE_POOLS_GLUSTER = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER)
CONNECT_LIST_STORAGE_POOLS_ZFS = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ZFS)
CONNECT_LIST_STORAGE_POOLS_VSTORAGE = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE)
CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT)
)
type ConnectBaselineCPUFlags uint
const (
CONNECT_BASELINE_CPU_EXPAND_FEATURES = ConnectBaselineCPUFlags(C.VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)
CONNECT_BASELINE_CPU_MIGRATABLE = ConnectBaselineCPUFlags(C.VIR_CONNECT_BASELINE_CPU_MIGRATABLE)
)
type ConnectCompareCPUFlags uint
const (
CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE = ConnectCompareCPUFlags(C.VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE)
CONNECT_COMPARE_CPU_VALIDATE_XML = ConnectCompareCPUFlags(C.VIR_CONNECT_COMPARE_CPU_VALIDATE_XML)
)
type ConnectListAllInterfacesFlags uint
const (
CONNECT_LIST_INTERFACES_INACTIVE = ConnectListAllInterfacesFlags(C.VIR_CONNECT_LIST_INTERFACES_INACTIVE)
CONNECT_LIST_INTERFACES_ACTIVE = ConnectListAllInterfacesFlags(C.VIR_CONNECT_LIST_INTERFACES_ACTIVE)
)
type ConnectListAllNodeDeviceFlags uint
const (
CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM)
CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV)
CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV)
CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE)
CONNECT_LIST_NODE_DEVICES_CAP_NET = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET)
CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST)
CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET)
CONNECT_LIST_NODE_DEVICES_CAP_SCSI = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI)
CONNECT_LIST_NODE_DEVICES_CAP_STORAGE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE)
CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST)
CONNECT_LIST_NODE_DEVICES_CAP_VPORTS = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS)
CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC)
CONNECT_LIST_NODE_DEVICES_CAP_DRM = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM)
CONNECT_LIST_NODE_DEVICES_CAP_MDEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV)
CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES)
CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV)
CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV)
CONNECT_LIST_NODE_DEVICES_CAP_VDPA = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA)
CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD)
CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE)
CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX)
CONNECT_LIST_NODE_DEVICES_CAP_VPD = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPD)
CONNECT_LIST_NODE_DEVICES_INACTIVE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE)
CONNECT_LIST_NODE_DEVICES_ACTIVE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE)
CONNECT_LIST_NODE_DEVICES_PERSISTENT = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_PERSISTENT)
CONNECT_LIST_NODE_DEVICES_TRANSIENT = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_TRANSIENT)
)
type ConnectListAllSecretsFlags uint
const (
CONNECT_LIST_SECRETS_EPHEMERAL = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_EPHEMERAL)
CONNECT_LIST_SECRETS_NO_EPHEMERAL = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL)
CONNECT_LIST_SECRETS_PRIVATE = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_PRIVATE)
CONNECT_LIST_SECRETS_NO_PRIVATE = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_NO_PRIVATE)
)
type ConnectGetAllDomainStatsFlags uint
const (
CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE)
CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE)
CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT)
CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT)
CONNECT_GET_ALL_DOMAINS_STATS_RUNNING = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING)
CONNECT_GET_ALL_DOMAINS_STATS_PAUSED = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED)
CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF)
CONNECT_GET_ALL_DOMAINS_STATS_OTHER = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER)
CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT)
CONNECT_GET_ALL_DOMAINS_STATS_BACKING = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING)
CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS)
)
type ConnectFlags uint
const (
CONNECT_RO = ConnectFlags(C.VIR_CONNECT_RO)
CONNECT_NO_ALIASES = ConnectFlags(C.VIR_CONNECT_NO_ALIASES)
)
type ConnectDomainEventAgentLifecycleState int
const (
CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED = ConnectDomainEventAgentLifecycleState(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED)
CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED = ConnectDomainEventAgentLifecycleState(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED)
)
type ConnectDomainEventAgentLifecycleReason int
const (
CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN = ConnectDomainEventAgentLifecycleReason(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN)
CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED = ConnectDomainEventAgentLifecycleReason(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED)
CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL = ConnectDomainEventAgentLifecycleReason(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL)
)
type CPUCompareResult int
const (
CPU_COMPARE_ERROR = CPUCompareResult(C.VIR_CPU_COMPARE_ERROR)
CPU_COMPARE_INCOMPATIBLE = CPUCompareResult(C.VIR_CPU_COMPARE_INCOMPATIBLE)
CPU_COMPARE_IDENTICAL = CPUCompareResult(C.VIR_CPU_COMPARE_IDENTICAL)
CPU_COMPARE_SUPERSET = CPUCompareResult(C.VIR_CPU_COMPARE_SUPERSET)
)
type NodeAllocPagesFlags uint
const (
NODE_ALLOC_PAGES_ADD = NodeAllocPagesFlags(C.VIR_NODE_ALLOC_PAGES_ADD)
NODE_ALLOC_PAGES_SET = NodeAllocPagesFlags(C.VIR_NODE_ALLOC_PAGES_SET)
)
type NodeSuspendTarget int
const (
NODE_SUSPEND_TARGET_MEM = NodeSuspendTarget(C.VIR_NODE_SUSPEND_TARGET_MEM)
NODE_SUSPEND_TARGET_DISK = NodeSuspendTarget(C.VIR_NODE_SUSPEND_TARGET_DISK)
NODE_SUSPEND_TARGET_HYBRID = NodeSuspendTarget(C.VIR_NODE_SUSPEND_TARGET_HYBRID)
)
type NodeGetCPUStatsAllCPUs int
const (
NODE_CPU_STATS_ALL_CPUS = NodeGetCPUStatsAllCPUs(C.VIR_NODE_CPU_STATS_ALL_CPUS)
)
const (
NODE_MEMORY_STATS_ALL_CELLS = int(C.VIR_NODE_MEMORY_STATS_ALL_CELLS)
)
type ConnectCredentialType int
const (
CRED_USERNAME = ConnectCredentialType(C.VIR_CRED_USERNAME)
CRED_AUTHNAME = ConnectCredentialType(C.VIR_CRED_AUTHNAME)
CRED_LANGUAGE = ConnectCredentialType(C.VIR_CRED_LANGUAGE)
CRED_CNONCE = ConnectCredentialType(C.VIR_CRED_CNONCE)
CRED_PASSPHRASE = ConnectCredentialType(C.VIR_CRED_PASSPHRASE)
CRED_ECHOPROMPT = ConnectCredentialType(C.VIR_CRED_ECHOPROMPT)
CRED_NOECHOPROMPT = ConnectCredentialType(C.VIR_CRED_NOECHOPROMPT)
CRED_REALM = ConnectCredentialType(C.VIR_CRED_REALM)
CRED_EXTERNAL = ConnectCredentialType(C.VIR_CRED_EXTERNAL)
)
type Connect struct {
ptr C.virConnectPtr
}
type NodeInfo struct {
Model string
Memory uint64
Cpus uint
MHz uint
Nodes uint32
Sockets uint32
Cores uint32
Threads uint32
}
// Additional data associated to the connection.
type virConnectionData struct {
errCallbackId *int
closeCallbackId *int
}
var connections map[C.virConnectPtr]*virConnectionData
var connectionsLock sync.RWMutex
func init() {
connections = make(map[C.virConnectPtr]*virConnectionData)
}
func saveConnectionData(c *Connect, d *virConnectionData) {
if c.ptr == nil {
return // Or panic?
}
connectionsLock.Lock()
defer connectionsLock.Unlock()
connections[c.ptr] = d
}
func getConnectionData(c *Connect) *virConnectionData {
connectionsLock.RLock()
d := connections[c.ptr]
connectionsLock.RUnlock()
if d != nil {
return d
}
d = &virConnectionData{}
saveConnectionData(c, d)
return d
}
func releaseConnectionData(c *Connect) {
if c.ptr == nil {
return
}
connectionsLock.Lock()
defer connectionsLock.Unlock()
delete(connections, c.ptr)
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virGetVersion
func GetVersion() (uint32, error) {
var version C.ulong
var err C.virError
ret := C.virGetVersionWrapper(&version, nil, nil, &err)
if ret < 0 {
return 0, makeError(&err)
}
return uint32(version), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpen
func NewConnect(uri string) (*Connect, error) {
var cUri *C.char
if uri != "" {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
var err C.virError
ptr := C.virConnectOpenWrapper(cUri, &err)
if ptr == nil {
return nil, makeError(&err)
}
return &Connect{ptr: ptr}, nil
}
type ConnectCredential struct {
Type ConnectCredentialType
Prompt string
Challenge string
DefResult string
Result string
ResultLen int
}
type ConnectAuthCallback func(creds []*ConnectCredential)
type ConnectAuth struct {
CredType []ConnectCredentialType
Callback ConnectAuthCallback
}
//export connectAuthCallback
func connectAuthCallback(ccredlist C.virConnectCredentialPtr, ncred C.uint, callbackID C.int) C.int {
cred := make([]*ConnectCredential, int(ncred))
for i := 0; i < int(ncred); i++ {
ccred := (C.virConnectCredentialPtr)(unsafe.Pointer((uintptr)(unsafe.Pointer(ccredlist)) + (unsafe.Sizeof(*ccredlist) * uintptr(i))))
cred[i] = &ConnectCredential{
Type: ConnectCredentialType(ccred._type),
Prompt: C.GoString(ccred.prompt),
Challenge: C.GoString(ccred.challenge),
DefResult: C.GoString(ccred.defresult),
ResultLen: -1,
}
}
callbackEntry := getCallbackId(int(callbackID))
callback, ok := callbackEntry.(ConnectAuthCallback)
if !ok {
panic("Unexpected callback type")
}
callback(cred)
for i := 0; i < int(ncred); i++ {
ccred := (C.virConnectCredentialPtr)(unsafe.Pointer((uintptr)(unsafe.Pointer(ccredlist)) + (unsafe.Sizeof(*ccredlist) * uintptr(i))))
if cred[i].ResultLen >= 0 {
ccred.result = C.CString(cred[i].Result)
ccred.resultlen = C.uint(cred[i].ResultLen)
}
}
return 0
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpenAuth
func NewConnectWithAuth(uri string, auth *ConnectAuth, flags ConnectFlags) (*Connect, error) {
var cUri *C.char
var err C.virError
var ptr C.virConnectPtr
if uri != "" {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
if auth == nil || len(auth.CredType) == 0 {
ptr = C.virConnectOpenAuthWrapper(cUri, nil, C.uint(flags), &err)
} else {
ccredtype := make([]C.int, len(auth.CredType))
for i := 0; i < len(auth.CredType); i++ {
ccredtype[i] = C.int(auth.CredType[i])
}
callbackID := registerCallbackId(auth.Callback)
ptr = C.virConnectOpenAuthHelper(cUri, &ccredtype[0], C.uint(len(auth.CredType)), C.int(callbackID), C.uint(flags), &err)
freeCallbackId(callbackID)
}
if ptr == nil {
return nil, makeError(&err)
}
return &Connect{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpenAuth
func NewConnectWithAuthDefault(uri string, flags ConnectFlags) (*Connect, error) {
var cUri *C.char
if uri != "" {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
var err C.virError
ptr := C.virConnectOpenAuthDefaultHelper(cUri, C.uint(flags), &err)
if ptr == nil {
return nil, makeError(&err)
}
return &Connect{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpenReadOnly
func NewConnectReadOnly(uri string) (*Connect, error) {
var cUri *C.char
if uri != "" {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
var err C.virError
ptr := C.virConnectOpenReadOnlyWrapper(cUri, &err)
if ptr == nil {
return nil, makeError(&err)
}
return &Connect{ptr: ptr}, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectClose
func (c *Connect) Close() (int, error) {
var err C.virError
result := int(C.virConnectCloseWrapper(c.ptr, &err))
if result == -1 {
return result, makeError(&err)
}
if result == 0 {
// No more reference to this connection, release data.
releaseConnectionData(c)
c.ptr = nil
}
return result, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectRef
func (c *Connect) Ref() error {
var err C.virError
ret := C.virConnectRefWrapper(c.ptr, &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// Return the raw pointer. Caller is responsible for closing it via
// CloseRawPtr(). This is intended to allow integration with Go bindings
// to other C APIs that require direct access a virConnectPtr. This should
// not be used in other scenarios.
func (c *Connect) RawPtr() (C.virConnectPtr, error) {
var err C.virError
ret := C.virConnectRefWrapper(c.ptr, &err)
if ret == -1 {
return nil, makeError(&err)
}
return c.ptr, nil
}
// Unref (and possibly close) raw libvirt connection object, previously
// obtained via RawPtr().
func CloseRawPtr(c C.virConnectPtr) (int, error) {
cc := Connect{ptr: c}
return cc.Close()
}
type CloseCallback func(conn *Connect, reason ConnectCloseReason)
// Register a close callback for the given destination. Only one
// callback per connection is allowed. Setting a callback will remove
// the previous one.
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectRegisterCloseCallback
func (c *Connect) RegisterCloseCallback(callback CloseCallback) error {
c.UnregisterCloseCallback()
goCallbackId := registerCallbackId(callback)
var err C.virError
res := C.virConnectRegisterCloseCallbackHelper(c.ptr, C.long(goCallbackId), &err)
if res != 0 {
freeCallbackId(goCallbackId)
return makeError(&err)
}
connData := getConnectionData(c)
connData.closeCallbackId = &goCallbackId
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectUnregisterCloseCallback
func (c *Connect) UnregisterCloseCallback() error {
connData := getConnectionData(c)
if connData.closeCallbackId == nil {
return nil
}
var err C.virError
res := C.virConnectUnregisterCloseCallbackHelper(c.ptr, &err)
if res != 0 {
return makeError(&err)
}
connData.closeCallbackId = nil
return nil
}
//export closeCallback
func closeCallback(conn C.virConnectPtr, reason ConnectCloseReason, goCallbackId int) {
callbackFunc := getCallbackId(goCallbackId)
callback, ok := callbackFunc.(CloseCallback)
if !ok {
panic("Inappropriate callback type called")
}
callback(&Connect{ptr: conn}, reason)
}
type ConnectIdentity struct {
UserNameSet bool
UserName string
UNIXUserIDSet bool
UNIXUserID uint64
GroupNameSet bool
GroupName string
UNIXGroupIDSet bool
UNIXGroupID uint64
ProcessIDSet bool
ProcessID int64
ProcessTimeSet bool
ProcessTime uint64
SASLUserNameSet bool
SASLUserName string
X509DistinguishedNameSet bool
X509DistinguishedName string
SELinuxContextSet bool
SELinuxContext string
}
func getConnectIdentityFieldInfo(params *ConnectIdentity) map[string]typedParamsFieldInfo {
return map[string]typedParamsFieldInfo{
C.VIR_CONNECT_IDENTITY_USER_NAME: typedParamsFieldInfo{
set: ¶ms.UserNameSet,
s: ¶ms.UserName,
},
C.VIR_CONNECT_IDENTITY_UNIX_USER_ID: typedParamsFieldInfo{
set: ¶ms.UNIXUserIDSet,
ul: ¶ms.UNIXUserID,
},
C.VIR_CONNECT_IDENTITY_GROUP_NAME: typedParamsFieldInfo{
set: ¶ms.GroupNameSet,
s: ¶ms.GroupName,
},
C.VIR_CONNECT_IDENTITY_UNIX_GROUP_ID: typedParamsFieldInfo{
set: ¶ms.UNIXGroupIDSet,
ul: ¶ms.UNIXGroupID,
},
C.VIR_CONNECT_IDENTITY_PROCESS_ID: typedParamsFieldInfo{
set: ¶ms.ProcessIDSet,
l: ¶ms.ProcessID,
},
C.VIR_CONNECT_IDENTITY_PROCESS_TIME: typedParamsFieldInfo{
set: ¶ms.ProcessTimeSet,
ul: ¶ms.ProcessTime,
},
C.VIR_CONNECT_IDENTITY_SASL_USER_NAME: typedParamsFieldInfo{
set: ¶ms.SASLUserNameSet,
s: ¶ms.SASLUserName,
},
C.VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME: typedParamsFieldInfo{
set: ¶ms.X509DistinguishedNameSet,
s: ¶ms.X509DistinguishedName,
},
C.VIR_CONNECT_IDENTITY_SELINUX_CONTEXT: typedParamsFieldInfo{
set: ¶ms.SELinuxContextSet,
s: ¶ms.SELinuxContext,
},
}
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectSetIdentity
func (c *Connect) SetIdentity(ident *ConnectIdentity, flags uint32) error {
info := getConnectIdentityFieldInfo(ident)
cparams, cnparams, gerr := typedParamsPackNew(info)
if gerr != nil {
return gerr
}
defer C.virTypedParamsFreeWrapper(cparams, cnparams)
var err C.virError
ret := C.virConnectSetIdentityWrapper(c.ptr, cparams, cnparams, C.uint(flags), &err)
if ret == -1 {
return makeError(&err)
}
return nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetCapabilities
func (c *Connect) GetCapabilities() (string, error) {
var err C.virError
str := C.virConnectGetCapabilitiesWrapper(c.ptr, &err)
if str == nil {
return "", makeError(&err)
}
capabilities := C.GoString(str)
C.free(unsafe.Pointer(str))
return capabilities, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetInfo
func (c *Connect) GetNodeInfo() (*NodeInfo, error) {
var cinfo C.virNodeInfo
var err C.virError
result := C.virNodeGetInfoWrapper(c.ptr, &cinfo, &err)
if result == -1 {
return nil, makeError(&err)
}
return &NodeInfo{
Model: C.GoString((*C.char)(unsafe.Pointer(&cinfo.model[0]))),
Memory: uint64(cinfo.memory),
Cpus: uint(cinfo.cpus),
MHz: uint(cinfo.mhz),
Nodes: uint32(cinfo.nodes),
Sockets: uint32(cinfo.sockets),
Cores: uint32(cinfo.cores),
Threads: uint32(cinfo.threads),
}, nil
}
func (ni *NodeInfo) GetMaxCPUs() uint32 {
return ni.Nodes * ni.Sockets * ni.Cores * ni.Threads
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetHostname
func (c *Connect) GetHostname() (string, error) {
var err C.virError
str := C.virConnectGetHostnameWrapper(c.ptr, &err)
if str == nil {
return "", makeError(&err)
}
hostname := C.GoString(str)
C.free(unsafe.Pointer(str))
return hostname, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetLibVersion
func (c *Connect) GetLibVersion() (uint32, error) {
var version C.ulong
var err C.virError
ret := C.virConnectGetLibVersionWrapper(c.ptr, &version, &err)
if ret < 0 {
return 0, makeError(&err)
}
return uint32(version), nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetType
func (c *Connect) GetType() (string, error) {
var err C.virError
str := C.virConnectGetTypeWrapper(c.ptr, &err)
if str == nil {
return "", makeError(&err)
}
hypDriver := C.GoString(str)
return hypDriver, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsAlive
func (c *Connect) IsAlive() (bool, error) {
var err C.virError
result := C.virConnectIsAliveWrapper(c.ptr, &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsEncrypted
func (c *Connect) IsEncrypted() (bool, error) {
var err C.virError
result := C.virConnectIsEncryptedWrapper(c.ptr, &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsSecure
func (c *Connect) IsSecure() (bool, error) {
var err C.virError
result := C.virConnectIsSecureWrapper(c.ptr, &err)
if result == -1 {
return false, makeError(&err)
}
if result == 1 {
return true, nil
}
return false, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListDefinedDomains
func (c *Connect) ListDefinedDomains() ([]string, error) {
var names [1024](*C.char)
namesPtr := unsafe.Pointer(&names)
var err C.virError
numDomains := C.virConnectListDefinedDomainsWrapper(
c.ptr,
(**C.char)(namesPtr),
1024, &err)
if numDomains == -1 {
return nil, makeError(&err)
}
goNames := make([]string, numDomains)
for k := 0; k < int(numDomains); k++ {
goNames[k] = C.GoString(names[k])
C.free(unsafe.Pointer(names[k]))
}
return goNames, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListDomains
func (c *Connect) ListDomains() ([]uint32, error) {
var cDomainsIds [512](uint32)
cDomainsPointer := unsafe.Pointer(&cDomainsIds)
var err C.virError
numDomains := C.virConnectListDomainsWrapper(c.ptr, (*C.int)(cDomainsPointer), 512, &err)
if numDomains == -1 {
return nil, makeError(&err)
}
return cDomainsIds[:numDomains], nil
}
// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectListInterfaces
func (c *Connect) ListInterfaces() ([]string, error) {
const maxIfaces = 1024
var names [maxIfaces](*C.char)
namesPtr := unsafe.Pointer(&names)
var err C.virError
numIfaces := C.virConnectListInterfacesWrapper(
c.ptr,
(**C.char)(namesPtr),
maxIfaces, &err)
if numIfaces == -1 {
return nil, makeError(&err)
}
goNames := make([]string, numIfaces)
for k := 0; k < int(numIfaces); k++ {
goNames[k] = C.GoString(names[k])
C.free(unsafe.Pointer(names[k]))
}
return goNames, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListNetworks
func (c *Connect) ListNetworks() ([]string, error) {
const maxNets = 1024
var names [maxNets](*C.char)
namesPtr := unsafe.Pointer(&names)
var err C.virError
numNetworks := C.virConnectListNetworksWrapper(
c.ptr,
(**C.char)(namesPtr),
maxNets, &err)
if numNetworks == -1 {
return nil, makeError(&err)
}
goNames := make([]string, numNetworks)
for k := 0; k < int(numNetworks); k++ {
goNames[k] = C.GoString(names[k])
C.free(unsafe.Pointer(names[k]))
}
return goNames, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectListNWFilters
func (c *Connect) ListNWFilters() ([]string, error) {
const maxFilters = 1024
var names [maxFilters](*C.char)
namesPtr := unsafe.Pointer(&names)
var err C.virError
numNWFilters := C.virConnectListNWFiltersWrapper(
c.ptr,
(**C.char)(namesPtr),
maxFilters, &err)
if numNWFilters == -1 {
return nil, makeError(&err)
}
goNames := make([]string, numNWFilters)
for k := 0; k < int(numNWFilters); k++ {
goNames[k] = C.GoString(names[k])
C.free(unsafe.Pointer(names[k]))
}
return goNames, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectListStoragePools
func (c *Connect) ListStoragePools() ([]string, error) {
const maxPools = 1024
var names [maxPools](*C.char)
namesPtr := unsafe.Pointer(&names)
var err C.virError
numStoragePools := C.virConnectListStoragePoolsWrapper(
c.ptr,
(**C.char)(namesPtr),
maxPools, &err)
if numStoragePools == -1 {
return nil, makeError(&err)
}
goNames := make([]string, numStoragePools)
for k := 0; k < int(numStoragePools); k++ {
goNames[k] = C.GoString(names[k])
C.free(unsafe.Pointer(names[k]))
}
return goNames, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectListSecrets
func (c *Connect) ListSecrets() ([]string, error) {
const maxSecrets = 1024
var uuids [maxSecrets](*C.char)
uuidsPtr := unsafe.Pointer(&uuids)
var err C.virError
numSecrets := C.virConnectListSecretsWrapper(
c.ptr,
(**C.char)(uuidsPtr),
maxSecrets, &err)
if numSecrets == -1 {
return nil, makeError(&err)
}
goUuids := make([]string, numSecrets)
for k := 0; k < int(numSecrets); k++ {
goUuids[k] = C.GoString(uuids[k])
C.free(unsafe.Pointer(uuids[k]))
}
return goUuids, nil
}
// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeListDevices
func (c *Connect) ListDevices(cap string, flags uint32) ([]string, error) {
ccap := C.CString(cap)
defer C.free(unsafe.Pointer(ccap))
const maxNodeDevices = 1024
var uuids [maxNodeDevices](*C.char)
uuidsPtr := unsafe.Pointer(&uuids)
var err C.virError
numNodeDevices := C.virNodeListDevicesWrapper(
c.ptr, ccap,
(**C.char)(uuidsPtr),
maxNodeDevices, C.uint(flags), &err)
if numNodeDevices == -1 {
return nil, makeError(&err)
}
goUuids := make([]string, numNodeDevices)
for k := 0; k < int(numNodeDevices); k++ {
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_domain.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_domain.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectDomainEventDeregisterFuncType)(virConnectPtr conn,
virConnectDomainEventCallback cb);
int
virConnectDomainEventDeregisterWrapper(virConnectPtr conn,
virConnectDomainEventCallback cb,
virErrorPtr err)
{
int ret = -1;
static virConnectDomainEventDeregisterFuncType virConnectDomainEventDeregisterSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectDomainEventDeregister",
(void**)&virConnectDomainEventDeregisterSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainEventDeregisterSymbol(conn,
cb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectDomainEventDeregisterAnyFuncType)(virConnectPtr conn,
int callbackID);
int
virConnectDomainEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
static virConnectDomainEventDeregisterAnyFuncType virConnectDomainEventDeregisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectDomainEventDeregisterAny",
(void**)&virConnectDomainEventDeregisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainEventDeregisterAnySymbol(conn,
callbackID);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectDomainEventRegisterFuncType)(virConnectPtr conn,
virConnectDomainEventCallback cb,
void * opaque,
virFreeCallback freecb);
int
virConnectDomainEventRegisterWrapper(virConnectPtr conn,
virConnectDomainEventCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectDomainEventRegisterFuncType virConnectDomainEventRegisterSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectDomainEventRegister",
(void**)&virConnectDomainEventRegisterSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainEventRegisterSymbol(conn,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectDomainEventRegisterAnyFuncType)(virConnectPtr conn,
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
void * opaque,
virFreeCallback freecb);
int
virConnectDomainEventRegisterAnyWrapper(virConnectPtr conn,
virDomainPtr dom,
int eventID,
virConnectDomainEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectDomainEventRegisterAnyFuncType virConnectDomainEventRegisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectDomainEventRegisterAny",
(void**)&virConnectDomainEventRegisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainEventRegisterAnySymbol(conn,
dom,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectDomainXMLFromNativeFuncType)(virConnectPtr conn,
const char * nativeFormat,
const char * nativeConfig,
unsigned int flags);
char *
virConnectDomainXMLFromNativeWrapper(virConnectPtr conn,
const char * nativeFormat,
const char * nativeConfig,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectDomainXMLFromNativeFuncType virConnectDomainXMLFromNativeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectDomainXMLFromNative",
(void**)&virConnectDomainXMLFromNativeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainXMLFromNativeSymbol(conn,
nativeFormat,
nativeConfig,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectDomainXMLToNativeFuncType)(virConnectPtr conn,
const char * nativeFormat,
const char * domainXml,
unsigned int flags);
char *
virConnectDomainXMLToNativeWrapper(virConnectPtr conn,
const char * nativeFormat,
const char * domainXml,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectDomainXMLToNativeFuncType virConnectDomainXMLToNativeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectDomainXMLToNative",
(void**)&virConnectDomainXMLToNativeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectDomainXMLToNativeSymbol(conn,
nativeFormat,
domainXml,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectGetAllDomainStatsFuncType)(virConnectPtr conn,
unsigned int stats,
virDomainStatsRecordPtr ** retStats,
unsigned int flags);
int
virConnectGetAllDomainStatsWrapper(virConnectPtr conn,
unsigned int stats,
virDomainStatsRecordPtr ** retStats,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectGetAllDomainStatsFuncType virConnectGetAllDomainStatsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetAllDomainStats",
(void**)&virConnectGetAllDomainStatsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetAllDomainStatsSymbol(conn,
stats,
retStats,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virConnectGetDomainCapabilitiesFuncType)(virConnectPtr conn,
const char * emulatorbin,
const char * arch,
const char * machine,
const char * virttype,
unsigned int flags);
char *
virConnectGetDomainCapabilitiesWrapper(virConnectPtr conn,
const char * emulatorbin,
const char * arch,
const char * machine,
const char * virttype,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virConnectGetDomainCapabilitiesFuncType virConnectGetDomainCapabilitiesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectGetDomainCapabilities",
(void**)&virConnectGetDomainCapabilitiesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectGetDomainCapabilitiesSymbol(conn,
emulatorbin,
arch,
machine,
virttype,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListAllDomainsFuncType)(virConnectPtr conn,
virDomainPtr ** domains,
unsigned int flags);
int
virConnectListAllDomainsWrapper(virConnectPtr conn,
virDomainPtr ** domains,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllDomainsFuncType virConnectListAllDomainsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllDomains",
(void**)&virConnectListAllDomainsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllDomainsSymbol(conn,
domains,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListDefinedDomainsFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListDefinedDomainsWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListDefinedDomainsFuncType virConnectListDefinedDomainsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListDefinedDomains",
(void**)&virConnectListDefinedDomainsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListDefinedDomainsSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListDomainsFuncType)(virConnectPtr conn,
int * ids,
int maxids);
int
virConnectListDomainsWrapper(virConnectPtr conn,
int * ids,
int maxids,
virErrorPtr err)
{
int ret = -1;
static virConnectListDomainsFuncType virConnectListDomainsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListDomains",
(void**)&virConnectListDomainsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListDomainsSymbol(conn,
ids,
maxids);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfDefinedDomainsFuncType)(virConnectPtr conn);
int
virConnectNumOfDefinedDomainsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfDefinedDomainsFuncType virConnectNumOfDefinedDomainsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfDefinedDomains",
(void**)&virConnectNumOfDefinedDomainsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfDefinedDomainsSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfDomainsFuncType)(virConnectPtr conn);
int
virConnectNumOfDomainsWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfDomainsFuncType virConnectNumOfDomainsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfDomains",
(void**)&virConnectNumOfDomainsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfDomainsSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAbortJobFuncType)(virDomainPtr domain);
int
virDomainAbortJobWrapper(virDomainPtr domain,
virErrorPtr err)
{
int ret = -1;
static virDomainAbortJobFuncType virDomainAbortJobSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAbortJob",
(void**)&virDomainAbortJobSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAbortJobSymbol(domain);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAbortJobFlagsFuncType)(virDomainPtr domain,
unsigned int flags);
int
virDomainAbortJobFlagsWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainAbortJobFlagsFuncType virDomainAbortJobFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAbortJobFlags",
(void**)&virDomainAbortJobFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAbortJobFlagsSymbol(domain,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAddIOThreadFuncType)(virDomainPtr domain,
unsigned int iothread_id,
unsigned int flags);
int
virDomainAddIOThreadWrapper(virDomainPtr domain,
unsigned int iothread_id,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainAddIOThreadFuncType virDomainAddIOThreadSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAddIOThread",
(void**)&virDomainAddIOThreadSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAddIOThreadSymbol(domain,
iothread_id,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAgentSetResponseTimeoutFuncType)(virDomainPtr domain,
int timeout,
unsigned int flags);
int
virDomainAgentSetResponseTimeoutWrapper(virDomainPtr domain,
int timeout,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainAgentSetResponseTimeoutFuncType virDomainAgentSetResponseTimeoutSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAgentSetResponseTimeout",
(void**)&virDomainAgentSetResponseTimeoutSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAgentSetResponseTimeoutSymbol(domain,
timeout,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAttachDeviceFuncType)(virDomainPtr domain,
const char * xml);
int
virDomainAttachDeviceWrapper(virDomainPtr domain,
const char * xml,
virErrorPtr err)
{
int ret = -1;
static virDomainAttachDeviceFuncType virDomainAttachDeviceSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAttachDevice",
(void**)&virDomainAttachDeviceSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAttachDeviceSymbol(domain,
xml);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAttachDeviceFlagsFuncType)(virDomainPtr domain,
const char * xml,
unsigned int flags);
int
virDomainAttachDeviceFlagsWrapper(virDomainPtr domain,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainAttachDeviceFlagsFuncType virDomainAttachDeviceFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAttachDeviceFlags",
(void**)&virDomainAttachDeviceFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAttachDeviceFlagsSymbol(domain,
xml,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAuthorizedSSHKeysGetFuncType)(virDomainPtr domain,
const char * user,
char *** keys,
unsigned int flags);
int
virDomainAuthorizedSSHKeysGetWrapper(virDomainPtr domain,
const char * user,
char *** keys,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainAuthorizedSSHKeysGetFuncType virDomainAuthorizedSSHKeysGetSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAuthorizedSSHKeysGet",
(void**)&virDomainAuthorizedSSHKeysGetSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAuthorizedSSHKeysGetSymbol(domain,
user,
keys,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainAuthorizedSSHKeysSetFuncType)(virDomainPtr domain,
const char * user,
const char ** keys,
unsigned int nkeys,
unsigned int flags);
int
virDomainAuthorizedSSHKeysSetWrapper(virDomainPtr domain,
const char * user,
const char ** keys,
unsigned int nkeys,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainAuthorizedSSHKeysSetFuncType virDomainAuthorizedSSHKeysSetSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainAuthorizedSSHKeysSet",
(void**)&virDomainAuthorizedSSHKeysSetSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainAuthorizedSSHKeysSetSymbol(domain,
user,
keys,
nkeys,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBackupBeginFuncType)(virDomainPtr domain,
const char * backupXML,
const char * checkpointXML,
unsigned int flags);
int
virDomainBackupBeginWrapper(virDomainPtr domain,
const char * backupXML,
const char * checkpointXML,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainBackupBeginFuncType virDomainBackupBeginSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBackupBegin",
(void**)&virDomainBackupBeginSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBackupBeginSymbol(domain,
backupXML,
checkpointXML,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virDomainBackupGetXMLDescFuncType)(virDomainPtr domain,
unsigned int flags);
char *
virDomainBackupGetXMLDescWrapper(virDomainPtr domain,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virDomainBackupGetXMLDescFuncType virDomainBackupGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBackupGetXMLDesc",
(void**)&virDomainBackupGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBackupGetXMLDescSymbol(domain,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBlockCommitFuncType)(virDomainPtr dom,
const char * disk,
const char * base,
const char * top,
unsigned long bandwidth,
unsigned int flags);
int
virDomainBlockCommitWrapper(virDomainPtr dom,
const char * disk,
const char * base,
const char * top,
unsigned long bandwidth,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainBlockCommitFuncType virDomainBlockCommitSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBlockCommit",
(void**)&virDomainBlockCommitSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBlockCommitSymbol(dom,
disk,
base,
top,
bandwidth,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBlockCopyFuncType)(virDomainPtr dom,
const char * disk,
const char * destxml,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
int
virDomainBlockCopyWrapper(virDomainPtr dom,
const char * disk,
const char * destxml,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainBlockCopyFuncType virDomainBlockCopySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBlockCopy",
(void**)&virDomainBlockCopySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBlockCopySymbol(dom,
disk,
destxml,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBlockJobAbortFuncType)(virDomainPtr dom,
const char * disk,
unsigned int flags);
int
virDomainBlockJobAbortWrapper(virDomainPtr dom,
const char * disk,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainBlockJobAbortFuncType virDomainBlockJobAbortSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBlockJobAbort",
(void**)&virDomainBlockJobAbortSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBlockJobAbortSymbol(dom,
disk,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBlockJobSetSpeedFuncType)(virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags);
int
virDomainBlockJobSetSpeedWrapper(virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainBlockJobSetSpeedFuncType virDomainBlockJobSetSpeedSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBlockJobSetSpeed",
(void**)&virDomainBlockJobSetSpeedSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBlockJobSetSpeedSymbol(dom,
disk,
bandwidth,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBlockPeekFuncType)(virDomainPtr dom,
const char * disk,
unsigned long long offset,
size_t size,
void * buffer,
unsigned int flags);
int
virDomainBlockPeekWrapper(virDomainPtr dom,
const char * disk,
unsigned long long offset,
size_t size,
void * buffer,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virDomainBlockPeekFuncType virDomainBlockPeekSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virDomainBlockPeek",
(void**)&virDomainBlockPeekSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virDomainBlockPeekSymbol(dom,
disk,
offset,
size,
buffer,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virDomainBlockPullFuncType)(virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
unsigned int flags);
int
virDomainBlockPullWrapper(virDomainPtr dom,
const char * disk,
unsigned long bandwidth,
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_qemu_generated_dlopen.go | vendor/libvirt.org/go/libvirt/libvirt_qemu_generated_dlopen.go | //go:build !libvirt_without_qemu && libvirt_dlopen
// +build !libvirt_without_qemu,libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo libvirt_dlopen LDFLAGS: -ldl
#cgo libvirt_dlopen CFLAGS: -DLIBVIRT_DLOPEN
#include <dlfcn.h>
#include <stdbool.h>
#include <stdio.h>
#include "libvirt_qemu_generated_dlopen.h"
#include "error_helper.h"
static void *handle;
static bool once;
static void *
libvirtQemuLoad(virErrorPtr err)
{
char *errMsg;
if (once) {
if (handle == NULL) {
setVirError(err, "Failed to open libvirt-qemu.so.0");
}
return handle;
}
handle = dlopen("libvirt-qemu.so.0", RTLD_NOW|RTLD_LOCAL);
once = true;
if (handle == NULL) {
setVirError(err, dlerror());
return handle;
}
return handle;
}
bool
libvirtQemuSymbol(const char *name,
void **symbol,
bool *once,
bool *success,
virErrorPtr err)
{
char *errMsg;
if (!libvirtQemuLoad(err)) {
return *success;
}
if (*once) {
if (!*success) {
// Set error for successive calls
char msg[100];
snprintf(msg, 100, "Failed to load %s", name);
setVirError(err, msg);
}
return *success;
}
// Documentation of dlsym says we should use dlerror() to check for failure
// in dlsym() as a NULL might be the right address for a given symbol.
// This is also the reason to have the @success argument.
*symbol = dlsym(handle, name);
if ((errMsg = dlerror()) != NULL) {
setVirError(err, errMsg);
*once = true;
return *success;
}
*once = true;
*success = true;
return *success;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_network.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_dlopen_network.go | //go:build libvirt_dlopen
// +build libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo LDFLAGS: -ldl
#cgo CFLAGS: -DLIBVIRT_DLOPEN
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated_dlopen.h"
#include "error_helper.h"
typedef int
(*virConnectListAllNetworksFuncType)(virConnectPtr conn,
virNetworkPtr ** nets,
unsigned int flags);
int
virConnectListAllNetworksWrapper(virConnectPtr conn,
virNetworkPtr ** nets,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virConnectListAllNetworksFuncType virConnectListAllNetworksSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListAllNetworks",
(void**)&virConnectListAllNetworksSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListAllNetworksSymbol(conn,
nets,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListDefinedNetworksFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListDefinedNetworksWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListDefinedNetworksFuncType virConnectListDefinedNetworksSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListDefinedNetworks",
(void**)&virConnectListDefinedNetworksSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListDefinedNetworksSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectListNetworksFuncType)(virConnectPtr conn,
char ** const names,
int maxnames);
int
virConnectListNetworksWrapper(virConnectPtr conn,
char ** const names,
int maxnames,
virErrorPtr err)
{
int ret = -1;
static virConnectListNetworksFuncType virConnectListNetworksSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectListNetworks",
(void**)&virConnectListNetworksSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectListNetworksSymbol(conn,
names,
maxnames);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNetworkEventDeregisterAnyFuncType)(virConnectPtr conn,
int callbackID);
int
virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
int callbackID,
virErrorPtr err)
{
int ret = -1;
static virConnectNetworkEventDeregisterAnyFuncType virConnectNetworkEventDeregisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNetworkEventDeregisterAny",
(void**)&virConnectNetworkEventDeregisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNetworkEventDeregisterAnySymbol(conn,
callbackID);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNetworkEventRegisterAnyFuncType)(virConnectPtr conn,
virNetworkPtr net,
int eventID,
virConnectNetworkEventGenericCallback cb,
void * opaque,
virFreeCallback freecb);
int
virConnectNetworkEventRegisterAnyWrapper(virConnectPtr conn,
virNetworkPtr net,
int eventID,
virConnectNetworkEventGenericCallback cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
static virConnectNetworkEventRegisterAnyFuncType virConnectNetworkEventRegisterAnySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNetworkEventRegisterAny",
(void**)&virConnectNetworkEventRegisterAnySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNetworkEventRegisterAnySymbol(conn,
net,
eventID,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfDefinedNetworksFuncType)(virConnectPtr conn);
int
virConnectNumOfDefinedNetworksWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfDefinedNetworksFuncType virConnectNumOfDefinedNetworksSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfDefinedNetworks",
(void**)&virConnectNumOfDefinedNetworksSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfDefinedNetworksSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virConnectNumOfNetworksFuncType)(virConnectPtr conn);
int
virConnectNumOfNetworksWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
static virConnectNumOfNetworksFuncType virConnectNumOfNetworksSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virConnectNumOfNetworks",
(void**)&virConnectNumOfNetworksSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virConnectNumOfNetworksSymbol(conn);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkCreateFuncType)(virNetworkPtr network);
int
virNetworkCreateWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
static virNetworkCreateFuncType virNetworkCreateSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkCreate",
(void**)&virNetworkCreateSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkCreateSymbol(network);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkCreateXMLFuncType)(virConnectPtr conn,
const char * xmlDesc);
virNetworkPtr
virNetworkCreateXMLWrapper(virConnectPtr conn,
const char * xmlDesc,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkCreateXMLFuncType virNetworkCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkCreateXML",
(void**)&virNetworkCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkCreateXMLSymbol(conn,
xmlDesc);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkCreateXMLFlagsFuncType)(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags);
virNetworkPtr
virNetworkCreateXMLFlagsWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkCreateXMLFlagsFuncType virNetworkCreateXMLFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkCreateXMLFlags",
(void**)&virNetworkCreateXMLFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkCreateXMLFlagsSymbol(conn,
xmlDesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef void
(*virNetworkDHCPLeaseFreeFuncType)(virNetworkDHCPLeasePtr lease);
void
virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease)
{
static virNetworkDHCPLeaseFreeFuncType virNetworkDHCPLeaseFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkDHCPLeaseFree",
(void**)&virNetworkDHCPLeaseFreeSymbol,
&once,
&success,
NULL)) {
return;
}
virNetworkDHCPLeaseFreeSymbol(lease);
}
typedef virNetworkPtr
(*virNetworkDefineXMLFuncType)(virConnectPtr conn,
const char * xml);
virNetworkPtr
virNetworkDefineXMLWrapper(virConnectPtr conn,
const char * xml,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkDefineXMLFuncType virNetworkDefineXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkDefineXML",
(void**)&virNetworkDefineXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkDefineXMLSymbol(conn,
xml);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkDefineXMLFlagsFuncType)(virConnectPtr conn,
const char * xml,
unsigned int flags);
virNetworkPtr
virNetworkDefineXMLFlagsWrapper(virConnectPtr conn,
const char * xml,
unsigned int flags,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkDefineXMLFlagsFuncType virNetworkDefineXMLFlagsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkDefineXMLFlags",
(void**)&virNetworkDefineXMLFlagsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkDefineXMLFlagsSymbol(conn,
xml,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkDestroyFuncType)(virNetworkPtr network);
int
virNetworkDestroyWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
static virNetworkDestroyFuncType virNetworkDestroySymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkDestroy",
(void**)&virNetworkDestroySymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkDestroySymbol(network);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkFreeFuncType)(virNetworkPtr network);
int
virNetworkFreeWrapper(virNetworkPtr network,
virErrorPtr err)
{
int ret = -1;
static virNetworkFreeFuncType virNetworkFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkFree",
(void**)&virNetworkFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkFreeSymbol(network);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkGetAutostartFuncType)(virNetworkPtr network,
int * autostart);
int
virNetworkGetAutostartWrapper(virNetworkPtr network,
int * autostart,
virErrorPtr err)
{
int ret = -1;
static virNetworkGetAutostartFuncType virNetworkGetAutostartSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetAutostart",
(void**)&virNetworkGetAutostartSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetAutostartSymbol(network,
autostart);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virNetworkGetBridgeNameFuncType)(virNetworkPtr network);
char *
virNetworkGetBridgeNameWrapper(virNetworkPtr network,
virErrorPtr err)
{
char * ret = NULL;
static virNetworkGetBridgeNameFuncType virNetworkGetBridgeNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetBridgeName",
(void**)&virNetworkGetBridgeNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetBridgeNameSymbol(network);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virConnectPtr
(*virNetworkGetConnectFuncType)(virNetworkPtr net);
virConnectPtr
virNetworkGetConnectWrapper(virNetworkPtr net,
virErrorPtr err)
{
virConnectPtr ret = NULL;
static virNetworkGetConnectFuncType virNetworkGetConnectSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetConnect",
(void**)&virNetworkGetConnectSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetConnectSymbol(net);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkGetDHCPLeasesFuncType)(virNetworkPtr network,
const char * mac,
virNetworkDHCPLeasePtr ** leases,
unsigned int flags);
int
virNetworkGetDHCPLeasesWrapper(virNetworkPtr network,
const char * mac,
virNetworkDHCPLeasePtr ** leases,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNetworkGetDHCPLeasesFuncType virNetworkGetDHCPLeasesSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetDHCPLeases",
(void**)&virNetworkGetDHCPLeasesSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetDHCPLeasesSymbol(network,
mac,
leases,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virNetworkGetMetadataFuncType)(virNetworkPtr network,
int type,
const char * uri,
unsigned int flags);
char *
virNetworkGetMetadataWrapper(virNetworkPtr network,
int type,
const char * uri,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virNetworkGetMetadataFuncType virNetworkGetMetadataSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetMetadata",
(void**)&virNetworkGetMetadataSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetMetadataSymbol(network,
type,
uri,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef const char *
(*virNetworkGetNameFuncType)(virNetworkPtr network);
const char *
virNetworkGetNameWrapper(virNetworkPtr network,
virErrorPtr err)
{
const char * ret = NULL;
static virNetworkGetNameFuncType virNetworkGetNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetName",
(void**)&virNetworkGetNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetNameSymbol(network);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkGetUUIDFuncType)(virNetworkPtr network,
unsigned char * uuid);
int
virNetworkGetUUIDWrapper(virNetworkPtr network,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
static virNetworkGetUUIDFuncType virNetworkGetUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetUUID",
(void**)&virNetworkGetUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetUUIDSymbol(network,
uuid);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkGetUUIDStringFuncType)(virNetworkPtr network,
char * buf);
int
virNetworkGetUUIDStringWrapper(virNetworkPtr network,
char * buf,
virErrorPtr err)
{
int ret = -1;
static virNetworkGetUUIDStringFuncType virNetworkGetUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetUUIDString",
(void**)&virNetworkGetUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetUUIDStringSymbol(network,
buf);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef char *
(*virNetworkGetXMLDescFuncType)(virNetworkPtr network,
unsigned int flags);
char *
virNetworkGetXMLDescWrapper(virNetworkPtr network,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
static virNetworkGetXMLDescFuncType virNetworkGetXMLDescSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkGetXMLDesc",
(void**)&virNetworkGetXMLDescSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkGetXMLDescSymbol(network,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkIsActiveFuncType)(virNetworkPtr net);
int
virNetworkIsActiveWrapper(virNetworkPtr net,
virErrorPtr err)
{
int ret = -1;
static virNetworkIsActiveFuncType virNetworkIsActiveSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkIsActive",
(void**)&virNetworkIsActiveSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkIsActiveSymbol(net);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkIsPersistentFuncType)(virNetworkPtr net);
int
virNetworkIsPersistentWrapper(virNetworkPtr net,
virErrorPtr err)
{
int ret = -1;
static virNetworkIsPersistentFuncType virNetworkIsPersistentSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkIsPersistent",
(void**)&virNetworkIsPersistentSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkIsPersistentSymbol(net);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkListAllPortsFuncType)(virNetworkPtr network,
virNetworkPortPtr ** ports,
unsigned int flags);
int
virNetworkListAllPortsWrapper(virNetworkPtr network,
virNetworkPortPtr ** ports,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNetworkListAllPortsFuncType virNetworkListAllPortsSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkListAllPorts",
(void**)&virNetworkListAllPortsSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkListAllPortsSymbol(network,
ports,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkLookupByNameFuncType)(virConnectPtr conn,
const char * name);
virNetworkPtr
virNetworkLookupByNameWrapper(virConnectPtr conn,
const char * name,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkLookupByNameFuncType virNetworkLookupByNameSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkLookupByName",
(void**)&virNetworkLookupByNameSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkLookupByNameSymbol(conn,
name);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkLookupByUUIDFuncType)(virConnectPtr conn,
const unsigned char * uuid);
virNetworkPtr
virNetworkLookupByUUIDWrapper(virConnectPtr conn,
const unsigned char * uuid,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkLookupByUUIDFuncType virNetworkLookupByUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkLookupByUUID",
(void**)&virNetworkLookupByUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkLookupByUUIDSymbol(conn,
uuid);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkLookupByUUIDStringFuncType)(virConnectPtr conn,
const char * uuidstr);
virNetworkPtr
virNetworkLookupByUUIDStringWrapper(virConnectPtr conn,
const char * uuidstr,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkLookupByUUIDStringFuncType virNetworkLookupByUUIDStringSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkLookupByUUIDString",
(void**)&virNetworkLookupByUUIDStringSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkLookupByUUIDStringSymbol(conn,
uuidstr);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPortPtr
(*virNetworkPortCreateXMLFuncType)(virNetworkPtr net,
const char * xmldesc,
unsigned int flags);
virNetworkPortPtr
virNetworkPortCreateXMLWrapper(virNetworkPtr net,
const char * xmldesc,
unsigned int flags,
virErrorPtr err)
{
virNetworkPortPtr ret = NULL;
static virNetworkPortCreateXMLFuncType virNetworkPortCreateXMLSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkPortCreateXML",
(void**)&virNetworkPortCreateXMLSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkPortCreateXMLSymbol(net,
xmldesc,
flags);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkPortDeleteFuncType)(virNetworkPortPtr port,
unsigned int flags);
int
virNetworkPortDeleteWrapper(virNetworkPortPtr port,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNetworkPortDeleteFuncType virNetworkPortDeleteSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkPortDelete",
(void**)&virNetworkPortDeleteSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkPortDeleteSymbol(port,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkPortFreeFuncType)(virNetworkPortPtr port);
int
virNetworkPortFreeWrapper(virNetworkPortPtr port,
virErrorPtr err)
{
int ret = -1;
static virNetworkPortFreeFuncType virNetworkPortFreeSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkPortFree",
(void**)&virNetworkPortFreeSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkPortFreeSymbol(port);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef virNetworkPtr
(*virNetworkPortGetNetworkFuncType)(virNetworkPortPtr port);
virNetworkPtr
virNetworkPortGetNetworkWrapper(virNetworkPortPtr port,
virErrorPtr err)
{
virNetworkPtr ret = NULL;
static virNetworkPortGetNetworkFuncType virNetworkPortGetNetworkSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkPortGetNetwork",
(void**)&virNetworkPortGetNetworkSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkPortGetNetworkSymbol(port);
if (!ret) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkPortGetParametersFuncType)(virNetworkPortPtr port,
virTypedParameterPtr * params,
int * nparams,
unsigned int flags);
int
virNetworkPortGetParametersWrapper(virNetworkPortPtr port,
virTypedParameterPtr * params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
static virNetworkPortGetParametersFuncType virNetworkPortGetParametersSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkPortGetParameters",
(void**)&virNetworkPortGetParametersSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkPortGetParametersSymbol(port,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkPortGetUUIDFuncType)(virNetworkPortPtr port,
unsigned char * uuid);
int
virNetworkPortGetUUIDWrapper(virNetworkPortPtr port,
unsigned char * uuid,
virErrorPtr err)
{
int ret = -1;
static virNetworkPortGetUUIDFuncType virNetworkPortGetUUIDSymbol;
static bool once;
static bool success;
if (!libvirtSymbol("virNetworkPortGetUUID",
(void**)&virNetworkPortGetUUIDSymbol,
&once,
&success,
err)) {
return ret;
}
ret = virNetworkPortGetUUIDSymbol(port,
uuid);
if (ret < 0) {
virCopyLastErrorWrapper(err);
}
return ret;
}
typedef int
(*virNetworkPortGetUUIDStringFuncType)(virNetworkPortPtr port,
char * buf);
int
virNetworkPortGetUUIDStringWrapper(virNetworkPortPtr port,
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | true |
kubev2v/forklift | https://github.com/kubev2v/forklift/blob/b3b4703e958c25d54c4d48138d9e80ae32fadac3/vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_host.go | vendor/libvirt.org/go/libvirt/libvirt_generated_functions_static_host.go | //go:build !libvirt_dlopen
// +build !libvirt_dlopen
/*
* This file is part of the libvirt-go-module project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Copyright (C) 2022 Red Hat, Inc.
*
*/
/****************************************************************************
* THIS CODE HAS BEEN GENERATED. DO NOT CHANGE IT DIRECTLY *
****************************************************************************/
package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "libvirt_generated.h"
#include "error_helper.h"
char *
virConnectBaselineCPUWrapper(virConnectPtr conn,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 7, 7)
setVirError(err, "Function virConnectBaselineCPU not available prior to libvirt version 0.7.7");
#else
ret = virConnectBaselineCPU(conn,
xmlCPUs,
ncpus,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectBaselineHypervisorCPUWrapper(virConnectPtr conn,
const char * emulator,
const char * arch,
const char * machine,
const char * virttype,
const char ** xmlCPUs,
unsigned int ncpus,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(4, 4, 0)
setVirError(err, "Function virConnectBaselineHypervisorCPU not available prior to libvirt version 4.4.0");
#else
ret = virConnectBaselineHypervisorCPU(conn,
emulator,
arch,
machine,
virttype,
xmlCPUs,
ncpus,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectCloseWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectClose not available prior to libvirt version 0.0.3");
#else
ret = virConnectClose(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectCompareCPUWrapper(virConnectPtr conn,
const char * xmlDesc,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 5)
setVirError(err, "Function virConnectCompareCPU not available prior to libvirt version 0.7.5");
#else
ret = virConnectCompareCPU(conn,
xmlDesc,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectCompareHypervisorCPUWrapper(virConnectPtr conn,
const char * emulator,
const char * arch,
const char * machine,
const char * virttype,
const char * xmlCPU,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 4, 0)
setVirError(err, "Function virConnectCompareHypervisorCPU not available prior to libvirt version 4.4.0");
#else
ret = virConnectCompareHypervisorCPU(conn,
emulator,
arch,
machine,
virttype,
xmlCPU,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectGetCPUModelNamesWrapper(virConnectPtr conn,
const char * arch,
char *** models,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 1, 3)
setVirError(err, "Function virConnectGetCPUModelNames not available prior to libvirt version 1.1.3");
#else
ret = virConnectGetCPUModelNames(conn,
arch,
models,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectGetCapabilitiesWrapper(virConnectPtr conn,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 2, 1)
setVirError(err, "Function virConnectGetCapabilities not available prior to libvirt version 0.2.1");
#else
ret = virConnectGetCapabilities(conn);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectGetHostnameWrapper(virConnectPtr conn,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 3, 0)
setVirError(err, "Function virConnectGetHostname not available prior to libvirt version 0.3.0");
#else
ret = virConnectGetHostname(conn);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectGetLibVersionWrapper(virConnectPtr conn,
unsigned long * libVer,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 3)
setVirError(err, "Function virConnectGetLibVersion not available prior to libvirt version 0.7.3");
#else
ret = virConnectGetLibVersion(conn,
libVer);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectGetMaxVcpusWrapper(virConnectPtr conn,
const char * type,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 2, 1)
setVirError(err, "Function virConnectGetMaxVcpus not available prior to libvirt version 0.2.1");
#else
ret = virConnectGetMaxVcpus(conn,
type);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectGetSysinfoWrapper(virConnectPtr conn,
unsigned int flags,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 8, 8)
setVirError(err, "Function virConnectGetSysinfo not available prior to libvirt version 0.8.8");
#else
ret = virConnectGetSysinfo(conn,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
const char *
virConnectGetTypeWrapper(virConnectPtr conn,
virErrorPtr err)
{
const char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectGetType not available prior to libvirt version 0.0.3");
#else
ret = virConnectGetType(conn);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
char *
virConnectGetURIWrapper(virConnectPtr conn,
virErrorPtr err)
{
char * ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 3, 0)
setVirError(err, "Function virConnectGetURI not available prior to libvirt version 0.3.0");
#else
ret = virConnectGetURI(conn);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectGetVersionWrapper(virConnectPtr conn,
unsigned long * hvVer,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectGetVersion not available prior to libvirt version 0.0.3");
#else
ret = virConnectGetVersion(conn,
hvVer);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectIsAliveWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 8)
setVirError(err, "Function virConnectIsAlive not available prior to libvirt version 0.9.8");
#else
ret = virConnectIsAlive(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectIsEncryptedWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 3)
setVirError(err, "Function virConnectIsEncrypted not available prior to libvirt version 0.7.3");
#else
ret = virConnectIsEncrypted(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectIsSecureWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 7, 3)
setVirError(err, "Function virConnectIsSecure not available prior to libvirt version 0.7.3");
#else
ret = virConnectIsSecure(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virConnectOpenWrapper(const char * name,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectOpen not available prior to libvirt version 0.0.3");
#else
ret = virConnectOpen(name);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virConnectOpenAuthWrapper(const char * name,
virConnectAuthPtr auth,
unsigned int flags,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 4, 0)
setVirError(err, "Function virConnectOpenAuth not available prior to libvirt version 0.4.0");
#else
ret = virConnectOpenAuth(name,
auth,
flags);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
virConnectPtr
virConnectOpenReadOnlyWrapper(const char * name,
virErrorPtr err)
{
virConnectPtr ret = NULL;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virConnectOpenReadOnly not available prior to libvirt version 0.0.3");
#else
ret = virConnectOpenReadOnly(name);
if (!ret) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectRefWrapper(virConnectPtr conn,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 0)
setVirError(err, "Function virConnectRef not available prior to libvirt version 0.6.0");
#else
ret = virConnectRef(conn);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectRegisterCloseCallbackWrapper(virConnectPtr conn,
virConnectCloseFunc cb,
void * opaque,
virFreeCallback freecb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 0)
setVirError(err, "Function virConnectRegisterCloseCallback not available prior to libvirt version 0.10.0");
#else
ret = virConnectRegisterCloseCallback(conn,
cb,
opaque,
freecb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectSetIdentityWrapper(virConnectPtr conn,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(5, 8, 0)
setVirError(err, "Function virConnectSetIdentity not available prior to libvirt version 5.8.0");
#else
ret = virConnectSetIdentity(conn,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectSetKeepAliveWrapper(virConnectPtr conn,
int interval,
unsigned int count,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 8)
setVirError(err, "Function virConnectSetKeepAlive not available prior to libvirt version 0.9.8");
#else
ret = virConnectSetKeepAlive(conn,
interval,
count);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virConnectUnregisterCloseCallbackWrapper(virConnectPtr conn,
virConnectCloseFunc cb,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 0)
setVirError(err, "Function virConnectUnregisterCloseCallback not available prior to libvirt version 0.10.0");
#else
ret = virConnectUnregisterCloseCallback(conn,
cb);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virGetVersionWrapper(unsigned long * libVer,
const char * type,
unsigned long * typeVer,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 0, 3)
setVirError(err, "Function virGetVersion not available prior to libvirt version 0.0.3");
#else
ret = virGetVersion(libVer,
type,
typeVer);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virInitializeWrapper(virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(err, "Function virInitialize not available prior to libvirt version 0.1.0");
#else
ret = virInitialize();
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeAllocPagesWrapper(virConnectPtr conn,
unsigned int npages,
unsigned int * pageSizes,
unsigned long long * pageCounts,
int startCell,
unsigned int cellCount,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 9)
setVirError(err, "Function virNodeAllocPages not available prior to libvirt version 1.2.9");
#else
ret = virNodeAllocPages(conn,
npages,
pageSizes,
pageCounts,
startCell,
cellCount,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetCPUMapWrapper(virConnectPtr conn,
unsigned char ** cpumap,
unsigned int * online,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 0, 0)
setVirError(err, "Function virNodeGetCPUMap not available prior to libvirt version 1.0.0");
#else
ret = virNodeGetCPUMap(conn,
cpumap,
online,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetCPUStatsWrapper(virConnectPtr conn,
int cpuNum,
virNodeCPUStatsPtr params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(err, "Function virNodeGetCPUStats not available prior to libvirt version 0.9.3");
#else
ret = virNodeGetCPUStats(conn,
cpuNum,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetCellsFreeMemoryWrapper(virConnectPtr conn,
unsigned long long * freeMems,
int startCell,
int maxCells,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 3, 3)
setVirError(err, "Function virNodeGetCellsFreeMemory not available prior to libvirt version 0.3.3");
#else
ret = virNodeGetCellsFreeMemory(conn,
freeMems,
startCell,
maxCells);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
unsigned long long
virNodeGetFreeMemoryWrapper(virConnectPtr conn,
virErrorPtr err)
{
unsigned long long ret = 0;
#if !LIBVIR_CHECK_VERSION(0, 3, 3)
setVirError(err, "Function virNodeGetFreeMemory not available prior to libvirt version 0.3.3");
#else
ret = virNodeGetFreeMemory(conn);
if (ret == 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetFreePagesWrapper(virConnectPtr conn,
unsigned int npages,
unsigned int * pages,
int startCell,
unsigned int cellCount,
unsigned long long * counts,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(1, 2, 6)
setVirError(err, "Function virNodeGetFreePages not available prior to libvirt version 1.2.6");
#else
ret = virNodeGetFreePages(conn,
npages,
pages,
startCell,
cellCount,
counts,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetInfoWrapper(virConnectPtr conn,
virNodeInfoPtr info,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 1, 0)
setVirError(err, "Function virNodeGetInfo not available prior to libvirt version 0.1.0");
#else
ret = virNodeGetInfo(conn,
info);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetMemoryParametersWrapper(virConnectPtr conn,
virTypedParameterPtr params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virNodeGetMemoryParameters not available prior to libvirt version 0.10.2");
#else
ret = virNodeGetMemoryParameters(conn,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetMemoryStatsWrapper(virConnectPtr conn,
int cellNum,
virNodeMemoryStatsPtr params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 3)
setVirError(err, "Function virNodeGetMemoryStats not available prior to libvirt version 0.9.3");
#else
ret = virNodeGetMemoryStats(conn,
cellNum,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetSEVInfoWrapper(virConnectPtr conn,
virTypedParameterPtr * params,
int * nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(4, 5, 0)
setVirError(err, "Function virNodeGetSEVInfo not available prior to libvirt version 4.5.0");
#else
ret = virNodeGetSEVInfo(conn,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeGetSecurityModelWrapper(virConnectPtr conn,
virSecurityModelPtr secmodel,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 6, 1)
setVirError(err, "Function virNodeGetSecurityModel not available prior to libvirt version 0.6.1");
#else
ret = virNodeGetSecurityModel(conn,
secmodel);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeSetMemoryParametersWrapper(virConnectPtr conn,
virTypedParameterPtr params,
int nparams,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 10, 2)
setVirError(err, "Function virNodeSetMemoryParameters not available prior to libvirt version 0.10.2");
#else
ret = virNodeSetMemoryParameters(conn,
params,
nparams,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
int
virNodeSuspendForDurationWrapper(virConnectPtr conn,
unsigned int target,
unsigned long long duration,
unsigned int flags,
virErrorPtr err)
{
int ret = -1;
#if !LIBVIR_CHECK_VERSION(0, 9, 8)
setVirError(err, "Function virNodeSuspendForDuration not available prior to libvirt version 0.9.8");
#else
ret = virNodeSuspendForDuration(conn,
target,
duration,
flags);
if (ret < 0) {
virCopyLastError(err);
}
#endif
return ret;
}
*/
import "C"
| go | Apache-2.0 | b3b4703e958c25d54c4d48138d9e80ae32fadac3 | 2026-01-07T09:44:30.792320Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.