Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- domain.go | 23 +++++++++++++++++++++++ domain_compat.h | 14 ++++++++++++++ domain_wrapper.go | 17 +++++++++++++++++ domain_wrapper.h | 6 ++++++ 4 files changed, 60 insertions(+) diff --git a/domain.go b/domain.go index 360659d..7901d8d 100644 --- a/domain.go +++ b/domain.go @@ -886,6 +886,14 @@ const ( DOMAIN_GUEST_INFO_FILESYSTEM = DomainGuestInfoTypes(C.VIR_DOMAIN_GUEST_INFO_FILESYSTEM) ) +type DomainAgentSetResponseTimeoutValues int + +const ( + VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK = DomainAgentSetResponseTimeoutValues(C.VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK) + VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_DEFAULT = DomainAgentSetResponseTimeoutValues(C.VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_DEFAULT) + VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_NOWAIT = DomainAgentSetResponseTimeoutValues(C.VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_NOWAIT) +) + // See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFree func (d *Domain) Free() error { var err C.virError @@ -5179,3 +5187,18 @@ func (d *Domain) GetGuestInfo(types DomainGuestInfoTypes, flags uint32) (*Domain return &info, nil } + +// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAgentSetResponseTimeout +func (d *Domain) AgentSetResponseTimeout(timeout int, flags uint32) error { + if C.LIBVIR_VERSION_NUMBER < 5010000 { + return makeNotImplementedError("virDomainAgentSetResponseTimeout") + } + + var err C.virError + ret := C.virDomainAgentSetResponseTimeoutWrapper(d.ptr, C.int(timeout), C.uint(flags), &err) + if ret == -1 { + return makeError(&err) + } + + return nil +} diff --git a/domain_compat.h b/domain_compat.h index 98cf5e1..3b91b15 100644 --- a/domain_compat.h +++ b/domain_compat.h @@ -1006,4 +1006,18 @@ struct _virDomainInterface { #define VIR_DOMAIN_GUEST_INFO_FILESYSTEM (1 << 4) #endif +/* 5.10.0 */ + +#ifndef VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK +#define VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK -2 +#endif + +#ifndef VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_DEFAULT +#define VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_DEFAULT -1 +#endif + +#ifndef VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_NOWAIT +#define VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_NOWAIT 0 +#endif + #endif /* LIBVIRT_GO_DOMAIN_COMPAT_H__ */ diff --git a/domain_wrapper.go b/domain_wrapper.go index 0f521cb..63573c3 100644 --- a/domain_wrapper.go +++ b/domain_wrapper.go @@ -2419,5 +2419,22 @@ virDomainGetGuestInfoWrapper(virDomainPtr domain, #endif } +int +virDomainAgentSetResponseTimeoutWrapper(virDomainPtr domain, + int timeout, + unsigned int flags, + virErrorPtr err) +{ +#if LIBVIR_VERSION_NUMBER < 5010000 + assert(0); // Caller should have checked version +#else + int ret = virDomainAgentSetResponseTimeout(domain, timeout, flags); + if (ret < 0) { + virCopyLastError(err); + } + return ret; +#endif +} + */ import "C" diff --git a/domain_wrapper.h b/domain_wrapper.h index 61b63bb..568910e 100644 --- a/domain_wrapper.h +++ b/domain_wrapper.h @@ -1017,4 +1017,10 @@ virDomainGetGuestInfoWrapper(virDomainPtr domain, unsigned int flags, virErrorPtr err); +int +virDomainAgentSetResponseTimeoutWrapper(virDomainPtr domain, + int timeout, + unsigned int flags, + virErrorPtr err); + #endif /* LIBVIRT_GO_DOMAIN_WRAPPER_H__ */ -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list