Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rackspace] Boot from volume #3189

Merged
merged 14 commits into from
Oct 2, 2014
Merged

Conversation

smashwilson
Copy link
Contributor

This adds the ability to boot Rackspace servers from a volume, including:

  • Creating a bootable volume from an image explicitly, then creating a server referencing that volume id;
  • Creating a server and a bootable volume at once from an image id; and
  • Specifying arbitrary custom volume mounts explicitly in a create_server request.

Here's some example code:

block = Fog::Rackspace::BlockStorage.new(rackspace_username: '' ... )
compute = Fog::Compute.new(provider: :rackspace

image_id = compute.images.find { |i| i.name =~ /Ubuntu/ }.id
flavor_id = compute.flavors.find { |f| f.name =~ /Performance/ }.id

# Two-step with explicit volume creation
volume = block.volumes.create size: 100, image_id: image_id
volume.wait_for { ready? }
server = compute.servers.create name: 'two-step', image_id: '', flavor_id: flavor_id, boot_volume_id: volume.id

# One-step with implicit volume creation
server = compute.servers.create name: 'one-step', image_id: '', flavor_id: flavor_id, boot_image_id: image_id

# Direct server request with explicit volume initialization
compute.create_server 'explicit', '', flavor_id, 1, 1, block_device_mapping: [
  {
    "device_name" => "/dev/sdb1",
    "source_type" => "blank",
    "destination_type" => "local",
    "delete_on_termination" => "True",
    "guest_format" => "swap",
    "boot_index" => "-1"
  },
  {
    "device_name" => "/dev/sda1",
    "source_type" => "volume",
    "destination_type" => "volume",
    "uuid" => "fake-volume-id-1",
    "boot_index" => "0"
  }
]

Here's the Openstack reference for it: http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-block-device-mapping-v2-boot

/cc @mdarby

@smashwilson
Copy link
Contributor Author

Hmmm. I'll investigate those failures tomorrow.

@smashwilson smashwilson changed the title [rackspace] Boot from volume [rackspace] [wip] Boot from volume Oct 1, 2014
@smashwilson smashwilson changed the title [rackspace] [wip] Boot from volume [rackspace] Boot from volume Oct 2, 2014
@smashwilson
Copy link
Contributor Author

@geemus This is ready to go, unless you've got any concerns about it 😄

geemus added a commit that referenced this pull request Oct 2, 2014
@geemus geemus merged commit 1bc7834 into fog:master Oct 2, 2014
@geemus
Copy link
Member

geemus commented Oct 2, 2014

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants