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')
|
||||
end
|
||||
|
||||
options[:timeout] = 30
|
||||
options[:timeout] ||= 30
|
||||
if options[:key_data] || options[:keys]
|
||||
options[:keys_only] = true
|
||||
#Explicitly set these so net-ssh doesn't add the default keys
|
||||
|
|
|
@ -14,7 +14,7 @@ module Fog
|
|||
node_hash[:uri] = client.uri
|
||||
xml = client.sys_info rescue nil
|
||||
[: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
|
||||
|
||||
node_hash[:hostname] = client.hostname
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
attribute :os_ext_sts_vm_state, :aliases => 'OS-EXT-STS:vm_state'
|
||||
|
||||
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={})
|
||||
|
@ -50,6 +50,7 @@ module Fog
|
|||
self.security_groups = attributes.delete(:security_groups)
|
||||
self.min_count = attributes.delete(:min_count)
|
||||
self.max_count = attributes.delete(:max_count)
|
||||
self.nics = attributes.delete(:nics)
|
||||
self.os_scheduler_hints = attributes.delete(:os_scheduler_hints)
|
||||
|
||||
super
|
||||
|
@ -256,7 +257,8 @@ module Fog
|
|||
'security_groups' => @security_groups,
|
||||
'min_count' => @min_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 = options.reject {|key, value| value.nil?}
|
||||
|
|
|
@ -41,6 +41,17 @@ module Fog
|
|||
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']
|
||||
data['os:scheduler_hints'] = options['os:scheduler_hints']
|
||||
end
|
||||
|
|
|
@ -17,13 +17,15 @@ module Fog
|
|||
# 'folder' => '/Datacenters/vm/Jeff/Templates' will be MUCH faster.
|
||||
# than simply listing everything.
|
||||
def all(filters = { })
|
||||
load service.list_virtual_machines(filters.merge(
|
||||
:datacenter => datacenter,
|
||||
:cluster => cluster,
|
||||
:network => network,
|
||||
:resource_pool => resource_pool,
|
||||
:folder => folder
|
||||
))
|
||||
f = {
|
||||
:datacenter => datacenter,
|
||||
:cluster => cluster,
|
||||
:network => network,
|
||||
:resource_pool => resource_pool,
|
||||
:folder => folder
|
||||
}.merge(filters)
|
||||
|
||||
load service.list_virtual_machines(f)
|
||||
end
|
||||
|
||||
def get(id, datacenter = nil)
|
||||
|
@ -31,9 +33,7 @@ module Fog
|
|||
rescue Fog::Compute::Vsphere::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue