steamcannon-deltacloud-core 0.0.8.1 → 0.1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/Rakefile +3 -9
  2. data/bin/deltacloudd +17 -15
  3. data/deltacloud.rb +1 -0
  4. data/lib/deltacloud/backend_capability.rb +21 -0
  5. data/lib/deltacloud/base_driver/base_driver.rb +6 -0
  6. data/lib/deltacloud/base_driver/features.rb +22 -0
  7. data/lib/deltacloud/base_driver/mock_driver.rb +24 -27
  8. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +432 -494
  9. data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +4 -7
  10. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +116 -3
  11. data/lib/deltacloud/drivers/mock/mock_driver.rb +56 -2
  12. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +5 -19
  13. data/lib/deltacloud/helpers/application_helper.rb +26 -3
  14. data/lib/deltacloud/models/image.rb +2 -1
  15. data/lib/deltacloud/models/instance.rb +22 -5
  16. data/lib/deltacloud/models/key.rb +17 -0
  17. data/lib/deltacloud/models/load_balancer.rb +39 -0
  18. data/lib/deltacloud/models/storage_volume.rb +2 -0
  19. data/lib/sinatra/rabbit.rb +4 -7
  20. data/public/javascripts/application.js +10 -24
  21. data/public/stylesheets/compiled/application.css +2 -0
  22. data/server.rb +214 -75
  23. data/views/blobs/new.html.haml +10 -0
  24. data/views/blobs/show.html.haml +21 -15
  25. data/views/buckets/index.html.haml +1 -1
  26. data/views/buckets/show.html.haml +5 -2
  27. data/views/errors/backend_capability_failure.html.haml +11 -0
  28. data/views/errors/backend_capability_failure.xml.haml +4 -0
  29. data/views/errors/backend_error.html.haml +3 -0
  30. data/views/errors/not_allowed.html.haml +6 -0
  31. data/views/errors/not_allowed.xml.haml +2 -0
  32. data/views/instances/index.html.haml +1 -1
  33. data/views/instances/new.html.haml +8 -0
  34. data/views/instances/show.html.haml +1 -1
  35. data/views/keys/show.xml.haml +2 -0
  36. data/views/load_balancers/index.html.haml +33 -0
  37. data/views/load_balancers/index.xml.haml +5 -0
  38. data/views/load_balancers/new.html.haml +38 -0
  39. data/views/load_balancers/show.html.haml +37 -0
  40. data/views/load_balancers/show.xml.haml +21 -0
  41. data/views/realms/index.html.haml +4 -7
  42. data/views/storage_snapshots/index.html.haml +3 -0
  43. data/views/storage_snapshots/index.xml.haml +0 -2
  44. data/views/storage_snapshots/new.html.haml +9 -0
  45. data/views/storage_snapshots/show.xml.haml +0 -2
  46. data/views/storage_volumes/attach.html.haml +20 -0
  47. data/views/storage_volumes/index.html.haml +16 -1
  48. data/views/storage_volumes/index.xml.haml +1 -20
  49. data/views/storage_volumes/new.html.haml +17 -0
  50. data/views/storage_volumes/show.xml.haml +13 -19
  51. metadata +53 -99
@@ -0,0 +1,10 @@
1
+ %h1 New Blob
2
+
3
+ %form{ :action => bucket_url(@bucket_id), :method => :post, :enctype => 'multipart/form-data'}
4
+ %label
5
+ Blob Name:
6
+ %input{ :name => 'blob_id', :size => 512}/
7
+ Blob Data:
8
+ %input{ :type => "file", :name => 'blob_data', :size => 50}/
9
+ %br
10
+ %input{ :type => :submit, :name => "commit", :value => "create"}/
@@ -3,18 +3,24 @@
3
3
  = @blob.id
4
4
 
5
5
  %dl
6
- %dt bucket
7
- %dd
8
- = @blob.bucket
9
- %dt Content_Length
10
- %dd
11
- = @blob.content_length
12
- %dt Content_Type
13
- %dd
14
- = @blob.content_type
15
- %dt Last_Modified
16
- %dd
17
- = @blob.last_modified
18
- %dt Content
19
- %dd
20
- =link_to 'Blob content', bucket_url(@blob.bucket) + '/' + @blob.id + '/content'
6
+ %di
7
+ %dt Bucket
8
+ %dd
9
+ = @blob.bucket
10
+ %dt Content_Length
11
+ %dd
12
+ = @blob.content_length
13
+ %dt Content_Type
14
+ %dd
15
+ = @blob.content_type
16
+ %dt Last_Modified
17
+ %dd
18
+ = @blob.last_modified
19
+ %dt Content
20
+ %dd
21
+ =link_to 'Blob content', bucket_url(@blob.bucket) + '/' + @blob.id + '/content'
22
+ %dt Delete this Blob
23
+ %dd
24
+ %form{ :action => bucket_url(@blob.bucket) + '/' + @blob.id , :method => :post }
25
+ %input{ :type => "hidden", :name => "_method", :value => "delete"}
26
+ %input{ :type => :submit, :value => "Delete"}/
@@ -30,4 +30,4 @@
30
30
  -bucket.blob_list.each do |blob|
31
31
  = blob
32
32
  %td
33
- =link_to 'Delete', destroy_bucket_url(bucket.name), :class => 'delete'
33
+ =link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
@@ -14,6 +14,9 @@
14
14
  %dd
15
15
  -@bucket.blob_list.each do |blob|
16
16
  = link_to blob, bucket_url(@bucket.name) + '/' + blob
17
- %dt delete bucket (must be empty)
17
+ %dt Delete bucket (must be empty)
18
18
  %dd
19
- =link_to 'Delete', destroy_bucket_url(@bucket.name), :class => 'delete'
19
+ %dt Create a new blob
20
+ %dd
21
+ =link_to 'Create Blob', bucket_url(@bucket.name) + '/new_blob'
22
+ =link_to_action 'Delete', destroy_bucket_url(@bucket.name), :delete
@@ -0,0 +1,11 @@
1
+ %h1 Backend Capability Failure
2
+
3
+ %p= @error.message
4
+
5
+ %dl
6
+ %di
7
+ %dt Request URL
8
+ %dd= request.env['REQUEST_URI']
9
+ %di
10
+ %dt Capability
11
+ %dd= @error.capability
@@ -0,0 +1,4 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %capability #{@error.capability}
3
+ %message #{@error.message}
4
+
@@ -6,6 +6,9 @@
6
6
  %di
7
7
  %dt Request URL
8
8
  %dd= request.env['REQUEST_URI']
9
+ %di
10
+ %dt Parameters
11
+ %dd= params.inspect
9
12
  %di
10
13
  %dt Code
11
14
  %dd= @error.code
@@ -0,0 +1,6 @@
1
+ %h1 Method Not Allowed
2
+
3
+ %dl
4
+ %di
5
+ %dt Request URL
6
+ %dd= request.env['REQUEST_URI']
@@ -0,0 +1,2 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %message Method not allowed for this resource
@@ -27,4 +27,4 @@
27
27
  = instance.state
28
28
  %td
29
29
  -instance.actions.each do |action|
30
- =link_to action, self.send(:"#{action}_instance_url", instance.id), :class => instance_action_method(action)
30
+ =link_to_action action, self.send(:"#{action}_instance_url", instance.id), instance_action_method(action)
@@ -9,6 +9,14 @@
9
9
  %label
10
10
  Instance Name:
11
11
  %input{ :name => 'name', :size => 30 }/
12
+ -if driver_has_feature?(:register_to_load_balancer)
13
+ %p
14
+ %label
15
+ Assign to load balancer:
16
+ %select{:name => 'load_balancer_id'}
17
+ %option{:value => ""}
18
+ - @load_balancers.each do |load_balancer|
19
+ %option{:value => load_balancer.id} #{load_balancer.id}
12
20
  -if driver_has_feature?(:authentication_key)
13
21
  %p
14
22
  %label
@@ -40,4 +40,4 @@
40
40
  %dt
41
41
  %dd
42
42
  -@instance.actions.each do |action|
43
- =link_to action, self.send(:"#{action}_instance_url", @instance.id), :class => instance_action_method(action)
43
+ =link_to_action action, self.send(:"#{action}_instance_url", @instance.id), instance_action_method(action)
@@ -17,3 +17,5 @@
17
17
  %password<
18
18
  =cdata do
19
19
  =@key.password
20
+ %state<
21
+ =@key.state
@@ -0,0 +1,33 @@
1
+ %h1 Load Balancers
2
+
3
+ %table.display
4
+ %thead
5
+ %tr
6
+ %th ID
7
+ %th Hostname
8
+ %th Realm
9
+ %th Balancer port
10
+ %th Instances port
11
+ %th Actions
12
+ %tbody
13
+ - @elements.each do |balancer|
14
+ %tr
15
+ %td
16
+ = link_to balancer.id, load_balancer_url( balancer.id )
17
+ %td
18
+ = balancer.public_addresses.first
19
+ %td
20
+ = link_to balancer.realms.first.id, realm_url( balancer.realms.first.id )
21
+ %td
22
+ - balancer.listeners.each do |listener|
23
+ ="#{listener.protocol}[#{listener.load_balancer_port}]<br/>"
24
+ %td
25
+ - balancer.listeners.each do |listener|
26
+ ="#{listener.protocol}[#{listener.load_balancer_port}]<br/>"
27
+ %td
28
+ =link_to_action 'Destroy', destroy_load_balancer_url(balancer.id), :delete
29
+ %tfoot
30
+ %tr
31
+ %td{:colspan => 6, :style => "text-align:right;"}
32
+ =link_to 'Create &raquo;', "#{url_for('/api/load_balancers/new')}", :class => 'button'
33
+
@@ -0,0 +1,5 @@
1
+
2
+ !!!XML
3
+ %load_balancers
4
+ - @elements.each do |c|
5
+ = haml :'load_balancers/show', :locals => { :@load_balancer => c, :partial => true }
@@ -0,0 +1,38 @@
1
+ %h1 New Load Balancer
2
+
3
+ %form{ :action => '/api/load_balancers', :method => :post }
4
+ %p
5
+ %label
6
+ Name:
7
+ %input{ :name => 'name', :size => 30 }/
8
+ -if @instances
9
+ %p
10
+ %label
11
+ Running instance:
12
+ %select{ :name => 'instance_id'}
13
+ - @instances.select{|i| i.state=="RUNNING"}.each do |instance|
14
+ %option{ :value => instance.id } #{instance.id}
15
+ %p
16
+ %label
17
+ Realm:
18
+ %select{ :name => 'realm_id'}
19
+ - @realms.each do |realm|
20
+ %option{ :value => realm.id } #{realm.id} - #{realm.name}
21
+ %hr
22
+ %p
23
+ %label
24
+ Protocol:
25
+ %select{ :name => 'listener_protocol'}
26
+ %option{ :value => 'HTTP'} HTTP
27
+ %option{ :value => 'TCP'} TCP
28
+ %p
29
+ %label
30
+ Load balancer port:
31
+ %input{ :name => "listener_lbr_port", :size => 30}
32
+ %p
33
+ %label
34
+ Instances port:
35
+ %input{ :name => "listener_inst_port", :size => 30}
36
+ %p
37
+ %input{ :type => :submit, :name => "commit", :value => "create" }/
38
+
@@ -0,0 +1,37 @@
1
+ %h1
2
+ = @load_balancer.id
3
+
4
+ %dl
5
+ %di
6
+ %dt Public addresses
7
+ %dd
8
+ = @load_balancer.public_addresses.join(',')
9
+ - if @load_balancer.created_at
10
+ %dt Created at
11
+ %dd
12
+ = @load_balancer.created_at
13
+ %dt Realms
14
+ %dd
15
+ = @load_balancer.realms.collect { |r| "#{r.id} - #{r.name}" }.join(',')
16
+ %dt Listeners
17
+ %dd
18
+ - @load_balancer.listeners.each do |listener|
19
+ ="Load balancer port: #{listener.load_balancer_port}"
20
+ %br
21
+ ="Instance port: #{listener.instance_port}"
22
+ %br
23
+ - if @load_balancer.instances.class.eql?(Array)
24
+ %dt Instances
25
+ - @load_balancer.instances.each do |inst|
26
+ %dd
27
+ =inst.id
28
+ =link_to_action, 'Delete', unregister_load_balancer_url(@load_balancer.id, :instance_id => inst.id), :post
29
+
30
+ %form{:action => url_for("/api/load_balancers/#{@load_balancer.id}/register"), :method => :post}
31
+ %p
32
+ %strong Add instances to load balancer
33
+ %p
34
+ %label Instance
35
+ %select{:name => :instance_id, :id => "list_instances"}
36
+ %input{:type => :submit, :value => "Assign"}
37
+
@@ -0,0 +1,21 @@
1
+ - unless defined?(partial)
2
+ !!! XML
3
+ %load_balancer{ :href => key_url(@load_balancer.id), :id => @load_balancer.id}
4
+ %actions
5
+ %link{ :rel => "destroy", :method => "delete", :href => destroy_load_balancer_url(@load_balancer.id)}
6
+ %public_addresses
7
+ - @load_balancer.public_addresses.each do |address|
8
+ %address #{address}
9
+ %created_at<
10
+ = @load_balancer.created_at
11
+ %realm{ :href => realm_url(@load_balancer.realms.first.id), :id => @load_balancer.realms.first.id}
12
+ %listeners
13
+ - @load_balancer.listeners.each do |listener|
14
+ %listener{ :protocol => listener.protocol}
15
+ %load_balancer_port #{listener.load_balancer_port}
16
+ %instance_port #{listener.instance_port}
17
+ %instances
18
+ - @load_balancer.instances.each do |instance|
19
+ %instance{:href => instance_url(instance.id), :id => instance.id}
20
+ %link{:rel => "unregister", :href => unregister_load_balancer_url(@load_balancer.id, { :instance_id => instance.id})}
21
+
@@ -5,15 +5,13 @@
5
5
  %thead
6
6
  %tr
7
7
  %th
8
- Name
9
- %th
10
- Architecture
8
+ ID
11
9
  %th
12
- Memory
10
+ Name
13
11
  %th
14
- Storage
12
+ State
15
13
  %th
16
- Mutable
14
+ Limit
17
15
  %tbody
18
16
  - @realms.each do |realm|
19
17
  %tr
@@ -25,5 +23,4 @@
25
23
  = realm.state
26
24
  %td
27
25
  = realm.limit
28
- %td
29
26
 
@@ -7,6 +7,7 @@
7
7
  %th Volume
8
8
  %th Created
9
9
  %th State
10
+ %th Actions
10
11
  %tbody
11
12
  - @storage_snapshots.each do |snapshot|
12
13
  %tr
@@ -18,3 +19,5 @@
18
19
  = snapshot.created
19
20
  %td
20
21
  = snapshot.state
22
+ %td
23
+ = link_to_action "Delete", destroy_storage_snapshot_url(snapshot.id), :delete
@@ -4,6 +4,4 @@
4
4
  %storage_snapshot{ :href => storage_snapshot_url(snapshot.id), :id => snapshot.id }
5
5
  %created<
6
6
  =snapshot.created
7
- %state<
8
- =snapshot.state
9
7
  %storage_volume{ :href => storage_volume_url(snapshot.storage_volume_id), :id => snapshot.storage_volume_id }
@@ -0,0 +1,9 @@
1
+ %h1 Create new storage volume snapshot
2
+
3
+ %form{ :action => '/api/storage_snapshots', :method => :post }
4
+ %p
5
+ %label
6
+ Volume ID:
7
+ %input{ :name => 'volume_id', :size => 30, :value => params[:volume_id] }
8
+ %p
9
+ %input{ :type => :submit, :name => "commit", :value => "create" }/
@@ -2,6 +2,4 @@
2
2
  %storage_snapshot{:href => storage_snapshot_url(@storage_snapshot.id), :id => @storage_snapshot.id }
3
3
  %created<
4
4
  =@storage_snapshot.created
5
- %state<
6
- =@storage_snapshot.state
7
5
  %storage_volume{:href => storage_volume_url(@storage_snapshot.storage_volume_id), :id => @storage_snapshot.storage_volume_id}
@@ -0,0 +1,20 @@
1
+ %h1 Attach storage volume
2
+
3
+ %form{ :action => attach_storage_volume_url(params[:id]), :method => :post }
4
+ %p
5
+ %label
6
+ Instance ID:
7
+ - if @instances.empty?
8
+ %select
9
+ %option There are no instances
10
+ - else
11
+ %select{ :name => 'instance_id' }
12
+ - @instances.each do |i|
13
+ %option{ :value => "#{i.id}"} #{i.name}
14
+ %p
15
+ %label
16
+ Device name:
17
+ %input{ :name => "device", :size => 10, :value => "/dev/sdc"}
18
+ %p
19
+ %input{ :type => :hidden, :name => :id, :value => params[:id]}
20
+ %input{ :type => :submit, :name => "commit", :value => "create" }/
@@ -5,8 +5,10 @@
5
5
  %tr
6
6
  %th ID
7
7
  %th Created
8
+ %th Realm
8
9
  %th Capacity
9
10
  %th Status
11
+ %th Actions
10
12
  %tbody
11
13
  - @storage_volumes.each do |volume|
12
14
  %tr
@@ -14,8 +16,21 @@
14
16
  = link_to volume.id, storage_volume_url( volume.id )
15
17
  %td
16
18
  = volume.created
19
+ %td
20
+ = volume.realm_id
17
21
  %td
18
22
  = "#{volume.capacity} GB"
19
23
  %td
20
24
  = "#{volume.state}"
21
-
25
+ %td
26
+ - if ["AVAILABLE", "IN-USE"].include?(volume.state)
27
+ =link_to_action "Snaphot", url_for("/api/storage_snapshots/new?volume_id=#{volume.id}"), :get
28
+ - unless volume.instance_id
29
+ =link_to_action "Delete", destroy_storage_volume_url(volume.id), :delete
30
+ =link_to_action "Attach", url_for("/api/storage_volumes/attach?id=#{volume.id}"), :get
31
+ - if volume.instance_id
32
+ =link_to_action "Detach", detach_storage_volume_url(volume.id), :post
33
+ %tfoot
34
+ %tr
35
+ %td{:colspan => 6}
36
+ %a{ :href => url_for("/api/storage_volumes/new")} Create volume
@@ -1,23 +1,4 @@
1
1
  !!!XML
2
2
  %storage_volumes
3
3
  - @elements.each do |volume|
4
- %storage_volume{ :href => storage_volume_url(volume.id), :id => volume.id }
5
- %created<
6
- =volume.created
7
- %capacity<
8
- =volume.capacity
9
- %state<
10
- =volume.state
11
- %device<
12
- =volume.device
13
- %instance_id<
14
- =volume.instance_id
15
- - unless volume.instance_id.nil?
16
- %instance{:href => instance_url(volume.instance_id), :id => volume.instance_id}
17
- %actions
18
- - if driver.respond_to?(:destroy_storage_volume)
19
- %link{ :rel => "destroy", :method => "delete", :href => destroy_storage_volume_url(volume.id)}
20
- - if driver.respond_to?(:attach_storage_volume)
21
- %link{ :rel => "attach", :method => "post", :href => attach_storage_volume_url(volume.id)}
22
- - if driver.respond_to?(:detach_storage_volume)
23
- %link{ :rel => "detach", :method => "post", :href => detach_storage_volume_url(volume.id)}
4
+ = haml :'storage_volumes/show', :locals => { :@storage_volume => volume, :partial => true }