• Christos Stavrakakis's avatar
    cyclades: Create servers with volumes · fc96f8c6
    Christos Stavrakakis authored
    Extend Cyclades POST /servers API endpoint to support specifying volumes
    when creating a server. The call is extended with the
    'block_device_mapping_v2' field that contains a list of dictionaries,
    each of which contains the following information about the devices that
    the server must have:
    
    * source_type: One of'image', 'snapshot', 'volume' or 'blank'
    * uuid: The UUID of the object that is specified by source_type (if
            source_type is not blank)
    * size: The size of the volume
    * delete_on_termination: Whether the volume will be preserved or
                             automaticaly deleted when the server is deleted
    
    If no volume is specified, then a volume is automatically created with
    the size of the flavor and with source the image that is specified in
    the 'imageRef' field of the API call.
    
    The follow restrictions apply:
    * Source_type can be other than 'blank', only if the disk template is
      ext_ or if the volume is created as a root volume of a server, so
      it will be filled with data by snf-image.
    * The root volume cannot be blank.
    * In order to use a volume, it must be in AVAILABLE status. This will
      never happen until detachable volumes are implemented. However, the
      user can "clone" a user volume either by creating a new volume from
      cinder and then using this new volume, or by taking a snapshot and then
      use the snapshot as a source.
    * The size field is required if the source is image, snapshot or blank.
      Also, the size of the volume must be equal or bigger from the source
      size (if any).
    
    Finally, move some code from 'servers' module to 'server_attachments'
    and 'commands' to avoid cyclic imports.
    fc96f8c6
server-create.py 6.41 KB