mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[compute|ninefold] small consistency fixes for server
This commit is contained in:
parent
c0ca2cd5dc
commit
3e8a2f3177
1 changed files with 16 additions and 15 deletions
|
@ -5,6 +5,9 @@ module Fog
|
||||||
class Ninefold
|
class Ninefold
|
||||||
|
|
||||||
class Server < Fog::Model
|
class Server < Fog::Model
|
||||||
|
extend Fog::Deprecation
|
||||||
|
deprecate :serviceofferingid, :flavor_id
|
||||||
|
deprecate :templateid, :image_id
|
||||||
|
|
||||||
identity :id
|
identity :id
|
||||||
|
|
||||||
|
@ -13,10 +16,11 @@ module Fog
|
||||||
attribute :cpuspeed
|
attribute :cpuspeed
|
||||||
|
|
||||||
attribute :cpuused
|
attribute :cpuused
|
||||||
attribute :created, :type => :time
|
attribute :created, :type => :time
|
||||||
attribute :displayname
|
attribute :displayname
|
||||||
attribute :domain
|
attribute :domain
|
||||||
attribute :domainid
|
attribute :domainid
|
||||||
|
attribute :flavor_id, :aliases => :serviceofferingid
|
||||||
attribute :forvirtualnetwork
|
attribute :forvirtualnetwork
|
||||||
attribute :group
|
attribute :group
|
||||||
attribute :groupid
|
attribute :groupid
|
||||||
|
@ -25,6 +29,7 @@ module Fog
|
||||||
attribute :hostid
|
attribute :hostid
|
||||||
attribute :hostname
|
attribute :hostname
|
||||||
attribute :hypervisor
|
attribute :hypervisor
|
||||||
|
attribute :image_id, :aliases => :templateid
|
||||||
#attribute :ipaddress
|
#attribute :ipaddress
|
||||||
attribute :isodisplaytext
|
attribute :isodisplaytext
|
||||||
attribute :isoid
|
attribute :isoid
|
||||||
|
@ -35,20 +40,18 @@ module Fog
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :networkkbsread
|
attribute :networkkbsread
|
||||||
attribute :networkkbswrite
|
attribute :networkkbswrite
|
||||||
|
attribute :nic
|
||||||
attribute :password
|
attribute :password
|
||||||
attribute :passwordenabled
|
attribute :passwordenabled
|
||||||
attribute :rootdeviceid
|
attribute :rootdeviceid
|
||||||
attribute :rootdevicetype
|
attribute :rootdevicetype
|
||||||
attribute :serviceofferingid
|
attribute :securitygroup
|
||||||
attribute :serviceofferingname
|
attribute :serviceofferingname
|
||||||
attribute :state
|
attribute :state
|
||||||
attribute :templatedisplaytext
|
attribute :templatedisplaytext
|
||||||
attribute :templateid
|
|
||||||
attribute :templatename
|
attribute :templatename
|
||||||
attribute :zoneid
|
attribute :zoneid
|
||||||
attribute :zonename
|
attribute :zonename
|
||||||
attribute :nic
|
|
||||||
attribute :securitygroup
|
|
||||||
|
|
||||||
# used for creation only.
|
# used for creation only.
|
||||||
attribute :networkids
|
attribute :networkids
|
||||||
|
@ -66,7 +69,7 @@ module Fog
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
merge_attributes({
|
merge_attributes({
|
||||||
:serviceofferingid => 105 # '1CPU, 384MB, 80GB HDD'
|
:flavor_id => 105 # '1CPU, 384MB, 80GB HDD'
|
||||||
})
|
})
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
@ -102,13 +105,13 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def flavor
|
def flavor
|
||||||
requires :serviceofferingid
|
requires :flavor_id
|
||||||
connection.flavors.get(serviceofferingid)
|
connection.flavors.get(flavor_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def image
|
def image
|
||||||
requires :templateid
|
requires :image_id
|
||||||
connection.images.get(templateid)
|
connection.images.get(image_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
|
@ -130,9 +133,7 @@ module Fog
|
||||||
|
|
||||||
def save
|
def save
|
||||||
raise "Operation not supported" if self.identity
|
raise "Operation not supported" if self.identity
|
||||||
requires :serviceofferingid
|
requires :flavor_id, :image_id, :zoneid
|
||||||
requires :templateid
|
|
||||||
requires :zoneid
|
|
||||||
|
|
||||||
unless networkids
|
unless networkids
|
||||||
# No network specified, use first in this zone.
|
# No network specified, use first in this zone.
|
||||||
|
@ -146,8 +147,8 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
:serviceofferingid => serviceofferingid,
|
:serviceofferingid => flavor_id,
|
||||||
:templateid => templateid,
|
:templateid => image_id,
|
||||||
:name => name,
|
:name => name,
|
||||||
:zoneid => zoneid,
|
:zoneid => zoneid,
|
||||||
:networkids => networkids,
|
:networkids => networkids,
|
||||||
|
|
Loading…
Add table
Reference in a new issue