[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH libvirt-java 8/9] Implement and use virDomainMigrateToURI2 instead of virDomainMigrateToURI



At Sat,  5 Jan 2013 12:48:25 +0100,
Wido den Hollander wrote:
> 
> The migrateToURI method now uses virDomainMigrateToURI2 so we can support
> some more features.
> 
> Signed-off-by: Wido den Hollander <wido widodh nl>
> ---
>  src/main/java/org/libvirt/Domain.java      |   33 +++++++++++++++++++++++++---
>  src/main/java/org/libvirt/jna/Libvirt.java |    2 ++
>  2 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
> index 03afa0e..6fb1161 100644
> --- a/src/main/java/org/libvirt/Domain.java
> +++ b/src/main/java/org/libvirt/Domain.java
> @@ -855,6 +855,35 @@ public class Domain {
>       *       href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainMigrateToURI";>
>       *       virDomainMigrateToURI</a>
>       *
> +     * @param dconnuri
> +     *            (optional) URI for target libvirtd if @flags includes VIR_MIGRATE_PEER2PEER
> +     * @param miguri
> +     *            (optional) URI for invoking the migration, not if @flags includs VIR_MIGRATE_TUNNELLED
> +     * @param dxml
> +     *            (optional) XML config for launching guest on target
> +     * @param flags
> +     *            Controls the migrate
> +     * @param dname
> +     *            The name at the destnation
> +     * @param bandwidth
> +     *            Specify the migration bandwidth
> +     * @return 0 if successful, -1 if not

Actually no. It throws an exception in case of an error.

I think it would be awkward introducing a new method with a known
glitch now, just in order to fix it later.

> +     * @throws LibvirtException
> +     */
> +    public int migrateToURI(String dconnuri, String miguri, String dxml, long flags, String dname, long bandwidth) throws LibvirtException {
> +        int returnValue = libvirt.virDomainMigrateToURI2(VDP, dconnuri, miguri, dxml, new NativeLong(flags), dname, new NativeLong(bandwidth));
> +        processError();
> +        return returnValue;
> +    }
> +
> +    /**
> +     * Migrate the domain object from its current host to the destination host
> +     * given by duri.
> +     *
> +     * @see <a
> +     *       href="http://www.libvirt.org/html/libvirt-libvirt.html#virDomainMigrateToURI";>
> +     *       virDomainMigrateToURI</a>
> +     *
>       * @param uri
>       *            The destination URI
>       * @param flags
> @@ -867,9 +896,7 @@ public class Domain {
>       * @throws LibvirtException
>       */
>      public int migrateToURI(String uri, long flags, String dname, long bandwidth) throws LibvirtException {
> -        int returnValue = libvirt.virDomainMigrateToURI(VDP, uri, new NativeLong(flags), dname, new NativeLong(bandwidth));
> -        processError();
> -        return returnValue;
> +        return migrateToURI(uri, null, null, flags, dname, bandwidth);
>      }
>  
>      /**
> diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
> index de2a262..27011d9 100644
> --- a/src/main/java/org/libvirt/jna/Libvirt.java
> +++ b/src/main/java/org/libvirt/jna/Libvirt.java
> @@ -214,6 +214,8 @@ public interface Libvirt extends Library {
>      public int virDomainMigrateSetMaxDowntime(DomainPointer virDomainPtr, long downtime, int flags);
>      public int virDomainMigrateToURI(DomainPointer virDomainPtr, String duri,
>              NativeLong flags, String dname, NativeLong bandwidth);
> +    public int virDomainMigrateToURI2(DomainPointer virDomainPtr, String dconnuri, String miguri,
> +            String dxml, NativeLong flags, String dname, NativeLong bandwidth);
>      public int virDomainMemoryStats(DomainPointer virDomainPtr, virDomainMemoryStats[] stats, int nr_stats, int flags);
>      public int virDomainPinVcpu(DomainPointer virDomainPtr, int vcpu, byte[] cpumap, int maplen);
>      public int virDomainReboot(DomainPointer virDomainPtr, int flags);

You know the drill: please drop the public modifier ;-)

And just remove the virDomainMigrateToURI in favor of virDomainMigrateToURI2.

Claudio
-- 
AV-Test GmbH, Henricistra├če 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]