1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Carlos Martín 2011-07-11 19:09:39 +02:00
commit 91b38d4ddf
3 changed files with 12 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -13,7 +13,7 @@
<% elsif im['STATE'] == '4'%>
<imageState>pending</imageState>
<% end %>
<imageOwnerId><%= erb_user_name %></imageOwnerId>
<imageOwnerId><%= im['UNAME'] %></imageOwnerId>
<% if im['PUBLIC'] == '0' %>
<isPublic>false</isPublic>
<% elsif im['PUBLIC'] == '1' %>