Class: Deltacloud::Drivers::Eucalyptus::EucalyptusDriver
Constant Summary
collapse
- SERVICE_STUBS =
{
"ec2" => "/services/Eucalyptus",
"s3" => "/services/Walrus"
}
- DEFAULT_PORT =
8773
Deltacloud::Drivers::Ec2::Ec2Driver::DEFAULT_REGION
Constants inherited
from BaseDriver
BaseDriver::MEMBER_SHOW_METHODS, BaseDriver::STATE_MACHINE_OPTS
Class Method Summary
collapse
Instance Method Summary
collapse
-
#create_firewall_rule(credentials, opts = {}) ⇒ Object
if the rule specifies a source group, port&protocol will be ignored.
-
#create_load_balancer(credentials, opts = {}) ⇒ Object
-
#default_image_owner ⇒ Object
-
#default_image_type ⇒ Object
-
#delete_firewall_rule(credentials, opts = {}) ⇒ Object
-
#destroy_load_balancer(credentials, id) ⇒ Object
-
#endpoint_for_service(service) ⇒ Object
-
#instance_state_machine ⇒ Object
-
#lb_register_instance(credentials, opts = {}) ⇒ Object
-
#lb_unregister_instance(credentials, opts = {}) ⇒ Object
-
#load_balancer(credentials, opts = {}) ⇒ Object
because load balancer is not on the supported_collections, the following methods shouldn’t be called.
-
#load_balancers(credentials, opts = nil) ⇒ Object
-
#new_client(credentials, type = :ec2) ⇒ Object
-
#tag_instance(credentials, instance, name) ⇒ Object
-
#untag_instance(credentials, instance_id) ⇒ Object
#addresses, #associate_address, #attach_storage_volume, #blob_data, #blob_metadata, #blob_segment_id, #blob_stream_connection, #blobs, #buckets, #configured_providers, #create_address, #create_blob, #create_bucket, #create_firewall, #create_image, #create_instance, #create_key, #create_storage_snapshot, #create_storage_volume, #delete_blob, #delete_bucket, #delete_firewall, #destroy_address, #destroy_image, #destroy_instance, #destroy_key, #destroy_storage_snapshot, #destroy_storage_volume, #detach_storage_volume, #disassociate_address, #firewalls, #images, #init_segmented_blob, #instance, #instances, #keys, #metric, #metrics, #providers, #realms, #reboot_instance, #run_on_instance, #storage_snapshots, #storage_volumes, #update_blob_metadata, #valid_credentials?
Methods inherited from BaseDriver
#address, #api_provider, #blob, #bucket, #catched_exceptions_list, #configured_providers, constraints, define_hardware_profile, define_instance_states, driver_name, feature, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #firewall, #hardware_profile, #hardware_profiles, hardware_profiles, #has_capability?, #has_feature?, has_feature?, #image, #instance, #instance_actions_for, #key, #name, #realm, #storage_snapshot, #storage_volume, #supported_collections
Methods included from Exceptions
exception_from_status, exceptions, included, logger, #safely
Class Method Details
.instance_state_machine ⇒ Object
Instance Method Details
#create_firewall_rule(credentials, opts = {}) ⇒ Object
if the rule specifies a source group, port&protocol will be ignored. And source group and cidr range can’t be mixed in a request
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 124
def create_firewall_rule(credentials, opts={})
if !(opts['groups'].nil?) && opts['groups'].length>0
ec2 = new_client(credentials)
opts['groups'].each do |group,owner|
safely do
ec2.authorize_security_group_named_ingress(opts['id'], owner, group)
end
end
elsif !(opts['addresses'].nil?) && opts['addresses'].length>0
ec2 = new_client(credentials)
opts['addresses'].each do |ip|
ec2.authorize_security_group_IP_ingress(opts['id'], opts['port_from'], opts['port_to'], opts['protocol'], ip)
end
end
end
|
#create_load_balancer(credentials, opts = {}) ⇒ Object
101
102
103
104
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 101
def create_load_balancer(credentials, opts={})
raise Deltacloud::BackendError.new(500, "Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
|
#default_image_owner ⇒ Object
73
74
75
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 73
def default_image_owner
"self"
end
|
#default_image_type ⇒ Object
77
78
79
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 77
def default_image_type
nil
end
|
#delete_firewall_rule(credentials, opts = {}) ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 141
def delete_firewall_rule(credentials, opts={})
ec2 = new_client(credentials)
firewall = opts[:firewall]
protocol, from_port, to_port, addresses, groups = firewall_rule_params(opts[:rule_id])
unless groups.nil?
groups.each_index do |i|
ec2.revoke_security_group_named_ingress(firewall, groups[i]['owner'], groups[i]['group_name'])
end
end
unless addresses.nil?
addresses.each do |ip|
ec2.revoke_security_group_IP_ingress(firewall, from_port, to_port, protocol, ip )
end
end
end
|
#destroy_load_balancer(credentials, id) ⇒ Object
106
107
108
109
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 106
def destroy_load_balancer(credentials, id)
raise Deltacloud::BackendError.new(500, "Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
|
#endpoint_for_service(service) ⇒ Object
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 176
def endpoint_for_service(service)
service = service.to_s
endpoint = api_provider
if endpoint && endpoint.include?(service)
addr = Hash[endpoint.split(";").map { |svc| svc.strip.split("=") }][service]
host = addr.split(':')[0]
port = addr.split(':')[1] || DEFAULT_PORT
stub = SERVICE_STUBS[service]
{ :endpoint_url => "http://#{host}:#{port}#{stub}",
:connection_mode => :per_thread }
else
{ :connection_mode => :per_thread }
end
end
|
#instance_state_machine ⇒ Object
69
70
71
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 69
def instance_state_machine
self.class.instance_state_machine
end
|
#lb_register_instance(credentials, opts = {}) ⇒ Object
111
112
113
114
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 111
def lb_register_instance(credentials, opts={})
raise Deltacloud::BackendError.new(500, "Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
|
#lb_unregister_instance(credentials, opts = {}) ⇒ Object
116
117
118
119
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 116
def lb_unregister_instance(credentials, opts={})
raise Deltacloud::BackendError.new(500, "Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
|
#load_balancer(credentials, opts = {}) ⇒ Object
because load balancer is not on the supported_collections, the following methods shouldn’t be called.
91
92
93
94
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 91
def load_balancer(credentials, opts={})
raise Deltacloud::BackendError.new(500, "Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
|
#load_balancers(credentials, opts = nil) ⇒ Object
96
97
98
99
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 96
def load_balancers(credentials, opts=nil)
raise Deltacloud::BackendError.new(500, "Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
|
#new_client(credentials, type = :ec2) ⇒ Object
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 157
def new_client(credentials, type = :ec2)
klass = case type
when :ec2 then Aws::Ec2
when :s3 then Aws::S3
when :elb then raise Deltacloud::BackendError.new(500,
"Loadbalancer",
"Loadbalancer not supported in Eucalyptus", "")
end
klass.new(credentials.user, credentials.password,
endpoint_for_service(type))
end
|
#tag_instance(credentials, instance, name) ⇒ Object
81
82
83
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 81
def tag_instance(credentials, instance, name)
end
|
#untag_instance(credentials, instance_id) ⇒ Object
85
86
87
|
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 85
def untag_instance(credentials, instance_id)
end
|