[Ovirt-devel] [PATCH server] Replace the occurence of the type @qmfc.object(Qmf::Query.new(:class => "xxx", 'key' => search_key)) for @qmfc.object(Qmf::Query.new(:class => "xxx"), 'key' => search_key) else the search on the key is not functionnal.
Michel Loiseleur
mloiseleur at linagora.com
Fri Nov 13 11:46:52 UTC 2009
This fix db-omatic that cannot recover the node on wich the vm run for example.
We have not investigate far away but that can be due to a change on the ruby-qmf API.
Signed-off-by: Michel Loiseleur <mloiseleur at linagora.com>
---
src/db-omatic/db_omatic.rb | 10 ++++++----
src/libvirt-list.rb | 6 +++---
src/matahari-list.rb | 4 ++--
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb
index 686ad71..da11bfa 100755
--- a/src/db-omatic/db_omatic.rb
+++ b/src/db-omatic/db_omatic.rb
@@ -198,7 +198,7 @@ class DbOmatic < Qmf::ConsoleHandler
if state == Vm::STATE_STOPPED
@logger.info "VM has moved to stopped, clearing VM attributes."
- qmf_vm = @qmfc.object(Qmf::Query.new(:class => "domain", 'uuid' => vm.uuid))
+ qmf_vm = @qmfc.object(Qmf::Query.new(:class => "domain"), 'uuid' => vm.uuid)
if qmf_vm
@logger.info "Deleting VM #{vm.description}."
result = qmf_vm.undefine
@@ -210,12 +210,14 @@ class DbOmatic < Qmf::ConsoleHandler
# If we are running, update the node that the domain is running on
elsif state == Vm::STATE_RUNNING
@logger.info "VM is running, determine the node it is running on"
- qmf_vm = @qmfc.object(Qmf::Query.new(:class => "domain", 'uuid' => vm.uuid))
+ qmf_vm = @qmfc.object(Qmf::Query.new(:class => "domain"), 'uuid' => vm.uuid)
if qmf_vm
qmf_host = @qmfc.object(Qmf::Query.new(:class => "node", :object_id => qmf_vm.node))
db_host = Host.find(:first, :conditions => ['hostname = ?', qmf_host.hostname])
@logger.info "VM #{vm.description} is running on node #{db_host.hostname}"
vm.host_id = db_host.id
+ elsif
+ @logger.info "Cannot find in QMF the node corresponding to #{domain['name']} "
end
end
@@ -276,7 +278,7 @@ class DbOmatic < Qmf::ConsoleHandler
# Double check to make sure this host is still up.
begin
- qmf_host = @qmfc.objects(Qmf::Query.new(:class => "node", 'hostname' => host_info['hostname']))
+ qmf_host = @qmfc.objects(Qmf::Query.new(:class => "node"), 'hostname' => host_info['hostname'])
if !qmf_host
@logger.info "Host #{host_info['hostname']} is not up after waiting 20 seconds, skipping dead VM check."
else
@@ -483,7 +485,7 @@ class DbOmatic < Qmf::ConsoleHandler
# them to stopped. VMs that exist as QMF objects will get set appropriately when the objects
# appear on the bus.
begin
- qmf_vm = @qmfc.object(Qmf::Query.new(:class => "domain", 'uuid' => db_vm.uuid))
+ qmf_vm = @qmfc.object(Qmf::Query.new(:class => "domain"), 'uuid' => db_vm.uuid)
if qmf_vm == nil
set_stopped = true
end
diff --git a/src/libvirt-list.rb b/src/libvirt-list.rb
index c81926a..f4df672 100755
--- a/src/libvirt-list.rb
+++ b/src/libvirt-list.rb
@@ -33,7 +33,7 @@ nodes.each do |node|
end
# Find any domains that on the current node.
- domains = qmfc.objects(Qmf::Query.new(:class => "domain", 'node' => node.object_id))
+ domains = qmfc.objects(Qmf::Query.new(:class => "domain"), 'node' => node.object_id)
domains.each do |domain|
r = domain.getXMLDesc()
puts "getXMLDesc() status: #{r.status}"
@@ -48,7 +48,7 @@ nodes.each do |node|
end
end
- pools = qmfc.objects(Qmf::Query.new(:class => "pool", 'node' => node.object_id))
+ pools = qmfc.objects(Qmf::Query.new(:class => "pool"), 'node' => node.object_id)
pools.each do |pool|
puts " pool: #{pool.name}"
for (key, val) in pool.properties
@@ -63,7 +63,7 @@ nodes.each do |node|
end
# Find volumes that are part of the pool.
- volumes = qmfc.objects(Qmf::Query.new(:class => "volume", 'pool' => pool.object_id))
+ volumes = qmfc.objects(Qmf::Query.new(:class => "volume"), 'pool' => pool.object_id)
volumes.each do |volume|
puts " volume: #{volume.name}"
for (key, val) in volume.properties
diff --git a/src/matahari-list.rb b/src/matahari-list.rb
index 8795019..6671f7a 100755
--- a/src/matahari-list.rb
+++ b/src/matahari-list.rb
@@ -33,7 +33,7 @@ hosts.each do |host|
end
# List cpus for current host
- cpus = qmfc.objects(Qmf::Query.new(:class => 'cpu', 'host' => host.object_id))
+ cpus = qmfc.objects(Qmf::Query.new(:class => 'cpu'), 'host' => host.object_id)
cpus.each do |cpu|
puts ' CPU:'
for (key, val) in cpu.properties
@@ -42,7 +42,7 @@ hosts.each do |host|
end # cpus.each
# List nics for current host
- nics = qmfc.objects(Qmf::Query.new(:class => 'nic', 'host' => host.object_id))
+ nics = qmfc.objects(Qmf::Query.new(:class => 'nic'), 'host' => host.object_id)
nics.each do |nic|
puts ' NIC: '
for (key, val) in nic.properties
--
1.6.2.5
More information about the ovirt-devel
mailing list