1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-08-24 17:49:28 +03:00

Merge branch 'master' into feature-3782

This commit is contained in:
Ruben S. Montero
2015-06-08 23:44:21 +02:00
46 changed files with 921 additions and 182 deletions

7
NOTICE
View File

@ -1,6 +1,6 @@
OpenNebula Open Source Project
--------------------------------------------------------------------------------
Copyright 2002-2014, OpenNebula Project, OpenNebula Systems (formerly C12G Labs)
Copyright 2002-2015, OpenNebula Project, OpenNebula Systems (formerly C12G Labs)
--------------------------------------------------------------------------------
You can find more information about the project, release notes and
@ -21,11 +21,6 @@ The following people have contributed to the development of the technology
- Daniel Molina Aranda (dmolina@opennebula.org)
- Hector Sanjuan Redondo (hsanjuan@opennebula.org)
The new features for service elasticity (oneFlow) introduced in OpenNebula 4.2
were funded by BlackBerry in the context of the Fund a Feature Program.
OpenNebula Project also acknowledges the contributions of C12G Labs developers.
LICENSE
OpenNebula is licensed under the Apache License, Version 2.0 (the

View File

@ -187,11 +187,6 @@ public:
*/
static const char * PUBLIC_AUTH;
/**
* Name for the default auth driver to be used for not registered users
*/
static const char * DEFAULT_AUTH;
/**
* Name for the default Sunstone server user
*/

View File

@ -1018,6 +1018,7 @@ TM_SHARED_FILES="src/tm_mad/shared/clone \
src/tm_mad/shared/context \
src/tm_mad/shared/premigrate \
src/tm_mad/shared/postmigrate \
src/tm_mad/shared/failmigrate \
src/tm_mad/shared/mvds \
src/tm_mad/shared/snap_create \
src/tm_mad/shared/snap_delete \
@ -1034,6 +1035,7 @@ TM_FS_LVM_FILES="src/tm_mad/fs_lvm/clone \
src/tm_mad/fs_lvm/snap_create \
src/tm_mad/fs_lvm/snap_delete \
src/tm_mad/fs_lvm/snap_revert \
src/tm_mad/fs_lvm/failmigrate \
src/tm_mad/fs_lvm/delete"
TM_QCOW2_FILES="src/tm_mad/qcow2/clone \
@ -1045,6 +1047,7 @@ TM_QCOW2_FILES="src/tm_mad/qcow2/clone \
src/tm_mad/qcow2/context \
src/tm_mad/qcow2/premigrate \
src/tm_mad/qcow2/postmigrate \
src/tm_mad/qcow2/failmigrate \
src/tm_mad/qcow2/mvds \
src/tm_mad/qcow2/snap_create \
src/tm_mad/qcow2/snap_delete \
@ -1060,6 +1063,7 @@ TM_SSH_FILES="src/tm_mad/ssh/clone \
src/tm_mad/ssh/context \
src/tm_mad/ssh/premigrate \
src/tm_mad/ssh/postmigrate \
src/tm_mad/ssh/failmigrate \
src/tm_mad/ssh/mvds \
src/tm_mad/ssh/snap_create \
src/tm_mad/ssh/snap_delete \
@ -1075,6 +1079,7 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \
src/tm_mad/dummy/context \
src/tm_mad/dummy/premigrate \
src/tm_mad/dummy/postmigrate \
src/tm_mad/dummy/failmigrate \
src/tm_mad/dummy/mvds \
src/tm_mad/dummy/snap_create \
src/tm_mad/dummy/snap_delete \
@ -1094,6 +1099,7 @@ TM_VMFS_FILES="src/tm_mad/vmfs/clone \
src/tm_mad/vmfs/snap_create \
src/tm_mad/vmfs/snap_delete \
src/tm_mad/vmfs/snap_revert \
src/tm_mad/vmfs/failmigrate \
src/tm_mad/vmfs/premigrate"
TM_LVM_FILES="src/tm_mad/lvm/clone \
@ -1106,6 +1112,7 @@ TM_LVM_FILES="src/tm_mad/lvm/clone \
src/tm_mad/lvm/snap_create \
src/tm_mad/lvm/snap_delete \
src/tm_mad/lvm/snap_revert \
src/tm_mad/lvm/failmigrate \
src/tm_mad/lvm/delete"
TM_CEPH_FILES="src/tm_mad/ceph/clone \
@ -1118,6 +1125,7 @@ TM_CEPH_FILES="src/tm_mad/ceph/clone \
src/tm_mad/ceph/snap_create \
src/tm_mad/ceph/snap_delete \
src/tm_mad/ceph/snap_revert \
src/tm_mad/ceph/failmigrate \
src/tm_mad/ceph/delete"
TM_DEV_FILES="src/tm_mad/dev/clone \
@ -1130,6 +1138,7 @@ TM_DEV_FILES="src/tm_mad/dev/clone \
src/tm_mad/dev/snap_create \
src/tm_mad/dev/snap_delete \
src/tm_mad/dev/snap_revert \
src/tm_mad/dev/failmigrate \
src/tm_mad/dev/delete"
#-------------------------------------------------------------------------------

View File

@ -703,6 +703,13 @@ HM_MAD = [
# defined all the modules available will be enabled
# authz : list of authentication modules separated by commas
#
# DEFAULT_AUTH: The default authentication driver to use when OpenNebula does
# not know the user and needs to authenticate it externally. If you want to
# use "default" (not recommended, but supported for backwards compatibility
# reasons) make sure you create a symlink pointing to the actual authentication
# driver in /var/lib/one/remotes/auth, and add "default" to the 'auth'
# parameter in the 'AUTH_MAD' section.
#
# SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as
# valid. During this time, the driver is not used. Use 0 to disable session
# caching
@ -721,6 +728,8 @@ AUTH_MAD = [
authn = "ssh,x509,ldap,server_cipher,server_x509"
]
#DEFAULT_AUTH = "default"
SESSION_EXPIRATION_TIME = 900
#ENABLE_OTHER_PERMISSIONS = "YES"

View File

@ -0,0 +1,11 @@
Defaults:oneadmin !requiretty
Defaults:oneadmin secure_path = /sbin:/bin:/usr/sbin:/usr/bin
Cmnd_Alias ONE_MISC = /bin/dd, /sbin/mkfs, /bin/sync
Cmnd_Alias ONE_NET = /sbin/brctl, /sbin/ebtables, /sbin/iptables, /sbin/ip, /usr/sbin/ipset
Cmnd_Alias ONE_LVM = /sbin/lvcreate, /sbin/lvremove, /sbin/lvrename, /sbin/lvs, /sbin/vgdisplay
Cmnd_Alias ONE_ISCSI = /usr/bin/iscsiadm, /usr/sbin/tgt-admin, /usr/sbin/tgtadm
Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl
Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN

128
share/pkgs/Debian8/opennebula Executable file
View File

@ -0,0 +1,128 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: opennebula
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: mysql
# Should-Stop: mysql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenNebula init script
# Description: OpenNebula cloud initialisation script
### END INIT INFO
# Author: Soren Hansen <soren@canonical.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenNebula cloud"
NAME=one
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
mkdir -p /var/run/one /var/lock/one
chown oneadmin /var/run/one /var/lock/one
su oneadmin -s /bin/sh -c 'one start'
}
#
# Function that stops the daemon/service
#
do_stop()
{
su oneadmin -s /bin/sh -c 'one stop'
}
do_start_sched()
{
su oneadmin -s /bin/sh -c 'one start-sched'
}
do_stop_sched()
{
su oneadmin -s /bin/sh -c 'one stop-sched'
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "oned" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
restart-sched)
log_daemon_msg "Restarting scheduler"
do_stop_sched
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 3
;;
esac
:

View File

@ -0,0 +1,106 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: opennebula-econe
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ECONE Server init script
# Description: OpenNebula ECONE service initialisation script
### END INIT INFO
# Author: Tino Vázquez <tinova@opennebula.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="ECONE Service"
NAME=econe-server
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME
PID_FILE=/var/run/one/econe-server.pid
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
su oneadmin -s /bin/sh -c "$DAEMON start"
}
#
# Function that stops the daemon/service
#
do_stop()
{
su oneadmin -s /bin/sh -c "$DAEMON stop"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
ECONE_PID=`cat $PID_FILE`
kill -0 $ECONE_PID > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
log_daemon_msg "$NAME is running"
log_end_msg 0
else
log_daemon_msg "$NAME is not running"
log_end_msg 1
fi
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -0,0 +1,94 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: opennebula-flow
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OneFlow init script
# Description: OpenNebula OneFlow service initialisation script
### END INIT INFO
# Author: Tino Vázquez <tinova@opennebula.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OneFlow Service"
NAME=oneflow-server
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
su oneadmin -s /bin/sh -c "$DAEMON start"
}
#
# Function that stops the daemon/service
#
do_stop()
{
su oneadmin -s /bin/sh -c "$DAEMON stop"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -0,0 +1,94 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: opennebula-gate
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OneGate init script
# Description: OpenNebula OneGate service initialisation script
### END INIT INFO
# Author: Tino Vázquez <tinova@opennebula.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OneGate Service"
NAME=onegate-server
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
su oneadmin -s /bin/sh -c "$DAEMON start"
}
#
# Function that stops the daemon/service
#
do_stop()
{
su oneadmin -s /bin/sh -c "$DAEMON stop"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -0,0 +1,105 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: opennebula-novnc
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: novnc init script
# Description: OpenNebula novnc server
### END INIT INFO
# Author: Arnold Bechtoldt <mail@arnoldbechtoldt.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OpenNebula novnc server"
NAME=novnc-server
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/opennebula-novnc
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
mkdir -p /var/lock/one /var/log/one
chown oneadmin /var/lock/one /var/log/one
su oneadmin -s /bin/sh -c "$DAEMON start"
}
#
# Function that retrives the status of the daemon/service
#
do_status()
{
su oneadmin -s /bin/sh -c "$DAEMON status"
}
#
# Function that stops the daemon/service
#
do_stop()
{
su oneadmin -s /bin/sh -c "$DAEMON stop"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
do_status && exit 0 || exit $?
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -0,0 +1,108 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: opennebula-sunstone
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Sunstone init script
# Description: OpenNebula Sunstone web interface cloud initialisation script
### END INIT INFO
# Author: Jaime Melis <jmelis@opennebula.org>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Sunstone Web interface"
NAME=sunstone-server
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/opennebula-sunstone
PID_FILE=/var/run/one/sunstone.pid
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
service opennebula-novnc start
mkdir -p /var/run/one /var/lock/one /var/log/one
chown oneadmin /var/run/one /var/lock/one /var/log/one
su oneadmin -s /bin/sh -c "$DAEMON start-sunstone"
}
#
# Function that stops the daemon/service
#
do_stop()
{
su oneadmin -s /bin/sh -c "$DAEMON stop-sunstone"
service opennebula-novnc stop
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
SUNSTONE_PID=`cat $PID_FILE`
kill -0 $SUNSTONE_PID > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
log_daemon_msg "$NAME is running"
log_end_msg 0
else
log_daemon_msg "$NAME is not running"
log_end_msg 1
fi
;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -167,6 +167,11 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
NUM_THREADS = 15
def sync(host_ids, options)
if `id -u`.to_i == 0 || `id -G`.split.collect{|e| e.to_i}.include?(0)
STDERR.puts("Cannot run 'onehost sync' as root")
exit -1
end
begin
current_version = File.read(REMOTES_LOCATION+'/VERSION').strip
rescue

View File

@ -303,11 +303,11 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d['AR_ID']
end
column :OWNER, "", :left, :size=>10 do |d|
column :OWNER, "", :left, :size=>15 do |d|
if d['VM']
"VM : #{d['VM']}"
"V:#{d['VM']}"
elsif d['VNET']
"NET: #{d['VNET']}"
"N:#{d['VNET']}"
end
end
@ -319,7 +319,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
d["IP"]||"-"
end
column :IP6_GLOBAL, "", :donottruncate, :size=>31 do |d|
column :IP6_GLOBAL, "", :donottruncate, :size=>26 do |d|
d["IP6_GLOBAL"]||"-"
end
end.show(leases, {})

View File

@ -216,84 +216,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
vms_desc = <<-EOT.unindent
Import vCenter running Virtual Machines into OpenNebula
Deprecated action in onevcenter, please use onehost importvm instead
EOT
command :vms, vms_desc, :options=>[ VCENTER, USER, PASS ] do
if options[:vuser].nil? ||
options[:vpass].nil? ||
options[:vcenter].nil?
STDERR.puts "vCenter connection parameters are mandatory to import"\
" VM templates:\n"\
"\t --vcenter vCenter hostname\n"\
"\t --vuser username to login in vcenter\n"\
"\t --vpass password for the user"
exit -1
end
STDERR.puts "Deprecated action in onevcenter, please use onehost "\
"importvm instead"
begin
STDOUT.print "\nConnecting to vCenter: #{options[:vcenter]}..."
vc = VCenterDriver::VIClient.new_connection(
:user => options[:vuser],
:password => options[:vpass],
:host => options[:vcenter])
STDOUT.print "done!\n\n"
STDOUT.print "Looking for running Virtual Machines..."
rs = vc.running_vms
STDOUT.print "done!\n"
rs.each {|dc, tmps|
STDOUT.print "\nDo you want to process datacenter #{dc} [y/n]? "
next if STDIN.gets.strip.downcase != 'y'
if tmps.empty?
STDOUT.print " No new running Virtual Machines found in"\
" #{dc}...\n\n"
next
end
tmps.each{ |v|
STDOUT.print "\n * Running Virtual Machine found:\n"\
" - Name : #{v[:name]}\n"\
" - UUID : #{v[:uuid]}\n"\
" - Cluster: #{v[:host]}\n"\
" Import this Virtual Machine [y/n]? "
next if STDIN.gets.strip.downcase != 'y'
one_v = ::OpenNebula::VirtualMachine.new(
::OpenNebula::VirtualMachine.build_xml, vc.one)
rc = one_v.allocate(v[:one])
if ::OpenNebula.is_error?(rc)
STDOUT.puts " Error creating Virtual Machine: "\
"#{rc.message}\n"
end
rc = one_v.deploy v[:host_id]
if ::OpenNebula.is_error?(rc)
STDOUT.puts " Error creating Virtual Machine: "\
"#{rc.message}\n"
else
STDOUT.puts " OpenNebula VM #{one_v.id} "\
"created!\n"
end
}
}
rescue Exception => e
STDOUT.puts "error: #{e.message}"
exit -1
end
exit 0
exit -1
end
network_desc = <<-EOT.unindent

View File

@ -52,6 +52,7 @@ done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/STAGING_DIR \
/DS_DRIVER_ACTION_DATA/DATASTORE/TYPE \
/DS_DRIVER_ACTION_DATA/IMAGE/PATH \
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5 \
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1 \
@ -65,6 +66,7 @@ RESTRICTED_DIRS="${XPATH_ELEMENTS[i++]}"
SAFE_DIRS="${XPATH_ELEMENTS[i++]}"
BRIDGE_LIST="${XPATH_ELEMENTS[i++]}"
STAGING_DIR="${XPATH_ELEMENTS[i++]:-/var/tmp}"
TYPE="${XPATH_ELEMENTS[i++]}"
SRC="${XPATH_ELEMENTS[i++]}"
MD5="${XPATH_ELEMENTS[i++]}"
SHA1="${XPATH_ELEMENTS[i++]}"
@ -76,6 +78,11 @@ IMAGE_HASH=`basename $DST`
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS"
# Disable auto-decompress for the 'files' datastores (type 2)
if [ "$TYPE" = "2" ]; then
NO_DECOMPRESS="${NO_DECOMPRESS:-yes}"
fi
if [ -n "$BRIDGE_LIST" ]; then
DOWNLOADER_ARGS=`set_downloader_args "$MD5" "$SHA1" "$NO_DECOMPRESS" "$LIMIT_TRANSFER_BW" "$SRC" -`
else

View File

@ -26,6 +26,8 @@ end
# TODO : use virsh freecell when available
######
ENV['LANG'] = 'C'
nodeinfo_text = `virsh -c qemu:///system nodeinfo`
exit(-1) if $?.exitstatus != 0
@ -40,36 +42,31 @@ nodeinfo_text.split(/\n/).each{|line|
}
######
# for everything else, top & proc
#####
# CPU
######
vmstat = `vmstat 1 2`
$free_cpu = $total_cpu * ((vmstat.split("\n").to_a.last.split)[14].to_i)/100
$used_cpu = $total_cpu - $free_cpu
NETINTERFACE = "eth|bond|em|p[0-9]+p[0-9]+"
######
# MEMORY
######
memory = `cat /proc/meminfo`
meminfo = Hash.new()
memory.each_line do |line|
key, value = line.split(':')
meminfo[key] = /\d+/.match(value)[0].to_i
end
top_text=`top -bin2`
exit(-1) if $?.exitstatus != 0
$total_memory = meminfo['MemTotal']
top_text.gsub!(/^top.*^top.*?$/m, "") # Strip first top output
$used_memory = meminfo['MemTotal'] - meminfo['MemFree'] - meminfo['Buffers'] - meminfo['Cached']
$free_memory = $total_memory - $used_memory
top_text.split(/\n/).each{|line|
if line.match('^%?Cpu')
line[7..-1].split(",").each{|elemento|
temp = elemento.strip.split(/[% ]/)
if temp[1]=="id"
idle = temp[0]
$free_cpu = idle.to_f * $total_cpu.to_f / 100
$used_cpu = $total_cpu.to_f - $free_cpu
break
end
}
end
}
$total_memory = `free -k|grep "Mem:" | awk '{print $2}'`
tmp=`free -k|grep "buffers\/cache"|awk '{print $3 " " $4}'`.split
$used_memory=tmp[0]
$free_memory=tmp[1]
######
# INTERFACE
######
NETINTERFACE = "eth|bond|em|enp|p[0-9]+p[0-9]+"
net_text=`cat /proc/net/dev`
exit(-1) if $?.exitstatus != 0

View File

@ -320,7 +320,7 @@ function mkfs_command {
OPTS="-F"
;;
"reiserfs")
"reiserfs"|"xfs")
OPTS="-f -q"
;;
@ -355,7 +355,9 @@ function mkfs_command {
return 0
;;
*)
OPTS=""
echo ""
echo "Filesystem '$FSTYPE' not valid." 1>&2
return 1
;;
esac

View File

@ -356,11 +356,18 @@ void OpenNebulaTemplate::set_conf_default()
#*******************************************************************************
# Auth Manager Configuration
#*******************************************************************************
# DEFAULT_AUTH
# SESSION_EXPIRATION_TIME
# ENABLE_OTHER_PERMISSIONS
# DEFAULT_UMASK
#*******************************************************************************
*/
// DEFAULT_AUTH
value = "default";
attribute = new SingleAttribute("DEFAULT_AUTH",value);
conf_default.insert(make_pair(attribute->name(),attribute));
// SESSION_EXPIRATION_TIME
value = "0";

View File

@ -130,7 +130,7 @@ module OpenNebula
raise "ONE_AUTH file not present"
end
@one_auth.rstrip!
@one_auth = @one_auth.rstrip
if endpoint
@one_endpoint = endpoint
@ -144,6 +144,8 @@ module OpenNebula
@one_endpoint = "http://localhost:2633/RPC2"
end
@one_endpoint= @one_endpoint.rstrip
@async = !options[:sync]
timeout=nil

View File

@ -503,7 +503,7 @@ if (Config.isTemplateCreationTabEnabled('input_output')){
'</label>'+
'<input type="text" id="PORT" name="port" />'+
'</div>'+
'<div class="large-6 columns hypervisor only_kvm only_vmware only_xen">'+
'<div class="large-6 columns">'+
'<label for="KEYMAP">'+tr("Keymap")+
'<span class="tip">'+tr("Keyboard configuration locale to use in the VNC/SPICE display")+'</span>'+
'</label>'+

View File

@ -87,26 +87,6 @@ get '/vcenter/templates' do
end
end
get '/vcenter/vms' do
begin
vms = vcenter_client.running_vms(
$cloud_auth.client(session[:user], session[:active_zone_endpoint]))
if vms.nil?
msg = "No datacenter found"
logger.error("[vCenter] " + msg)
error = Error.new(msg)
error 404, error.to_json
end
[200, vms.to_json]
rescue Exception => e
logger.error("[vCenter] " + e.message)
error = Error.new(e.message)
error 403, error.to_json
end
end
get '/vcenter/networks' do
begin
networks = vcenter_client.vcenter_networks(

1
src/tm_mad/ceph/failmigrate Symbolic link
View File

@ -0,0 +1 @@
../common/failmigrate

29
src/tm_mad/common/failmigrate Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2015, 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. #
#--------------------------------------------------------------------------- #
# FAILMIGRATE SOURCE DST remote_system_dir vmid dsid template
# - SOURCE is the host where the VM is running
# - DST is the host where the VM failed to be migrated
# - remote_system_dir is the path for the VM home in the system datastore
# - vmid is the id of the VM
# - dsid is the target datastore
# - template is the template of the VM in XML and base64 encoded
# To access the vm_template you can use the xpath.rb utility. Check the
# datastore drivers for an example.
exit 0

1
src/tm_mad/dev/failmigrate Symbolic link
View File

@ -0,0 +1 @@
../common/failmigrate

View File

@ -0,0 +1 @@
../common/failmigrate

View File

@ -0,0 +1 @@
../common/failmigrate

1
src/tm_mad/lvm/failmigrate Symbolic link
View File

@ -0,0 +1 @@
../common/failmigrate

View File

@ -0,0 +1 @@
../common/failmigrate

View File

@ -0,0 +1 @@
../common/failmigrate

1
src/tm_mad/ssh/failmigrate Symbolic link
View File

@ -0,0 +1 @@
../common/failmigrate

1
src/tm_mad/vmfs/failmigrate Symbolic link
View File

@ -0,0 +1 @@
../common/failmigrate

View File

@ -36,7 +36,6 @@
const char * UserPool::CORE_AUTH = "core";
const char * UserPool::SERVER_AUTH = "server*";
const char * UserPool::PUBLIC_AUTH = "public";
const char * UserPool::DEFAULT_AUTH = "default";
const char * UserPool::SERVER_NAME = "serveradmin";
@ -248,7 +247,7 @@ error_no_open:
erro_exists:
oss << "Password file " << filenames[i] << " already exists "
<< "but OpenNebula is boostraping the database. Check your "
<< "but OpenNebula is boostraping the database. Check your "
<< "database configuration in oned.conf.";
goto error_common;
@ -713,6 +712,7 @@ bool UserPool::authenticate_external(const string& username,
string mad_pass;
string error_str;
string tmp_str;
string default_auth;
Nebula& nd = Nebula::instance();
AuthManager * authm = nd.get_authm();
@ -734,7 +734,9 @@ bool UserPool::authenticate_external(const string& username,
}
//Initialize authentication request and call the driver
ar.add_authenticate(UserPool::DEFAULT_AUTH, username,"-",token);
nd.get_configuration_attribute("DEFAULT_AUTH",default_auth);
ar.add_authenticate(default_auth, username,"-",token);
authm->trigger(AuthManager::AUTHENTICATE, &ar);
ar.wait();

View File

@ -478,9 +478,11 @@ class ExecDriver < VirtualMachineDriver
action = VmmAction.new(self, id, :migrate, drv_message)
pre = "PRE"
post = "POST"
failed = "FAIL"
pre << action.data[:tm_command] << " " << action.data[:vm]
post << action.data[:tm_command] << " " << action.data[:vm]
failed << action.data[:tm_command] << " " << action.data[:vm]
steps=[
# Execute a pre-migrate TM setup
@ -499,7 +501,15 @@ class ExecDriver < VirtualMachineDriver
{
:driver => :vmm,
:action => :migrate,
:parameters => [:deploy_id, :dest_host, :host]
:parameters => [:deploy_id, :dest_host, :host],
:fail_actions => [
{
:driver => :tm,
:action => :tm_failmigrate,
:parameters => failed.split,
:no_fail => true
}
]
},
# Execute networking clean up operations
# NOTE: VM is now in the new host. If we fail from now on, oned will

View File

@ -146,7 +146,50 @@ class VIClient
# The associated resource pool for this connection
########################################################################
def resource_pool
return @cluster.resourcePool
rp_name = @one_host["TEMPLATE/VCENTER_RESOURCE_POOL"]
if rp_name.nil?
@cluster.resourcePool
else
find_resource_pool(rp_name)
end
end
########################################################################
# Searches the desired ResourcePool of the DataCenter for the current
# connection. Returns a RbVmomi::VIM::ResourcePool or the default pool
# if not found
# @param rpool [String] the ResourcePool name
########################################################################
def find_resource_pool(poolName)
baseEntity = @cluster
entityArray = poolName.split('/')
entityArray.each do |entityArrItem|
if entityArrItem != ''
if baseEntity.is_a? RbVmomi::VIM::Folder
baseEntity = baseEntity.childEntity.find { |f|
f.name == entityArrItem
} or return @cluster.resourcePool
elsif baseEntity.is_a? RbVmomi::VIM::ClusterComputeResource
baseEntity = baseEntity.resourcePool.resourcePool.find { |f|
f.name == entityArrItem
} or return @cluster.resourcePool
elsif baseEntity.is_a? RbVmomi::VIM::ResourcePool
baseEntity = baseEntity.resourcePool.find { |f|
f.name == entityArrItem
} or return @cluster.resourcePool
else
return @cluster.resourcePool
end
end
end
if !baseEntity.is_a?(RbVmomi::VIM::ResourcePool) and
baseEntity.respond_to?(:resourcePool)
baseEntity = baseEntity.resourcePool
end
baseEntity
end
########################################################################
@ -538,7 +581,8 @@ class VCenterHost < ::OpenNebula::Host
############################################################################
# Generate an OpenNebula monitor string for this host. Reference:
# https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.ComputeResource.Summary.html
# https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/Reference
# Guide/vim.ComputeResource.Summary.html
# - effectiveCpu: Effective CPU resources (in MHz) available to run
# VMs. This is the aggregated from all running hosts excluding hosts in
# maintenance mode or unresponsive are not counted.
@ -690,6 +734,22 @@ class VCenterVm
hid = VIClient::translate_hostname(hostname)
connection = VIClient.new(hid)
vm = connection.find_vm_template(deploy_id)
# Find out if we need to reconfigure capacity
xml = REXML::Document.new xml_text
expected_cpu = xml.root.elements["//TEMPLATE/CPU"].text
expected_memory = xml.root.elements["//TEMPLATE/MEMORY"].text
current_cpu = vm.config.hardware.numCPU
current_memory = vm.config.hardware.memoryMB
if current_cpu != expected_cpu or current_memory != expected_memory
capacity_hash = {:numCPUs => expected_cpu.to_i,
:memoryMB => expected_memory }
spec = RbVmomi::VIM.VirtualMachineConfigSpec(capacity_hash)
vm.ReconfigVM_Task(:spec => spec).wait_for_completion
end
vm.PowerOnVM_Task.wait_for_completion
return vm.config.uuid
end
@ -1058,6 +1118,8 @@ class VCenterVm
#
########################################################################
def vm_to_one
host_name = @vm.runtime.host.parent.name
str = "NAME = \"#{@vm.name}\"\n"\
"CPU = \"#{@vm.config.hardware.numCPU}\"\n"\
"vCPU = \"#{@vm.config.hardware.numCPU}\"\n"\
@ -1068,21 +1130,25 @@ class VCenterVm
" VM_TEMPLATE =\"#{@vm.config.uuid}\"\n"\
"]\n"\
"IMPORT_VM_ID = \"#{@vm.config.uuid}\"\n"\
"SCHED_REQUIREMENTS=\"NAME=\\\"#{@vm.runtime.host.parent.name}\\\"\"\n"
"SCHED_REQUIREMENTS=\"NAME=\\\"#{host_name}\\\"\"\n"
vp=@vm.config.extraConfig.select{|v| v[:key]=="remotedisplay.vnc.port"}
vp = @vm.config.extraConfig.select{|v|
v[:key]=="remotedisplay.vnc.port"}
keymap = @vm.config.extraConfig.select{|v|
v[:key]=="remotedisplay.vnc.keymap"}
if vp.size > 0
str << "GRAPHICS = [\n"\
" TYPE =\"vnc\",\n"\
" LISTEN =\"0.0.0.0\",\n"\
" PORT =\"#{vp[0][:value]}\"\n"\
"]\n"
" PORT =\"#{vp[0][:value]}\"\n"
str << " ,KEYMAP =\"#{keymap[0][:value]}\"\n" if keymap
str << "]\n"
end
if @vm.config.annotation.nil? || @vm.config.annotation.empty?
str << "DESCRIPTION = \"vCenter Virtual Machine imported by OpenNebula"\
" from Cluster #{@vm.runtime.host.parent.name}\"\n"
str << "DESCRIPTION = \"vCenter Virtual Machine imported by"\
" OpenNebula from Cluster #{@vm.runtime.host.parent.name}\"\n"
else
notes = @vm.config.annotation.gsub("\\", "\\\\").gsub("\"", "\\\"")
str << "DESCRIPTION = \"#{notes}\"\n"
@ -1193,7 +1259,6 @@ private
def self.clone_vm(xml_text)
xml = REXML::Document.new xml_text
pcs = xml.root.get_elements("//USER_TEMPLATE/PUBLIC_CLOUD")
raise "Cannot find VCenter element in VM template." if pcs.nil?
@ -1210,33 +1275,29 @@ private
raise "Cannot find VM_TEMPLATE in VCenter element." if uuid.nil?
uuid = uuid.text
vmid = xml.root.elements["/VM/ID"].text
hid = xml.root.elements["//HISTORY_RECORDS/HISTORY/HID"]
raise "Cannot find host id in deployment file history." if hid.nil?
context = xml.root.elements["//TEMPLATE/CONTEXT"]
connection = VIClient.new(hid)
vc_template = connection.find_vm_template(uuid)
relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
:diskMoveType => :moveChildMostDiskBacking,
:pool => connection.resource_pool)
:diskMoveType => :moveChildMostDiskBacking,
:pool => connection.resource_pool)
clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(
:location => relocate_spec,
:powerOn => false,
:template => false)
:location => relocate_spec,
:powerOn => false,
:template => false)
begin
vm = vc_template.CloneVM_Task(
:folder => vc_template.parent,
:name => "one-#{vmid}",
:spec => clone_spec).wait_for_completion
:folder => vc_template.parent,
:name => "one-#{vmid}",
:spec => clone_spec).wait_for_completion
rescue Exception => e
if !e.message.start_with?('DuplicateName')
@ -1247,8 +1308,7 @@ private
raise "Cannot clone VM Template" if vm.nil?
vm.Destroy_Task.wait_for_completion
vm.Destroy_Task.wait_for_completion
vm = vc_template.CloneVM_Task(
:folder => vc_template.parent,
:name => "one-#{vmid}",
@ -1257,8 +1317,11 @@ private
vm_uuid = vm.config.uuid
# VNC Section
vnc_port = xml.root.elements["/VM/TEMPLATE/GRAPHICS/PORT"]
vnc_listen = xml.root.elements["/VM/TEMPLATE/GRAPHICS/LISTEN"]
vnc_keymap = xml.root.elements["/VM/TEMPLATE/GRAPHICS/KEYMAP"]
if !vnc_listen
vnc_listen = "0.0.0.0"
@ -1271,11 +1334,16 @@ private
if vnc_port
config_array +=
[{:key=>"remotedisplay.vnc.enabled", :value=>"TRUE"},
{:key=>"remotedisplay.vnc.port", :value=>vnc_port.text},
{:key=>"remotedisplay.vnc.ip", :value=>vnc_listen}]
[{:key=>"remotedisplay.vnc.enabled",:value=>"TRUE"},
{:key=>"remotedisplay.vnc.port", :value=>vnc_port.text},
{:key=>"remotedisplay.vnc.ip", :value=>vnc_listen}]
end
config_array += [{:key=>"remotedisplay.vnc.keymap",
:value=>vnc_keymap.text}] if vnc_keymap
# Context section
if context
# Remove <CONTEXT> (9) and </CONTEXT>\n (11)
context_text = "# Context variables generated by OpenNebula\n"
@ -1293,7 +1361,8 @@ private
context_vnc_spec = {:extraConfig =>config_array}
end
# Take care of the NIC section, build the reconfig hash
# NIC section, build the reconfig hash
nics = xml.root.get_elements("//TEMPLATE/NIC")
nic_spec = {}
@ -1309,12 +1378,19 @@ private
nic_spec = {:deviceChange => nic_array}
end
if !context_vnc_spec.empty? or !nic_spec.empty?
spec_hash = context_vnc_spec.merge(nic_spec)
spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)
vm.ReconfigVM_Task(:spec => spec).wait_for_completion
end
# Capacity section
cpu = xml.root.elements["//TEMPLATE/CPU"].text
memory = xml.root.elements["//TEMPLATE/MEMORY"].text
capacity_spec = {:numCPUs => cpu.to_i,
:memoryMB => memory }
# Perform the VM reconfiguration
spec_hash = context_vnc_spec.merge(nic_spec).merge(capacity_spec)
spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)
vm.ReconfigVM_Task(:spec => spec).wait_for_completion
# Power on the VM
vm.PowerOnVM_Task.wait_for_completion
return vm_uuid

View File

@ -28,6 +28,7 @@ $: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'vmware_driver'
require 'vi_driver'
#------------------------------------------------------------------------------
# Wait the VM to shutdown TIMEOUT (xPOLL_INTERVAL) seconds.
@ -39,12 +40,14 @@ TIMEOUT=300
deploy_id = ARGV[0]
host = ARGV[1]
VIDriver::initialize(host)
vmware_drv = VMwareDriver.new(host)
vmware_drv.shutdown(deploy_id)
count=0
while (vmware_drv.poll(deploy_id).match(/STATE=(.*)/)[1] != "d") do
while (VIDriver::poll_vm(deploy_id).match(/STATE=(.*)/)[1] != "d") do
sleep POLL_INTERVAL
if count > TIMEOUT then
OpenNebula.log_debug("Timeout reached and VM #{deploy_id} is still alive.")

View File

@ -62,8 +62,15 @@ class EbtablesVLAN < VNMMAD::VNMDriver
def deactivate
lock
attach_nic_id = @vm['TEMPLATE/NIC[ATTACH="YES"]/NIC_ID']
process do |nic|
if attach_nic_id && attach_nic_id != nic[:nic_id]
next
end
mac = nic[:mac]
# remove 0-padding
mac = mac.split(":").collect{|e| e.hex.to_s(16)}.join(":")

View File

@ -40,7 +40,7 @@ module VNMMAD
lock
vm_id = @vm['ID']
process do |nic|
#:white_ports_tcp => iptables_range
#:white_ports_udp => iptables_range
@ -93,8 +93,15 @@ module VNMMAD
def deactivate
lock
vm_id = @vm['ID']
vm_id = @vm['ID']
attach_nic_id = @vm['TEMPLATE/NIC[ATTACH="YES"]/NIC_ID']
process do |nic|
if attach_nic_id && attach_nic_id != nic[:nic_id]
next
end
chain = "one-#{vm_id}-#{nic[:network_id]}"
iptables_out = `#{command(:iptables)} -n -v --line-numbers -L FORWARD`
if m = iptables_out.match(/.*#{chain}.*/)
@ -196,4 +203,4 @@ module VNMMAD
"#{command(:iptables)} #{rule}"
end
end
end
end

View File

@ -23,7 +23,7 @@ module VNMMAD
DRIVER = "sg"
XPATH_FILTER = "TEMPLATE/NIC"
# Creates a new SG driver and scans SG Rules
def initialize(vm, deploy_id = nil, hypervisor = nil)
super(vm, XPATH_FILTER, deploy_id, hypervisor)
@ -48,7 +48,7 @@ module VNMMAD
@security_group_rules = rules
end
# Activate the rules, bootstrap iptables chains and set filter rules for
# Activate the rules, bootstrap iptables chains and set filter rules for
# each VM NIC
def activate
deactivate
@ -68,7 +68,7 @@ module VNMMAD
sg_ids.each do |sg_id|
rules = @security_group_rules[sg_id]
sg = SGIPTables::SecurityGroupIPTables.new(@vm, nic, sg_id,
sg = SGIPTables::SecurityGroupIPTables.new(@vm, nic, sg_id,
rules)
begin
@ -92,7 +92,13 @@ module VNMMAD
lock
begin
attach_nic_id = @vm['TEMPLATE/NIC[ATTACH="YES"]/NIC_ID']
@vm.nics.each do |nic|
if attach_nic_id && attach_nic_id != nic[:nic_id]
next
end
SGIPTables.nic_deactivate(@vm, nic)
end
rescue Exception => e

View File

@ -72,7 +72,13 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
def deactivate
lock
attach_nic_id = @vm['TEMPLATE/NIC[ATTACH="YES"]/NIC_ID']
process do |nic|
if attach_nic_id && attach_nic_id != nic[:nic_id]
next
end
@nic = nic
# Remove flows