Re: [PATCH libvirt-java 6/7] Implement virDomainMigrate2 and use it for a new migrate method.

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

 



At Sun, 13 Jan 2013 19:09:28 +0100,
Wido den Hollander wrote:
> 
> virDomainMigrate2 adds the dxml argument which makes it possible
> to alter host-specific portions of the domain XML that will be
> used on the destination host.
> 
> The original migrate method still uses virDomainMigrate for backwards
> compatibility reasons.
> 
> Signed-off-by: Wido den Hollander <wido@xxxxxxxxx>
> ---
>  src/main/java/org/libvirt/Domain.java      |   58 ++++++++++++++++++++++++++++
>  src/main/java/org/libvirt/jna/Libvirt.java |    2 +
>  2 files changed, 60 insertions(+)
> 
> diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
> index 6bdc1df..2758747 100644
> --- a/src/main/java/org/libvirt/Domain.java
> +++ b/src/main/java/org/libvirt/Domain.java
> @@ -778,6 +778,64 @@ public class Domain {
>  
>      /**
>       * Migrate this domain object from its current host to the destination host
> +     * given by dconn (a connection to the destination host).
> +     * Flags may be one of more of the following:

s/one of/one or/

> +     * Domain.VIR_MIGRATE_LIVE Attempt a live migration.

Huh? Only one possible flag? Better not duplicate this information
here, this is hard to keep in sync.

> +     * If a hypervisor supports renaming domains during migration, then you may
> +     * set the dname parameter to the new name (otherwise it keeps the same name).
> +     * If this is not supported by the hypervisor, dname must be NULL or else you

"NULL" should be "null" in Java.

> +     * will get an error.
> +     * Since typically the two hypervisors connect directly to each other in order
> +     * to perform the migration, you may need to specify a path from the source
> +     * to the destination. This is the purpose of the uri parameter.
> +     * If uri is NULL, then libvirt will try tofind the best method.
> +     * Uri may specify the hostname or IP address of the destination host as seen
> +     * from the source, or uri may be a URI giving transport, hostname, user,
> +     * port, etc. in the usual form.
> +     * Uri should only be specified if you want to migrate over a specific interface
> +     * on the remote host.
> +     * For Qemu/KVM, the uri should be of the form "tcp://hostname[:port]".
> +     * This does not require TCP auth to be setup between the connections, since
> +     * migrate uses a straight TCP connection (unless using the PEER2PEER flag,
> +     * in which case URI should be a full fledged libvirt URI).
> +     * Refer also to driver documentation for the particular URIs supported.
> +     * If set to 0, libvirt will choose a suitable default.

This sentence makes no sense. To what parameter is it referring to?
There's some part of text missing before.

> +     * Some hypervisors do not support this feature and will return an
> +     * error if bandwidth is not 0. To see which features are supported by the
> +     * current hypervisor, see Connect.getCapabilities, /capabilities/host/migration_features.
> +     * There are many limitations on migration imposed by the underlying technology
> +     * for example it may not be possible to migrate between different processors
> +     * even with the same architecture, or between different types of hypervisor.
> +     *
> +     * If the hypervisor supports it, @dxml can be used to alter

Don't use @dxml in order to refer to arguments. That's a libvirt doc thing.

> +     * host-specific portions of the domain XML that will be used on
> +     * the destination.

Phew. That's a long comment without paragraphs. Insert a few <p>'s.

> +     * @param dconn
> +     *            destination host (a Connect object)
> +     * @param dxml
> +     *            (optional) XML config for launching guest on target
> +     * @param flags
> +     *            flags
> +     * @param dname
> +     *            (optional) rename domain to this at destination
> +     * @param uri
> +     *            (optional) dest hostname/URI as seen from the source host
> +     * @param bandwidth
> +     *            optional) specify migration bandwidth limit in Mbps

Missing opening paren.

> +     * @return the new domain object if the migration was successful, or NULL in
> +     *         case of error.

It never return NULL nor null because it will throw an exception on
error. But I can see where this is coming from.

ACK with this squashed in:

---- >8 -----
diff --git a/src/main/java/org/libvirt/Domain.java b/src/main/java/org/libvirt/Domain.java
index 2575d7b..3d779d6 100644
--- a/src/main/java/org/libvirt/Domain.java
+++ b/src/main/java/org/libvirt/Domain.java
@@ -786,35 +786,51 @@ public class Domain {
     /**
      * Migrate this domain object from its current host to the destination host
      * given by dconn (a connection to the destination host).
-     * Flags may be one of more of the following:
-     * Domain.VIR_MIGRATE_LIVE Attempt a live migration.
+     * <p>
+     * Flags may be bitwise OR'ed values of
+     * {@link org.libvirt.Domain.MigrateFlags MigrateFlags}.
+     * <p>
      * If a hypervisor supports renaming domains during migration, then you may
      * set the dname parameter to the new name (otherwise it keeps the same name).
-     * If this is not supported by the hypervisor, dname must be NULL or else you
-     * will get an error.
+     * <p>
+     * If this is not supported by the hypervisor, dname must be {@code null} or
+     * else you will get an exception.
+     * <p>
      * Since typically the two hypervisors connect directly to each other in order
      * to perform the migration, you may need to specify a path from the source
      * to the destination. This is the purpose of the uri parameter.
-     * If uri is NULL, then libvirt will try tofind the best method.
+     * <p>
+     * If uri is {@code null}, then libvirt will try to find the best method.
+     * <p>
      * Uri may specify the hostname or IP address of the destination host as seen
      * from the source, or uri may be a URI giving transport, hostname, user,
      * port, etc. in the usual form.
+     * <p>
      * Uri should only be specified if you want to migrate over a specific interface
      * on the remote host.
-     * For Qemu/KVM, the uri should be of the form "tcp://hostname[:port]".
+     * <p>
+     * For Qemu/KVM, the URI should be of the form {@code "tcp://hostname[:port]"}.
+     * <p>
      * This does not require TCP auth to be setup between the connections, since
      * migrate uses a straight TCP connection (unless using the PEER2PEER flag,
      * in which case URI should be a full fledged libvirt URI).
+     * <p>
      * Refer also to driver documentation for the particular URIs supported.
-     * If set to 0, libvirt will choose a suitable default.
+     * <p>
+     * The maximum bandwidth (in Mbps) that will be used to do
+     * migration can be specified with the bandwidth parameter. If
+     * set to 0, libvirt will choose a suitable default.
+     * <p>
      * Some hypervisors do not support this feature and will return an
-     * error if bandwidth is not 0. To see which features are supported by the
-     * current hypervisor, see Connect.getCapabilities, /capabilities/host/migration_features.
+     * error if bandwidth is not 0. To see which features are
+     * supported by the current hypervisor, see
+     * Connect.getCapabilities, /capabilities/host/migration_features.
+     * <p>
      * There are many limitations on migration imposed by the underlying technology
      * for example it may not be possible to migrate between different processors
      * even with the same architecture, or between different types of hypervisor.
-     *
-     * If the hypervisor supports it, @dxml can be used to alter
+     * <p>
+     * If the hypervisor supports it, dxml can be used to alter
      * host-specific portions of the domain XML that will be used on
      * the destination.
      *
@@ -829,11 +845,11 @@ public class Domain {
      * @param uri
      *            (optional) dest hostname/URI as seen from the source host
      * @param bandwidth
-     *            optional) specify migration bandwidth limit in Mbps
-     * @return the new domain object if the migration was successful, or NULL in
-     *         case of error. Note that the new domain object exists in the
-     *         scope of the destination connection (dconn).
-     * @throws LibvirtException
+     *            (optional) specify migration bandwidth limit in Mbps
+     * @return the new domain object if the migration was
+     *         successful. Note that the new domain object exists in
+     *         the scope of the destination connection (dconn).
+     * @throws LibvirtException if the migration fails
      */
     public Domain migrate(Connect dconn, long flags, String dxml, String dname, String uri, long bandwidth) throws LibvirtException {
         DomainPointer newPtr = libvirt.virDomainMigrate2(VDP, dconn.VCP, dxml, new NativeLong(flags), dname, uri, new NativeLong(bandwidth));

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

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]