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

Address ticket #59

git-svn-id: http://svn.opennebula.org/one/trunk@294 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
Rubén S. Montero 2009-01-02 14:58:51 +00:00
parent 9bfc1fb489
commit 77681ccfc8
60 changed files with 996 additions and 524 deletions

View File

@ -125,14 +125,85 @@ public:
// --------------------------------------------------------------
// Environment & Configuration
// --------------------------------------------------------------
// --------------------------------------------------------------
/**
* Returns the value of ONE_LOCATION env variable. When this variable is
* not defined the nebula location is "/".
* @return the nebula location.
*/
const string& get_nebula_location()
{
return nebula_location;
};
/**
* Returns the path where mad executables are stored, if ONE_LOCATION is
* defined this path points to $ONE_LOCATION/bin, otherwise it is
* /usr/lib/one/mads.
* @return the mad execs location.
*/
const string& get_mad_location()
{
return mad_location;
};
/**
* Returns the path where defaults for mads are stored, if ONE_LOCATION is
* defined this path points to $ONE_LOCATION/etc, otherwise it is /etc/one
* @return the mad defaults location.
*/
const string& get_defaults_location()
{
return etc_location;
};
/**
* Returns the path where logs (oned.log, schedd.log,...) are generated
* if ONE_LOCATION is defined this path points to $ONE_LOCATION/var,
* otherwise it is /var/log/one.
* @return the log location.
*/
const string& get_log_location()
{
return log_location;
};
/**
* Returns the path where the OpenNebula DB and the VM local directories
* are stored. When ONE_LOCATION is defined this path points to
* $ONE_LOCATION/var, otherwise it is /var/lib/one.
* @return the log location.
*/
const string& get_var_location()
{
return var_location;
};
/**
* Returns the path of the log file for a VM, depending where OpenNebula is
* installed,
* $ONE_LOCATION/var/$VM_ID/vm.log
* or
* /var/log/one/$VM_ID.log
* @return the log location for the VM.
*/
string get_vm_log_filename(int oid)
{
ostringstream oss;
if (nebula_location == "/")
{
oss << log_location << oid << ".log";
}
else
{
oss << nebula_location << "var/" << oid << "/vm.log";
}
return oss.str();
};
const string& get_nebula_hostname()
{
return hostname;
@ -140,7 +211,7 @@ public:
static string version()
{
return "ONE1.1.80";
return "ONE1.1.85";
};
void start();
@ -161,7 +232,34 @@ private:
// -----------------------------------------------------------------------
Nebula():nebula_configuration(0),db(0),vmpool(0),hpool(0),vnpool(0),lcm(0),
vmm(0),im(0),tm(0),dm(0),rm(0){};
vmm(0),im(0),tm(0),dm(0),rm(0)
{
const char * nl = getenv("ONE_LOCATION");
if (nl == 0) //OpenNebula installed under root directory
{
nebula_location = "/";
mad_location = "/usr/lib/one/mads/";
etc_location = "/etc/one/";
log_location = "/var/log/one/";
var_location = "/var/lib/one/";
}
else
{
nebula_location = nl;
if ( nebula_location.at(nebula_location.size()-1) != '/' )
{
nebula_location += "/";
}
mad_location = nebula_location + "lib/mads/";
etc_location = nebula_location + "etc/";
log_location = nebula_location + "var/";
var_location = nebula_location + "var/";
}
};
~Nebula()
{
@ -229,8 +327,13 @@ private:
// Environment variables
// ---------------------------------------------------------------
string nebula_location;
string hostname;
string nebula_location;
string mad_location;
string etc_location;
string log_location;
string var_location;
string hostname;
// ---------------------------------------------------------------
// Configuration

View File

@ -25,40 +25,59 @@ class NebulaTemplate : public Template
{
public:
NebulaTemplate(string& nebula_location);
NebulaTemplate(string& etc_location, string& var_location);
~NebulaTemplate(){};
static const char * conf_name;
int get(
const char * name,
vector<const Attribute*>& values) const
int get(const char * name, vector<const Attribute*>& values) const
{
string _name(name);
return Template::get(_name,values);
};
void get(
const char * name,
string& values) const
void get(const char * name, string& values) const
{
string _name(name);
Template::get(_name,values);
};
void get(const char * name, int& values) const
{
string _name(name);
Template::get(_name,values);
};
void get(
const char * name,
int& values) const
void get(const char * name, time_t& values) const
{
string _name(name);
const SingleAttribute * sattr;
vector<const Attribute *> attr;
Template::get(_name,values);
};
string _name(name);
if ( Template::get(_name,attr) == 0 )
{
values = 0;
return;
}
sattr = dynamic_cast<const SingleAttribute *>(attr[0]);
if ( sattr != 0 )
{
istringstream is;
is.str(sattr->value());
is >> values;
}
else
values = 0;
};
private:
friend class Nebula;

View File

@ -253,6 +253,8 @@ public:
/**
* Returns the transfer filename. The transfer file is in the form:
* $ONE_LOCATION/var/$VM_ID/transfer.$SEQ
* or, in case that OpenNebula is installed in root
* /var/lib/one/$VM_ID/transfer.$SEQ
* The hasHistory() function MUST be called before this one.
* @return the transfer filename
*/
@ -263,7 +265,9 @@ public:
/**
* Returns the deployment filename. The deployment file is in the form:
* $ONE_LOCATION/var/$VM_ID/deployment.$SEQ
* $ONE_LOCATION/var/$VM_ID/deployment.$SEQ
* or, in case that OpenNebula is installed in root
* /var/lib/one/$VM_ID/deployment.$SEQ
* The hasHistory() function MUST be called before this one.
* @return the deployment filename
*/
@ -297,7 +301,9 @@ public:
/**
* Returns the remote VM directory. The VM remote dir is in the form:
* $VM_DIR/$VM_ID/
* $VM_DIR/$VM_ID/
* or, in case that OpenNebula is installed in root
* /var/lib/one/$VM_ID/
* The hasHistory() function MUST be called before this one.
* @return the remote directory
*/
@ -729,7 +735,9 @@ private:
/**
* Log class for the virtual machine, it writes log messages in
* $ONE_LOCATION/var/$VID/vm.log
* $ONE_LOCATION/var/$VID/vm.log
* or, in case that OpenNebula is installed in root
* /var/log/one/$VM_ID.log
*/
Log * _log;

View File

@ -1,166 +1,356 @@
#!/bin/sh
#!/bin/bash
MAKE_LINKS="no"
#-------------------------------------------------------------------------------
# Install program for OpenNebula. It will install it relative to
# $ONE_LOCATION if defined with the -d option, otherwise it'll be installed
# under /. In this case you may specified the oneadmin user/group, so you do
# not need run the OpenNebula daemon with root priviledges
#-------------------------------------------------------------------------------
if [ "$1" = "-l" ]; then
MAKE_LINKS="yes"
shift
#-------------------------------------------------------------------------------
# COMMAND LINE PARSING
#-------------------------------------------------------------------------------
usage() {
echo
echo "Usage: install.sh [-u install_user] [-g install_group] [-k keep conf]"
echo " [-d ONE_LOCATION] [-r] [-h]"
echo
echo "-u: user that will run opennebula, defults to user executing install.sh"
echo "-g: group of the user that will run opennebula, defults to user"
echo " executing install.sh"
echo "-k: keep current configuration files, useful when upgrading"
echo "-d: target installation directory, if not defined it'd be root"
echo "-r: remove Opennebula, only useful if -d was not specified, otherwise"
echo " rm -rf \$ONE_LOCATION would do the job"
echo "-h: prints this help"
}
#-------------------------------------------------------------------------------
TEMP_OPT=`getopt -o hkru:g:d: -n 'install.sh' -- "$@"`
if [ $? != 0 ] ; then
usage
exit 1
fi
eval set -- "$TEMP_OPT"
INSTALL_ETC="yes"
UNINSTALL="no"
ONEADMIN_USER=`id -u`
ONEADMIN_GROUP=`id -g`
SRC_DIR=$PWD
DST_DIR=$1
echo $SRC_DIR
echo $DST_DIR
while true ; do
case "$1" in
-h) usage; exit 0;;
-k) INSTALL_ETC="no" ; shift ;;
-r) UNINSTALL="yes" ; shift ;;
-u) ONEADMIN_USER="$2" ; shift 2;;
-g) ONEADMIN_GROUP="$2"; shift 2;;
-d) DST_DIR="$2" ; shift 2 ;;
--) shift ; break ;;
*) usage; exit 1 ;;
esac
done
inst_ln() {
if [ "$MAKE_LINKS" = "yes" ]; then
ln -s $SRC_DIR/$1 $DST_DIR/$2
#-------------------------------------------------------------------------------
# Definition of locations
#-------------------------------------------------------------------------------
if [ -z "$DST_DIR" ] ; then
BIN_LOCATION="/usr/bin"
LIB_LOCATION="/usr/lib/one"
ETC_LOCATION="/etc/one"
LOG_LOCATION="/var/log/one"
VAR_LOCATION="/var/lib/one"
RUN_LOCATION="/var/run/one"
INCLUDE_LOCATION="/usr/include"
SHARE_LOCATION="/usr/share/doc/opennebula"
MAKE_DIRS="$LIB_LOCATION $ETC_LOCATION $LOG_LOCATION \
$VAR_LOCATION $RUN_LOCATION $SHARE_LOCATION"
CHOWN_DIRS="$LOG_LOCATION $VAR_LOCATION $RUN_LOCATION"
else
BIN_LOCATION="$DST_DIR/bin"
LIB_LOCATION="$DST_DIR/lib"
ETC_LOCATION="$DST_DIR/etc"
VAR_LOCATION="$DST_DIR/var"
INCLUDE_LOCATION="$DST_DIR/include"
SHARE_LOCATION="$DST_DIR/share"
MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \
$INCLUDE_LOCATION $SHARE_LOCATION"
CHOWN_DIRS="$DST_DIR"
fi
SHARE_DIRS="$SHARE_LOCATION/examples \
$SHARE_LOCATION/examples/tm"
ETC_DIRS="$ETC_LOCATION/im_kvm \
$ETC_LOCATION/im_xen \
$ETC_LOCATION/im_ec2 \
$ETC_LOCATION/vmm_kvm \
$ETC_LOCATION/vmm_xen \
$ETC_LOCATION/vmm_ec2 \
$ETC_LOCATION/tm_nfs \
$ETC_LOCATION/tm_ssh \
$ETC_LOCATION/tm_dummy"
LIB_DIRS="$LIB_LOCATION/im_probes \
$LIB_LOCATION/ruby \
$LIB_LOCATION/tm_commands \
$LIB_LOCATION/tm_commands/nfs \
$LIB_LOCATION/tm_commands/ssh \
$LIB_LOCATION/tm_commands/dummy \
$LIB_LOCATION/mads"
MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS"
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# FILE DEFINITION, WHAT IS GOING TO BE INSTALLED AND WHERE
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
INSTALL_FILES[0]="BIN_FILES:$BIN_LOCATION"
INSTALL_FILES[1]="INCLUDE_FILES:$INCLUDE_LOCATION"
INSTALL_FILES[2]="LIB_FILES:$LIB_LOCATION"
INSTALL_FILES[3]="RUBY_LIB_FILES:$LIB_LOCATION/ruby"
INSTALL_FILES[4]="MADS_LIB_FILES:$LIB_LOCATION/mads"
INSTALL_FILES[5]="IM_PROBES_LIB_FILES:$LIB_LOCATION/im_probes"
INSTALL_FILES[6]="NFS_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/nfs"
INSTALL_FILES[7]="SSH_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/ssh"
INSTALL_FILES[8]="DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy"
INSTALL_FILES[9]="EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples"
INSTALL_FILES[10]="TM_EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples/tm"
INSTALL_ETC_FILES[0]="ETC_FILES:$ETC_LOCATION"
INSTALL_ETC_FILES[1]="VMM_XEN_ETC_FILES:$ETC_LOCATION/vmm_xen"
INSTALL_ETC_FILES[2]="VMM_KVM_ETC_FILES:$ETC_LOCATION/vmm_kvm"
INSTALL_ETC_FILES[3]="VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2"
INSTALL_ETC_FILES[4]="IM_XEN_ETC_FILES:$ETC_LOCATION/im_xen"
INSTALL_ETC_FILES[5]="IM_KVM_ETC_FILES:$ETC_LOCATION/im_kvm"
INSTALL_ETC_FILES[6]="IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2"
INSTALL_ETC_FILES[7]="TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs"
INSTALL_ETC_FILES[8]="TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh"
INSTALL_ETC_FILES[9]="TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy"
#-------------------------------------------------------------------------------
# Binary files, to be installed under $BIN_LOCATION
#-------------------------------------------------------------------------------
BIN_FILES="src/nebula/oned \
src/scheduler/mm_sched \
src/client/ruby/onevm \
src/client/ruby/onehost \
src/client/ruby/onevnet \
share/scripts/one"
#-------------------------------------------------------------------------------
# C/C++ OpenNebula API Library & Development files
# Include files, to be installed under $INCLUDE_LOCATION
# Library files, to be installed under $LIB_LOCATION
#-------------------------------------------------------------------------------
INCLUDE_FILES="include/OneClient.h"
LIB_FILES="src/client/liboneapi.a"
#-------------------------------------------------------------------------------
# Ruby library files, to be installed under $LIB_LOCATION/ruby
#-------------------------------------------------------------------------------
RUBY_LIB_FILES="src/mad/ruby/one_mad.rb \
src/mad/ruby/one_ssh.rb \
src/mad/ruby/ThreadScheduler.rb \
src/client/ruby/one.rb \
src/client/ruby/client_utilities.rb \
src/client/ruby/command_parse.rb \
src/tm_mad/TMScript.rb"
#-------------------------------------------------------------------------------
# Driver executable files, to be installed under $LIB_LOCATION/mads
#-------------------------------------------------------------------------------
MADS_LIB_FILES="share/scripts/madcommon.sh \
src/tm_mad/tm_common.sh \
src/vmm_mad/xen/one_vmm_xen.rb \
src/vmm_mad/xen/one_vmm_xen \
src/vmm_mad/kvm/one_vmm_kvm.rb \
src/vmm_mad/kvm/one_vmm_kvm \
src/vmm_mad/ec2/one_vmm_ec2.rb \
src/vmm_mad/ec2/one_vmm_ec2 \
src/im_mad/im_ssh/one_im_ssh.rb \
src/im_mad/im_ssh/one_im_ssh \
src/im_mad/ec2/one_im_ec2.rb \
src/im_mad/ec2/one_im_ec2 \
src/tm_mad/one_tm \
src/tm_mad/one_tm.rb"
#-------------------------------------------------------------------------------
# Information Manager Probes, to be installed under $LIB_LOCATION/im_probes
#-------------------------------------------------------------------------------
IM_PROBES_LIB_FILES="src/im_mad/xen/xen.rb \
src/im_mad/kvm/kvm.rb \
src/im_mad/host_probes/architecture.sh \
src/im_mad/host_probes/cpu.sh \
src/im_mad/host_probes/name.sh"
#-------------------------------------------------------------------------------
# Transfer Manager commands, to be installed under $LIB_LOCATION/tm_commands
# - NFS TM, $LIB_LOCATION/tm_commands/nfs
# - SSH TM, $LIB_LOCATION/tm_commands/ssh
# - dummy TM, $LIB_LOCATION/tm_commands/dummy
#-------------------------------------------------------------------------------
NFS_TM_COMMANDS_LIB_FILES="src/tm_mad/nfs/tm_clone.sh \
src/tm_mad/nfs/tm_delete.sh \
src/tm_mad/nfs/tm_ln.sh \
src/tm_mad/nfs/tm_mkswap.sh \
src/tm_mad/nfs/tm_mkimage.sh \
src/tm_mad/nfs/tm_mv.sh"
SSH_TM_COMMANDS_LIB_FILES="src/tm_mad/ssh/tm_clone.sh \
src/tm_mad/ssh/tm_delete.sh \
src/tm_mad/ssh/tm_ln.sh \
src/tm_mad/ssh/tm_mkswap.sh \
src/tm_mad/ssh/tm_mkimage.sh \
src/tm_mad/ssh/tm_mv.sh"
DUMMY_TM_COMMANDS_LIB_FILES="src/tm_mad/dummy/tm_dummy.sh"
#-------------------------------------------------------------------------------
# Configuration files for OpenNebula, to be installed under $ETC_LOCATION
#-------------------------------------------------------------------------------
ETC_FILES="share/etc/oned.conf \
share/etc/defaultrc"
#-------------------------------------------------------------------------------
# Virtualization drivers config. files, to be installed under $ETC_LOCATION
# - xen, $ETC_LOCATION/vmm_xen
# - kvm, $ETC_LOCATION/vmm_kvm
# - ec2, $ETC_LOCATION/vmm_ec2
#-------------------------------------------------------------------------------
VMM_XEN_ETC_FILES="src/vmm_mad/xen/vmm_xenrc \
src/vmm_mad/xen/vmm_xen.conf"
VMM_KVM_ETC_FILES="src/vmm_mad/kvm/vmm_kvmrc \
src/vmm_mad/kvm/vmm_kvm.conf"
VMM_EC2_ETC_FILES="src/vmm_mad/ec2/vmm_ec2rc \
src/vmm_mad/ec2/vmm_ec2.conf"
#-------------------------------------------------------------------------------
# Information drivers config. files, to be installed under $ETC_LOCATION
# - xen, $ETC_LOCATION/im_xen
# - kvm, $ETC_LOCATION/im_kvm
# - ec2, $ETC_LOCATION/im_ec2
#-------------------------------------------------------------------------------
IM_XEN_ETC_FILES="src/im_mad/xen/im_xenrc \
src/im_mad/xen/im_xen.conf"
IM_KVM_ETC_FILES="src/im_mad/kvm/im_kvmrc \
src/im_mad/kvm/im_kvm.conf"
IM_EC2_ETC_FILES="src/im_mad/ec2/im_ec2rc \
src/im_mad/ec2/im_ec2.conf"
#-------------------------------------------------------------------------------
# Storage drivers config. files, to be installed under $ETC_LOCATION
# - nfs, $ETC_LOCATION/tm_nfs
# - ssh, $ETC_LOCATION/tm_ssh
# - dummy, $ETC_LOCATION/tm_dummy
#-------------------------------------------------------------------------------
TM_NFS_ETC_FILES="src/tm_mad/nfs/tm_nfs.conf \
src/tm_mad/nfs/tm_nfsrc"
TM_SSH_ETC_FILES="src/tm_mad/ssh/tm_ssh.conf \
src/tm_mad/ssh/tm_sshrc"
TM_DUMMY_ETC_FILES="src/tm_mad/dummy/tm_dummy.conf \
src/tm_mad/dummy/tm_dummyrc"
#-------------------------------------------------------------------------------
# Sample files, to be installed under $SHARE_LOCATION/examples
#-------------------------------------------------------------------------------
EXAMPLE_SHARE_FILES="share/examples/vm.template \
share/examples/vm.schema \
share/examples/private.net \
share/examples/public.net"
#-------------------------------------------------------------------------------
# TM Sample files, to be installed under $SHARE_LOCATION/examples/tm
#-------------------------------------------------------------------------------
TM_EXAMPLE_SHARE_FILES="share/examples/tm/tm_clone.sh \
share/examples/tm/tm_delete.sh \
share/examples/tm/tm_ln.sh \
share/examples/tm/tm_mkimage.sh \
share/examples/tm/tm_mkswap.sh \
share/examples/tm/tm_mv.sh"
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# INSTALL.SH SCRIPT
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# --- Create OpenNebula directories ---
if [ "$UNINSTALL" = "no" ] ; then
for d in $MAKE_DIRS; do
mkdir -p $d
done
fi
# --- Install/Uninstall files ---
do_file() {
if [ "$UNINSTALL" = "yes" ]; then
rm $2/`basename $1`
else
cp $SRC_DIR/$1 $DST_DIR/$2
cp $SRC_DIR/$1 $2
fi
}
inst_cp() {
cp $SRC_DIR/$1 $DST_DIR/$2
}
if [ -z "$SRC_DIR" -o -z "$DST_DIR" ]; then
echo Must supply a destination directory
exit -1
fi
DIRS="/bin /include /etc /etc/im_kvm /etc/im_xen /etc/vmm_kvm /etc/vmm_xen /libexec /lib/ruby /var /share/examples /share/examples/tm /lib/im_probes /lib/tm_commands/nfs /lib/tm_commands/ssh /lib/tm_commands/dummy /etc/vmm_ec2 /etc/im_ec2 /etc/tm_nfs /etc/tm_ssh /etc/tm_dummy"
for d in $DIRS; do
mkdir -p $DST_DIR$d
for i in ${INSTALL_FILES[@]}; do
SRC=$`echo $i | cut -d: -f1`
DST=`echo $i | cut -d: -f2`
eval SRC_FILES=$SRC
for f in $SRC_FILES; do
do_file $f $DST
done
done
# --- Programs & Scripts---
if [ "$INSTALL_ETC" = "yes" ] ; then
for i in ${INSTALL_ETC_FILES[@]}; do
SRC=$`echo $i | cut -d: -f1`
DST=`echo $i | cut -d: -f2`
eval SRC_FILES=$SRC
for f in $SRC_FILES; do
do_file $f $DST
done
done
fi
inst_ln src/nebula/oned bin
inst_ln src/scheduler/mm_sched bin
# --- Set ownership or remove OpenNebula directories ---
inst_ln src/client/ruby/onevm bin
inst_ln src/client/ruby/onehost bin
inst_ln src/client/ruby/onevnet bin
inst_ln share/scripts/madcommon.sh libexec
inst_ln share/scripts/one bin
# --- C/C++ OpenNebula API Library & Development files
inst_ln src/client/liboneapi.a lib/
inst_ln include/OneClient.h include/
# --- Ruby Libraries
inst_ln src/mad/ruby/one_mad.rb lib/ruby
inst_ln src/mad/ruby/one_ssh.rb lib/ruby
inst_ln src/mad/ruby/ThreadScheduler.rb lib/ruby
inst_ln src/client/ruby/one.rb lib/ruby
inst_ln src/client/ruby/client_utilities.rb lib/ruby
inst_ln src/client/ruby/command_parse.rb lib/ruby
# --- ONE configuration files ---
inst_cp share/etc/oned.conf etc
inst_cp share/etc/defaultrc etc
# --- XEN driver & configuration files ---
inst_ln src/vmm_mad/xen/one_vmm_xen.rb bin
inst_ln src/vmm_mad/xen/one_vmm_xen bin
inst_ln src/im_mad/xen/xen.rb lib/im_probes
inst_cp src/vmm_mad/xen/vmm_xenrc etc/vmm_xen
inst_cp src/vmm_mad/xen/vmm_xen.conf etc/vmm_xen
inst_cp src/im_mad/xen/im_xenrc etc/im_xen
inst_cp src/im_mad/xen/im_xen.conf etc/im_xen
# --- KVM driver & configuration files ---
inst_ln src/vmm_mad/kvm/one_vmm_kvm.rb bin
inst_ln src/vmm_mad/kvm/one_vmm_kvm bin
inst_ln src/im_mad/kvm/kvm.rb lib/im_probes
inst_cp src/vmm_mad/kvm/vmm_kvmrc etc/vmm_kvm
inst_cp src/vmm_mad/kvm/vmm_kvm.conf etc/vmm_kvm
inst_cp src/im_mad/kvm/im_kvmrc etc/im_kvm
inst_cp src/im_mad/kvm/im_kvm.conf etc/im_kvm
# --- EC2 driver & configuration files ---
inst_ln src/vmm_mad/ec2/one_vmm_ec2.rb bin
inst_ln src/vmm_mad/ec2/one_vmm_ec2 bin
inst_ln src/im_mad/ec2/one_im_ec2.rb bin
inst_ln src/im_mad/ec2/one_im_ec2 bin
inst_cp src/vmm_mad/ec2/vmm_ec2rc etc/vmm_ec2
inst_cp src/vmm_mad/ec2/vmm_ec2.conf etc/vmm_ec2
inst_cp src/im_mad/ec2/im_ec2rc etc/im_ec2
inst_cp src/im_mad/ec2/im_ec2.conf etc/im_ec2
# --- Information driver & probes ---
inst_ln src/im_mad/im_ssh/one_im_ssh.rb bin
inst_ln src/im_mad/im_ssh/one_im_ssh bin
inst_ln src/im_mad/host_probes/architecture.sh lib/im_probes
inst_ln src/im_mad/host_probes/cpu.sh lib/im_probes
inst_ln src/im_mad/host_probes/name.sh lib/im_probes
# -- Transfer manager --
inst_ln src/tm_mad/one_tm bin
inst_ln src/tm_mad/one_tm.rb bin
inst_ln src/tm_mad/TMScript.rb lib/ruby
inst_ln src/tm_mad/tm_common.sh libexec
inst_ln src/tm_mad/nfs/tm_nfs.conf etc/tm_nfs
inst_ln src/tm_mad/nfs/tm_nfsrc etc/tm_nfs
inst_ln src/tm_mad/nfs/tm_clone.sh lib/tm_commands/nfs
inst_ln src/tm_mad/nfs/tm_delete.sh lib/tm_commands/nfs
inst_ln src/tm_mad/nfs/tm_ln.sh lib/tm_commands/nfs
inst_ln src/tm_mad/nfs/tm_mkswap.sh lib/tm_commands/nfs
inst_ln src/tm_mad/nfs/tm_mkimage.sh lib/tm_commands/nfs
inst_ln src/tm_mad/nfs/tm_mv.sh lib/tm_commands/nfs
inst_ln src/tm_mad/ssh/tm_ssh.conf etc/tm_ssh
inst_ln src/tm_mad/ssh/tm_sshrc etc/tm_ssh
inst_ln src/tm_mad/ssh/tm_clone.sh lib/tm_commands/ssh
inst_ln src/tm_mad/ssh/tm_delete.sh lib/tm_commands/ssh
inst_ln src/tm_mad/ssh/tm_ln.sh lib/tm_commands/ssh
inst_ln src/tm_mad/ssh/tm_mkswap.sh lib/tm_commands/ssh
inst_ln src/tm_mad/ssh/tm_mkimage.sh lib/tm_commands/ssh
inst_ln src/tm_mad/ssh/tm_mv.sh lib/tm_commands/ssh
inst_ln src/tm_mad/dummy/tm_dummy.conf etc/tm_dummy
inst_ln src/tm_mad/dummy/tm_dummyrc etc/tm_dummy
inst_ln src/tm_mad/dummy/tm_dummy.sh lib/tm_commands/dummy
# --- Examples ---
inst_cp share/examples/vm.template share/examples
inst_cp share/examples/vm.schema share/examples
inst_cp share/examples/private.net share/examples
inst_cp share/examples/public.net share/examples
inst_cp share/examples/tm/tm_clone.sh share/examples/tm
inst_cp share/examples/tm/tm_delete.sh share/examples/tm
inst_cp share/examples/tm/tm_ln.sh share/examples/tm
inst_cp share/examples/tm/tm_mkimage.sh share/examples/tm
inst_cp share/examples/tm/tm_mkswap.sh share/examples/tm
inst_cp share/examples/tm/tm_mv.sh share/examples/tm
if [ "$UNINSTALL" = "no" ] ; then
/bin/chown -R $ONEADMIN_USER:$ONEADMIN_GROUP $CHOWN_DIRS
else
for d in `echo $MAKE_DIRS | awk '{for (i=NF;i>=1;i--) printf $i" "}'`; do
rmdir $d
done
fi

View File

@ -29,7 +29,9 @@
#-------------------------------------------------------------------------------
# Debug for MADs.
# If set, MADs will generate cores and logs in $ONE_LOCATION/var.
# If set, MADs will generate cores and logs in $ONE_LOCATION/var. If OpenNebula
# is installed in /, then the files will be in /var/lib/one and /var/log/one,
# respectively.
# Possible values are [0=ERROR, 1=DEBUG]
ONE_MAD_DEBUG=

View File

@ -47,27 +47,36 @@ MAC_PREFIX = "00:03"
#-------------------------------------------------------------------------------
# You can add more information managers with different configurations but make
# sure it has different names.
#
# name : name for this information manager
# executable: path of the virtual machine manager executable, can be an
# absolute path or a relative path from $ONE_LOCATION
# arguments : for the driver executable
# default : default values and configuration parameters for the driver
#
# executable: path of the information driver executable, can be an
# absolute path or relative to $ONE_LOCATION/lib/mads (or
# /usr/lib/one/mads/ if OpenNebula was installed in /)
#
# arguments : for the driver executable, usually a probe configuration file,
# can be an absolute path or relative to $ONE_LOCATION/etc (or
# /etc/one/ if OpenNebula was installed in /)
#
# default : default values and configuration parameters for the driver, can
# be an absolute path or relative to $ONE_LOCATION/etc (or
# /etc/one/ if OpenNebula was installed in /)
#-------------------------------------------------------------------------------
IM_MAD = [
name = "im_xen",
executable = "bin/one_im_ssh",
arguments = "etc/im_xen/im_xen.conf",
default = "etc/im_xen/im_xen.conf" ]
executable = "one_im_ssh",
arguments = "im_xen/im_xen.conf",
default = "im_xen/im_xen.conf" ]
#-------------------------------------------------------------------------------
# KVM Information Driver Manager sample configuration
#-------------------------------------------------------------------------------
# IM_MAD = [
# name = "im_kvm",
# executable = "bin/one_im_ssh",
# arguments = "etc/im_kvm/im_kvm.conf",
# default = "etc/im_kvm/im_kvm.conf" ]
# executable = "one_im_ssh",
# arguments = "im_kvm/im_kvm.conf",
# default = "im_kvm/im_kvm.conf" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@ -75,9 +84,9 @@ IM_MAD = [
#-------------------------------------------------------------------------------
# IM_MAD = [
# name = "im_ec2",
# executable = "bin/one_im_ec2",
# arguments = "etc/im_ec2/im_ec2.conf",
# default = "etc/im_ec2/im_ec2.conf" ]
# executable = "one_im_ec2",
# arguments = "im_ec2/im_ec2.conf",
# default = "im_ec2/im_ec2.conf" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@ -85,18 +94,26 @@ IM_MAD = [
#-------------------------------------------------------------------------------
# You can add more virtualization managers with different configurations but
# make sure it has different names.
#
# name : name of the virtual machine manager driver
# executable: path of the virtual machine manager executable, can be an
# absolute path or a relative path from $ONE_LOCATION
#
# executable: path of the virtualization driver executable, can be an
# absolute path or relative to $ONE_LOCATION/lib/mads (or
# /usr/lib/one/mads/ if OpenNebula was installed in /)
#
# arguments : for the driver executable
# default : default values and configuration parameters for the driver
#
# default : default values and configuration parameters for the driver, can
# be an absolute path or relative to $ONE_LOCATION/etc (or
# /etc/one/ if OpenNebula was installed in /)
#
# type : driver type, supported drivers: xen, kvm, ec2
#-------------------------------------------------------------------------------
VM_MAD = [
name = "vmm_xen",
executable = "bin/one_vmm_xen",
default = "etc/vmm_xen/vmm_xen.conf",
executable = "one_vmm_xen",
default = "vmm_xen/vmm_xen.conf",
type = "xen" ]
#-------------------------------------------------------------------------------
@ -104,8 +121,8 @@ VM_MAD = [
#-------------------------------------------------------------------------------
# VM_MAD = [
# name = "vmm_kvm",
# executable = "bin/one_vmm_kvm",
# default = "etc/vmm_kvm/vmm_kvm.conf",
# executable = "one_vmm_kvm",
# default = "vmm_kvm/vmm_kvm.conf",
# type = "kvm" ]
#-------------------------------------------------------------------------------
@ -114,8 +131,8 @@ VM_MAD = [
#-------------------------------------------------------------------------------
# VM_MAD = [
# name = "vmm_ec2",
# executable = "bin/one_vmm_ec2",
# default = "etc/vmm_ec2/vmm_ec2.conf",
# executable = "one_vmm_ec2",
# default = "vmm_ec2/vmm_ec2.conf",
# type = "ec2" ]
#-------------------------------------------------------------------------------
@ -125,27 +142,35 @@ VM_MAD = [
#-------------------------------------------------------------------------------
# You can add more transfer managers with different configurations but make
# sure it has different names.
# name : name for this transfer manager
# executable: path of the transfer manager executable, can be an
# absolute path or a relative path from $ONE_LOCATION
# arguments : for the driver executable
# default : default values and configuration parameters for the driver
# name : name for this transfer driver
#
# executable: path of the transfer driver executable, can be an
# absolute path or relative to $ONE_LOCATION/lib/mads (or
# /usr/lib/one/mads/ if OpenNebula was installed in /)
#
# arguments : for the driver executable, usually a commands configuration file
# , can be an absolute path or relative to $ONE_LOCATION/etc (or
# /etc/one/ if OpenNebula was installed in /)
#
# default : default values and configuration parameters for the driver, can
# be an absolute path or relative to $ONE_LOCATION/etc (or
# /etc/one/ if OpenNebula was installed in /)
#-------------------------------------------------------------------------------
TM_MAD = [
name = "tm_ssh",
executable = "bin/one_tm",
arguments = "etc/tm_ssh/tm_ssh.conf",
default = "etc/tm_ssh/tm_ssh.conf" ]
executable = "one_tm",
arguments = "tm_ssh/tm_ssh.conf",
default = "tm_ssh/tm_ssh.conf" ]
#-------------------------------------------------------------------------------
# NFS Transfer Manager Driver sample configuration
#-------------------------------------------------------------------------------
# TM_MAD = [
# name = "tm_nfs",
# executable = "bin/one_tm",
# arguments = "etc/tm_nfs/tm_nfs.conf",
# default = "etc/tm_nfs/tm_nfs.conf" ]
# executable = "one_tm",
# arguments = "tm_nfs/tm_nfs.conf",
# default = "tm_nfs/tm_nfs.conf" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@ -153,7 +178,7 @@ TM_MAD = [
#-------------------------------------------------------------------------------
# TM_MAD = [
# name = "tm_dummy",
# executable = "bin/one_tm",
# arguments = "etc/tm_dummy/tm_dummy.conf",
# default = "etc/tm_dummy/tm_dummy.conf" ]
# executable = "one_tm",
# arguments = "tm_dummy/tm_dummy.conf",
# default = "tm_dummy/tm_dummy.conf" ]
#-------------------------------------------------------------------------------

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`

View File

@ -1,5 +1,11 @@
#!/bin/bash
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
log "mkimage placeholder"

View File

@ -3,7 +3,13 @@
SIZE=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
DST_PATH=`arg_path $DST`
DST_HOST=`arg_host $DST`

View File

@ -3,7 +3,15 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
VAR_LOCATION=/var/lib/one/
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
VAR_LOCATION=$ONE_LOCATION/var/
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
@ -13,7 +21,7 @@ if [ "$SRC_PATH" == "$DST_PATH" ]; then
log "Will not move, source and destination are equal"
else
# Is saving a disk image?
echo "$DST_PATH" | egrep -e "^$ONE_LOCATION/var/.+/disk\..+$"
echo "$DST_PATH" | egrep -e "^$VAR_LOCATION.+/disk\..+$"
if [ "x$?" == "x0" ]; then
log "Moving $SRC_PATH"
exec_and_log "ssh $DST_HOST mv $SRC_PATH $DST_PATH"

View File

@ -44,17 +44,30 @@ function execute_mad
LOG_FILE=$MAD_FILE
fi
if [ -n "${ONE_MAD_DEBUG}" ]; then
exec nice -n $PRIORITY bin/$MAD_FILE.rb $* 2>> var/$LOG_FILE.log
if [ -z "${ONE_LOCATION}" ]; then
MAD_EXEC_PATH=/usr/lib/one/mads/$MAD_FILE.rb
MAD_LOG_PATH=/var/log/one/$LOG_FILE.log
else
exec nice -n $PRIORITY bin/$MAD_FILE.rb $* 2> /dev/null
MAD_EXEC_PATH=$ONE_LOCATION/lib/mads/$MAD_FILE.rb
MAD_LOG_PATH=$ONE_LOCATION/var/$LOG_FILE.log
fi
if [ -n "${ONE_MAD_DEBUG}" ]; then
exec nice -n $PRIORITY $MAD_EXEC_PATH $* 2>> $MAD_LOG_PATH
else
exec nice -n $PRIORITY $MAD_EXEC_PATH $* 2> /dev/null
fi
}
# Set global environment
if [ -z "${ONE_LOCATION}" ]; then
DEFAULTRC=/etc/one/defaultrc
else
DEFAULTRC=$ONE_LOCATION/etc/defaultrc
fi
export_rc_vars $ONE_LOCATION/etc/defaultrc
export_rc_vars $DEFAULTRC
# Sanitize PRIORITY variable
if [ -z "$PRIORITY" ]; then

View File

@ -1,17 +1,25 @@
#! /bin/sh
if [ -z "$ONE_LOCATION" ]; then
echo "ONE_LOCATION is not defined"
exit 1
ONE_PID=/var/run/one/oned.pid
ONE_SCHEDPID=/var/run/one/sched.pid
ONE_CONF=/etc/one/oned.conf
ONED=/usr/bin/oned
ONE_SCHEDULER=/usr/bin/mm_sched
LOCK_FILE=/var/lock/one
else
ONE_PID=$ONE_LOCATION/var/oned.pid
ONE_SCHEDPID=$ONE_LOCATION/var/sched.pid
ONE_CONF=$ONE_LOCATION/etc/oned.conf
ONED=$ONE_LOCATION/bin/oned
ONE_SCHEDULER=$ONE_LOCATION/bin/mm_sched
LOCK_FILE=$ONE_LOCATION/var/.lock
fi
ONE_PID=$ONE_LOCATION/var/oned.pid
ONE_SCHEDPID=$ONE_LOCATION/var/sched.pid
ONE_CONF=$ONE_LOCATION/etc/oned.conf
ONED=$ONE_LOCATION/bin/oned
ONE_SCHEDULER=$ONE_LOCATION/bin/mm_sched
setup()
{
PORT=`cat $ONE_CONF | grep ^PORT= | cut -d= -f2`
@ -21,7 +29,7 @@ setup()
exit 1
fi
if [ -f $ONE_LOCATION/var/.lock ]; then
if [ -f $LOCK_FILE ]; then
if [ -f $ONE_PID ]; then
ONEPID=`cat $ONE_PID`
ps $ONEPID &> /dev/null
@ -39,7 +47,7 @@ setup()
fi
fi
echo "Stale .lock detected. Erasing it."
rm $ONE_LOCATION/var/.lock
rm $LOCK_FILE
fi
}

View File

@ -29,8 +29,19 @@ module ONE
########################
# DATABASE DEFINITIONS #
########################
def ONE.get_db_filename
one_location=ENV["ONE_LOCATION"]
if !one_location
db_filename = "/var/lib/one/one.db"
else
db_filename = one_location + "/var/one.db"
end
db_filename
end
ONE_LOCATION=ENV["ONE_LOCATION"]
TABLES={
"vm_pool" => %w{oid uid last_poll template_id state lcm_state
@ -95,8 +106,13 @@ module ONE
class Database
attr_reader :db
def initialize(file=ONE_LOCATION+"/var/one.db")
@db=SQLite3::Database.new(file)
def initialize(file=nil)
if file == nil
file=ONE.get_db_filename
end
@db=SQLite3::Database.new(file)
@db.busy_timeout(5000)
@db.busy_handler do |data, retries|

View File

@ -17,16 +17,15 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'one'
require 'client_utilities'

View File

@ -17,15 +17,15 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'one'
require 'client_utilities'

View File

@ -17,16 +17,15 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'one'
require 'client_utilities'

View File

@ -1,20 +1,27 @@
#!/bin/bash
if [ -z "${ONE_LOCATION}" ]; then
echo "Please, set ONE_LOCATION variable."
exit -1
EC2RC=/etc/one/im_ec2/im_ec2rc
EC2CONF=/etc/one/im_ec2/im_ec2.conf
MADCOMMON=/usr/lib/one/mads/madcommon.sh
VAR_LOCATION=/var/lib/one
else
EC2RC=$ONE_LOCATION/etc/im_ec2/im_ec2rc
EC2CONF=$ONE_LOCATION/etc/im_ec2/im_ec2.conf
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
VAR_LOCATION=$ONE_LOCATION/var
fi
. $ONE_LOCATION/libexec/madcommon.sh
. $MADCOMMON
# Export the vmm_mad specific rc
export_rc_vars $ONE_LOCATION/etc/im_ec2/im_ec2rc
export_rc_vars $EC2RC
# Export max instance type usages
export_rc_vars $ONE_LOCATION/etc/im_ec2/im_ec2.conf
export_rc_vars $EC2CONF
# Go to ONE_LOCATION
cd $ONE_LOCATION
# Go to var directory ONE_LOCATION/var or /var/lib/one
cd $VAR_LOCATION
# Execute the actual MAD
execute_mad $*

View File

@ -3,11 +3,12 @@
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'pp'
require 'one_mad'

View File

@ -1,25 +1,27 @@
#!/bin/bash
if [ -z "${ONE_LOCATION}" ]; then
echo "Please, set ONE_LOCATION variable."
exit -1
fi
. $ONE_LOCATION/libexec/madcommon.sh
# Export the im_mad specific rc
DRIVER_NAME=`basename $1 | cut -d. -f1`
export_rc_vars $ONE_LOCATION/etc/${DRIVER_NAME}/${DRIVER_NAME}rc
if [ -z "${ONE_LOCATION}" ]; then
DRIVERRC=/etc/one/${DRIVER_NAME}/${DRIVER_NAME}rc
MADCOMMON=/usr/lib/one/mads/madcommon.sh
VAR_LOCATION=/var/lib/one
else
DRIVERRC=$ONE_LOCATION/etc/${DRIVER_NAME}/${DRIVER_NAME}rc
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
VAR_LOCATION=$ONE_LOCATION/var
fi
# Go to ONE_LOCATION
. $MADCOMMON
cd $ONE_LOCATION
# Export the im_mad specific rc
export_rc_vars $DRIVERRC
# Go to var directory ONE_LOCATION/var or /var/lib/one
cd $VAR_LOCATION
LOG_FILE=$DRIVER_NAME
# Execute the actual MAD
execute_mad $*

View File

@ -3,11 +3,16 @@
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit(-1)
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
ETC_LOCATION="/etc/one/"
PROBE_LOCATION="/usr/lib/one/im_probes/"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
ETC_LOCATION=ONE_LOCATION+"/etc/"
PROBE_LOCATION=ONE_LOCATION+"/lib/im_probes/"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'pp'
@ -168,7 +173,7 @@ class SensorList < SSHCommandList
(name, script)=l.split("=")
name.strip!
script.strip!
script=ONE_LOCATION+"/"+script if script[0] != ?/
script=PROBE_LOCATION+script if script[0] != ?/
self<<Sensor.new(name, script)
else
STDERR.puts "Malformed line in configuration file: " + line
@ -262,7 +267,7 @@ if !im_conf
exit(-1)
end
im_conf=ONE_LOCATION+"/"+im_conf if im_conf[0] != ?/
im_conf=ETC_LOCATION+im_conf if im_conf[0] != ?/
sensors.load_sensors(im_conf)
im=IM.new(sensors)

View File

@ -2,7 +2,7 @@
# Remote directory where scripts are written
REMOTE_DIR=/tmp/ne_im_scripts
cpuarchitecture=lib/im_probes/architecture.sh
nodename=lib/im_probes/name.sh
cpu=lib/im_probes/cpu.sh
kvm=lib/im_probes/kvm.rb
cpuarchitecture=architecture.sh
nodename=name.sh
cpu=cpu.sh
kvm=kvm.rb

View File

@ -2,7 +2,7 @@
# Remote directory where scripts are written
REMOTE_DIR=/tmp/ne_im_scripts
cpuarchitecture=lib/im_probes/architecture.sh
nodename=lib/im_probes/name.sh
cpu=lib/im_probes/cpu.sh
xen=lib/im_probes/xen.rb
cpuarchitecture=architecture.sh
nodename=name.sh
cpu=cpu.sh
xen=xen.rb

View File

@ -110,11 +110,11 @@ int Mad::start()
{
if ( it->second.empty() == false )
{
if (it->second[0] != '/') //Look in ONE_LOCATION
if (it->second[0] != '/') //Look in ONE_LOCATION/lib/mads or in "/usr/lib/one/mads"
{
Nebula& nd = Nebula::instance();
exec_path = nd.get_nebula_location() + "/" + it->second;
exec_path = nd.get_mad_location() + it->second;
executable= exec_path.c_str();
}
else //Absolute Path

View File

@ -152,8 +152,15 @@ class ONEMad
local_deployment_file=nil
one_location=ENV["ONE_LOCATION"]
if one_location == nil
var_location = "/var/lib/one/"
else
var_location = one_location + "/var/"
end
m=remote_deployment_file.match(/.*?\/(\d+)\/images\/(deployment.\d+)$/)
local_deployment_file="#{one_location}/var/#{m[1]}/#{m[2]}" if m
local_deployment_file="#{var_location}#{m[1]}/#{m[2]}" if m
return local_deployment_file
end

View File

@ -35,25 +35,12 @@ using namespace std;
void Nebula::start()
{
int rc;
const char * nl;
int fd;
sigset_t mask;
int signal;
char hn[80];
const SingleAttribute * sattr;
vector<const Attribute *> attr;
nl = getenv("ONE_LOCATION");
if (nl == 0)
{
throw runtime_error("Environment variable ONE_LOCATION not defined");
}
nebula_location = nl;
int rc;
int fd;
sigset_t mask;
int signal;
char hn[80];
if ( gethostname(hn,79) != 0 )
{
throw runtime_error("Error getting hostname");
@ -65,7 +52,7 @@ void Nebula::start()
// Configuration
// -----------------------------------------------------------
nebula_configuration = new NebulaTemplate(nebula_location);
nebula_configuration = new NebulaTemplate(etc_location, var_location);
rc = nebula_configuration->load_configuration();
@ -82,10 +69,11 @@ void Nebula::start()
try
{
string log_fname;
int log_level_int;
log_fname = nebula_location + "/var/oned.log";
Log::MessageType clevel = Log::ERROR;
string log_fname;
int log_level_int;
Log::MessageType clevel = Log::ERROR;
log_fname = log_location + "oned.log";
nebula_configuration->get("DEBUG_LEVEL", log_level_int);
@ -113,9 +101,7 @@ void Nebula::start()
Log::INFO,
os,
log_fname.c_str(),
clevel);
clevel);
}
catch(runtime_error&)
{
@ -140,7 +126,7 @@ void Nebula::start()
try
{
string db_name = nebula_location + "/var/one.db";
string db_name = var_location + "one.db";
db = new SqliteDB(db_name,Nebula::log);
}
@ -170,7 +156,7 @@ void Nebula::start()
Nebula::log("ONE",Log::INFO,"Bootstraping OpenNebula database.");
vmpool->bootstrap();
hpool->bootstrap();
hpool->bootstrap();
vnpool->bootstrap();
// -----------------------------------------------------------
@ -203,32 +189,17 @@ void Nebula::start()
MadManager::mad_manager_system_init();
time_t timer_period;
istringstream is;
nebula_configuration->get("MANAGER_TIMER", attr);
sattr = static_cast<const SingleAttribute *>(attr[0]);
is.str(sattr->value());
is >> timer_period;
time_t timer_period;
nebula_configuration->get("MANAGER_TIMER", timer_period);
// ---- Virtual Machine Manager ----
try
{
time_t poll_period;
vector<const Attribute *> vmm_mads;
attr.clear();
nebula_configuration->get("VM_POLLING_INTERVAL", attr);
sattr = static_cast<const SingleAttribute *>(attr[0]);
is.clear();
is.str(sattr->value());
is >> poll_period;
nebula_configuration->get("VM_POLLING_INTERVAL", poll_period);
nebula_configuration->get("VM_MAD", vmm_mads);
@ -274,16 +245,8 @@ void Nebula::start()
vector<const Attribute *> im_mads;
time_t monitor_period;
attr.clear();
nebula_configuration->get("HOST_MONITORING_INTERVAL", attr);
sattr = static_cast<const SingleAttribute *>(attr[0]);
is.clear();
is.str(sattr->value());
is >> monitor_period;
nebula_configuration->get("HOST_MONITORING_INTERVAL", monitor_period);
nebula_configuration->get("IM_MAD", im_mads);
im = new InformationManager(hpool,timer_period,monitor_period,im_mads);
@ -350,7 +313,7 @@ void Nebula::start()
hpool,
vnpool,
rm_port,
nebula_location + "/var/one_xmlrpc.log");
log_location + "one_xmlrpc.log");
}
catch (bad_alloc&)
{

View File

@ -28,15 +28,14 @@ const char * NebulaTemplate::conf_name="oned.conf";
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
NebulaTemplate::NebulaTemplate(string& nebula_location)
NebulaTemplate::NebulaTemplate(string& etc_location, string& var_location)
{
ostringstream os;
SingleAttribute * attribute;
string value;
conf_file = nebula_location + "/etc/";
conf_file += conf_name;
conf_file = etc_location + conf_name;
// POLL_INTERVAL
value = "300";
@ -61,10 +60,8 @@ NebulaTemplate::NebulaTemplate(string& nebula_location)
attribute = new SingleAttribute("PORT",value);
conf_default.insert(make_pair(attribute->name(),attribute));
//VM_DIR
value = nebula_location + "/var";
attribute = new SingleAttribute("VM_DIR",value);
//VM_DIR
attribute = new SingleAttribute("VM_DIR",var_location);
conf_default.insert(make_pair(attribute->name(),attribute));
//MAC_PREFIX

View File

@ -45,7 +45,7 @@ static const char * susage =
static void print_license()
{
cout<< "Copyright 2002-2008, Distributed Systems Architecture Group,\n"
cout<< "Copyright 2002-2009, Distributed Systems Architecture Group,\n"
<< "Universidad Complutense de Madrid (dsa-research.org).\n\n"
<< Nebula::version() << " is distributed and licensed for use under the"
<< " terms of the\nApache License, Version 2.0 "
@ -106,18 +106,24 @@ int main(int argc, char **argv)
// ---------------------------------
// Check if other oned is running
// ---------------------------------
string lockfile;
string var_location;
nl = getenv("ONE_LOCATION");
if (nl == 0)
if (nl == 0) // OpenNebula in root of FSH
{
cerr << "Error: ONE_LOCATION environment variable is undefined.\n";
exit(-1);
var_location = "/var/lib/one/";
lockfile = "/var/lock/one";
}
else
{
var_location = nl;
var_location += "/var/";
lockfile = var_location + ".lock";
}
string lockfile(nl);
lockfile += "/var/.lock";
fd = open(lockfile.c_str(), O_CREAT|O_EXCL, 0640);
@ -125,6 +131,7 @@ int main(int argc, char **argv)
{
cerr<< "Error: Can not start oned, opening lock file " << lockfile
<< endl;
exit(-1);
}
@ -151,9 +158,8 @@ int main(int argc, char **argv)
case 0: // Child process
wd=nl;
wd += "/var/";
rc = chdir(wd.c_str());
rc = chdir(var_location.c_str());
if (rc != 0)
{

View File

@ -30,6 +30,7 @@
#include "Scheduler.h"
#include "RankPolicy.h"
#include "Nebula.h"
using namespace std;
@ -62,21 +63,10 @@ extern "C" void * scheduler_action_loop(void *arg)
void Scheduler::start()
{
int rc;
string nebula_location;
const char * nl;
Nebula& nd = Nebula::instance();
pthread_attr_t pattr;
nl = getenv("ONE_LOCATION");
if (nl == 0)
{
throw runtime_error("Environment variable ONE_LOCATION not defined");
}
nebula_location = nl;
// -----------------------------------------------------------
// Log system
// -----------------------------------------------------------
@ -85,7 +75,7 @@ void Scheduler::start()
{
string log_fname;
log_fname = nebula_location + "/var/sched.log";
log_fname = nd.get_log_location() + "sched.log";
Scheduler::log("SCHED",
Log::INFO,
@ -103,7 +93,7 @@ void Scheduler::start()
try
{
string db_name = nebula_location + "/var/one.db";
string db_name = nd.get_var_location() + "one.db";
db = new SqliteDB(db_name,Scheduler::log);
}
@ -112,17 +102,8 @@ void Scheduler::start()
throw;
}
try
{
string db_name = nebula_location + "/var/one.db";
hpool = new SchedulerHostPool(db);
vmpool = new SchedulerVirtualMachinePool(db);
}
catch (exception&)
{
throw;
}
hpool = new SchedulerHostPool(db);
vmpool = new SchedulerVirtualMachinePool(db);
// -----------------------------------------------------------
// Load scheduler policies

View File

@ -197,7 +197,6 @@ int Template::get(
return j;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -37,11 +37,11 @@ TransferManagerDriver::TransferManagerDriver(
if ( it != attrs.end() )
{
if (it->second[0] != '/') //Look in ONE_LOCATION
if (it->second[0] != '/') //Look in ONE_LOCATION/etc or in "/etc/one"
{
Nebula& nd = Nebula::instance();
file = nd.get_nebula_location() + "/" + it->second;
file = nd.get_defaults_location() + it->second;
cfile = file.c_str();
}
else //Absolute Path

View File

@ -93,6 +93,12 @@ class TMPlugin < Hash
end
one_location=ENV['ONE_LOCATION']
if one_location == nil
tm_commands_location = "/usr/lib/one/tm_commands/"
else
tm_commands_location = one_location + "/lib/tm_commands/"
end
scripts_text.each_line {|line|
case line
@ -100,16 +106,12 @@ class TMPlugin < Hash
# skip empty or commented lines
next
when /^\s*(\w+)\s*=\s*(.*)\s*$/
# TODO: add ONE_LOCATION if it is not FQDM
command=$1.strip.upcase
path=$2.strip
# Substitutes ONE_LOCATION by the envionment variable
path.gsub!(/ONE_LOCATION/, one_location)
# Prepend ONE_LOCATION if the path does not
# Prepend default location for tm commands if the path does not
# start with /
path=one_location+"/"+path if path[0]!=?/
path=tm_commands_location+path if path[0]!=?/
self[command]=path
else

View File

@ -1,6 +1,6 @@
CLONE = lib/tm_commands/dummy/tm_dummy.sh
LN = lib/tm_commands/dummy/tm_dummy.sh
MKSWAP = lib/tm_commands/dummy/tm_dummy.sh
MKIMAGE = lib/tm_commands/dummy/tm_dummy.sh
DELETE = lib/tm_commands/dummy/tm_dummy.sh
MV = lib/tm_commands/dummy/tm_dummy.sh
CLONE = dummy/tm_dummy.sh
LN = dummy/tm_dummy.sh
MKSWAP = dummy/tm_dummy.sh
MKIMAGE = dummy/tm_dummy.sh
DELETE = dummy/tm_dummy.sh
MV = dummy/tm_dummy.sh

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`

View File

@ -1,5 +1,11 @@
#!/bin/bash
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
log "mkimage placeholder"

View File

@ -3,7 +3,13 @@
SIZE=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
DST_PATH=`arg_path $DST`

View File

@ -3,7 +3,15 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
VAR_LOCATION=/var/lib/one/
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
VAR_LOCATION=$ONE_LOCATION/var/
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
@ -12,7 +20,7 @@ if [ "$SRC_PATH" == "$DST_PATH" ]; then
log "Will not move, source and destination are equal"
else
# Is saving a disk image?
echo "$DST_PATH" | egrep -e "^$ONE_LOCATION/var/.+/disk\..+$"
echo "$DST_PATH" | egrep -e "^$VAR_LOCATION.+/disk\..+$"
if [ "x$?" == "x0" ]; then
log "Moving $SRC_PATH"
exec_and_log "mv $SRC_PATH $DST_PATH"

View File

@ -1,6 +1,6 @@
CLONE = lib/tm_commands/nfs/tm_clone.sh
LN = lib/tm_commands/nfs/tm_ln.sh
MKSWAP = lib/tm_commands/nfs/tm_mkswap.sh
MKIMAGE = lib/tm_commands/nfs/tm_mkimage.sh
DELETE = lib/tm_commands/nfs/tm_delete.sh
MV = lib/tm_commands/nfs/tm_mv.sh
CLONE = nfs/tm_clone.sh
LN = nfs/tm_ln.sh
MKSWAP = nfs/tm_mkswap.sh
MKIMAGE = nfs/tm_mkimage.sh
DELETE = nfs/tm_delete.sh
MV = nfs/tm_mv.sh

View File

@ -1,25 +1,28 @@
#!/bin/bash
if [ -z "${ONE_LOCATION}" ]; then
echo "Please, set ONE_LOCATION variable."
exit -1
fi
. $ONE_LOCATION/libexec/madcommon.sh
# Export the im_mad specific rc
DRIVER_NAME=`basename $1 | cut -d. -f1`
export_rc_vars $ONE_LOCATION/etc/${DRIVER_NAME}/${DRIVER_NAME}rc
if [ -z "${ONE_LOCATION}" ]; then
DRIVERRC=/etc/one/${DRIVER_NAME}/${DRIVER_NAME}rc
MADCOMMON=/usr/lib/one/mads/madcommon.sh
VAR_LOCATION=/var/lib/one
else
DRIVERRC=$ONE_LOCATION/etc/${DRIVER_NAME}/${DRIVER_NAME}rc
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
VAR_LOCATION=$ONE_LOCATION/var
fi
. $MADCOMMON
# Export the im_mad specific rc
export_rc_vars $DRIVERRC
# Go to ONE_LOCATION
cd $ONE_LOCATION
cd $VAR_LOCATION
LOG_FILE=$DRIVER_NAME
# Execute the actual MAD
execute_mad $*

View File

@ -3,11 +3,14 @@
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit(-1)
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
ETC_LOCATION="/etc/one/"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
ETC_LOCATION=ONE_LOCATION+"/etc/"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'pp'
require 'one_mad'
@ -73,7 +76,7 @@ if !tm_conf
exit(-1)
end
tm_conf=ONE_LOCATION+"/"+tm_conf if tm_conf[0] != ?/
tm_conf=ETC_LOCATION+tm_conf if tm_conf[0] != ?/
plugin=TMPlugin.new(tm_conf)

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`

View File

@ -3,9 +3,16 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
TM_COMMANDS_LOCATION=/usr/lib/one/tm_commands/
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
TM_COMMANDS_LOCATION=$ONE_LOCATION/lib/tm_commands/
fi
. $TMCOMMON
log "Link $SRC_PATH (non shared dir, will clone)"
#exec_and_log "ln -s $SRC_PATH $DST_PATH"
exec $ONE_LOCATION/lib/tm_commands/ssh/tm_clone.sh $SRC $DST
exec $TM_COMMANDS_LOCATION/ssh/tm_clone.sh $SRC $DST

View File

@ -1,5 +1,11 @@
#!/bin/bash
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
log "mkimage placeholder"

View File

@ -3,7 +3,13 @@
SIZE=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
DST_PATH=`arg_path $DST`
DST_HOST=`arg_host $DST`

View File

@ -3,7 +3,13 @@
SRC=$1
DST=$2
. $ONE_LOCATION/libexec/tm_common.sh
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`

View File

@ -1,6 +1,6 @@
CLONE = lib/tm_commands/ssh/tm_clone.sh
LN = lib/tm_commands/ssh/tm_ln.sh
MKSWAP = lib/tm_commands/ssh/tm_mkswap.sh
MKIMAGE = lib/tm_commands/ssh/tm_mkimage.sh
DELETE = lib/tm_commands/ssh/tm_delete.sh
MV = lib/tm_commands/ssh/tm_mv.sh
CLONE = ssh/tm_clone.sh
LN = ssh/tm_ln.sh
MKSWAP = ssh/tm_mkswap.sh
MKIMAGE = ssh/tm_mkimage.sh
DELETE = ssh/tm_delete.sh
MV = ssh/tm_mv.sh

View File

@ -98,7 +98,7 @@ void History::non_persistent_data()
// ----------- Local Locations ------------
os.str("");
os << nd.get_nebula_location() << "/var/" << oid;
os << nd.get_var_location() << oid;
vm_lhome = os.str();

View File

@ -163,7 +163,7 @@ int VirtualMachine::select(SqliteDB * db)
int boid;
string filename;
const char * nl;
Nebula& nd = Nebula::instance();
oss << "SELECT * FROM " << table << " WHERE oid = " << oid;
@ -214,43 +214,31 @@ int VirtualMachine::select(SqliteDB * db)
goto error_previous_history;
}
}
//Create Log support fo this VM
nl = getenv("ONE_LOCATION");
if (nl == 0)
{
goto error_env; //no logging support for this VM
}
//Create support directory fo this VM
oss.str("");
oss << nl << "/var/" << oid;
oss << nd.get_var_location() << oid;
mkdir(oss.str().c_str(), 0777);
chmod(oss.str().c_str(), 0777);
//Create Log support fo this VM
try
{
oss << "/vm.log";
filename = oss.str();
_log = new Log(filename,Log::DEBUG);
_log = new Log(nd.get_vm_log_filename(oid),Log::DEBUG);
}
catch(exception &e)
{
_log = 0;
{
ose << "Error creating log: " << e.what();
Nebula::log("ONE",Log::ERROR, ose);
goto error_log;
_log = 0;
}
return 0;
error_log:
error_env:
return 0;
error_id:
ose << "Error getting VM id: " << oid;
log("VMM", Log::ERROR, ose);

View File

@ -37,11 +37,11 @@ VirtualMachineManagerDriver::VirtualMachineManagerDriver(
if ( it != attrs.end() )
{
if (it->second[0] != '/') //Look in ONE_LOCATION
if (it->second[0] != '/') //Look in ONE_LOCATION/etc or in "/etc/one"
{
Nebula& nd = Nebula::instance();
file = nd.get_nebula_location() + "/" + it->second;
file = nd.get_defaults_location() + it->second;
cfile = file.c_str();
}
else //Absolute Path

View File

@ -1,17 +1,22 @@
#!/bin/bash
if [ -z "${ONE_LOCATION}" ]; then
echo "Please, set ONE_LOCATION variable."
exit -1
DRIVERRC=/etc/one/vmm_ec2/vmm_ec2rc
MADCOMMON=/usr/lib/one/mads/madcommon.sh
VAR_LOCATION=/var/lib/one
else
DRIVERRC=$ONE_LOCATION/etc/vmm_ec2/vmm_ec2rc
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
VAR_LOCATION=$ONE_LOCATION/var
fi
. $ONE_LOCATION/libexec/madcommon.sh
. $MADCOMMON
# Export the vmm_mad specific rc
export_rc_vars $ONE_LOCATION/etc/vmm_ec2/vmm_ec2rc
export_rc_vars $DRIVERRC
# Go to ONE_LOCATION
cd $ONE_LOCATION
cd $VAR_LOCATION
# Execute the actual MAD
execute_mad
execute_mad $*

View File

@ -16,24 +16,22 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
VMWARECMD="/usr/bin/"
ONE_LOCATION = ENV["ONE_LOCATION"]
EC2_LOCATION = ENV["EC2_HOME"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
end
if !EC2_LOCATION
puts "EC2_LOCATION not set"
exit -1
end
$: << ONE_LOCATION+"/lib/ruby"
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << RUBY_LIB_LOCATION
require 'pp'
require 'one_mad'

View File

@ -19,4 +19,4 @@
#CLASSPATH=""
EC2_HOME="<path_to_ec2_utils>"
EC2_PRIVATE_KEY="<path_to_your_ec2_pem_key>"
EC2_CERT="<path_to_your_ec2_pem_cert"
EC2_CERT="<path_to_your_ec2_pem_cert>"

View File

@ -1,17 +1,22 @@
#!/bin/bash
if [ -z "${ONE_LOCATION}" ]; then
echo "Please, set ONE_LOCATION variable."
exit -1
DRIVERRC=/etc/one/vmm_kvm/vmm_kvmrc
MADCOMMON=/usr/lib/one/mads/madcommon.sh
VAR_LOCATION=/var/lib/one
else
DRIVERRC=$ONE_LOCATION/etc/vmm_kvm/vmm_kvmrc
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
VAR_LOCATION=$ONE_LOCATION/var
fi
. $ONE_LOCATION/libexec/madcommon.sh
. $MADCOMMON
# Export the vmm_mad specific rc
export_rc_vars $ONE_LOCATION/etc/vmm_kvm/vmm_kvmrc
export_rc_vars $DRIVERRC
# Go to ONE_LOCATION
cd $ONE_LOCATION
cd $VAR_LOCATION
# Execute the actual MAD
execute_mad $*
execute_mad $*

View File

@ -1,15 +1,15 @@
#!/usr/bin/env ruby
ONE_LOCATION=ENV["ONE_LOCATION"]
DEBUG_LEVEL=ENV["ONE_MAD_DEBUG"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'pp'

View File

@ -1,17 +1,22 @@
#!/bin/bash
if [ -z "${ONE_LOCATION}" ]; then
echo "Please, set ONE_LOCATION variable."
exit -1
DRIVERRC=/etc/one/vmm_xen/vmm_xenrc
MADCOMMON=/usr/lib/one/mads/madcommon.sh
VAR_LOCATION=/var/lib/one
else
DRIVERRC=$ONE_LOCATION/etc/vmm_xen/vmm_xenrc
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
VAR_LOCATION=$ONE_LOCATION/var
fi
. $ONE_LOCATION/libexec/madcommon.sh
. $MADCOMMON
# Export the vmm_mad specific rc
export_rc_vars $ONE_LOCATION/etc/vmm_xen/vmm_xenrc
export_rc_vars $DRIVERRC
# Go to ONE_LOCATION
cd $ONE_LOCATION
cd $VAR_LOCATION
# Execute the actual MAD
execute_mad
execute_mad $*

View File

@ -1,18 +1,18 @@
#!/usr/bin/env ruby
ONE_LOCATION=ENV["ONE_LOCATION"]
DEBUG_LEVEL=ENV["ONE_MAD_DEBUG"]
XENTOP_PATH=ENV["XENTOP_PATH"]
XM_PATH=ENV["XM_PATH"]
ONE_LOCATION=ENV["ONE_LOCATION"]
DEBUG_LEVEL=ENV["ONE_MAD_DEBUG"]
if !ONE_LOCATION
puts "ONE_LOCATION not set"
exit -1
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
end
$: << ONE_LOCATION+"/lib/ruby"
$: << RUBY_LIB_LOCATION
require 'pp'