[PATCH] Do something sensible if the config file isn't found
by Mark McLoughlin
If the config file wasn't found (e.g. if running from a git checkout)
then we were returning an empty dict rather than the config defaults.
---
imagefactory/ApplicationConfiguration.py | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/imagefactory/ApplicationConfiguration.py b/imagefactory/ApplicationConfiguration.py
index 5e62a01..4754f6f 100644
--- a/imagefactory/ApplicationConfiguration.py
+++ b/imagefactory/ApplicationConfiguration.py
@@ -45,25 +45,23 @@ class ApplicationConfiguration(object):
def __init__(self):
super(ApplicationConfiguration, self).__init__()
- self.configuration = {}
self.argparser = self.__new_argument_parser()
- arguments = self.parse_arguments()
-
- config_file_path = arguments.config
- if (os.path.isfile(config_file_path)):
+ configuration = self.parse_arguments()
+
+ if (os.path.isfile(configuration.config)):
try:
- config_file = open(config_file_path)
+ config_file = open(configuration.config)
uconfig = json.load(config_file)
# coerce this dict to ascii for python 2.6
config = {}
for k, v in uconfig.items():
config[k.encode('ascii')]=v.encode('ascii')
- self.configuration = self.parse_arguments(defaults=config).__dict__
+ configuration = self.parse_arguments(defaults=config)
except IOError, e:
logging.exception(e)
- self.configuration = arguments
-
-
+
+ self.configuration = configuration.__dict__
+
def __new_argument_parser(self):
main_description = """Image Factory is an application for creating system images to run virtual machines in various public and private \
clouds. The imgfac command can be used to start a daemon providing a QMFv2 agent interface, allowing for \
--
1.7.4.4
12 years, 11 months
rails3 branch
by Matt Wagner
Hi,
In between sprints I spent a little bit of time looking at what it would
take to get Conductor to run on Fedora 15. The most obvious change is
that Fedora 15 ships with Rails 3.
My effort to get things running was very incomplete and it's not yet in a
working state. But now that I'm no longer working on it, I wanted to
mention that I pushed a 'rails3' topic branch so others can pick it up
when the mood strikes / time allows.
Most of Mo's patches from December[1] won't apply because the project
has changed so much. All but 6/8 and 7/8 have been applied, though
applying the patches is largely a manual effort. There is also other
work that will need doing, including updating several versions of gems
that don't seem to be compatible with Rails 3.
I have notes on my efforts at
http://aeolusproject.org/page/Rails_3_Migration
Redmine tasks #190 and #1435 should track the remaining work that I'm
aware of.
[1] https://fedorahosted.org/pipermail/deltacloud-devel/2010-December/thread....
-- Matt
12 years, 11 months
Problem while creating instances in RHEV
by Alfredo Moralejo
Hi,
While trying aeolus with RHEV-M , I've found a problem while creating instances.
When creating a new instance, a VM is created and immediately deleted in RHEV-M. Instance appears in error state.
I think problem is in condor job that is not managing properly the "PENDING" status that deltacloud returns after VM creation.
After VM creation, RHEV-M puts the VM in "Image Locked" for some seconds until the VM is actually created. Deltacloud maps this status to PENDING. It seems that condor job is not managing properly (I guess job should retry until VM appears
as STOPPED, the status it expects to start it).
This is the sequence of GM Status in condor for the job:
04/30/11 16:25:28 [14525] (26.0) gm state change: GM_INIT -> GM_START
04/30/11 16:25:28 [14525] (26.0) gm state change: GM_START -> GM_CLEAR_REQUEST
04/30/11 16:25:28 [14525] (26.0) gm state change: GM_CLEAR_REQUEST -> GM_UNSUBMITTED
04/30/11 16:25:28 [14525] (26.0) gm state change: GM_UNSUBMITTED -> GM_SAVE_INSTANCE_NAME
04/30/11 16:25:33 [14525] (26.0) gm state change: GM_SAVE_INSTANCE_NAME -> GM_CREATE_VM
04/30/11 16:26:08 [14525] (26.0) gm state change: GM_CREATE_VM -> GM_SAVE_INSTANCE_ID
04/30/11 16:26:08 [14525] (26.0) gm state change: GM_SAVE_INSTANCE_ID -> GM_SUBMITTED
04/30/11 16:26:08 [14525] (26.0) gm state change: GM_SUBMITTED -> GM_PROBE_JOB
04/30/11 16:26:11 [14525] (26.0) gm state change: GM_PROBE_JOB -> GM_SUBMITTED
04/30/11 16:26:50 [14525] (26.0) gm state change: GM_SUBMITTED -> GM_DONE_SAVE
04/30/11 16:26:55 [14525] (26.0) gm state change: GM_DONE_SAVE -> GM_STOPPED
04/30/11 16:27:11 [14525] (26.0) gm state change: GM_STOPPED -> GM_DELETE
I've open bz https://bugzilla.redhat.com/show_bug.cgi?id=702571
Best regards,
Alfredo
12 years, 11 months
[PATCH 1/1] classad_plugin: fallback to WEBrick URI on failure
by Mark McLoughlin
When running conductor under WEBrick it's a different base URI, so try
falling back to that on failure.
Also, avoid segfaulting when we don't get the XML response we expect,
free the GError on error and unref the XML nodes when we're finished
with them.
---
src/classad_plugin/conductor_classad_plugin.cpp | 82 +++++++++++++---------
1 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/src/classad_plugin/conductor_classad_plugin.cpp b/src/classad_plugin/conductor_classad_plugin.cpp
index 5151d72..f0addcf 100644
--- a/src/classad_plugin/conductor_classad_plugin.cpp
+++ b/src/classad_plugin/conductor_classad_plugin.cpp
@@ -73,25 +73,37 @@ static void _print_value(FILE *fp, Value val, const char *name)
}
static RestXmlNode *
-get_xml (RestProxyCall *call)
+query_conductor (const char *base_uri, const char *uri, GError **err)
{
- RestXmlParser *parser;
- RestXmlNode *root;
- GError *error = NULL;
+ RestProxy *proxy;
+ RestProxyCall *call;
+ RestXmlNode *ret = NULL;
- parser = rest_xml_parser_new();
+ proxy = rest_proxy_new(base_uri, FALSE);
+ call = rest_proxy_new_call(proxy);
+ rest_proxy_call_set_function(call, uri);
+
+ if (rest_proxy_call_sync(call, err)) {
+ RestXmlParser *parser = rest_xml_parser_new();
- root = rest_xml_parser_parse_from_data(parser,
- rest_proxy_call_get_payload(call),
- rest_proxy_call_get_payload_length(call));
+ ret = rest_xml_parser_parse_from_data(parser,
+ rest_proxy_call_get_payload(call),
+ rest_proxy_call_get_payload_length(call));
+
+ if (rest_xml_node_find(ret, "value") == NULL) {
+ rest_xml_node_unref(ret);
+ ret = NULL;
+ }
+
+ g_object_unref(parser);
+ }
g_object_unref(call);
- g_object_unref(parser);
+ g_object_unref(proxy);
- return root;
+ return ret;
}
-
/*
* Perform our quota check against the Aeolus Conductor database.
* The arglist to this function is expected to contain:
@@ -109,8 +121,6 @@ conductor_quota_check(const char *name, const ArgumentList &arglist,
Value account_id;
FILE *fp;
bool val = false;
- RestProxy *proxy;
- RestProxyCall *call;
RestXmlNode *root;
std::stringstream rest_call;
GError *err = NULL;
@@ -156,33 +166,37 @@ conductor_quota_check(const char *name, const ArgumentList &arglist,
// Call rest API to get answer on quota..
// FIXME: this should be configurable somehow, maybe passed via condor?
- proxy = rest_proxy_new("http://localhost:3000/conductor", FALSE);
- call = rest_proxy_new_call(proxy);
- rest_proxy_call_set_function(call, rest_call.str().c_str());
fprintf(fp, "Calling REST API with %s\n", rest_call.str().c_str());
- rest_proxy_call_sync(call, &err);
-
- if (err != NULL) {
- fprintf(fp, "Error calling REST API: %s\n", err->message);
- } else {
- root = get_xml(call);
- if (root) {
- RestXmlNode *node;
- gchar *value;
-
- node = rest_xml_node_find(root, "value");
- value = node->content;
-
- fprintf (fp, "return value is %s\n", value);
- if (strncmp(value, "true", 4) == 0) {
- result.SetBooleanValue(true);
- val = true;
+
+ root = query_conductor("http://localhost:3000/conductor", rest_call.str().c_str(), &err);
+ if (root == NULL) {
+ root = query_conductor("http://localhost:3000", rest_call.str().c_str(), NULL);
+
+ // Print the first error if the second call fails
+ if (err != NULL) {
+ if (root == NULL) {
+ fprintf(fp, "Error calling REST API: %s\n", err->message);
}
+ g_error_free(err);
}
}
- g_object_unref(proxy);
+ if (root != NULL) {
+ RestXmlNode *node;
+ gchar *value;
+
+ node = rest_xml_node_find(root, "value");
+ value = node->content;
+
+ fprintf (fp, "return value is %s\n", value);
+ if (strncmp(value, "true", 4) == 0) {
+ result.SetBooleanValue(true);
+ val = true;
+ }
+
+ rest_xml_node_unref(root);
+ }
do_ret:
fclose(fp);
--
1.7.4.4
12 years, 11 months
Feature #1339 (rev.1)
by jzigmund@redhat.com
Fixed format of Uptime, removed information about HWP resources of deployment, because now we have stored only user-created HWP, whose values doesnt reflect real ones.
12 years, 11 months
EC2 build failures caused by repos.fpo being down
by Justin Clift
Hi Matt,
Pradeep is experiencing failures when pushing a new template to EC2.
Watching /var/log/imagefactory.log, it seems to be caused by the repos.fedorapeople.org
site being offline (which it is):
********************************************************************
2011-05-05 13:43:50,683 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(2431) Message: Exception during push_image
2011-05-05 13:43:50,683 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(2431) Message: Unexpected error: (<class 'oz.OzException.OzException'>)
2011-05-05 13:43:50,683 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(2431) Message: value: ('ssh -i /etc/oz/id_rsa-icicle-gen -o ServerAliveInterval=30 -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o UserKnownHostsFile=/dev/null root(a)ec2-50-17-89-125.compute-1.amazonaws.com yum -y install cyrus-sasl dovecot sendmail sendmail-cf spamassassin spambayes ' failed(1): Warning: Permanently added 'ec2-50-17-89-125.compute-1.amazonaws.com,50.17.89.125' (RSA) to the list of known hosts.
http://repos.fedorapeople.org/repos/aeolus/demo/webapp/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - ""
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: custom. Please verify its path and try again
)
********************************************************************
Would it be possible to mirror our repos to the aeolusproject.org site
(or anywhere), so that Pradeep's demo tomorrow can go ahead even if this
happens again?
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 11 months
[PATCH conductor] Create UI to show operation status of deployment
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
.../resources/deployments_controller.rb | 2 +-
src/app/helpers/resources/deployments_helper.rb | 28 ++++++++++++++++++++
.../views/resources/deployments/_operation.haml | 19 +++++++++++++
src/features/deployment.feature | 7 +++++
src/features/step_definitions/deployment_steps.rb | 2 +-
src/features/support/paths.rb | 3 ++
6 files changed, 59 insertions(+), 2 deletions(-)
create mode 100644 src/app/helpers/resources/deployments_helper.rb
create mode 100644 src/app/views/resources/deployments/_operation.haml
diff --git a/src/app/controllers/resources/deployments_controller.rb b/src/app/controllers/resources/deployments_controller.rb
index 81378f8..5890e83 100644
--- a/src/app/controllers/resources/deployments_controller.rb
+++ b/src/app/controllers/resources/deployments_controller.rb
@@ -48,7 +48,7 @@ class Resources::DeploymentsController < ApplicationController
@deployment = Deployment.find(params[:id])
require_privilege(Privilege::VIEW, @deployment)
init_new_deployment_attrs
- @tab_captions = ['Properties', 'Instances', 'Provider Services', 'Required Services', 'History', 'Permissions']
+ @tab_captions = ['Properties', 'Instances', 'Provider Services', 'Required Services', 'History', 'Permissions','Operation']
@details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
respond_to do |format|
format.js do
diff --git a/src/app/helpers/resources/deployments_helper.rb b/src/app/helpers/resources/deployments_helper.rb
new file mode 100644
index 0000000..4a87a74
--- /dev/null
+++ b/src/app/helpers/resources/deployments_helper.rb
@@ -0,0 +1,28 @@
+module Resources::DeploymentsHelper
+ def count_uptime(start_time)
+ difference = Time.now.utc - start_time
+
+ seconds = difference % 60
+ difference = (difference - seconds) / 60
+ minutes = difference % 60
+ difference = (difference - minutes) / 60
+ hours = difference % 24
+ difference = (difference - hours) / 24
+ days = difference % 7
+
+ return "#{days.to_i} day(s), #{hours.to_i}:#{minutes.to_i}:#{seconds.to_i}"
+
+ end
+
+ def count_resources(deployment)
+ deployment_memory = 0
+ deployment_cpu = 0
+ deployment_storage = 0
+ deployment.instances.each do |instance|
+ deployment_memory += instance.hardware_profile.memory.value.to_i
+ deployment_cpu += instance.hardware_profile.cpu.value.to_i
+ deployment_storage += instance.hardware_profile.storage.value.to_i
+ end
+ return {:total_memory => deployment_memory.to_s, :total_cpu => deployment_cpu.to_s , :total_storage => deployment_storage.to_s}
+ end
+end
diff --git a/src/app/views/resources/deployments/_operation.haml b/src/app/views/resources/deployments/_operation.haml
new file mode 100644
index 0000000..cbc53d5
--- /dev/null
+++ b/src/app/views/resources/deployments/_operation.haml
@@ -0,0 +1,19 @@
+%h3 Operational status of #{(a)deployment.name}
+
+Uptime:
+= count_uptime((a)deployment.created_at)
+%br
+Count of instances:
+= @deployment.instances.count
+%br
+%h3 HW Resources:
+- unless @deployment.instances.empty?
+ - deployment_resources = count_resources(@deployment)
+ Total memory:
+ = deployment_resources[:total_memory]
+ Total number of cpu:
+ = deployment_resources[:total_cpu]
+ Total volume of storage:
+ = deployment_resources[:total_storage]
+- else
+ No instances
diff --git a/src/features/deployment.feature b/src/features/deployment.feature
index 4b26097..44abfb7 100644
--- a/src/features/deployment.feature
+++ b/src/features/deployment.feature
@@ -34,3 +34,10 @@ Feature: Manage Deployments
When I check "testdeployment" deployment
And I press "Stop"
Then I should see "testdeployment"
+
+ Scenario: Show operational status of deployment
+ Given there is a deployment named "testdeployment" belonging to "testdeployable" owned by "testuser"
+ When I am on the operational status of deployment page
+ Then I should see "Operational status of testdeployment"
+ And I should see "Uptime"
+ And I should see "HW Resources"
diff --git a/src/features/step_definitions/deployment_steps.rb b/src/features/step_definitions/deployment_steps.rb
index ef187c8..343e7c8 100644
--- a/src/features/step_definitions/deployment_steps.rb
+++ b/src/features/step_definitions/deployment_steps.rb
@@ -1,7 +1,7 @@
Given /^there is a deployment named "([^"]*)" belonging to "([^"]*)" owned by "([^"]*)"$/ do |deployment_name, deployable_name, owner_name|
user = Factory(:user, :login => owner_name)
deployable = Deployable.create!(:name => deployable_name, :owner => user)
- deployable.deployments.create!({:name => deployment_name, :pool => Pool.first, :owner => user})
+ @deployment = Deployment.create!({:name => deployment_name, :pool => Pool.first, :owner => user, :deployable_id => deployable.id})
end
When /^I check "([^"]*)" deployment/ do |name|
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index 04c589a..9f859a0 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -116,6 +116,9 @@ module NavigationHelpers
when /the deployable deployments page/
image_factory_deployable_path(@deployable, :details_tab => 'deployments')
+ when /the operational status of deployment page/
+ resources_deployment_path(@deployment, :details_tab => 'operation')
+
when /^(.*)'s image factory deployable page$/
image_factory_deployable_path(Deployable.find_by_name($1))
--
1.7.4.4
12 years, 11 months
[PATCH] Do not destroy Hardware Profile when destroying Pool
by Jirka Tomasek
From: Jiri Tomasek <jtomasek(a)redhat.com>
---
src/app/models/pool.rb | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index b3da2a7..87f5c19 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -46,7 +46,6 @@ class Pool < ActiveRecord::Base
# NOTE: Commented out because images table doesn't have pool_id foreign key?!
#has_many :images, :dependent => :destroy
- has_many :hardware_profiles, :dependent => :destroy
validates_presence_of :name
validates_presence_of :pool_family
@@ -72,10 +71,6 @@ class Pool < ActiveRecord::Base
end
end
- def hardware_profiles
- HardwareProfile.find(:all, :conditions => {:provider_id => nil})
- end
-
def destroyable?
instances.all? {|i| i.destroyable? }
end
--
1.7.4.2
12 years, 11 months