You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by dk...@apache.org on 2013/04/08 13:42:01 UTC
[2/4] git commit: Fgcp: fix cimi system deletion: advertise op and
ensure state becomes DELETING until gone
Fgcp: fix cimi system deletion: advertise op and ensure state becomes DELETING until gone
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/88c189a6
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/88c189a6
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/88c189a6
Branch: refs/heads/master
Commit: 88c189a6c3441aed605de04571a5a621862f0959
Parents: 3082294
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Sat Apr 6 01:51:01 2013 +1100
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Apr 8 21:39:27 2013 +1000
----------------------------------------------------------------------
.../drivers/fgcp/fgcp_driver_cimi_methods.rb | 15 ++++++++++-----
.../drivers/mock/mock_driver_cimi_methods.rb | 4 ++++
2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88c189a6/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
index d0ae1ea..64e434c 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
@@ -48,7 +48,8 @@ module Deltacloud::Drivers::Fgcp
)
end
systems = systems.select { |s| opts[:id] == s[:id] } if opts[:id]
- # now add system state and advertised operations
+
+ # now add system state and advertise operations
systems.each do |system|
vservers = client.list_vservers(system[:id])['vservers'][0]['vserver']
if vservers.nil?
@@ -57,19 +58,23 @@ module Deltacloud::Drivers::Fgcp
vservers.each do |vserver|
state = @@MACHINE_STATE_MAP[client.get_vserver_status(vserver['vserverId'][0])['vserverStatus'][0]]
system[:state] ||= state
- system[:operations] << { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" } if state == 'STOPPED'
- system[:operations] << { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" } if state == 'STARTED'
+ system[:operations] << { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" } if state == 'STOPPED'
+ system[:operations] << { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" } if state == 'STARTED'
if system[:state] != state
system[:state] = 'MIXED'
# this case could have been caused by one machine in capturing state and one in e.g. creating,
# but just advertise both operations to cut it short
- system[:operations] << { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" }
- system[:operations] << { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" }
+ system[:operations] << { :href => context.system_url("#{system[:id]}/start"), :rel => "http://schemas.dmtf.org/cimi/1/action/start" }
+ system[:operations] << { :href => context.system_url("#{system[:id]}/stop"), :rel => "http://schemas.dmtf.org/cimi/1/action/stop" }
break
end
end
system[:operations].uniq!
end
+ # check for special case: in destroy_system the FW is stopped before the system is deleted
+ system[:state] = 'DELETING' if ((vservers.nil? and system[:state] != 'CREATING') or system[:state] == 'STOPPED') and
+ ['STOPPED', 'STOPPING'].include? client.get_efm_status("#{system[:id]}-S-0001")['efmStatus'][0]
+ system[:operations] << { :href => context.system_url(system[:id]), :rel => "delete" } if system[:state] == 'STOPPED'
end
systems
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/88c189a6/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index b0d4f9a..0efeecb 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -303,6 +303,8 @@ module Deltacloud::Drivers::Mock
# Convert all attributes that have values of the form
# http://cimi.example.org/COLL/ID
+ # or
+ # http://cimi.example.org/COLL/ID/SUBCOLL/ENT_ID
def convert_urls(val, context)
if val.nil? || val.is_a?(Fixnum)
# Nothing to do
@@ -330,6 +332,8 @@ module Deltacloud::Drivers::Mock
#
# URLs that should be rewritten need to be in the form
# http://cimi.example.org/COLLECTION/ID
+ # or
+ # http://cimi.example.org/COLLECTION/SYSTEM_ID/SUBCOLLECTION/ENT_ID
def rewrite_url(s, context)
begin
u = URI.parse(s)