Commit 44c1a89e authored by Daniel Berrange's avatar Daniel Berrange 💬

Add compat for 1.2.18 release

Signed-off-by: Daniel Berrange's avatarDaniel P. Berrange <[email protected]>
parent 16edcbb2
...@@ -7,7 +7,7 @@ Make sure to have `libvirt-dev` package (or the development files otherwise some ...@@ -7,7 +7,7 @@ Make sure to have `libvirt-dev` package (or the development files otherwise some
## Version Support ## Version Support
The libvirt go package provides API coverage for libvirt versions The libvirt go package provides API coverage for libvirt versions
from 1.2.20 onwards, through conditional compilation of newer APIs. from 1.2.18 onwards, through conditional compilation of newer APIs.
## Documentation ## Documentation
......
...@@ -3536,9 +3536,12 @@ func (d *Domain) ManagedSaveRemove(flags uint32) error { ...@@ -3536,9 +3536,12 @@ func (d *Domain) ManagedSaveRemove(flags uint32) error {
} }
func (d *Domain) Rename(name string, flags uint32) error { func (d *Domain) Rename(name string, flags uint32) error {
if C.LIBVIR_VERSION_NUMBER < 1002019 {
return GetNotImplementedError()
}
cname := C.CString(name) cname := C.CString(name)
defer C.free(cname) defer C.free(cname)
ret := C.virDomainRename(d.ptr, cname, C.uint(flags)) ret := C.virDomainRenameCompat(d.ptr, cname, C.uint(flags))
if ret == -1 { if ret == -1 {
return GetLastError() return GetLastError()
} }
......
...@@ -6,6 +6,18 @@ package libvirt ...@@ -6,6 +6,18 @@ package libvirt
#include <assert.h> #include <assert.h>
#include "domain_compat.h" #include "domain_compat.h"
int virDomainRenameCompat(virDomainPtr dom,
const char *new_name,
unsigned int flags)
{
#if LIBVIR_VERSION_NUMBER < 1002019
assert(0); // Caller should have checked version
#else
return virDomainRename(dom, new_name, flags);
#endif
}
int virDomainGetPerfEventsCompat(virDomainPtr dom, int virDomainGetPerfEventsCompat(virDomainPtr dom,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
......
#ifndef LIBVIRT_GO_DOMAIN_COMPAT_H__ #ifndef LIBVIRT_GO_DOMAIN_COMPAT_H__
#define LIBVIRT_GO_ERROR_COMPAT_H__ #define LIBVIRT_GO_ERROR_COMPAT_H__
/* 1.2.19 */
#ifndef VIR_DOMAIN_BANDWIDTH_IN_FLOOR
#define VIR_DOMAIN_BANDWIDTH_IN_FLOOR "inbound.floor"
#endif
#ifndef VIR_DOMAIN_EVENT_DEFINED_RENAMED
#define VIR_DOMAIN_EVENT_DEFINED_RENAMED 2
#endif
#ifndef VIR_DOMAIN_EVENT_UNDEFINED_RENAMED
#define VIR_DOMAIN_EVENT_UNDEFINED_RENAMED 1
#endif
int virDomainRenameCompat(virDomainPtr dom,
const char *new_name,
unsigned int flags);
/* 1.3.1 */ /* 1.3.1 */
#ifndef VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE #ifndef VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment