Openstack nova API live migrate AttributeError: _action python 2.7

asked 2017-02-28 14:11:02 -0600

enjoisno gravatar image

updated 2017-02-28 14:29:29 -0600

I am trying live migrate a server via the openstack python sdk.

from keystoneauth1.identity import v3
from keystoneauth1 import session
import json, ast

auth = v3.Password(auth_url='',

sess = session.Session(auth=auth)


from novaclient import client

nova = client.Client('2.30', session=sess)

servers = nova.servers.list()

for s in servers:
    # print(dir(s))

Here is the error message I am getting

<Server: api_test_ubuntu2>
Traceback (most recent call last):
  File "C:/Users/a/PycharmProjects/openstack_api/", line 129, in <module>
  File "C:\Python27\lib\site-packages\novaclient\", line 402, in substitution
    return methods[-1].func(obj, *args, **kwargs)
  File "C:\Python27\lib\site-packages\novaclient\v2\", line 1675, in live_migrate
    return self._action('os-migrateLive', server, body)
  File "C:\Python27\lib\site-packages\novaclient\", line 180, in __getattr__
    raise AttributeError(k)
AttributeError: _action

I am able to connect and run other command to the nova api like nova.servers.list() and others.

I am using Python 2.7.12 on windows and python-openstackclient with python-novaclient both at the lastest versions.

Thanks for your help

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-01 06:54:08 -0600

sowmya gravatar image

updated 2017-03-01 07:01:00 -0600

I think the way you are calling the API is slightly incorrect try as below:

for s in servers:
      get the instance ID from the server(instance) <server ID> to be migrated 
     nova.servers.live_migrate(host="oscnode1.localhost",block_migration=False,server=<server ID>)


live_migrate(self, server, host, block_migration):
        Migrates a running instance to a new machine.

        :param server: instance id which comes from nova list.
        :param host: destination host name.
        :param block_migration: if True, do block_migration, can be set as
edit flag offensive delete link more


That fixed the error and it is now working. Below is what I changed it to using the 2.0 nova api version.

nova.servers.live_migrate(host="oscnode1.localhost", block_migration=False,, disk_over_commit=False)
enjoisno gravatar imageenjoisno ( 2017-03-01 07:38:53 -0600 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-02-28 14:00:21 -0600

Seen: 366 times

Last updated: Mar 01 '17