mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge branch 'master' of github.com:fog/fog into auth_deux
This commit is contained in:
commit
f66dbe1162
5 changed files with 26 additions and 13 deletions
|
@ -46,7 +46,7 @@ module Fog
|
||||||
raise ArgumentError.new(':key_data, :keys, :password or a loaded ssh-agent is required to initialize SSH')
|
raise ArgumentError.new(':key_data, :keys, :password or a loaded ssh-agent is required to initialize SSH')
|
||||||
end
|
end
|
||||||
|
|
||||||
options[:timeout] = 30
|
options[:timeout] ||= 30
|
||||||
if options[:key_data] || options[:keys]
|
if options[:key_data] || options[:keys]
|
||||||
options[:keys_only] = true
|
options[:keys_only] = true
|
||||||
#Explicitly set these so net-ssh doesn't add the default keys
|
#Explicitly set these so net-ssh doesn't add the default keys
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
||||||
node_hash[:uri] = client.uri
|
node_hash[:uri] = client.uri
|
||||||
xml = client.sys_info rescue nil
|
xml = client.sys_info rescue nil
|
||||||
[:uuid, :manufacturer, :product, :serial].each do |attr|
|
[:uuid, :manufacturer, :product, :serial].each do |attr|
|
||||||
node_hash[attr] = node_attr(attr, xml)
|
node_hash[attr] = node_attr(attr, xml) rescue nil
|
||||||
end if xml
|
end if xml
|
||||||
|
|
||||||
node_hash[:hostname] = client.hostname
|
node_hash[:hostname] = client.hostname
|
||||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
||||||
attribute :os_ext_sts_vm_state, :aliases => 'OS-EXT-STS:vm_state'
|
attribute :os_ext_sts_vm_state, :aliases => 'OS-EXT-STS:vm_state'
|
||||||
|
|
||||||
attr_reader :password
|
attr_reader :password
|
||||||
attr_writer :image_ref, :flavor_ref, :os_scheduler_hints
|
attr_writer :image_ref, :flavor_ref, :nics, :os_scheduler_hints
|
||||||
|
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
|
@ -50,6 +50,7 @@ module Fog
|
||||||
self.security_groups = attributes.delete(:security_groups)
|
self.security_groups = attributes.delete(:security_groups)
|
||||||
self.min_count = attributes.delete(:min_count)
|
self.min_count = attributes.delete(:min_count)
|
||||||
self.max_count = attributes.delete(:max_count)
|
self.max_count = attributes.delete(:max_count)
|
||||||
|
self.nics = attributes.delete(:nics)
|
||||||
self.os_scheduler_hints = attributes.delete(:os_scheduler_hints)
|
self.os_scheduler_hints = attributes.delete(:os_scheduler_hints)
|
||||||
|
|
||||||
super
|
super
|
||||||
|
@ -256,7 +257,8 @@ module Fog
|
||||||
'security_groups' => @security_groups,
|
'security_groups' => @security_groups,
|
||||||
'min_count' => @min_count,
|
'min_count' => @min_count,
|
||||||
'max_count' => @max_count,
|
'max_count' => @max_count,
|
||||||
'os:scheduler_hints' => @os_scheduler_hints
|
'nics' => @nics,
|
||||||
|
'os:scheduler_hints' => @os_scheduler_hints,
|
||||||
}
|
}
|
||||||
options['metadata'] = metadata.to_hash unless @metadata.nil?
|
options['metadata'] = metadata.to_hash unless @metadata.nil?
|
||||||
options = options.reject {|key, value| value.nil?}
|
options = options.reject {|key, value| value.nil?}
|
||||||
|
|
|
@ -41,6 +41,17 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options['nics']
|
||||||
|
data['server']['networks'] =
|
||||||
|
Array(options['nics']).map do |nic|
|
||||||
|
{
|
||||||
|
'uuid' => nic['net_id'],
|
||||||
|
'fixed_ip' => nic['v4_fixed_ip'],
|
||||||
|
'port' => nic['port_id']
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if options['os:scheduler_hints']
|
if options['os:scheduler_hints']
|
||||||
data['os:scheduler_hints'] = options['os:scheduler_hints']
|
data['os:scheduler_hints'] = options['os:scheduler_hints']
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,13 +17,15 @@ module Fog
|
||||||
# 'folder' => '/Datacenters/vm/Jeff/Templates' will be MUCH faster.
|
# 'folder' => '/Datacenters/vm/Jeff/Templates' will be MUCH faster.
|
||||||
# than simply listing everything.
|
# than simply listing everything.
|
||||||
def all(filters = { })
|
def all(filters = { })
|
||||||
load service.list_virtual_machines(filters.merge(
|
f = {
|
||||||
:datacenter => datacenter,
|
:datacenter => datacenter,
|
||||||
:cluster => cluster,
|
:cluster => cluster,
|
||||||
:network => network,
|
:network => network,
|
||||||
:resource_pool => resource_pool,
|
:resource_pool => resource_pool,
|
||||||
:folder => folder
|
:folder => folder
|
||||||
))
|
}.merge(filters)
|
||||||
|
|
||||||
|
load service.list_virtual_machines(f)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(id, datacenter = nil)
|
def get(id, datacenter = nil)
|
||||||
|
@ -31,9 +33,7 @@ module Fog
|
||||||
rescue Fog::Compute::Vsphere::NotFound
|
rescue Fog::Compute::Vsphere::NotFound
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue