mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
Merge branch 'feature-1163'
This commit is contained in:
commit
ee9ed1187a
22
install.sh
22
install.sh
@ -245,7 +245,8 @@ LIB_DIRS="$LIB_LOCATION/ruby \
|
||||
VAR_DIRS="$VAR_LOCATION/remotes \
|
||||
$VAR_LOCATION/remotes/im \
|
||||
$VAR_LOCATION/remotes/im/kvm.d \
|
||||
$VAR_LOCATION/remotes/im/xen.d \
|
||||
$VAR_LOCATION/remotes/im/xen3.d \
|
||||
$VAR_LOCATION/remotes/im/xen4.d \
|
||||
$VAR_LOCATION/remotes/im/vmware.d \
|
||||
$VAR_LOCATION/remotes/im/ganglia.d \
|
||||
$VAR_LOCATION/remotes/vmm \
|
||||
@ -421,7 +422,8 @@ INSTALL_FILES=(
|
||||
MADS_LIB_FILES:$LIB_LOCATION/mads
|
||||
IM_PROBES_FILES:$VAR_LOCATION/remotes/im
|
||||
IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d
|
||||
IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d
|
||||
IM_PROBES_XEN3_FILES:$VAR_LOCATION/remotes/im/xen3.d
|
||||
IM_PROBES_XEN4_FILES:$VAR_LOCATION/remotes/im/xen4.d
|
||||
IM_PROBES_VMWARE_FILES:$VAR_LOCATION/remotes/im/vmware.d
|
||||
IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d
|
||||
AUTH_SSH_FILES:$VAR_LOCATION/remotes/auth/ssh
|
||||
@ -825,11 +827,17 @@ IM_PROBES_KVM_FILES="src/im_mad/remotes/kvm.d/kvm.rb \
|
||||
src/im_mad/remotes/kvm.d/poll.sh \
|
||||
src/im_mad/remotes/kvm.d/name.sh"
|
||||
|
||||
IM_PROBES_XEN_FILES="src/im_mad/remotes/xen.d/xen.rb \
|
||||
src/im_mad/remotes/xen.d/architecture.sh \
|
||||
src/im_mad/remotes/xen.d/cpu.sh \
|
||||
src/im_mad/remotes/xen.d/poll.sh \
|
||||
src/im_mad/remotes/xen.d/name.sh"
|
||||
IM_PROBES_XEN3_FILES="src/im_mad/remotes/xen.d/xen.rb \
|
||||
src/im_mad/remotes/xen.d/architecture.sh \
|
||||
src/im_mad/remotes/xen.d/cpu.sh \
|
||||
src/im_mad/remotes/xen.d/poll3.sh \
|
||||
src/im_mad/remotes/xen.d/name.sh"
|
||||
|
||||
IM_PROBES_XEN4_FILES="src/im_mad/remotes/xen.d/xen.rb \
|
||||
src/im_mad/remotes/xen.d/architecture.sh \
|
||||
src/im_mad/remotes/xen.d/cpu.sh \
|
||||
src/im_mad/remotes/xen.d/poll4.sh \
|
||||
src/im_mad/remotes/xen.d/name.sh"
|
||||
|
||||
IM_PROBES_VMWARE_FILES="src/im_mad/remotes/vmware.d/vmware.rb"
|
||||
|
||||
|
@ -153,10 +153,19 @@ IM_MAD = [
|
||||
# -r number of retries when monitoring a host
|
||||
# -t number of threads, i.e. number of hosts monitored at the same time
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# Driver for Xen 3.x
|
||||
#IM_MAD = [
|
||||
# name = "xen",
|
||||
# executable = "one_im_ssh",
|
||||
# arguments = "xen" ]
|
||||
# arguments = "xen3" ]
|
||||
|
||||
# Driver for Xen 4.x
|
||||
#IM_MAD = [
|
||||
# name = "xen",
|
||||
# executable = "one_im_ssh",
|
||||
# arguments = "xen4" ]
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
20
src/im_mad/remotes/xen.d/poll4.sh
Executable file
20
src/im_mad/remotes/xen.d/poll4.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
|
||||
# #
|
||||
# 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
../../vmm/xen4/poll --xen -t
|
||||
|
@ -19,7 +19,13 @@
|
||||
require "pp"
|
||||
|
||||
XENTOP_PATH="/usr/sbin/xentop"
|
||||
XM_PATH="/usr/sbin/xm"
|
||||
|
||||
dir=File.basename(Dir.pwd)
|
||||
if dir=='xen4.d'
|
||||
XM_PATH="/usr/sbin/xl"
|
||||
else
|
||||
XM_PATH="/usr/sbin/xm"
|
||||
end
|
||||
|
||||
def print_info(name, value)
|
||||
value = "0" if value.nil? or value.to_s.strip.empty?
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "XenDriver.h"
|
||||
#include "Nebula.h"
|
||||
#include "NebulaUtil.h"
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <math.h>
|
||||
@ -42,6 +43,7 @@ int XenDriver::deployment_description(
|
||||
string root = "";
|
||||
string kernel_cmd = "";
|
||||
string bootloader = "";
|
||||
string hvm = "";
|
||||
|
||||
const VectorAttribute * disk;
|
||||
const VectorAttribute * context;
|
||||
@ -155,6 +157,7 @@ int XenDriver::deployment_description(
|
||||
root = os->vector_value("ROOT");
|
||||
kernel_cmd = os->vector_value("KERNEL_CMD");
|
||||
bootloader = os->vector_value("BOOTLOADER");
|
||||
hvm = os->vector_value("HVM");
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,6 +181,11 @@ int XenDriver::deployment_description(
|
||||
get_default("OS","ROOT",root);
|
||||
}
|
||||
|
||||
if ( hvm.empty() )
|
||||
{
|
||||
get_default("OS","HVM",hvm);
|
||||
}
|
||||
|
||||
if ( kernel_cmd.empty() )
|
||||
{
|
||||
get_default("OS","KERNEL_CMD",kernel_cmd);
|
||||
@ -206,9 +214,9 @@ int XenDriver::deployment_description(
|
||||
{
|
||||
file << "bootloader = \"" << bootloader << "\"" << endl;
|
||||
}
|
||||
else
|
||||
else //No kernel & no bootloader use hvm
|
||||
{
|
||||
goto error_boot;
|
||||
file << "builder = \"hvm\"" << endl;
|
||||
}
|
||||
|
||||
attrs.clear();
|
||||
@ -225,6 +233,10 @@ int XenDriver::deployment_description(
|
||||
{
|
||||
default_driver = "tap:aio:";
|
||||
}
|
||||
else if (*default_driver.rbegin() != ':' )
|
||||
{
|
||||
default_driver += ':';
|
||||
}
|
||||
|
||||
file << "disk = [" << endl;
|
||||
|
||||
@ -248,13 +260,13 @@ int XenDriver::deployment_description(
|
||||
goto error_disk;
|
||||
}
|
||||
|
||||
transform(type.begin(),type.end(),type.begin(),(int(*)(int))toupper);
|
||||
one_util::toupper(type);
|
||||
|
||||
mode = "w";
|
||||
|
||||
if ( !ro.empty() )
|
||||
{
|
||||
transform(ro.begin(),ro.end(),ro.begin(),(int(*)(int))toupper);
|
||||
one_util::toupper(ro);
|
||||
|
||||
if ( ro == "YES" )
|
||||
{
|
||||
@ -265,6 +277,11 @@ int XenDriver::deployment_description(
|
||||
if ( !driver.empty() )
|
||||
{
|
||||
file << " '" << driver;
|
||||
|
||||
if (*driver.rbegin() != ':')
|
||||
{
|
||||
file << ":";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -305,6 +322,11 @@ int XenDriver::deployment_description(
|
||||
if ( !driver.empty() )
|
||||
{
|
||||
file << driver;
|
||||
|
||||
if (*driver.rbegin() != ':')
|
||||
{
|
||||
file << ":";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -503,12 +525,6 @@ error_memory:
|
||||
file.close();
|
||||
return -1;
|
||||
|
||||
error_boot:
|
||||
vm->log("VMM", Log::ERROR,
|
||||
"No kernel or bootloader defined and no default provided.");
|
||||
file.close();
|
||||
return -1;
|
||||
|
||||
error_disk:
|
||||
vm->log("VMM", Log::ERROR, "Wrong target value in DISK.");
|
||||
file.close();
|
||||
|
@ -18,16 +18,16 @@
|
||||
# (all domains will use these values as defaults). These values can
|
||||
# be overridden in each VM template. Valid atributes are:
|
||||
# - credit
|
||||
# - os [kernel,initrd,root,kernel_cmd]
|
||||
# - os [kernel,initrd,root,kernel_cmd,hvm]
|
||||
# - vcpu
|
||||
# - disk[driver]
|
||||
# - nic[model]
|
||||
# - raw
|
||||
|
||||
#VCPU = 1
|
||||
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro" ]
|
||||
#OS = [ kernel="/vmlinuz", initrd="/initrd.img", root="sda1", kernel_cmd="ro", hvm="yes" ]
|
||||
|
||||
CREDIT = 256
|
||||
DISK = [ driver = "tap2:tapdisk:aio:" ]
|
||||
DISK = [ driver = "raw:" ]
|
||||
|
||||
#RAW = "data=\"on_crash=destroy\""
|
||||
|
@ -47,10 +47,8 @@ READONLY="${XPATH_ELEMENTS[2]}"
|
||||
BUS="${XPATH_ELEMENTS[3]}"
|
||||
CACHE="${XPATH_ELEMENTS[4]}"
|
||||
|
||||
DEFAULT_FILE_PREFIX="file"
|
||||
|
||||
if [ -n "$IMAGE_PREFIX" ]; then
|
||||
DEFAULT_FILE_PREFIX="$IMAGE_PREFIX"
|
||||
if [ -z "$DEFAULT_FILE_PREFIX" ]; then
|
||||
DEFAULT_FILE_PREFIX="file"
|
||||
fi
|
||||
|
||||
case "$TYPE" in
|
||||
@ -74,5 +72,5 @@ else
|
||||
MODE="w"
|
||||
fi
|
||||
|
||||
exec_and_log "$XM_ATTACH_DISK $DOMAIN $FULL_DISK /dev/$TARGET $MODE" \
|
||||
exec_and_log "$XM_ATTACH_DISK $DOMAIN $FULL_DISK ${TARGET_PREFIX}$TARGET $MODE" \
|
||||
"Could not attach $FULL_DISK ($TARGET) to $DOMAIN"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
|
||||
@ -29,6 +29,8 @@ function error_exit() {
|
||||
}
|
||||
|
||||
domain=$1
|
||||
id=$2
|
||||
host=$3
|
||||
|
||||
mkdir -p `dirname $domain`
|
||||
cat > $domain
|
||||
@ -37,19 +39,17 @@ output=`$XM_CREATE $domain`
|
||||
|
||||
error_exit $? "Unable to create domain"
|
||||
|
||||
domain_name=`echo $output | grep 'Started domain' | sed 's/^.*Started domain //' | tr -d '\n' | cut -d' ' -f1`
|
||||
domain_name=`grep -e '^name =' < $domain | cut -d= -f2 | tr -d ' ' | tr -d "\'" | cut -d' ' -f1`
|
||||
|
||||
out=`grep -e '^\#O CPU_CREDITS =' < $domain`
|
||||
|
||||
if [ "x$?" = "x0" ]; then
|
||||
credits=`echo $out | cut -d= -f2 | tr -d ' '`
|
||||
|
||||
|
||||
log_debug "Credits set to $credits"
|
||||
|
||||
name=`grep -e '^name =' < $domain | cut -d= -f2 | tr -d ' ' | tr -d "\'" | cut -d' ' -f1`
|
||||
|
||||
$XM_CREDITS -d $name -w $credits
|
||||
|
||||
|
||||
$XM_CREDITS -d $domain_name -w $credits
|
||||
|
||||
if [ "x$?" != "x0" ]; then
|
||||
log_error "Unable to set VM credits"
|
||||
fi
|
||||
|
@ -24,5 +24,5 @@ SOURCE="$2"
|
||||
TARGET="$3"
|
||||
TARGET_INDEX="$4"
|
||||
|
||||
exec_and_log "$XM_DETACH_DISK $DOMAIN /dev/$TARGET" \
|
||||
exec_and_log "$XM_DETACH_DISK $DOMAIN ${TARGET_PREFIX}$TARGET" \
|
||||
"Could not detach $TARGET from $DOMAIN"
|
||||
|
@ -41,7 +41,11 @@ export XM_NETWORK_LIST="sudo $XM_PATH network-list"
|
||||
# Xen 4 uses the new blktap2 and tap:aio handler is no longer supported.
|
||||
# To make it work uncomment this line. This will be used as the default
|
||||
# handler for disk hot plug
|
||||
#export IMAGE_PREFIX="tap:tapdisk:aio"
|
||||
#export DEFAULT_FILE_PREFIX="tap:tapdisk:aio"
|
||||
export DEFAULT_FILE_PREFIX="file"
|
||||
|
||||
# attach and detach disk target prefix
|
||||
TARGET_PREFIX="/dev/"
|
||||
|
||||
# Seconds to wait after shutdown until timeout
|
||||
export SHUTDOWN_TIMEOUT=300
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
export LANG=C
|
||||
|
||||
export XM_PATH="/usr/sbin/xm"
|
||||
export XM_PATH="/usr/sbin/xl"
|
||||
export XM_CANCEL="sudo $XM_PATH destroy"
|
||||
export XM_CREATE="sudo $XM_PATH create"
|
||||
export XM_CREDITS="sudo $XM_PATH sched-cred"
|
||||
@ -41,7 +41,10 @@ export XM_CREDITS="sudo $XM_PATH sched-credit"
|
||||
# Xen 4 uses the new blktap2 and tap:aio handler is no longer supported.
|
||||
# To make it work uncomment this line. This will be used as the default
|
||||
# handler for disk hot plug
|
||||
export IMAGE_PREFIX="tap2:tapdisk:aio"
|
||||
export DEFAULT_FILE_PREFIX="raw"
|
||||
|
||||
# attach and detach disk target prefix
|
||||
TARGET_PREFIX=""
|
||||
|
||||
# Seconds to wait after shutdown until timeout
|
||||
export SHUTDOWN_TIMEOUT=300
|
||||
|
Loading…
Reference in New Issue
Block a user