1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Merge branch 'master' into feature-687

This commit is contained in:
Carlos Martín 2011-07-01 18:00:40 +02:00
commit f719100b0f
11 changed files with 55 additions and 29 deletions

View File

@ -455,6 +455,7 @@ VMM_EXEC_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \
src/vmm_mad/remotes/kvm/deploy \
src/vmm_mad/remotes/kvm/kvmrc \
src/vmm_mad/remotes/kvm/migrate \
src/vmm_mad/remotes/kvm/migrate_local \
src/vmm_mad/remotes/kvm/restore \
src/vmm_mad/remotes/kvm/save \
src/vmm_mad/remotes/kvm/shutdown"

View File

@ -81,9 +81,10 @@ EOT
end
end
def list_pool(options, top=false)
user_flag = options[:filter_flag] ? options[:filter_flag] : -2
pool = factory_pool(user_flag)
def list_pool(options, top=false, filter_flag=-2)
filter_flag ||= -2
pool = factory_pool(filter_flag)
rc = pool.info
return -1, rc.message if OpenNebula.is_error?(rc)
@ -200,15 +201,15 @@ EOT
def filterflag_to_i(str)
filter_flag = case str
when "a", "all" then "-2"
when "m", "mine" then "-3"
when "g", "group" then "-1"
when "a", "all" then -2
when "m", "mine" then -3
when "g", "group" then -1
else
if str.match(/^[0123456789]+$/)
str
str.to_i
else
user = translation_hash[:users].select { |k,v| v==str }
user.length > 0 ? user.first.first : "-2"
user.length > 0 ? user.first.first.to_i : -2
end
end

View File

@ -18,7 +18,7 @@ require 'one_helper'
class OneTemplateHelper < OpenNebulaHelper::OneHelper
def self.rname
"TEMPLATE"
"VMTEMPLATE"
end
def self.conf_file

View File

@ -184,7 +184,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :chown, chown_desc, [:range, :imageid_list], :userid, [:groupid,nil] do
gid = args[2].nil? ? -1 : args[2].to_id
gid = args[2].nil? ? -1 : args[2].to_i
helper.perform_actions(args[0],options,"Owner/Group changed") do |image|
image.chown(args[1].to_i, gid)
end
@ -195,7 +195,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :list, list_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent
@ -211,6 +211,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :top, top_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options, true)
helper.list_pool(options, true, args[0])
end
end

View File

@ -169,7 +169,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :list, list_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent
@ -185,6 +185,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :top, top_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options, true)
helper.list_pool(options, true, args[0])
end
end

View File

@ -314,7 +314,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :list, list_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent
@ -332,6 +332,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :top, top_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
helper.list_pool(options, true)
helper.list_pool(options, true, args[0])
end
end

View File

@ -158,7 +158,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
command :list, list_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
helper.list_pool(options)
helper.list_pool(options, false, args[0])
end
show_desc = <<-EOT.unindent

View File

@ -16,15 +16,6 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
#Parse command line arguments
while getopts r: option $@
do
case $option in
r) export IM_REMOTE_DIR="$OPTARG";;
esac
done
shift $(($OPTIND - 1))
#Setup driver variables
DRIVER_NAME=`basename $0 | cut -d. -f1`

View File

@ -62,7 +62,13 @@ class InformationManagerDriver < OpenNebulaDriver
# Use rsync to sync:
# sync_cmd = "rsync -Laz #{REMOTES_LOCATION}
# #{host}:#{@remote_dir}"
LocalCommand.run(sync_cmd, log_method(number))
cmd=LocalCommand.run(sync_cmd, log_method(number))
if cmd.code!=0
send_message('MONITOR', RESULT[:failure], number,
'Could not update remotes')
return
end
end
end
do_action("#{@hypervisor}", number, host, :MONITOR,

View File

@ -52,7 +52,7 @@ class EC2Driver < VirtualMachineDriver
:terminate => "#{EC2_LOCATION}/bin/ec2-terminate-instances",
:describe => "#{EC2_LOCATION}/bin/ec2-describe-instances",
:associate => "#{EC2_LOCATION}/bin/ec2-associate-address",
:authorize => "#{EC2_LOCATION}bin/ec2-authorize"
:authorize => "#{EC2_LOCATION}/bin/ec2-authorize"
}
# EC2 constructor, loads defaults for the EC2Driver
@ -64,7 +64,7 @@ class EC2Driver < VirtualMachineDriver
concurrency = EC2_JVM_CONCURRENCY.to_i
end
super(
super('',
:concurrency => concurrency,
:threaded => true
)

View File

@ -0,0 +1,27 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
source $(dirname $0)/kvmrc
deploy_id=$1
dest_host=$2
src_host=$3
virsh --connect $QEMU_PROTOCOL://$src_host/system \
migrate --live $deploy_id $QEMU_PROTOCOL://$dest_host/system