[PATCH Conductor] #1966 Backbone & Refresh Instance Status
by Tomas Sedovic
All,
These patches set us up with Backbone.js and provide code that
automatically refreshes status and other properties of the instances on
the deployment details page.
With this page, when you launch a deployment, the instance status should
change from 'pending' to 'running' or 'create_failed' automatically (no
need to refresh the page).
We can add more of this dynamic behaviour iteratively as needed.
The patches are attached to this email, because git-send-email isn't
particularly fond of minified javascript libraries and doesn't want to
let the patches through the normal way.
I'll appreciate any comments and suggestions on how to make the code
shorter and better.
Cheers,
thomas|shadow
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.
12 years, 8 months
Exception in ImageFactory (Aeolus 0.3.0)
by philippe.berthault@bull.net
Hello,
The aeolus-image push command to Amazon EC2 is failed due to an exception into the python code of image-factory :(
The status is now "FAILED" while the previous tests done by Michel Gauthier reports a status "New". So it seems we have done a small step further on.
[root]# aeolus-image push -r ec2-us-east-1 --id 864dad40-cf9b-44c2-ae84-962d64bb8996
Provider Image: c76732dd-7a64-4074-87b0-8983cf3dae9a
Image: 864dad40-cf9b-44c2-ae84-962d64bb8996
Build: ad4b8caa-f3d4-4f42-8fd4-968b67e3c4e5
Status: FAILED
Percent Complete: 0
In the /var/log/imagefactory.log file, we see the following problem:
2011-08-17 15:38:13,752 DEBUG imagefactory.qmfagent.ImageFactoryAgent.ImageFactoryAgent pid(2290)
Method called: name = push_image
args = {'credentials': '*** REDACTED ***', 'image': '864dad40-cf9b-44c2-ae84-962d64bb8996', 'build': '', 'providers': ['ec2-us-east-1']}
handle = <cqmf2.AgentEvent; proxy of <Swig Object of type 'qmf::AgentEvent *' at 0x2c89030> >
addr = redhat.com:imagefactory:3aa62164-8dc2-46a0-b896-213bc16649da:image_factory
subtypes = {}
userId = anonymous
2011-08-17 15:38:13,753 DEBUG imagefactory.ImageWarehouse.ImageWarehouse pid(2290)
Created Image Warehouse instance http://localhost:9090 - buckets(target_images, templates, icicles, provider_images)
Getting metadata (['latest_unpushed']) from http://localhost:9090/images/864dad40-cf9b-44c2-ae84-962d64bb8996
Querying (http://localhost:9090/target_images/_query)
with expression ($build == "ad4b8caa-f3d4-4f42-8fd4-968b67e3c4e5" && $target == "ec2")
Getting metadata (['template']) from http://localhost:9090/target_images/7756b621-4543-42f7-bcf1-e9326f5b5f20
Created Image Warehouse instance http://localhost:9090 - buckets(target_images, templates, icicles, provider_images)
Created Image Warehouse instance http://localhost:9090 - buckets(target_images, templates, icicles, provider_images)
2011-08-17 15:38:13,771 DEBUG oz.Guest.FedoraRemoteGuest pid(2290)
Name: Fedora 14 x86_64 with updates-c76732dd-7a64-4074-87b0-8983cf3dae9a,
UUID: a9344787-30a9-492f-8dbc-819b55a47e08
MAC: 52:54:00:f3:60:d6, distro: Fedora
update: 14, arch: x86_64, diskimage: /var/tmp/Fedora 14 x86_64
with updates-c76732dd-7a64-4074-87b0-8983cf3dae9a.dsk
nicmodel: virtio, clockoffset: utc
mousetype: ps2, disk_bus: virtio, disk_dev: vda
icicletmp: /var/lib/oz/icicletmp/Fedora 14 x86_64
with updates-c76732dd-7a64-4074-87b0-8983cf3dae9a, listen_port: 29311
Original ISO path: /var/lib/oz/isos/Fedora14x86_64-url.iso
Modified ISO cache: /var/lib/oz/isos/Fedora14x86_64-url-oz.iso
Output ISO path: /var/tmp/Fedora 14 x86_64
with updates-c76732dd-7a64-4074-87b0-8983cf3dae9a-url-oz.iso
ISO content path: /var/lib/oz/isocontent/Fedora 14 x86_64
with updates-c76732dd-7a64-4074-87b0-8983cf3dae9a-url
2011-08-17 15:38:13,776 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(2290)
Exception caught in ImageFactory
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/imagefactory/builders/FedoraBuilder.py", line 498, in push_image
self.init_guest("remote")
…
File "/usr/lib64/python2.7/urllib2.py", line 1173, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1148, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>
2011-08-17 15:38:13,807 DEBUG imagefactory.BuildJob.BuildAdaptor pid(2290)
Raising event with agent handler (<ImageFactoryAgent(Thread-1, initial)>),
changed status from NEW to FAILED
We are using Aeolus behind a proxy and it's impossible to bypass it. This proxy has been declared (http_proxy and https_proxy environment variables) in the following daemons: deltacloud-core, deltacloud-ec2-us-east-1, deltacloud-ec2-us-west-1, imagefactory and iwhd. But there is no effect and we are always stopped in the image-factory python package.
A bugzilla #731420 on image-factory has been opened on this blocking problem.
Thanks.
P. Berthault.
12 years, 8 months
Error After Launching Deployment
by James Labocki
I am looking for help finding the root cause of a failure to deploy an image to RHEV 3.0 using Aeolus. I understand RHEV 3.0 is not officially supported yet, but any help or pointers would be greatly appreciated. After launching a deployment the state goes to error and I see the following in the conductor interface:
Create_Instance_Failure: Failed to perform transfer: Server returned nothing (no headers, no data)
Version Information
[root ~]# rpm -qa |egrep 'aeolus|iwhd|image|delta'
aeolus-configure-2.0.1-2.el6.20110726134906gitdf2c66b.noarch
rubygem-imagefactory-console-0.5.0-4.el6.20110726134859gitcc22497.noarch
aeolus-conductor-doc-0.3.0-1.el6.fc14.noarch
libdeltacloud-0.9-1.el6.x86_64
iwhd-0.98.15.z3-1.el6.x86_64
python-deltarpm-3.5-0.5.20090913git.el6.x86_64
condor-deltacloud-gahp-7.6.0-5dcloud.el6.x86_64
aeolus-conductor-0.3.0-1.el6.fc14.noarch
imagefactory-0.4.1-2.el6.noarch
rubygem-aeolus-image-0.1.0-3.el6.20110726134857git00b5aa2.noarch
aeolus-all-0.3.0-1.el6.fc14.noarch
deltacloud-core-0.3.9999-1308927004.el6.noarch
rubygem-deltacloud-client-0.3.1-1.el6.noarch
aeolus-conductor-daemons-0.3.0-1.el6.fc14.noarch
Here are the contents of /var/log/deltacloud-rhevm/rhevm.log
127.0.0.1 - - [16/Aug/2011 17:23:13] "GET /api HTTP/1.1" 200 869 0.0090
127.0.0.1 - - [16/Aug/2011 17:23:13] "GET /api HTTP/1.1" 200 869 0.0101
127.0.0.1 - - [16/Aug/2011 17:23:13] "GET /api/instances HTTP/1.1" 200 1293 0.2889
127.0.0.1 - - [16/Aug/2011 17:23:13] "GET /api/instances HTTP/1.1" 200 1293 0.2894
127.0.0.1 - - [16/Aug/2011 17:23:13] "GET /api HTTP/1.1" 200 869 0.0061
127.0.0.1 - - [16/Aug/2011 17:23:18] "GET /api HTTP/1.1" 200 869 0.0454
Deltacloud::ExceptionHandler::ProviderError - 500 Internal Server Error:
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:63:in `post'
././lib/deltacloud/drivers/rhevm/rhevm_client.rb:73:in `create_vm'
././lib/deltacloud/drivers/rhevm/rhevm_driver.rb:188:in `create_instance'
././lib/deltacloud/base_driver/exceptions.rb:111:in `call'
././lib/deltacloud/base_driver/exceptions.rb:111:in `safely'
././lib/deltacloud/drivers/rhevm/rhevm_driver.rb:182:in `create_instance'
././server.rb:397
././lib/sinatra/rabbit.rb:113:in `instance_eval'
././lib/sinatra/rabbit.rb:113:in `POST /api/instances'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:863:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:863:in `route'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `route_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:500:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `route!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'
././lib/sinatra/rack_driver_select.rb:45:in `call'
././lib/sinatra/rack_matrix_params.rb:85:in `call'
././lib/sinatra/rack_runtime.rb:36:in `call'
././lib/sinatra/rack_etag.rb:42:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/context.rb:22:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:76:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:74:in `catch'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:74:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1060:in `call'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1060:in `spawn_threadpool'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `initialize'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `new'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `spawn_threadpool'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1049:in `defer'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:54:in `process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:42:in `receive_data'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/backends/base.rb:57:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/server.rb:156:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/controllers/controller.rb:80:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:177:in `send'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:177:in `run_command'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:143:in `run!'
/usr/share/deltacloud-core/bin/deltacloudd:126
/usr/bin/deltacloudd:5:in `load'
/usr/bin/deltacloudd:5
_machine'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/backends/base.rb:57:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/server.rb:156:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/controllers/controller.rb:80:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:177:in `send'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:177:in `run_command'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:143:in `run!'
/usr/share/deltacloud-core/bin/deltacloudd:126
/usr/bin/deltacloudd:5:in `load'
/usr/bin/deltacloudd:5
!! Unexpected error while processing request: undefined method `details' for #<Deltacloud::ExceptionHandler::ProviderError:0x7f3f426f6778>
undefined method `details' for #<Deltacloud::ExceptionHandler::ProviderError:0x7f3f426f6778>
././views/errors/502.xml.haml:5:in `__tilt_c2d225826150225b6ff2072079794052'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb:192:in `send'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb:192:in `evaluate'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb:449:in `evaluate'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb:131:in `render'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:343:in `render_without_format'
././lib/sinatra/respond_to.rb:129:in `render'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:311:in `haml'
././lib/deltacloud/helpers/application_helper.rb:112:in `report_error'
././lib/sinatra/respond_to.rb:242:in `call'
././lib/sinatra/respond_to.rb:242:in `respond_to'
././lib/deltacloud/helpers/application_helper.rb:111:in `report_error'
././server.rb:61
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:641:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:641:in `error_block!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:636:in `each'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:636:in `error_block!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:630:in `handle_exception!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:605:in `dispatch!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'
././lib/sinatra/rack_driver_select.rb:45:in `call'
././lib/sinatra/rack_matrix_params.rb:85:in `call'
././lib/sinatra/rack_runtime.rb:36:in `call'
././lib/sinatra/rack_etag.rb:42:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-accept-0.4.3/lib/rack/accept/context.rb:22:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/commonlogger.rb:18:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:76:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:74:in `catch'
/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:74:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1060:in `call'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1060:in `spawn_threadpool'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `initialize'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1057:in `new'
/usr/lib/ruby/gems/1.8/gems/ev
I am able to hit the RHEVM API from the host runnig aeolus/deltacloud:
# curl -k -u admin@rhev3.cloud.redhat.com:password https://rhev3.cloud.redhat.com:8443/rhevm-api/
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<api>
<link rel="capabilities" href="/rhevm-api/capabilities"/>
<link rel="clusters" href="/rhevm-api/clusters"/>
<link rel="clusters/search" href="/rhevm-api/clusters?search={query}"/>
<link rel="datacenters" href="/rhevm-api/datacenters"/>
<link rel="datacenters/search" href="/rhevm-api/datacenters?search={query}"/>
<link rel="events" href="/rhevm-api/events"/>
<link rel="events/search" href="/rhevm-api/events?search={query}"/>
<link rel="hosts" href="/rhevm-api/hosts"/>
<link rel="hosts/search" href="/rhevm-api/hosts?search={query}"/>
<link rel="networks" href="/rhevm-api/networks"/>
<link rel="roles" href="/rhevm-api/roles"/>
<link rel="storagedomains" href="/rhevm-api/storagedomains"/>
<link rel="storagedomains/search" href="/rhevm-api/storagedomains?search={query}"/>
<link rel="tags" href="/rhevm-api/tags"/>
<link rel="templates" href="/rhevm-api/templates"/>
<link rel="templates/search" href="/rhevm-api/templates?search={query}"/>
<link rel="users" href="/rhevm-api/users"/>
<link rel="groups" href="/rhevm-api/groups"/>
<link rel="domains" href="/rhevm-api/domains"/>
<link rel="vmpools" href="/rhevm-api/vmpools"/>
<link rel="vmpools/search" href="/rhevm-api/vmpools?search={query}"/>
<link rel="vms" href="/rhevm-api/vms"/>
<link rel="vms/search" href="/rhevm-api/vms?search={query}"/>
<special_objects>
<link rel="templates/blank" href="/rhevm-api/templates/00000000-0000-0000-0000-000000000000"/>
<link rel="tags/root" href="/rhevm-api/tags/00000000-0000-0000-0000-000000000000"/>
</special_objects>
<system_version revision="0" build="0" minor="0" major="3"/>
<summary>
<vms>
<total>1</total>
<active>1</active>
</vms>
<hosts>
<total>2</total>
<active>2</active>
</hosts>
<users>
<total>1</total>
<active>1</active>
</users>
<storage_domains>
<total>3</total>
<active>3</active>
</storage_domains>
</summary>
</api>
12 years, 8 months
[PATCH conductor 1/2] Removed instance key polymorhic association
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/2013
There is no need to associate a key with a provider account.
---
src/app/models/instance.rb | 14 ++------------
src/app/models/instance_key.rb | 3 +--
src/app/models/provider_account.rb | 1 -
...110808133834_remove_polymorphic_instance_key.rb | 11 +++++++++++
src/features/step_definitions/instance_steps.rb | 2 +-
src/spec/factories/instance_key.rb | 4 ++--
src/spec/models/instance_observer_spec.rb | 16 ----------------
7 files changed, 17 insertions(+), 34 deletions(-)
create mode 100644 src/db/migrate/20110808133834_remove_polymorphic_instance_key.rb
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 6199c15..bfb9ab0 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -73,7 +73,7 @@ class Instance < ActiveRecord::Base
belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
belongs_to :instance_hwp
- has_one :instance_key, :as => :instance_key_owner, :dependent => :destroy
+ has_one :instance_key, :dependent => :destroy
has_many :permissions, :as => :permission_object, :dependent => :destroy,
:include => [:role],
:order => "permissions.id ASC"
@@ -234,7 +234,7 @@ class Instance < ActiveRecord::Base
client = self.provider_account.connect
return nil unless client && client.feature?(:instances, :authentication_key)
if key = client.create_key(:name => key_name)
- self.instance_key = InstanceKey.create!(:pem => key.pem.first, :name => key.id, :instance_key_owner => self)
+ self.instance_key = InstanceKey.create!(:pem => key.pem.first, :name => key.id, :instance => self)
self.save!
end
end
@@ -341,16 +341,6 @@ class Instance < ActiveRecord::Base
read_attribute(:public_addresses)
end
- def create_auth_key
- raise "instance provider_account is not set" unless self.provider_account
- client = self.provider_account.connect
- return nil unless client && client.feature?(:instances, :authentication_key)
- kname = "#{self.name}_#{Time.now.to_i}_key_#{self.object_id}".gsub(/[^a-zA-Z0-9\.\-]/, '_')
- if key = client.create_key(:name => kname)
- self.update_attribute(:instance_key, InstanceKey.create!(:pem => key.pem.first, :name => key.id, :instance_key_owner => self))
- end
- end
-
scope :with_hardware_profile, lambda {
{:include => :hardware_profile}
}
diff --git a/src/app/models/instance_key.rb b/src/app/models/instance_key.rb
index bec06ab..df5f871 100644
--- a/src/app/models/instance_key.rb
+++ b/src/app/models/instance_key.rb
@@ -35,6 +35,5 @@
#
class InstanceKey < ActiveRecord::Base
-
- belongs_to :instance_key_owner, :polymorphic => true
+ belongs_to :instance
end
diff --git a/src/app/models/provider_account.rb b/src/app/models/provider_account.rb
index a506ba6..7fd508f 100644
--- a/src/app/models/provider_account.rb
+++ b/src/app/models/provider_account.rb
@@ -47,7 +47,6 @@ class ProviderAccount < ActiveRecord::Base
:include => [:role],
:order => "permissions.id ASC"
- has_one :instance_key, :as => :instance_key_owner, :dependent => :destroy
# validation of credentials is done in provider_account validation, :validate => false prevents nested_attributes from validation
has_many :credentials, :dependent => :destroy, :validate => false
accepts_nested_attributes_for :credentials
diff --git a/src/db/migrate/20110808133834_remove_polymorphic_instance_key.rb b/src/db/migrate/20110808133834_remove_polymorphic_instance_key.rb
new file mode 100644
index 0000000..91d2ab7
--- /dev/null
+++ b/src/db/migrate/20110808133834_remove_polymorphic_instance_key.rb
@@ -0,0 +1,11 @@
+class RemovePolymorphicInstanceKey < ActiveRecord::Migration
+ def self.up
+ remove_column :instance_keys, :instance_key_owner_type
+ rename_column :instance_keys, :instance_key_owner_id, :instance_id
+ end
+
+ def self.down
+ add_column :instance_keys, :instance_key_owner_type, :string
+ rename_column :instance_keys, :instance_id, :instance_key_owner_id
+ end
+end
diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb
index fd9ffdf..99cc9e3 100644
--- a/src/features/step_definitions/instance_steps.rb
+++ b/src/features/step_definitions/instance_steps.rb
@@ -7,7 +7,7 @@ def pending_instance
end
Given /^a mock running instance exists$/ do
- mock_instance.instance_key = FactoryGirl.create :mock_instance_key, :instance_key_owner => mock_instance
+ mock_instance.instance_key = FactoryGirl.create :mock_instance_key, :instance => mock_instance
end
Given /^a mock pending instance exists$/ do
diff --git a/src/spec/factories/instance_key.rb b/src/spec/factories/instance_key.rb
index 60c7524..3196095 100644
--- a/src/spec/factories/instance_key.rb
+++ b/src/spec/factories/instance_key.rb
@@ -30,12 +30,12 @@ uH9ebPTGZc5cTpOEV9SupUez4cAedBGeHVDHy06sATrgIwKBgQCdqFhrse+uhRacK1LAymvBsou5
end
factory :ec2_instance_key1, :parent => :instance_key do
- instance_key_owner { |p| p.association(:ec2_instance) }
+ association :instance, :factory => :ec2_instance
name "1_user"
end
factory :mock_instance_key, :parent => :instance_key do
- instance_key_owner { |c| c.association(:instance) }
+ association :instance, :factory => :instance
end
end
diff --git a/src/spec/models/instance_observer_spec.rb b/src/spec/models/instance_observer_spec.rb
index 078b487..5303904 100644
--- a/src/spec/models/instance_observer_spec.rb
+++ b/src/spec/models/instance_observer_spec.rb
@@ -172,22 +172,6 @@ describe InstanceObserver do
end
end
- it "should generate instance key when instance is running" do
- client = mock('DeltaCloud').as_null_object
- client.stub!(:"feature?").and_return(true)
- @provider_account.stub!(:connect).and_return(client)
- @instance.stub!(:provider_account).and_return(@provider_account)
-
- @instance.instance_key = FactoryGirl.create(:instance_key, :name => 'key1', :instance_key_owner => @instance)
- @instance.instance_key.stub!(:replace_on_server).and_return(true)
- @provider_account.instance_key = FactoryGirl.create(:instance_key, :name => 'key1', :instance_key_owner => @provider_account)
-
- @instance.state = Instance::STATE_RUNNING
- @instance.save!
- @instance.instance_key.name.should != @provider_account.instance_key.name
- end
-
-
it "should track the events of the instance lifetime" do
@instance.events.should have(1).items
@instance.events[0].summary.should match /created/
--
1.7.6
12 years, 8 months
[PATCH conductor] Disable the viewstate redirects
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
Previously, when we updated a viewstate with a request whose params didn't
have a viewstate uuid specified, we added viewstate=uuid to that request's
params.
To do that, we had to do a redirect, which was causing a lot of problems, so
this removes the redirect.
---
src/lib/viewstate.rb | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/src/lib/viewstate.rb b/src/lib/viewstate.rb
index 58ee3cc..2b2fb2c 100644
--- a/src/lib/viewstate.rb
+++ b/src/lib/viewstate.rb
@@ -143,14 +143,6 @@ module ActionController
@viewstate.state = @viewstate.state.merge(viewstate_params)
set_session_viewstate(@viewstate)
-
- respond_to do |format|
- format.html do
- params[:viewstate] = @viewstate.id
- redirect_to params
- end
- format.js { }
- end
else
@viewstate = nil
end
--
1.7.6
12 years, 8 months
[PATCH conductor] Removed can_start and can_create actions
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
These actions were used by condor plugins when choosing provider account,
now provider account is chosen on conductor side so it's not used anymore.
---
src/app/controllers/instances_controller.rb | 52 +--------------------------
src/config/routes.rb | 5 ---
src/features/api.feature | 40 --------------------
3 files changed, 1 insertions(+), 96 deletions(-)
delete mode 100644 src/features/api.feature
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index a315db9..e0f5d13 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -1,5 +1,5 @@
class InstancesController < ApplicationController
- before_filter :require_user, :except => [:can_start, :can_create]
+ before_filter :require_user
before_filter :load_instance, :only => [:show, :key, :edit, :update]
before_filter :set_view_vars, :only => [:show, :index]
@@ -148,56 +148,6 @@ class InstancesController < ApplicationController
end
end
- def can_create
- respond_to do |format|
- begin
- provider_account = ProviderAccount.find(params[:provider_account_id])
- @instance = Instance.find(params[:id])
- @action_request = "can_create"
- @value = Quota.can_create_instance?(@instance, provider_account)
- format.html { render :partial => 'can_perform_state_change.xml' }
- format.xml { render :partial => 'can_perform_state_change.xml' }
- format.json { render :json => {:action_request => @action_request, :instance_id => @instance.id, :value => @value} }
- rescue ActiveRecord::RecordNotFound
- format.html { head :not_found }
- format.json { render :json => {:error => 'Record not found'}, :status => :not_found }
- format.xml { render :xml => {:error => 'Record not found'}, :status => :not_found }
- rescue Exception
- format.html { head :internal_server_error }
- format.json { render :json => {:error => $!}, :status => :internal_server_error }
- format.xml { render :xml => {:error => $!}, :status => :internal_server_error }
- end
- end
- end
-
- def can_start
- respond_to do |format|
- begin
- provider_account = ProviderAccount.find(params[:provider_account_id])
- @instance = Instance.find(params[:id])
- @action_request = "can_start"
- @value = Quota.can_start_instance?(@instance, provider_account)
- format.html { render :partial => 'can_perform_state_change.xml' }
- format.xml { render :partial => 'can_perform_state_change.xml' }
- format.json { render :json => {:action_request => @action_request, :instance_id => @instance.id, :value => @value} }
- rescue ActiveRecord::RecordNotFound => e
- format.html do
- puts e.inspect
- head :not_found
- end
- format.json { render :json => {:error => 'Record not found'}, :status => :not_found }
- format.xml { render :xml => {:error => 'Record not found'}, :status => :not_found }
- rescue Exception => e
- format.html do
- puts e.inspect
- head :internal_server_error
- end
- format.json { render :json => {:error => $!}, :status => :internal_server_error }
- format.xml { render :xml => {:error => $!}, :status => :internal_server_error }
- end
- end
- end
-
private
def load_instance
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 1d6857e..c8b601c 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -95,15 +95,10 @@ Conductor::Application.routes.draw do
get 'remove_failed'
end
member do
- get 'can_start'
- get 'can_create'
get 'key'
end
end
- #map.can_start_instance '/instances/:instance_id/can_start/:provider_account_id', :controller => 'instances', :action => 'can_start', :conditions => { :method => :get }
- #map.can_create_instance '/instances/:instance_id/can_create/:provider_account_id', :controller => 'instances', :action => 'can_create', :conditions => { :method => :get }
-
resources :image_imports
resources :hardware_profiles do
diff --git a/src/features/api.feature b/src/features/api.feature
deleted file mode 100644
index 4ff624a..0000000
--- a/src/features/api.feature
+++ /dev/null
@@ -1,40 +0,0 @@
-Feature: User authentication
- In order to automatically manage my Cloud Engine environment
- As a client
- I must be able to access a Cloud Engine APU+I
-
- Background:
- Given I am an authorised user
- And I am logged in
-
- Scenario: Check can start instance
- Given there is a user "testuser"
- And there is a provider named "testprovider"
- And there is a provider account named "testaccount"
- And there are the following instances:
- | name | external_key | state | public_addresses | private_addresses |
- | mock | ext_mock | stopped | mock.public.address | mock.private.address |
- And user "testuser" owns instance "mock"
- When a client requests "can_start" for instance "mock" for provider account "testaccount"
- Then the root element should be "result"
- And there should exist the following xpath: "/result/action_request"
- And this path should have the value "can_start"
- And there should exist the following xpath: "/result/instance_id"
- And there should exist the following xpath: "/result/value"
- And this path should have the value "true"
-
- Scenario: Check can create instance
- Given there is a user "testuser"
- And there is a provider named "testprovider"
- And there is a provider account named "testaccount"
- And there are the following instances:
- | name | external_key | state | public_addresses | private_addresses |
- | mock | ext_mock | stopped | mock.public.address | mock.private.address |
- And user "testuser" owns instance "mock"
- When a client requests "can_create" for instance "mock" for provider account "testaccount"
- Then the root element should be "result"
- And there should exist the following xpath: "/result/action_request"
- And this path should have the value "can_create"
- And there should exist the following xpath: "/result/instance_id"
- And there should exist the following xpath: "/result/value"
- And this path should have the value "true"
--
1.7.6
12 years, 8 months
[PATCH 0/1] Remove more than one deployment at time
by Jirka Tomasek
This patch fixes BZ723306. It implements multi_destroy feature for
deployments and deployments/_list.haml is used for displaying
deployments table thoughout the application (filter views)
Right now this brings 2 failing cucumber tests caused by double redirect
from destroy action, tsedovic is now working on patchfix.
12 years, 8 months
[PATCH conductor] Default to HTML responses
by Matt Wagner
Hi all,
This is a rebased re-send of https://fedorahosted.org/pipermail/aeolus-devel/2011-July/003345.html
Many browsers, including IE and elinks, send "*/*" as a content type in the HTTP Accept header. (In elinks, it seems to be the only one. In IE, it's a long series of inapplicable formats, followed by */*.) In Rails respond_to blocks, "*/*" will hit the first block. With this patch, we are consistently using HTML, so that HTML is always the default response type in this case. Previously, we would sometimes render partials and set an inappropriate MIME type causing the browser to display them. This was, needless to say, a horrible user experience.
I'm pretty sure I pushed this before and it somehow got lost in the shuffle. But because there's no ACK on the list, I'm resending for approval.
-- Matt
12 years, 8 months
[PATCH imagefactory] Add progress to the image warehouse upload code.
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
imgfac/ImageWarehouse.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/imgfac/ImageWarehouse.py b/imgfac/ImageWarehouse.py
index e5a6f8e..4277fb1 100644
--- a/imgfac/ImageWarehouse.py
+++ b/imgfac/ImageWarehouse.py
@@ -190,6 +190,16 @@ class ImageWarehouse(object):
return build_id
def _upload_image_file(self, object_url, image_file_path):
+ self.last_mb = -1
+ def _progress(down_total, down_current, up_total, up_current):
+ if up_total == 0:
+ return
+ current_mb = int(up_current) / 10485760
+ if current_mb > self.last_mb or up_current == up_total:
+ self.last_mb = current_mb
+ self.log.debug("%dkB of %dkB" % (up_current/1024,
+ up_total/1024))
+
try:
image_file = open(image_file_path)
@@ -201,6 +211,8 @@ class ImageWarehouse(object):
curl.setopt(pycurl.PUT, 1)
curl.setopt(pycurl.INFILE, image_file)
curl.setopt(pycurl.INFILESIZE, image_size)
+ curl.setopt(curl.NOPROGRESS, 0)
+ curl.setopt(curl.PROGRESSFUNCTION, _progress)
curl.perform()
curl.close()
image_file.close()
--
1.7.4.4
12 years, 8 months
[PATCH] Adjusted use of dist tag according to Fedora packaging guidelines
by James Laska
The Fedora packaging guidelines note the use of the dist tag at the end of the
release string. The following patch adjusts aeolus-all and aeolus-conductor to
move the dist string to the end of the rpm release.
Signed-off-by: James Laska <jlaska(a)redhat.com>
---
aeolus-all.spec.in | 2 +-
aeolus-conductor.spec.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/aeolus-all.spec.in b/aeolus-all.spec.in
index 80841e4..81da990 100644
--- a/aeolus-all.spec.in
+++ b/aeolus-all.spec.in
@@ -1,6 +1,6 @@
Name: aeolus-all
Version: @VERSION@
-Release: 0%{?dist}%{?extra_release}
+Release: 0%{?extra_release}%{?dist}
Summary: A meta-package to pull in all components for Aeolus
Group: Applications/Internet
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 664e966..c2d37db 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -3,7 +3,7 @@
Name: aeolus-conductor
Version: @VERSION@
-Release: 0%{?dist}%{?extra_release}
+Release: 0%{?extra_release}%{?dist}
Summary: The Aeolus Conductor
Group: Applications/System
--
1.7.6
12 years, 8 months