[PATCH conductor] BZ #784971: CloudForms Diagnostics Tooling
by Jason Guiditta
https://bugzilla.redhat.com/show_bug.cgi?id=784971
Add a quick script to add in supporting diagnosis of issues. This
will be expanded and improved in future versions, this just attempts
to add some bare functionality.
---
aeolus-conductor.spec.in | 6 ++-
src/lib/aeolus/debug/aeolus-debug | 89 +++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+), 1 deletions(-)
create mode 100755 src/lib/aeolus/debug/aeolus-debug
diff --git a/aeolus-conductor.spec.in b/aeolus-conductor.spec.in
index 74460ca..0eea345 100644
--- a/aeolus-conductor.spec.in
+++ b/aeolus-conductor.spec.in
@@ -117,6 +117,7 @@ getent passwd aeolus >/dev/null || \
%{__mkdir} -p %{buildroot}%{_localstatedir}/lib/%{name}
%{__mkdir} -p %{buildroot}%{_localstatedir}/log/%{name}
%{__mkdir} -p %{buildroot}%{_localstatedir}/run/%{name}
+%{__mkdir} -p %{buildroot}/%{_bindir}
# now copy over the rails source files. This is a bit verbose, but only
# takes in the stuff we need (and no backup files, etc)
@@ -162,7 +163,8 @@ rake="lib/tasks"
rb="app/models app/controllers app/controllers/api app/helpers app/services app/util \
config config/initializers config/environments db db/migrate \
features/support features/step_definitions lib spec spec/controllers \
- spec/factories spec/helpers spec/models spec/services spec/controllers/api lib/aeolus lib/aeolus/event"
+ spec/factories spec/helpers spec/models spec/services spec/controllers/api lib/aeolus \
+ lib/aeolus/event"
rhtml="app/views/layouts"
svg="public/images public/images/icons public/javascripts/jquery-svg"
ttf="public/fonts"
@@ -189,6 +191,7 @@ sass --style compact ./src/app/stylesheets/login.scss %{buildroot}%{app_root}/pu
# misc files
%{__cp} src/Rakefile %{buildroot}%{app_root}
%{__cp} src/config.ru %{buildroot}%{app_root}
+%{__cp} src/lib/aeolus/debug/aeolus-debug %{buildroot}%{_bindir}
%{__mkdir} -p %{buildroot}%{app_root}/config
%{__cp} src/config/database.pg %{buildroot}%{app_root}/config
@@ -293,6 +296,7 @@ fi
%{app_root}/db
%{app_root}/dbomatic
%{app_root}/lib
+%{_bindir}/aeolus-debug
%{app_root}/log
%{app_root}/public
%{app_root}/Rakefile
diff --git a/src/lib/aeolus/debug/aeolus-debug b/src/lib/aeolus/debug/aeolus-debug
new file mode 100755
index 0000000..cb415f5
--- /dev/null
+++ b/src/lib/aeolus/debug/aeolus-debug
@@ -0,0 +1,89 @@
+#!/usr/bin/env ruby
+
+require "optparse"
+require "fileutils"
+
+NAME="aeolus-debug"
+
+# Set up the options
+options = {}
+
+optparse = OptionParser.new do|opts|
+ opts.banner = "Usage: #{NAME} [options] command"
+
+ options[:basedir] = '/tmp'
+ opts.on('-d', '--dir [DIRECTORY]', 'Directory to place the tarball. Defaults to /tmp' ) do |opt|
+ options[:basedir] = opt
+ end
+
+ opts.on('-h', '--help', 'Display help and exit' ) do
+ puts opts
+ exit
+ end
+
+end
+
+optparse.parse!
+
+# Check that we are running as root
+if Process.uid != 0
+ puts "#{NAME} must be run as root"
+ exit
+end
+
+# Define what we want to collect
+SOURCES = [
+# Conductor
+"/var/log/aeolus**/**/*.log",
+"/etc/aeolus*/**/**",
+"/etc/imagefactory**/**",
+"/var/log/imagefactory**/**/*.log",
+"/etc/iwhd**/**",
+"/var/log/iwhd**/**/*.log",
+"/var/log/deltacloud-core**/**/*.log",
+"/var/log/libvirt**/**",
+"/etc/oz/oz.cfg",
+"/proc/cpuinfo",
+"/proc/meminfo"
+]
+
+# Collect the files
+timename = "aeolus-debug-#{Time.now.strftime("%Y%m%d%H%M%S")}"
+target_dir = File.join(options[:basedir], timename)
+
+if File.exists?(target_dir)
+ puts "#{target_dir} already exists. Please delete it"
+ exit
+end
+
+FileUtils.mkdir_p(target_dir, :verbose => true)
+
+files = []
+SOURCES.each do |d|
+ files << Dir.glob(d)
+end
+
+files = files.flatten
+puts "File list: #{files}"
+files.each do |source|
+ file_dir = File.file?(source) ? File.dirname(source): source
+ complete_target = File.join(target_dir, file_dir)
+ FileUtils.mkdir_p(complete_target, :verbose => true)
+ FileUtils.cp(source, complete_target, {:verbose=>true,:preserve =>true}) if File.file?(source)
+end
+
+# Below are custom system calls to get more info
+system("rpm -qa | egrep 'aeolus|iwhd|deltacloud|imagefactory|oz' >> #{File.join(target_dir, 'packages')}")
+system("virsh capabilities >> #{File.join(target_dir, 'virsh_capabilities')}")
+
+# Tar the output and log it
+tarfile = target_dir + ".tar.gz"
+pwd = Dir.pwd()
+Dir.chdir(options[:basedir])
+system("tar -czvf #{tarfile} #{timename}")
+Dir.chdir(pwd)
+
+puts "A debug file has been created at #{tarfile}."
+
+# Clean up
+FileUtils.rm_r(target_dir)
--
1.7.7.6
12 years, 3 months
[PATCH conductor] BZ#783218 added pessimistic database locking for quota to prevent updating with old values
by Tomas Hrcka
---
src/app/models/instance_observer.rb | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/app/models/instance_observer.rb b/src/app/models/instance_observer.rb
index 9d13fb0..06ba2ef 100644
--- a/src/app/models/instance_observer.rb
+++ b/src/app/models/instance_observer.rb
@@ -65,13 +65,21 @@ class InstanceObserver < ActiveRecord::Observer
elsif RUNNING_STATES.include?(state_from) && !RUNNING_STATES.include?(state_to)
quota.running_instances -= 1
end
-
- if !ACTIVE_STATES.include?(state_from) && ACTIVE_STATES.include?(state_to)
- quota.total_instances += 1
- elsif ACTIVE_STATES.include?(state_from) && !ACTIVE_STATES.include?(state_to)
- quota.total_instances -= 1
- end
- quota.save!
+ quota.transaction do
+ quota.lock!
+ if !RUNNING_STATES.include?(state_from) && RUNNING_STATES.include?(state_to)
+ quota.running_instances += 1
+ elsif RUNNING_STATES.include?(state_from) && !RUNNING_STATES.include?(state_to)
+ quota.running_instances -= 1
+ end
+
+ if !ACTIVE_STATES.include?(state_from) && ACTIVE_STATES.include?(state_to)
+ quota.total_instances += 1
+ elsif ACTIVE_STATES.include?(state_from) && !ACTIVE_STATES.include?(state_to)
+ quota.total_instances -= 1
+ end
+ quota.save!
+ end
end
end
end
--
1.7.1
12 years, 3 months
BZ 717987 - realms refreshing
by Jan Provazník
Hi,
this patchset adds autoupdating of realms (done by dbomatic) which we need for
2 reasons: 1) realms availability changes in time, 2) realms visibility for a provider
account changes in time (theoretically).
This patchset adds 'available' flag to Provider and Ream models.
When doing realms refresh:
- if a provider is not accessible, pthe provider is marked as unavailable
- if a provider account of a provider (which is accessible) is not accessible,
all realms associated with this account are removed
- available status is updated for any existing realm
What is not part of this patchset is displaying of this 'availability' status in UI
(which we should probably display).
Till now, realms updating was triggered when accessing realms mapping page, I removed
this call - update is quite slow operation and dbomatic handles this now.
Jan
12 years, 3 months
[PATCH conductor] BZ 783904 PA quota when updated to unlimited, text should be automatically set to Unlimited.
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=783904
---
.../provider_accounts/_provider_form.html.haml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/views/provider_accounts/_provider_form.html.haml b/src/app/views/provider_accounts/_provider_form.html.haml
index 56b7e74..90c2f47 100644
--- a/src/app/views/provider_accounts/_provider_form.html.haml
+++ b/src/app/views/provider_accounts/_provider_form.html.haml
@@ -21,11 +21,11 @@
= label_tag t("quotas.quota")
= text_field :quota, :maximum_running_instances, :title => t('provider_accounts.form.quota_instances'), :value => @quota.maximum_running_instances || t('provider_accounts.properties.unlimited'), :id => "quota_instances"
(
- %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }<>
+ %button.linkbutton.nospace{ :type => 'button', :onclick => "set_unlimited_quota(\"quota_instances\");" }
= t('provider_accounts.form.unlimited_quota')
)
:javascript
function set_unlimited_quota(elem_id) {
- $("#" + elem_id)[0].value = t('provider_accounts.properties.unlimited');
+ $("#" + elem_id)[0].value = "#{t('provider_accounts.properties.unlimited')}";
}
--
1.7.7.6
12 years, 3 months
[PATCH conductor] Fixed 2 keys/values for successful conversion YAML to PO file
by jzigmund@redhat.com
From: Jozef Zigmund <jzigmund(a)redhat.com>
---
src/app/views/pool_families/_list.html.haml | 2 +-
src/config/locales/en.yml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/app/views/pool_families/_list.html.haml b/src/app/views/pool_families/_list.html.haml
index 8be3fd8..40ca206 100644
--- a/src/app/views/pool_families/_list.html.haml
+++ b/src/app/views/pool_families/_list.html.haml
@@ -40,7 +40,7 @@
%td= pool.statistics[:quota_percent]
%td= pool.statistics[:used_quota]
%td= pool.statistics[:available_quota].nil? ? raw('∞') : pool.statistics[:available_quota]
- %td= pool.enabled? ? t("pool_families.index.yes") : t("pool_families.index.no")
+ %td= pool.enabled? ? t("pool_families.index.answer_yes") : t("pool_families.index.answer_no")
%td= link_to pool.catalogs.first.name, catalog_path(pool.catalogs.first) if pool.catalogs.any?
%td= link_to t(:edit), edit_pool_path(pool), :class => 'pool_family_button'
%tr
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index b5dfc05..096d38f 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -589,8 +589,8 @@ en:
available_instances: "Available Inst."
failed_instances: "Failed Inst."
enabled: Enabled
- yes: Yes
- no: No
+ answer_yes: "Yes"
+ answer_no: "No"
catalog: "Catalog"
total_statistics: TOTAL
new:
--
1.7.7.6
12 years, 3 months
[PATCH conductor] BZ 787046 - reduce number of iwhd operations in deployments/overview
by Richard Su
https://bugzilla.redhat.com/show_bug.cgi?id=787046
The instance object makes multiple calls to iwhd to retrieve the image
and image_build. We can reduce the number of calls by storing the result
in an instance variable and reuse it on subsequent requests.
---
src/app/models/instance.rb | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 03bc119..68ed3bb 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -178,11 +178,11 @@ class Instance < ActiveRecord::Base
def image
- Aeolus::Image::Warehouse::Image.find(image_uuid) if image_uuid
+ @image ||= Aeolus::Image::Warehouse::Image.find(image_uuid) if image_uuid
end
def image_build
- Aeolus::Image::Warehouse::ImageBuild.find(image_build_uuid) if image_build_uuid
+ @image_build ||= Aeolus::Image::Warehouse::ImageBuild.find(image_build_uuid) if image_build_uuid
end
def build
@@ -357,7 +357,7 @@ class Instance < ActiveRecord::Base
# try to get architecture of the image associated with this instance
# for imported images template is empty -> architecture is not set,
# in this case we omit this check
- return Aeolus::Image::Warehouse::Image.find(build.image.uuid).os.arch
+ return image.os.arch
rescue
logger.warn "failed to get image architecture for instance '#{name}', skipping architecture check: #{$!}"
logger.warn $!.backtrace.join("\n ")
--
1.7.7.6
12 years, 3 months
[PATCH conductor] BZ 784557 - send build request only if there are some providers
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
---
src/app/controllers/images_controller.rb | 11 +++++++----
src/config/locales/en.yml | 1 +
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index 41c48a5..4821d7e 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -64,10 +64,13 @@ class ImagesController < ApplicationController
def rebuild_all
@image = Aeolus::Image::Warehouse::Image.find(params[:id])
- factory_image = Aeolus::Image::Factory::Image.new(:id => @image.id)
- factory_image.targets = Provider.list_for_user(current_user, Privilege::VIEW).map {|p| p.provider_type.deltacloud_driver}.uniq.join(',')
- factory_image.template = @image.template_xml.to_s
- factory_image.save!
+ targets = Provider.list_for_user(current_user, Privilege::VIEW).map {|p| p.provider_type.deltacloud_driver}.uniq
+ unless targets.empty?
+ factory_image = Aeolus::Image::Factory::Image.new(:id => @image.id)
+ factory_image.targets = targets.join(',')
+ factory_image.template = @image.template_xml.to_s
+ factory_image.save!
+ end
redirect_to image_path((a)image.id)
end
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 0467072..7e8e53d 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -762,6 +762,7 @@ en:
no_file: You must specify the template XML file
no_template: "The image doesn't have a template because it's been imported."
no_provider_accounts: Images cannot be built, as no provider accounts are currently enabled.
+ no_providers: Images cannot be built and pushed, as no providers are currently enabled.
new:
new_image: New Image
description:
--
1.7.7.5
12 years, 3 months