[ovirt-users] VM migration by using the Python SDK

Yaniv Kaul ykaul at redhat.com
Mon Mar 7 18:59:23 UTC 2016


On Mon, Mar 7, 2016 at 6:17 PM, Jean-Pierre Ribeauville <
jpribeauville at axway.com> wrote:

> Hi,
>
>
>
>
>
> I’m a little bit lost by looking how to migrate a Guest between two nodes
> of a same cluster by using  ovirt  python  API .
>

Copy-paste from oVirt system tests[1], adapt as you need:

def vm_migrate(prefix):
    api = prefix.virt_env.engine_vm().get_api()
    host_names = [h.name() for h in prefix.virt_env.host_vms()]

    migrate_params = params.Action(
        host=params.Host(
            name=sorted(host_names)[1]
        ),
    )
    api.vms.get(VM1_NAME).migrate(migrate_params)
    testlib.assert_true_within_short(
        lambda: api.vms.get(VM1_NAME).status.state == 'up',
    )


Y.
[1]
https://gerrit.ovirt.org/#/c/48206/4/basic_suite_3.6/test-scenarios/004_basic_sanity.py

>
>
> Is it the good way  to start for ovirt engine sources ?
>
>
>
> Thx for help.
>
>
>
> Regards,
>
>
>
> Jean-Pierre RIBEAUVILLE
>
>
>
> +33 1 4717 2049
>
>
>
> [image: axway_logo_tagline_87px]
>
>
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160307/41bbf9f9/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 11720 bytes
Desc: not available
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160307/41bbf9f9/attachment-0001.png>


More information about the Users mailing list