Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 740828173 for ; Thu, 18 Aug 2011 09:13:02 +0000 (UTC) Received: (qmail 66843 invoked by uid 500); 18 Aug 2011 09:13:01 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 66706 invoked by uid 500); 18 Aug 2011 09:12:52 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 66691 invoked by uid 99); 18 Aug 2011 09:12:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 09:12:49 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 09:12:43 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7I9CN56016801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Aug 2011 05:12:23 -0400 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7I9CLSA009153 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 18 Aug 2011 05:12:22 -0400 Subject: Re: [PATCH core] Added check for datacenter in cluster Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Michal Fojtik In-Reply-To: <1313658222-27227-1-git-send-email-fvollero@redhat.com> Date: Thu, 18 Aug 2011 11:13:03 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <320D0114-1DC2-477A-AC7D-44E78876B6DC@redhat.com> References: <1313658222-27227-1-git-send-email-fvollero@redhat.com> To: deltacloud-dev@incubator.apache.org X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 On Aug 18, 2011, at 11:03 AM, fvollero@redhat.com wrote: ACK. With small inline doubts :) -- Michal > From: Francesco Vollero >=20 > Signed-off-by: Francesco Vollero > --- > .../lib/deltacloud/drivers/rhevm/rhevm_client.rb | 10 ++++++++-- > .../lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 1 + > 2 files changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb = b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb > index b4a2a80..fcc25e2 100644 > --- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb > +++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb > @@ -131,8 +131,8 @@ module RHEVM > [ RHEVM::Cluster::new(self, vm)] > else > = Client::parse_response(RHEVM::client(@api_entrypoint)["/clusters"].get(hea= ders)).xpath('/clusters/cluster').collect do |vm| > - RHEVM::Cluster::new(self, vm) > - end > + RHEVM::Cluster::new(self, vm) if has_datacenter?(vm) > + end.compact > end > end >=20 > @@ -196,6 +196,11 @@ module RHEVM > Nokogiri::XML(response) > end >=20 > + def has_datacenter?(vm) > + value=3D!(vm/'data_center').empty? > + puts "has_datacenter value: #{value}" > + value > + end > end >=20 > class BaseObject > @@ -300,6 +305,7 @@ module RHEVM > @description =3D ((xml/'description').first.text rescue nil) > @datacenter =3D Link::new(@client, = (xml/'data_center').first[:id], (xml/'data_center').first[:href]) > end > + This new line is not necessary here. > end >=20 > class DataCenter < BaseObject > diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb = b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb > index d0d528e..5190598 100644 > --- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb > +++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb > @@ -78,6 +78,7 @@ class RHEVMDriver < Deltacloud::BaseDriver > realm_arr =3D [] > safely do > clusters =3D client.clusters > + puts clusters.size Forgot to remove some debugging stuff? > clusters.each do |r| > d =3D client.datacenters(:id =3D> r.datacenter.id).first > realm_arr << convert_realm(r, d) > --=20 > 1.7.4.4 >=20 -- Michal ------------------------------------------------------ Michal Fojtik, mfojtik@redhat.com Deltacloud API: http://deltacloud.org