1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[opennebula] clean up and code simplification

This commit is contained in:
Achim Ledermüller 2014-06-05 10:27:34 +02:00
parent d4676d6e7c
commit 9031a00c92
3 changed files with 5 additions and 17 deletions

View file

@ -17,8 +17,7 @@ module Fog
end
def description
return "" if @description.nil?
return @description
attributes[:description] || ""
end
def uuid=(str)
@ -29,13 +28,8 @@ module Fog
return self.id
end
def vlan=(str)
@vlan=str
end
def vlan
return "" if @vlan.nil?
return @vlan
attributes[:vlan] || ""
end
def save

View file

@ -22,19 +22,13 @@ module Fog
attribute :flavor
def save
#if persisted?
# service.update_vm(attributes)
#else
merge_attributes(service.vm_allocate(attributes))
#end
#reload
end
# only for integration in foreman
# needed by formbuilder
# should be handled by foreman and not from by fog
# should be handled by foreman and not by fog
def vminterfaces
#[] << Fog::Compute::OpenNebula::Interfaces.new
[]
end
@ -65,7 +59,7 @@ module Fog
if status == 4
service.vm_resume(id)
end
return true
true
end
def stop

View file

@ -8,7 +8,7 @@ Shindo.tests("Fog::Compute[:opennebula] | vm_create and destroy request", 'openn
tests("Allocate VM") do
response = compute.vm_allocate({:name => 'fog-'+name_base.to_s, :flavor => f})
test("response should be a kind of Hash") { response.kind_of? Hash}
test("id should be a one-id (interger)") { response['id'].is_a? Fixnum}
test("id should be a one-id (Fixnum)") { response['id'].is_a? Fixnum}
end
tests("Destroy VM") do
compute.vm_destroy(response['id'])