os_server fails with "Error in creating instance (Inner Exception: create() takes at least 4 non-keyword arguments (2 given))"

I managed to get the os_server_facts module working, but when I try to use the os_server module to create a new VM instance, I get the following error:

Error in creating instance (Inner Exception: create() takes at least 4 non-keyword arguments (2 given))

No other meaningful diagnostic information is provided (even with “-v -v -v”), so I have no idea where to look. I couldn’t find anything specific to Ansible when I looked up the error message via Google. I couldn’t finding any direct calls to a method named “create” in os_server.py, either.

This is likely from the lower level python-novaclient library. Given all of your issues with
version dependency hell, you’ve probably got some mix of libraries that just don’t gel
together. If it’s possible, I’d highly recommend against using any Centos-based system.

Unfortunately, I don’t have a choice in this case.

Is there any way to obtain the stack trace of the original exception, so I could at least determine where the mismatch is occurring?

Rich

After digging through the source code, I believe I’ve tracked the problem down to the following call in _tasks.py in Shade:

class ServerCreate(task_manager.Task):
def main(self, client):
return client.nova_client.servers.create(**self.args)

This appears to be calling the following method from servers.py in novaclient:

def create(self, name, image, flavor, meta=None … and a bunch more parameters with default values)

I can only assume that self.args is only expanding into two values instead of the expected minimum 4.

I don’t know where the value of self.args comes from, however. I’m definitely passing a “name”, “flavor”, and “image” to the os_server module.

Rich

I think I found the problem.

Over time, a line in Shade’s openstackcloud.py changed from this (in v1.1 and v1.2):

server = self.manager.submitTask(_tasks.ServerCreate(

name=name, image=image, flavor=flavor, **kwargs))

to this (in v1.3-v1.11):

server = self.manager.submitTask(_tasks.ServerCreate(

name=name, flavor=flavor, **kwargs))

to this (in v1.12+):

server = self.manager.submit_task(_tasks.ServerCreate(

name=name, **kwargs))

Downgrading to Shade 1.11.1 seems to have fixed the problem.

I finally managed to create a VM instance. Yay.

~Rich