Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 62D29C1D2 for ; Fri, 25 Jan 2013 12:51:06 +0000 (UTC) Received: (qmail 94720 invoked by uid 500); 25 Jan 2013 12:51:06 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 94650 invoked by uid 500); 25 Jan 2013 12:51:04 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 94613 invoked by uid 99); 25 Jan 2013 12:51:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jan 2013 12:51:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 628CE825339; Fri, 25 Jan 2013 12:51:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkoper@apache.org To: commits@deltacloud.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: Fgcp: changes and bug fixes to pass most api tests (rebased) Message-Id: <20130125125102.628CE825339@tyr.zones.apache.org> Date: Fri, 25 Jan 2013 12:51:02 +0000 (UTC) Updated Branches: refs/heads/master 2e33d1737 -> f9ea0c116 Fgcp: changes and bug fixes to pass most api tests (rebased) Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/f9ea0c11 Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/f9ea0c11 Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/f9ea0c11 Branch: refs/heads/master Commit: f9ea0c11683b7d816ad8cf921f06a628c80af1c6 Parents: 2e33d17 Author: Dies Koper Authored: Fri Jan 25 22:08:42 2013 +1100 Committer: Dies Koper Committed: Fri Jan 25 23:49:46 2013 +1100 ---------------------------------------------------------------------- server/lib/deltacloud/drivers/fgcp/fgcp_client.rb | 2 +- server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb | 20 ++++++++++++--- tests/config.yaml | 4 +- tests/deltacloud/common_tests_collections.rb | 4 +- tests/deltacloud/instances_test.rb | 8 +++--- tests/deltacloud/test_setup.rb | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f9ea0c11/server/lib/deltacloud/drivers/fgcp/fgcp_client.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_client.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_client.rb index 489e8c4..4d569da 100644 --- a/server/lib/deltacloud/drivers/fgcp/fgcp_client.rb +++ b/server/lib/deltacloud/drivers/fgcp/fgcp_client.rb @@ -167,7 +167,7 @@ class FgcpClient #{description} - jp + ja #{name} #{description} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f9ea0c11/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb index 716ac85..6b749c9 100644 --- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver.rb @@ -109,6 +109,13 @@ class FgcpDriver < Deltacloud::BaseDriver if xml['diskimages'] # not likely to not be so, but just in case xml['diskimages'][0]['diskimage'].each do |img| + # 32bit CentOS/RHEL images are refused on hwps > 16GB (i.e. w_high, quad_high) + os_arch = img['osName'][0].to_s =~ /.*32.?bit.*/ ? 'i386' : 'x86_64' + os_centos_rhel = img['osName'][0] =~ /(CentOS|Red Hat).*/ + allowed_hwps = hwps.select do |hwp| + hwp.memory.default.to_i < 16000 or os_arch == 'x86_64' or not os_centos_rhel + end + images << Image.new( :id => img['diskimageId'][0], :name => img['diskimageName'][0].to_s, @@ -118,8 +125,8 @@ class FgcpDriver < Deltacloud::BaseDriver # This will determine image architecture using OS name. # Usually the OS name includes '64bit' or '32bit'. If not, # it will fall back to 64 bit. - :architecture => img['osName'][0].to_s =~ /.*32.?bit.*/ ? 'i386' : 'x86_64', - :hardware_profiles => hwps + :architecture => os_arch, + :hardware_profiles => allowed_hwps ) if opts[:id].nil? or opts[:id] == img['diskimageId'][0] end end @@ -139,7 +146,7 @@ class FgcpDriver < Deltacloud::BaseDriver if opts[:name].nil? # default to instance name instance = client.get_vserver_attributes(opts[:id]) - opts[:name] ||= instance['vserver'][0]['vserverName'] + opts[:name] = instance['vserver'][0]['vserverName'] opts[:description] ||= opts[:name] end @@ -1444,6 +1451,11 @@ eofwopxml status 404 # Not Found end + # trying to create an image that has never been booted + on /NEVER_BOOTED/ do + status 409 # Conflict + end + # reached maximum number of attempts while polling for an update on /Server did not include public IP address in FW NAT rules/ do status 504 # Gateway Timeout @@ -1630,7 +1642,7 @@ eofwopxml :firewalls => server != 'FW' ? [client.extract_vsys_id(vserver['vserverId'][0]) + '-S-0001'] : nil, :owner_id => vserver['creator'][0] } - instance.merge!( {'create_image' => false}) if not server == 'vserver' + instance.merge!( {'create_image' => false}) if server != 'vserver' or state_data[:state] != 'STOPPED' instance.merge! state_data Instance::new(instance) http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f9ea0c11/tests/config.yaml ---------------------------------------------------------------------- diff --git a/tests/config.yaml b/tests/config.yaml index 2f18caa..078f6fa 100644 --- a/tests/config.yaml +++ b/tests/config.yaml @@ -39,9 +39,9 @@ fgcp: #used for instances tests: preferred: provider: "au" - image: "IMG_3c9820_D30U8UNY6I9S" + image: "IMG_3c9820_S24FWXU0Q9VH0JK" hardware_profile: "economy" - realm: "UZXC0GRT-ZG8ZJCJ07" + realm: "UZXC0GRT-ZG8ZJCJ07-N-DMZ" # CIMI testing http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f9ea0c11/tests/deltacloud/common_tests_collections.rb ---------------------------------------------------------------------- diff --git a/tests/deltacloud/common_tests_collections.rb b/tests/deltacloud/common_tests_collections.rb index 5745296..717e3a7 100644 --- a/tests/deltacloud/common_tests_collections.rb +++ b/tests/deltacloud/common_tests_collections.rb @@ -39,7 +39,7 @@ module CommonCollectionsTest end it "must require authentication to access the #{test_collection} collection" do - skip "Skipping for #{test_collection} as no auth required here" if ["hardware_profiles", "instance_states"].include?(test_collection) + skip "Skipping for #{test_collection} as auth may not be required here" if ["hardware_profiles", "instance_states"].include?(test_collection) proc { get(test_collection, :noauth => true) }.must_raise RestClient::Request::Unauthorized end @@ -59,7 +59,7 @@ module CommonCollectionsTest end end - #run tests for both the top-level collection and it's members + #run tests for both the top-level collection and its members def self.run_collection_and_member_tests_for(test_collection) #first run only 'top-level' collection tests (e.g. for 'images') run_collection_tests_for(test_collection) http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f9ea0c11/tests/deltacloud/instances_test.rb ---------------------------------------------------------------------- diff --git a/tests/deltacloud/instances_test.rb b/tests/deltacloud/instances_test.rb index 73b5ed2..1522914 100644 --- a/tests/deltacloud/instances_test.rb +++ b/tests/deltacloud/instances_test.rb @@ -84,11 +84,11 @@ puts "CLEANUP attempt finished... resources looks like: #{@@created_resources.in #Now run the instances-specific tests: - it 'must have the "state" element defined for each instance in collection' do + it 'must have a legal "state" element defined for each instance in collection, or no "state" at all' do res = get(INSTANCES) (res.xml/'instances/instance').each do |r| - (r/'state').wont_be_empty - (r/'state').first.must_match /(RUNNING|STOPPED|PENDING)/ + # provider may not return state for each instance in collection because of performance reasons + (r/'state').first.must_match /(RUNNING|STOPPED|PENDING)/ unless (r/'state').empty? end end @@ -242,7 +242,7 @@ puts "CLEANUP attempt finished... resources looks like: #{@@created_resources.in instance_actions = (res.xml/'actions/link').to_a.inject([]){|actions, current| actions << current[:rel]; actions} skip "no create image support for instance #{@@my_instance_id}" unless instance_actions.include?("create_image") #create image - res = post("/images", :instance_id => @@my_instance_id, :name=>random_name) + res = post("/images", :instance_id => @@my_instance_id, :name => random_name) res.code.must_equal 201 my_image_id = (res.xml/'image')[0][:id] #mark for deletion later: http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f9ea0c11/tests/deltacloud/test_setup.rb ---------------------------------------------------------------------- diff --git a/tests/deltacloud/test_setup.rb b/tests/deltacloud/test_setup.rb index b28e456..4d1943c 100644 --- a/tests/deltacloud/test_setup.rb +++ b/tests/deltacloud/test_setup.rb @@ -172,7 +172,7 @@ module Deltacloud::Test::Methods def random_name name = rand(36**10).to_s(36) - name.insert(0, "apitest") + name.insert(0, "dcapitest") end def get_a(item)