Also enforce the enum type for MigrateSetMaxSpeed and MigrateGetMaxSpeed
functions which previously accepted generic uint32 type since the flags
haven't been in use.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
domain.go | 10 ++++++++--
domain_compat.h | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/domain.go b/domain.go
index f4546b8..91b8399 100644
--- a/domain.go
+++ b/domain.go
@@ -811,6 +811,12 @@ const (
MIGRATE_TLS = DomainMigrateFlags(C.VIR_MIGRATE_TLS)
)
+type DomainMigrateMaxSpeedFlags int
+
+const (
+ MIGRATE_MAX_SPEED_POSTCOPY =
DomainMigrateMaxSpeedFlags(C.VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY)
+)
+
type VcpuState int
const (
@@ -2484,7 +2490,7 @@ func (d *Domain) MigrateSetCompressionCache(size uint64, flags
uint32) error {
}
// See also
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetM...
-func (d *Domain) MigrateGetMaxSpeed(flags uint32) (uint64, error) {
+func (d *Domain) MigrateGetMaxSpeed(flags DomainMigrateMaxSpeedFlags) (uint64, error) {
var maxSpeed C.ulong
var err C.virError
@@ -2497,7 +2503,7 @@ func (d *Domain) MigrateGetMaxSpeed(flags uint32) (uint64, error) {
}
// See also
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetM...
-func (d *Domain) MigrateSetMaxSpeed(speed uint64, flags uint32) error {
+func (d *Domain) MigrateSetMaxSpeed(speed uint64, flags DomainMigrateMaxSpeedFlags) error
{
var err C.virError
ret := C.virDomainMigrateSetMaxSpeedWrapper(d.ptr, C.ulong(speed), C.uint(flags),
&err)
if ret == -1 {
diff --git a/domain_compat.h b/domain_compat.h
index 7589f41..9a30e8f 100644
--- a/domain_compat.h
+++ b/domain_compat.h
@@ -944,4 +944,8 @@ struct _virDomainInterface {
#define VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY "bandwidth.postcopy"
#endif
+#ifndef VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY
+#define VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY (1 << 0)
+#endif
+
#endif /* LIBVIRT_GO_DOMAIN_COMPAT_H__ */
--
2.20.1