Re: [PATCH v3 2/5] vz: add migration backbone code

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

 



On Tue, Aug 25, 2015 at 12:04:14PM +0300, nshirokovskiy@xxxxxxxxxxxxx wrote:
> From: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
> 
> This patch makes basic vz migration possible. For example by virsh:
>   virsh -c vz:///system migrate --direct $NAME $STUB vz+ssh://$DST/system
> 
> $STUB could be anything as it is required virsh argument but it is not
> used in direct migration.
> 
> Vz migration is implemented as direct migration. The reason is that vz sdk do
> all the job. Prepare phase function is used to pass session uuid from
> destination to source so we don't introduce new rpc call.

I'm trying to understand why you need $STUB as dummy data.

IIRC, when doing direct migration, you should be providing a valid
URI for the first parameter, and not need the second uri.

> +
> +static int
> +vzDomainMigratePrepare3(virConnectPtr conn,
> +                        const char *cookiein ATTRIBUTE_UNUSED,
> +                        int cookieinlen ATTRIBUTE_UNUSED,
> +                        char **cookieout,
> +                        int *cookieoutlen,
> +                        const char *uri_in ATTRIBUTE_UNUSED,
> +                        char **uri_out ATTRIBUTE_UNUSED,
> +                        unsigned long flags,
> +                        const char *dname ATTRIBUTE_UNUSED,
> +                        unsigned long resource ATTRIBUTE_UNUSED,
> +                        const char *dom_xml ATTRIBUTE_UNUSED)
> +{
> +    vzConnPtr privconn = conn->privateData;
> +    int ret = -1;
> +
> +    virCheckFlags(0, -1);
> +
> +    if (!(*cookieout = vzFormatCookie(privconn->session_uuid)))
> +        goto cleanup;
> +    *cookieoutlen = strlen(*cookieout) + 1;
> +    ret = 0;
> +
> + cleanup:
> +    if (ret != 0) {
> +        VIR_FREE(*cookieout);
> +        *cookieoutlen = 0;
> +    }
> +
> +    return ret;
> +}
> +
> +static int
> +vzConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
> +{
> +    switch (feature) {
> +    case VIR_DRV_FEATURE_MIGRATION_V3:
> +    case VIR_DRV_FEATURE_MIGRATION_DIRECT:
> +        return 1;
> +    default:
> +        return 0;
> +    }
> +}
> +
> +static virURIPtr
> +vzMakeVzUri(const char *connuri_str)
> +{
> +    virURIPtr connuri = NULL;
> +    virURIPtr vzuri = NULL;
> +    int ret = -1;
> +
> +    if (!(connuri = virURIParse(connuri_str)))
> +        goto cleanup;
> +
> +    if (VIR_ALLOC(vzuri) < 0)
> +        goto cleanup;
> +    memset(vzuri, 0, sizeof(*vzuri));
> +
> +    if (VIR_STRDUP(vzuri->server, connuri->server) < 0)
> +        goto cleanup;
> +    vzuri->port = connuri->port;
> +    ret = 0;
> +
> + cleanup:
> +
> +    virURIFree(connuri);
> +    if (ret < 0) {
> +        virURIFree(vzuri);
> +        vzuri = NULL;
> +    }
> +
> +    return vzuri;
> +}
> +
> +#define VZ_MIGRATION_FLAGS (0)
> +
> +#define VZ_MIGRATION_PARAMETERS (NULL)
> +
> +static int
> +vzDomainMigratePerform3(virDomainPtr domain,
> +                        const char *xmlin ATTRIBUTE_UNUSED,
> +                        const char *cookiein ATTRIBUTE_UNUSED,
> +                        int cookieinlen ATTRIBUTE_UNUSED,
> +                        char **cookieout ATTRIBUTE_UNUSED,
> +                        int *cookieoutlen ATTRIBUTE_UNUSED,
> +                        const char *dconnuri ATTRIBUTE_UNUSED,
> +                        const char *uri,

I think you should be using 'dconnuri' rather than 'uri', so
then you would not need the $STUB dummy parameter.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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