diff --git a/share/hooks/host_error.rb b/share/hooks/host_error.rb
index 5bf785204f..b4f7864233 100755
--- a/share/hooks/host_error.rb
+++ b/share/hooks/host_error.rb
@@ -1,4 +1,4 @@
-#!/usr/bin/env ruby
+#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
@@ -18,9 +18,9 @@
####################################################
# Script to implement host failure tolerance
-# It can be set to
+# It can be set to
# -r resubmit VMs running in the host
-# -d delete VMs running in the host
+# -d delete VMs running in the host
####################################################
ONE_LOCATION=ENV["ONE_LOCATION"]
@@ -64,16 +64,18 @@ host.info
host_name = host.name
# Loop through all vms
-vms = VirtualMachinePool.new(client, -2)
+vms = VirtualMachinePool.new(client)
exit -1 if OpenNebula.is_error?(vms)
-vms.info
+vms.info_all
-vm_ids_array = vms.retrieve_elements("/VM_POOL/VM[STATE=3]/HISTORY[HOSTNAME=\"#{host_name}\"]/../ID")
+state = "STATE=3"
+state += " or STATE=5" if force == "y"
+vm_ids_array = vms.retrieve_elements("/VM_POOL/VM[#{state}]/HISTORY_RECORDS/HISTORY[HOSTNAME=\"#{host_name}\" and last()]/../../ID")
if vm_ids_array
- vm_ids_array.each do |vm_id|
+ vm_ids_array.each do |vm_id|
vm=OpenNebula::VirtualMachine.new_with_id(vm_id, client)
vm.info
@@ -85,21 +87,3 @@ if vm_ids_array
end
end
-if force == "y"
- vm_ids_array = vms.retrieve_elements("/VM_POOL/VM[STATE=5]/HISTORY[HOSTNAME=\"#{host_name}\"]/../ID")
-
- if vm_ids_array
- vm_ids_array.each do |vm_id|
- vm=OpenNebula::VirtualMachine.new_with_id(vm_id, client)
- vm.info
-
- if mode == "-r"
- vm.resubmit
- elsif mode == "-d"
- vm.finalize
- end
- end
- end
-end
-
-
diff --git a/src/cloud/ec2/lib/EC2QueryServer.rb b/src/cloud/ec2/lib/EC2QueryServer.rb
index 03e7f44ecf..1d8c786729 100644
--- a/src/cloud/ec2/lib/EC2QueryServer.rb
+++ b/src/cloud/ec2/lib/EC2QueryServer.rb
@@ -161,11 +161,10 @@ class EC2QueryServer < CloudServer
end
def describe_images(params, one_client)
- user_flag=-1
+ user_flag = OpenNebula::Pool::INFO_GROUP
impool = ImagePool.new(one_client, user_flag)
impool.info
- erb_user_name = params['AWSAccessKeyId']
erb_version = params['Version']
response = ERB.new(File.read(@config[:views]+"/describe_images.erb"))
@@ -221,7 +220,7 @@ class EC2QueryServer < CloudServer
end
def describe_instances(params, one_client)
- user_flag=-1
+ user_flag = OpenNebula::Pool::INFO_MINE
vmpool = VirtualMachinePool.new(one_client, user_flag)
vmpool.info
diff --git a/src/cloud/ec2/lib/views/describe_images.erb b/src/cloud/ec2/lib/views/describe_images.erb
index 5ef277ad1a..163241c670 100644
--- a/src/cloud/ec2/lib/views/describe_images.erb
+++ b/src/cloud/ec2/lib/views/describe_images.erb
@@ -13,7 +13,7 @@
<% elsif im['STATE'] == '4'%>
pending
<% end %>
- <%= erb_user_name %>
+ <%= im['UNAME'] %>
<% if im['PUBLIC'] == '0' %>
false
<% elsif im['PUBLIC'] == '1' %>