[libvirt] [libvirt-go PATCH] Add MigrateGetMaxDowntime API

John Ferlan jferlan at redhat.com
Mon Aug 28 22:16:33 UTC 2017


Signed-off-by: John Ferlan <jferlan at redhat.com>
---

 This is a "best guess" effort - basically copied some previous examples
 from recent comments, built, and ran the same test that the CI build test
 runs.

 domain.go | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/domain.go b/domain.go
index cc786dd..f83aa31 100644
--- a/domain.go
+++ b/domain.go
@@ -2319,6 +2319,21 @@ func (d *Domain) MigrateSetMaxSpeed(speed uint64, flags uint32) error {
 	return nil
 }
 
+func (d *Domain) MigrateGetMaxDowntime(flags uint32) (uint64, error) {
+	var downtime C.ulonglong
+
+	if C.LIBVIR_VERSION_NUMBER < 3007000 {
+		return 0, GetNotImplementedError("virDomainMigrateGetMaxDowntime")
+	}
+
+	ret := C.virDomainMigrateGetMaxDowntime(d.ptr, &downtime, C.uint(flags))
+	if ret == -1 {
+		return 0, GetLastError()
+	}
+
+	return uint64(downtime), nil
+}
+
 func (d *Domain) MigrateSetMaxDowntime(downtime uint64, flags uint32) error {
 	ret := C.virDomainMigrateSetMaxDowntime(d.ptr, C.ulonglong(downtime), C.uint(flags))
 	if ret == -1 {
-- 
2.9.5




More information about the libvir-list mailing list