Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE1DF1008D for ; Mon, 8 Apr 2013 23:46:27 +0000 (UTC) Received: (qmail 36210 invoked by uid 500); 8 Apr 2013 23:46:27 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 36140 invoked by uid 500); 8 Apr 2013 23:46:27 -0000 Mailing-List: contact dev-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 dev@deltacloud.apache.org Received: (qmail 36131 invoked by uid 99); 8 Apr 2013 23:46:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 23:46:27 +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 lutter@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; Mon, 08 Apr 2013 23:46:22 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r38Nk1Rq020806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 8 Apr 2013 19:46:01 -0400 Received: from [10.3.112.22] (ovpn-112-22.phx2.redhat.com [10.3.112.22]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r38NjxLl016241; Mon, 8 Apr 2013 19:46:00 -0400 Message-ID: <1365464759.23209.94.camel@avon.watzmann.net> Subject: Re: deltacloud as a lib and broker From: David Lutterkort To: dev@deltacloud.apache.org Cc: Martin Povolny , aeolus-devel Date: Mon, 08 Apr 2013 16:45:59 -0700 In-Reply-To: <5162BBBC.20605@redhat.com> References: <515EC593.90807@redhat.com> <1365200562.23209.66.camel@avon.watzmann.net> <5162BBBC.20605@redhat.com> Organization: Red Hat Inc Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Virus-Checked: Checked by ClamAV on apache.org On Mon, 2013-04-08 at 14:44 +0200, Jan Provaznik wrote: > > There are some other downsides to using DC in process (as a library): it > > also significantly changes where DC can go architecturally. So far, the > > classic DC API has worked very hard to be stateless - CIMI isn't, and it > > wouldn't be unreasonable to introduce state into the classic DC API. > > That would be much more awkward if DC becomes a library. > > > > I'm not familiar with DC plans (which sound really interesting) but even > with stateful DC the lib could make sense: > 1) the DC lib - can be used by anyone who doesn't need any stateful feature > 2) DC/CIMI stateful service - built *on top* of the lib, wraps the lib > with REST API, adds stateful features I think this is the right way to slice things up: make the DC service(s) wrappers around the DC library. The library essentially deals with adapting the internal driver API to something stable, and probably will make the API look a little more Rubyish. For example, right now code to start and stop an instance would look something like dc = Deltacloud::new(some_backend, some_provider, credentials) inst = dc.create_instance(...) unless starts_automatically(dc) # needs to look at instance_states wait_for_state(dc, inst, "STOPPED") dc.start_instance(credentials, inst.id) end wait_for_state(dc, inst, "STARTED") .. do stuff with your running instance .. dc.stop_instance(dc, inst) As you can see, the above isn't very Rubyish; it would be nicer to write dc = Deltacloud::new(some_backend, some_provider, credentials) inst = dc.create_instance(...) if inst.initial_state == 'STOPPED' inst.poll_for { |inst| inst.stopped? } inst.start end inst.poll_for { |inst| inst.started? } .. do stuff with your running instance .. inst.stop What I am mostly after is a feel for who's going to do the following around a DC library: * Come up with a library API that is safe to use - that includes keeping the API stable and making sure we only expose reasonable parts of the driver API. We don't want an automatic "It's in the drivers, therefore it's part of the API" * Write enough tests to convince us that the library API still works * Document that API Ok .. who's raising their hand ? ;) David