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

John Ferlan posted 1 patch 6 years, 7 months ago
Failed in applying to current master (apply log)
domain.go | 15 +++++++++++++++
1 file changed, 15 insertions(+)
[libvirt] [libvirt-go PATCH] Add MigrateGetMaxDowntime API
Posted by John Ferlan 6 years, 7 months ago
Signed-off-by: John Ferlan <jferlan@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-go PATCH] Add MigrateGetMaxDowntime API
Posted by John Ferlan 6 years, 7 months ago

On 08/28/2017 06:16 PM, John Ferlan wrote:
> Signed-off-by: John Ferlan <jferlan@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(+)
> 

Although I did push the python and perl changes, I wasn't as sure about
this change - so I left it for now. The libvirt-go build's fine, it's
just the 'test -tags api' that fails

John

> 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 {
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list