cloudify-openstack-plugin icon indicating copy to clipboard operation
cloudify-openstack-plugin copied to clipboard

There is no way to boot a VM by volume, using an image name instead of a UUID

Open chriscoomber opened this issue 8 years ago • 0 comments

Summary

I want to boot a VM by using a boot volume, which is created by providing the openstack name for an image (not the openstack id).

Symptoms / repro

Here's the relevant node_templates:

  vm:
    type: cloudify.openstack.nodes.Server
    properties:
      flavor: { get_input: vm_flavor }
      management_network_name: {
        "name": { get_input: management_network }
      }
      openstack_config: {
        "username": { get_secret: openstack_user },
        "tenant_name": { get_secret: openstack_project },
        "region": "RegionOne",
        "auth_url": { get_secret: openstack_auth_url },
        "password": { get_secret: openstack_password }
      }
    relationships:
    - type: cloudify.openstack.server_connected_to_keypair
      target: keypair
    - type: cloudify.relationships.connected_to
      target: mvs_node_boot_volume


  boot_volume:
    type: cloudify.openstack.nodes.Volume
    properties:
      openstack_config: {
        "username": { get_secret: openstack_user },
        "tenant_name": { get_secret: openstack_project },
        "region": "RegionOne",
        "auth_url": { get_secret: openstack_auth_url },
        "password": { get_secret: openstack_password }
      }
      boot: true
    interfaces:
      cloudify.interfaces.lifecycle:
        create:
          inputs:
            args:
              size: 35
              imageRef: { get_input: vm_image_name }

The result of this is:

  • The boot volume is created successfully, and is properly created using the image at vm_image_name.
  • The image fails to be created, with error:
    Task failed | my_blueprint | my_deployment | install | cloudify.interfaces.lifecycle.create | vm | vm_gs6yit 
    | Task failed 'nova_plugin.server.create' -> Invalid input for field/attribute imageRef. Value: my-image-
    name. u'my-image-name' is not valid under any of the given schemas [status_code=400]
    
  • The workflow fails.

I find it odd that the image was fine to be created with an image name (as opposed to a UUID), but the server (which doesn't need an image to be created!) cannot be created with an image name (as opposed to a UUID).

Environment

Cloudify manager version: v4.1.1 Openstack plugin version: v2.2.0

Suggestion

I see that there's some existing code which goes and gets the ID from a name-or-ID. This is used for the Server node-type. I imagine this could be used elsewhere to solve this issue.

https://github.com/cloudify-cosmo/cloudify-openstack-plugin/blob/7211674653cc7e762b18edcd8969b553f5e87bc1/nova_plugin/server.py#L911

chriscoomber avatar Nov 01 '17 20:11 chriscoomber