1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-27 14:03:40 +03:00

Merge branch 'master' into feature-1437

Conflicts:
	install.sh
This commit is contained in:
Tino Vazquez 2012-09-20 19:03:19 +02:00
commit 6281564810
109 changed files with 3646 additions and 1850 deletions

View File

@ -46,6 +46,7 @@ public:
{
SUSPEND_SUCCESS,/**< Send by LCM when a VM is suspended*/
STOP_SUCCESS, /**< Send by LCM when a VM is stopped*/
POWEROFF_SUCCESS, /**< Send by LCM when a VM is powered off */
DONE, /**< Send by LCM when a VM is shut down*/
FAILED, /**< Send by LCM when one of the execution steps fails*/
RESUBMIT, /**< Send by LCM when a VM is ready for resubmission*/
@ -129,6 +130,15 @@ public:
int shutdown (
int vid);
/**
* Powers off a VM.
* @param vid VirtualMachine identification
* @return 0 on success, -1 if the VM does not exits or -2 if the VM is
* in a wrong a state
*/
int poweroff (
int vid);
/**
* Holds a VM.
* @param vid VirtualMachine identification
@ -317,6 +327,8 @@ private:
void stop_success_action(int vid);
void poweroff_success_action(int vid);
void done_action(int vid);
void failed_action(int vid);

View File

@ -70,6 +70,7 @@ public:
MIGRATE, /**< Sent by the DM to migrate a VM to other host */
LIVE_MIGRATE, /**< Sent by the DM to live-migrate a VM */
SHUTDOWN, /**< Sent by the DM to shutdown a running VM */
POWEROFF, /**< Sent by the DM to power off a running VM */
RESTART, /**< Sent by the DM to restart a deployed VM */
DELETE, /**< Sent by the DM to delete a VM */
CLEAN, /**< Sent by the DM to cleanup a VM for resubmission*/
@ -202,6 +203,8 @@ private:
void shutdown_action(int vid);
void poweroff_action(int vid);
void failure_action(VirtualMachine * vm);
void restart_action(int vid);

View File

@ -128,6 +128,15 @@ public:
VirtualMachine * vm,
const VectorAttribute * disk,
ostream& xfr);
/**
* Inserts a transfer command in the xfs stream, for live migration
*
* @param vm The VM
* @param xfr Stream where the transfer command will be written
*/
void migrate_transfer_command(
VirtualMachine * vm,
ostream& xfr);
private:
/**
@ -275,4 +284,3 @@ private:
};
#endif /*TRANSFER_MANAGER_H*/

View File

@ -56,7 +56,8 @@ public:
STOPPED = 4,
SUSPENDED = 5,
DONE = 6,
FAILED = 7
FAILED = 7,
POWEROFF = 8
};
/**
@ -81,7 +82,8 @@ public:
FAILURE = 14,
CLEANUP = 15,
UNKNOWN = 16,
HOTPLUG = 17
HOTPLUG = 17,
SHUTDOWN_POWEROFF = 18
};
// -------------------------------------------------------------------------

1223
install.sh

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ digraph OpenNebula {
color="white" }
subgraph { rank = max; suspended; done; failure;
stopped;color="white" }
stopped; poweroff; color="white" }
# create
user -> pending [label="create"];
@ -42,6 +42,10 @@ digraph OpenNebula {
shutdown -> epilog [style="dashed"];
epilog -> done [style="dashed"];
# poweroff
running -> shutdown_poweroff [label="poweroff"];
shutdown_poweroff -> poweroff [style="dashed"];
# livemigrate
running -> migrate [label="livemigrate"];
migrate -> running [style="dashed"];
@ -80,6 +84,7 @@ digraph OpenNebula {
# restart
unknown -> boot [label="restart"];
boot -> boot [label="restart"];
poweroff -> boot [label="restart"];
# reboot, reset
running -> running [label="reboot / reset"];

View File

@ -23,7 +23,7 @@ digraph OpenNebula {
subgraph { rank = same; prolog; boot; color="white" }
subgraph { rank = same; migrate; save; shutdown; unknown; hotplug;
color="white" }
subgraph { rank = max; suspended; done; failure; stopped; color="white" }
subgraph { rank = max; suspended; done; failure; stopped; poweroff; color="white" }
# create
user -> pending [label="create"];
@ -35,9 +35,13 @@ digraph OpenNebula {
# shutdown
running -> shutdown [label="shutdown"];
shutdown -> epilog [style="dashed"];
shutdown -> epilog [label="shutdown", style="dashed"];
epilog -> done [style="dashed"];
# poweroff
running -> shutdown [label="poweroff"];
shutdown -> poweroff [label="poweroff", style="dashed"];
# livemigrate
running -> migrate [label="livemigrate"];
migrate -> running [label="livemigrate", style="dashed"];
@ -75,6 +79,7 @@ digraph OpenNebula {
# restart
unknown -> boot [label="restart"];
boot -> boot [label="restart"];
poweroff -> boot [label="restart"];
# reboot, reset
running -> running [label="reboot / reset"];

View File

@ -0,0 +1,83 @@
Here are located the files needed to generate OpenNebula contextualization packages. The packages generated contain these files:
* `/etc/udev/rules.d/*` These files disable the udev network an cdrom
generation
* `/etc/init.d/vmcontext` This is the startup script that will try to mount
context cdrom, load contextualizaton variables,
call scripts in the contextualization scripts
directory and call init.sh if it exists in the
context cd.
* `/etc/one-context.d/*` This directory holds the scripts that will be
called by vmcontext script. They should be named
starting with a number so they are called in order.
By default only the network configuration context script is included in the
packages. These scripts are different for rpm and deb based distributions and
are located in `base_<deb|rpm>` directories.
The packages also have a post-install script that does this steps:
* Delete persistent cd and net rules from /etc/udev/rules.d
* Links vmcontext script to /etc/rc<runlevel>.d
* Deletes network configuration files
# GENERATOR
## Requirements
* Ruby >= 1.8.7
* gem fpm
* dpkg utils for deb package creation
* rpm utils for rpm package creation
On Ubuntu/Debian you can install the package `rpm` and you will be able to generate both rpm and deb packages.
## Description
The script `generator.sh` generates both deb and rpm packages and can be configured to include more files in the package or change some of its parameters.
On start it creates a temporary directory and copies there:
* `base` directory
* `base_<deb|rpm>` directory
* Any file or directory from the arguments.
Then these files are included in the package
## Usage
The default parameters to create a package are as follows:
VERSION=1.0.1
MAINTAINER=C12G Labs <support@c12g.com>
LICENSE=Apache
PACKAGE_NAME=one-context
VENDOR=C12G Labs
DESCRIPTION="
This package prepares a VM image for OpenNebula:
* Disables udev net and cd persistent rules
* Deletes udev net and cd persistent rules
* Unconfigures the network
* Adds OpenNebula contextualization scripts to startup
To get support use the OpenNebula mailing list:
http://opennebula.org/community:mailinglists
"
PACKAGE_TYPE=deb
URL=http://opennebula.org
You can change any parameter setting an environment variable with the same name. For example, to generate an rpm package with a different package name:
$ PACKAGE_TYPE=rpm PACKAGE_NAME=my-context ./generate.sh
You can also include new files. This is handy to, for example, include new scripts executed to contextualize an image. For example, we can have an script that install a user ssh key. We will create the file hierarchy that will go inside the package in a directory:
$ mkdir -p ssh/etc/one-context.d
$ cp <our-ssh-script> ssh/etc/one-context.d/01-ssh-key
$ ./generate.sh ssh/etc
NOTE: The generator must be executed from the same directory it resides.

View File

@ -0,0 +1,70 @@
#!/bin/bash
#
# chkconfig: 2345 9 90
# description: network reconfigure
#
# -------------------------------------------------------------------------- #
# Copyright 2010-2012, C12G Labs S.L. #
# #
# 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. #
#--------------------------------------------------------------------------- #
### BEGIN INIT INFO
# Provides: vmcontext
# Required-Start:
# Required-Stop:
# Should-Start: networking
# Should-Stop: networking
# Default-Start:
# Default-Stop: 0 6
# Short-Description: OpenNebula contextualization script
### END INIT INFO
function export_rc_vars
{
if [ -f $1 ] ; then
ONE_VARS=`cat $1 | egrep -e '^[a-zA-Z\-\_0-9]*=' | sed 's/=.*$//'`
. $1
for v in $ONE_VARS; do
export $v
done
fi
}
function execute_scripts {
SCRIPTS_DIR="/etc/one-context.d"
for script in $SCRIPTS_DIR/*; do
$script
done
}
CDROM_DEVICE=$(ls /dev/cdrom* /dev/scd* | sort | head -n 1)
if [ -e "$CDROM_DEVICE" ]; then
mount -t iso9660 $CDROM_DEVICE /mnt
if [ -f /mnt/context.sh ]; then
export_rc_vars /mnt/context.sh
fi
execute_scripts
if [ -f /mnt/init.sh ]; then
/mnt/init.sh
fi
umount /mnt
else
execute_scripts
fi

View File

@ -0,0 +1,155 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2010-2012, C12G Labs S.L. #
# #
# 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. #
#--------------------------------------------------------------------------- #
# Gets IP address from a given MAC
mac2ip() {
mac=$1
let ip_a=0x`echo $mac | cut -d: -f 3`
let ip_b=0x`echo $mac | cut -d: -f 4`
let ip_c=0x`echo $mac | cut -d: -f 5`
let ip_d=0x`echo $mac | cut -d: -f 6`
ip="$ip_a.$ip_b.$ip_c.$ip_d"
echo $ip
}
# Gets the network part of an IP
get_network() {
network=$(get_iface_var "NETWORK")
if [ -z "$network" ]; then
network="$(echo $IP | cut -d'.' -f1,2,3).0"
fi
echo $network
}
# Gets the network mask
get_mask() {
mask=$(get_iface_var "MASK")
if [ -z "$mask" ]; then
mask="255.255.255.0"
fi
echo $mask
}
# Gets the network gateway
get_gateway() {
gateway=$(get_iface_var "GATEWAY")
if [ -z "$gateway" ]; then
if [ "$DEV" = "eth0" ]; then
net_prefix=$(echo $NETWORK | cut -d'.' -f1,2,3)
gateway="${net_prefix}.1"
fi
fi
echo $gateway
}
get_interfaces() {
IFCMD="/sbin/ifconfig -a"
$IFCMD | grep ^eth | sed 's/ *Link encap:Ethernet.*HWaddr /-/g'
}
get_dev() {
echo $1 | cut -d'-' -f 1
}
get_mac() {
echo $1 | cut -d'-' -f 2
}
get_ip() {
ip=$(get_iface_var "IP")
if [ -z "$ip" ]; then
ip=$(mac2ip $MAC)
fi
echo $ip
}
get_iface_var() {
var_name="${UPCASE_DEV}_$1"
var=$(eval "echo \"\${$var_name}\"")
echo $var
}
upcase() {
echo "$*" | tr '[:lower:]' '[:upper:]'
}
gen_iface_conf() {
cat <<EOT
auto $DEV
iface $DEV inet static
address $IP
network $NETWORK
netmask $MASK
EOT
if [ -n "$GATEWAY" ]; then
echo " gateway $GATEWAY"
fi
echo ""
}
gen_network_configuration()
{
cat <<EOT
auto lo
iface lo inet loopback
EOT
IFACES=`get_interfaces`
for i in $IFACES; do
MAC=`get_mac $i`
DEV=`get_dev $i`
UPCASE_DEV=`upcase $DEV`
IP=$(get_ip)
NETWORK=$(get_network)
MASK=$(get_mask)
GATEWAY=$(get_gateway)
gen_iface_conf
done
}
configure_network()
{
gen_network_configuration > /etc/network/interfaces
service networking start
sleep 2
}
configure_network

View File

@ -0,0 +1,150 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2010-2012, C12G Labs S.L. #
# #
# 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. #
#--------------------------------------------------------------------------- #
# Gets IP address from a given MAC
mac2ip() {
mac=$1
let ip_a=0x`echo $mac | cut -d: -f 3`
let ip_b=0x`echo $mac | cut -d: -f 4`
let ip_c=0x`echo $mac | cut -d: -f 5`
let ip_d=0x`echo $mac | cut -d: -f 6`
ip="$ip_a.$ip_b.$ip_c.$ip_d"
echo $ip
}
# Gets the network part of an IP
get_network() {
network=$(get_iface_var "NETWORK")
if [ -z "$network" ]; then
network="$(echo $IP | cut -d'.' -f1,2,3).0"
fi
echo $network
}
# Gets the network mask
get_mask() {
mask=$(get_iface_var "MASK")
if [ -z "$mask" ]; then
mask="255.255.255.0"
fi
echo $mask
}
# Gets the network gateway
get_gateway() {
gateway=$(get_iface_var "GATEWAY")
if [ -z "$gateway" ]; then
if [ "$DEV" = "eth0" ]; then
net_prefix=$(echo $NETWORK | cut -d'.' -f1,2,3)
gateway="${net_prefix}.1"
fi
fi
echo $gateway
}
get_interfaces() {
IFCMD="/sbin/ifconfig -a"
$IFCMD | grep ^eth | sed 's/ *Link encap:Ethernet.*HWaddr /-/g'
}
get_dev() {
echo $1 | cut -d'-' -f 1
}
get_mac() {
echo $1 | cut -d'-' -f 2
}
get_ip() {
ip=$(get_iface_var "IP")
if [ -z "$ip" ]; then
ip=$(mac2ip $MAC)
fi
echo $ip
}
get_iface_var() {
var_name="${UPCASE_DEV}_$1"
var=$(eval "echo \"\${$var_name}\"")
echo $var
}
upcase() {
echo "$*" | tr '[:lower:]' '[:upper:]'
}
gen_iface_conf() {
cat <<EOT
DEVICE=$DEV
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
NETMASK=$MASK
IPADDR=$IP
EOT
if [ -n "$GATEWAY" ]; then
echo "GATEWAY=$GATEWAY"
fi
echo ""
}
gen_network_configuration()
{
IFACES=`get_interfaces`
for i in $IFACES; do
MAC=`get_mac $i`
DEV=`get_dev $i`
UPCASE_DEV=`upcase $DEV`
IP=$(get_ip)
NETWORK=$(get_network)
MASK=$(get_mask)
GATEWAY=$(get_gateway)
gen_iface_conf > /etc/sysconfig/network-scripts/ifcfg-${DEV}
done
}
configure_network()
{
gen_network_configuration
service network restart
sleep 2
}
configure_network

View File

@ -0,0 +1,60 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2010-2012, C12G Labs S.L. #
# #
# 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. #
#--------------------------------------------------------------------------- #
VERSION=${VERSION:-3.6.0}
MAINTAINER=${MAINTAINER:-C12G Labs <support@c12g.com>}
LICENSE=${LICENSE:-Apache 2.0}
PACKAGE_NAME=${PACKAGE_NAME:-one-context}
VENDOR=${VENDOR:-C12G Labs}
DESC="
This package prepares a VM image for OpenNebula:
* Disables udev net and cd persistent rules
* Deletes udev net and cd persistent rules
* Unconfigures the network
* Adds OpenNebula contextualization scripts to startup
To get support check the OpenNebula web page:
http://OpenNebula.org
"
DESCRIPTION=${DESCRIPTION:-$DESC}
PACKAGE_TYPE=${PACKAGE_TYPE:-deb}
URL=${URL:-http://opennebula.org}
SCRIPTS_DIR=$PWD
NAME="${PACKAGE_NAME}_${VERSION}.${PACKAGE_TYPE}"
rm $NAME
rm -rf tmp
mkdir tmp
cp -r base/* tmp
cp -r base_$PACKAGE_TYPE/* tmp
for i in $*; do
cp -r "$i" tmp
done
cd tmp
fpm -n "$PACKAGE_NAME" -t "$PACKAGE_TYPE" -s dir --vendor "$VENDOR" \
--license "$LICENSE" --description "$DESCRIPTION" --url "$URL" \
-m "$MAINTAINER" -v "$VERSION" --after-install $SCRIPTS_DIR/postinstall \
-a all -p $SCRIPTS_DIR/$NAME *
echo $NAME

View File

@ -0,0 +1,47 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2010-2012, C12G Labs S.L. #
# #
# 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. #
#--------------------------------------------------------------------------- #
rm -f /etc/udev/rules.d/70-persistent-cd.rules
rm -f /etc/udev/rules.d/70-persistent-net.rules
RUNLEVEL=$(runlevel | cut -d' ' -f2)
(
cd /etc/rc${RUNLEVEL}.d
ln -sf ../init.d/vmcontext S99vmcontext
)
# Debian based distros
if [ -d /etc/network ]; then
cp /etc/network/interfaces /etc/network/interfaces.$(date "+%s")
cat > /etc/network/interfaces <<EOT
# The loopback network interface
auto lo
iface lo inet loopback
EOT
fi
# RedHat based distros
if [ -d /etc/sysconfig/network-scripts ]; then
rm -f /etc/sysconfig/network-scripts/ifcfg-eth*
fi

View File

@ -85,6 +85,16 @@ class AuthDriver < OpenNebulaDriver
end
end
# Works the same as log_method but changes the password by '****'.
# The last word is the password for authentication.
def log_method_no_password(num, secret)
lambda {|message|
m=message.gsub(/ #{Regexp.escape(secret)}$/, ' ****')
log(num, m)
}
end
# Authenticate a user based in a string of the form user:secret when using the
# driver secret is protocol:token
# @param [String] the id for this request, used by OpenNebula core
@ -115,7 +125,8 @@ class AuthDriver < OpenNebulaDriver
Shellwords.escape(p)
end.join(' '))
rc = LocalCommand.run(command, log_method(request_id))
rc = LocalCommand.run(command,
log_method_no_password(request_id, secret))
result , info = get_info_from_execution(rc)

View File

@ -83,8 +83,8 @@ begin
end
if ldap.authenticate(user_name, secret)
escaped_user=URI_PARSER.escape(user_name)
escaped_secret=URI_PARSER.escape(secret)
escaped_user=URI_PARSER.escape(user)
escaped_secret=URI_PARSER.escape(user_name)
puts "ldap #{escaped_user} #{escaped_secret}"
authenticated=true
break

View File

@ -82,6 +82,36 @@ module CLIHelper
print "\33[#{x};#{y}H"
end
def CLIHelper.scr_red
print "\33[31m"
end
def CLIHelper.scr_green
print "\33[32m"
end
ANSI_RED="\33[31m"
ANSI_GREEN="\33[32m"
ANSI_RESET="\33[0m"
OK_STATES=%w{runn rdy on}
BAD_STATES=%w{fail err err}
def CLIHelper.color_state(stat)
if $stdout.tty?
case stat.strip
when *OK_STATES
ANSI_GREEN+stat+ANSI_RESET
when *BAD_STATES
ANSI_RED+stat+ANSI_RESET
else
stat
end
else
stat
end
end
# Print header
def CLIHelper.print_header(str, underline=true)
if $stdout.tty?
@ -158,6 +188,14 @@ module CLIHelper
end
end
def describe_columns
str="%-20s: %-20s"
@columns.each do |column, d|
puts str % [column, d[:desc]]
end
end
private
def print_table(data, options)
@ -169,12 +207,23 @@ module CLIHelper
ncolumns=@default_columns.length
res_data=data_array(data, options)
if options[:stat_column]
stat_column=@default_columns.index(
options[:stat_column].upcase.to_sym)
else
stat_column=@default_columns.index(:STAT)
end
begin
print res_data.collect{|l|
(0..ncolumns-1).collect{ |i|
dat=l[i]
col=@default_columns[i]
format_str(col, dat)
str=format_str(col, dat)
str=CLIHelper.color_state(str) if i==stat_column
str
}.join(' ')
}.join("\n")
rescue Errno::EPIPE

View File

@ -468,6 +468,10 @@ module CommandParser
else
puts "one parameter to run"
end
puts
puts "Usage:"
print " #{name} "
print_command(@commands[name])
exit -1
else
id=0
@ -585,7 +589,6 @@ module CommandParser
def print_commands
cmd_format5 = "#{' '*3}%s"
cmd_format10 = "#{' '*8}%s"
if @main
print_command(@main)
@ -601,6 +604,8 @@ module CommandParser
end
def print_command(command)
cmd_format10 = "#{' '*8}%s"
args_str=command[:args_format].collect{ |a|
if a.include?(nil)
"[<#{a.compact.join("|")}>]"

View File

@ -61,6 +61,66 @@ EOT
:description => "Show units in kilobytes"
}
DESCRIBE={
:name => "describe",
:large => "--describe",
:description => "Describe list columns"
}
# Command line VM template options
TEMPLATE_OPTIONS=[
{
:name => 'name',
:large => '--name name',
:description =>
'Name for the VM',
:format => String
},
{
:name => 'cpu',
:large => '--cpu cpu',
:description =>
'CPU percentage reserved for the VM (1=100% one CPU)',
:format => Float
},
{
:name => 'memory',
:large => '--memory memory',
:description => 'Memory ammount given to the VM',
:format => String,
:proc => lambda do |o,options|
m=o.strip.match(/^(\d+(?:\.\d+)?)(m|mb|g|gb)?$/i)
if !m
[-1, 'Memory value malformed']
else
multiplier=case m[2]
when /(g|gb)/i
1024
else
1
end
value=m[1].to_f*multiplier
[0, value.floor]
end
end
},
{
:name => 'disk',
:large => '--disk disk0,disk1',
:description => 'Disks to attach. To use a disk owned by other user use user[disk]',
:format => Array
},
{
:name => 'network',
:large => '--network network0,network1',
:description => 'Networks to attach. To use a network owned by other user use user[network]',
:format => Array
}
]
OPTIONS = XML, NUMERIC, KILOBYTES
class OneHelper
@ -88,6 +148,13 @@ EOT
end
def list_pool(options, top=false, filter_flag=nil)
if options[:describe]
table = format_pool(options)
table.describe_columns
return 0
end
filter_flag ||= OpenNebula::Pool::INFO_ALL
pool = factory_pool(filter_flag)
@ -445,4 +512,76 @@ EOT
str = File.read(path)
str
end
def self.parse_user_object(user_object)
reg=/^([^\[]+)(?:\[([^\]]+)\])?$/
m=user_object.match(reg)
return nil if !m
user=nil
if m[2]
user=m[1]
object=m[2]
else
object=m[1]
end
[user, object]
end
def self.create_disk_net(objects, section, name)
template=''
objects.each do |obj|
res=parse_user_object(obj)
return [-1, "#{section.capitalize} \"#{obj}\" malformed"] if !res
user, object=*res
template<<"#{section.upcase}=[\n"
template<<" #{name.upcase}_UNAME=\"#{user}\",\n" if user
template<<" #{name.upcase}=\"#{object}\"\n"
template<<"]\n"
end if objects
[0, template]
end
def self.create_template(options)
template=''
template<<"NAME=\"#{options[:name]}\"\n" if options[:name]
template<<"CPU=#{options[:cpu]}\n" if options[:cpu]
template<<"MEMORY=#{options[:memory]}\n" if options[:memory]
if options[:disk]
res=create_disk_net(options[:disk], 'DISK', 'IMAGE')
return res if res.first!=0
template<<res.last
end
if options[:network]
res=create_disk_net(options[:network], 'NIC', 'NETWORK')
return res if res.first!=0
template<<res.last
end
[0, template]
end
def self.create_template_options_used?(options)
# Get the template options names as symbols. options hash
# uses symbols
template_options=OpenNebulaHelper::TEMPLATE_OPTIONS.map do |o|
o[:name].to_sym
end
# Check if one at least one of the template options is
# in options hash
(template_options-options.keys)!=template_options
end
end

View File

@ -17,6 +17,153 @@
require 'one_helper'
class OneImageHelper < OpenNebulaHelper::OneHelper
TEMPLATE_OPTIONS=[
{
:name => "name",
:short => "-n name",
:large => "--name type",
:format => String,
:description => "Name of the new image"
},
{
:name => "description",
:short => "-d description",
:large => "--description description",
:format => String,
:description => "Description for the new Image"
},
{
:name => "type",
:short => "-t type",
:large => "--type type",
:format => String,
:description => "Type of the new Image",
:proc => lambda do |o, options|
type=o.strip.upcase
if %w{OS CDROM DATABLOCK}.include? type
[0, type]
else
[-1, "Type should be OS, CDROM or DATABLOCK"]
end
end
},
{
:name => "persistent",
:short => "-p",
:large => "--persistent",
:description => "Tells if the image will be persistent"
},
{
:name => "prefix",
:large => "--prefix prefix",
:description => "Device prefix for the disk (hd, sd, xvd or vd)",
:format => String,
:proc => lambda do |o, options|
prefix=o.strip.downcase
if %w{hd sd xvd vd}.include? prefix
[0, prefix]
else
[-1, "The prefix must be hd, sd, xvd or vd"]
end
end
},
{
:name => "target",
:large => "--target target",
:description => "Device the disk will be attached to",
:format => String
},
{
:name => "path",
:large => "--path path",
:description => "Path of the image file",
:format => String,
:proc => lambda do |o, options|
if o[0,1]=='/'
path=o
else
path=Dir.pwd+"/"+o
end
if File.exist?(path)
[0, path]
else
[-1, "File '#{path}' does not exist."]
end
end
},
{
:name => "driver",
:large => "--driver driver",
:description => "Driver to use image (raw, qcow2, tap:aio:...)",
:format => String
},
{
:name => "disk_type",
:large => "--disk_type disk_type",
:description => "Type of the image (BLOCK, CDROM or FILE)",
:format => String,
:proc => lambda do |o, options|
type=o.strip.upcase
if %w{BLOCK CDROM FILE}.include? type
[0, type]
else
[-1, "Disk type must be BLOCK, CDROM or FILE"]
end
end
},
{
:name => "source",
:large => "--source source",
:description =>
"Source to be used. Useful for not file-based images",
:format => String
},
{
:name => "size",
:large => "--size size",
:description => "Size in MB. Used for DATABLOCK type",
:format => String,
:proc => lambda do |o, options|
if !options[:type] || !(options[:type].upcase=='DATABLOCK')
next [-1, "Size is only used for DATABLOCK type images"]
end
m=o.strip.match(/^(\d+(?:\.\d+)?)(m|mb|g|gb)?$/i)
if !m
[-1, 'Size value malformed']
else
multiplier=case m[2]
when /(g|gb)/i
1024
else
1
end
value=m[1].to_f*multiplier
[0, value.floor]
end
end
},
{
:name => "fstype",
:large => "--fstype fstype",
:description => "Type of file system to be built. This can be "<<
"any value understood by mkfs unix command.",
:format => String,
:proc => lambda do |o, options|
if !options[:type] || !(options[:type].upcase=='DATABLOCK')
[-1, "FSTYPE is only used for DATABLOCK type images"]
else
[0, o]
end
end
}
]
def self.rname
"IMAGE"
end
@ -151,4 +298,34 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
CLIHelper.print_header(str_h1 % "IMAGE TEMPLATE",false)
puts image.template_str
end
def self.create_image_variables(options, name)
if Array===name
names=name
else
names=[name]
end
t=''
names.each do |n|
if options[n]
t<<"#{n.to_s.upcase}=\"#{options[n]}\"\n"
end
end
t
end
def self.create_image_template(options)
template_options=TEMPLATE_OPTIONS.map do |o|
o[:name].to_sym
end
template=create_image_variables(
options, template_options-[:persistent])
template<<"PERSISTENT=YES\n" if options[:persistent]
[0, template]
end
end

View File

@ -90,7 +90,8 @@ cmd = CommandParser::CmdParser.new(ARGV) do
Lists the ACL rule set
EOT
command :list, list_desc,:options=>OpenNebulaHelper::XML do
command :list, list_desc,:options=>[OpenNebulaHelper::XML,
OpenNebulaHelper::DESCRIBE] do
helper.list_pool( options )
end
end

View File

@ -44,6 +44,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
list_options = CLIHelper::OPTIONS
list_options << OpenNebulaHelper::XML
list_options << OpenNebulaHelper::NUMERIC
list_options << OpenNebulaHelper::DESCRIBE
########################################################################
# Formatters for arguments

View File

@ -45,6 +45,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
list_options = CLIHelper::OPTIONS
list_options << OpenNebulaHelper::XML
list_options << OpenNebulaHelper::NUMERIC
list_options << OpenNebulaHelper::DESCRIBE
########################################################################
# Formatters for arguments

View File

@ -44,6 +44,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
list_options = CLIHelper::OPTIONS
list_options << OpenNebulaHelper::XML
list_options << OpenNebulaHelper::NUMERIC
list_options << OpenNebulaHelper::DESCRIBE
########################################################################
# Formatters for arguments

View File

@ -170,7 +170,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :list, list_desc,
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS+
[OpenNebulaHelper::DESCRIBE] do
helper.list_pool(options)
end

View File

@ -45,6 +45,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
list_options = CLIHelper::OPTIONS
list_options << OpenNebulaHelper::XML
list_options << OpenNebulaHelper::NUMERIC
list_options << OpenNebulaHelper::DESCRIBE
CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE]
@ -79,16 +80,37 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Creates a new Image from the given template file
EOT
command :create, create_desc, :file, :options=>CREATE_OPTIONS do
command :create, create_desc, [:file, nil], :options=>CREATE_OPTIONS+
OneImageHelper::TEMPLATE_OPTIONS do
if options[:datastore].nil?
STDERR.puts "Datastore to save the image is mandatory: "
STDERR.puts "\t -d datastore_id"
exit -1
end
if args[0] && OpenNebulaHelper.create_template_options_used?(options)
STDERR.puts "You can not use both template file and template"<<
" creation options."
next -1
end
res=OneImageHelper.create_image_template(options)
if res.first!=0
STDERR.puts res.last
next -1
end
helper.create_resource(options) do |image|
begin
template=File.read(args[0])
image.allocate(template, options[:datastore] )
if args[0]
template=File.read(args[0])
else
template=''
end
template<<res.last
image.allocate(template, options[:datastore])
rescue => e
STDERR.puts e.messsage
exit -1

View File

@ -44,6 +44,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
list_options = CLIHelper::OPTIONS
list_options << OpenNebulaHelper::XML
list_options << OpenNebulaHelper::NUMERIC
list_options << OpenNebulaHelper::DESCRIBE
instantiate_options = [
OneTemplateHelper::VM_NAME,
@ -81,9 +82,29 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Creates a new Template from the given template file
EOT
command :create, create_desc, :file do
command :create, create_desc, [:file, nil],
:options=>OpenNebulaHelper::TEMPLATE_OPTIONS do
res=OpenNebulaHelper.create_template(options)
if args[0] && OpenNebulaHelper.create_template_options_used?(options)
STDERR.puts "You can not use both template file and template"<<
" creation options."
next -1
end
if res.first!=0
STDERR.puts res.last
next -1
end
helper.create_resource(options) do |t|
template=File.read(args[0])
if args[0]
template=File.read(args[0])
else
template=''
end
template<<res.last
t.allocate(template)
end
end

View File

@ -45,6 +45,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
list_options = CLIHelper::OPTIONS
list_options << OpenNebulaHelper::XML
list_options << OpenNebulaHelper::NUMERIC
list_options << OpenNebulaHelper::DESCRIBE
READ_FILE={
:name => "read_file",

View File

@ -99,15 +99,41 @@ cmd=CommandParser::CmdParser.new(ARGV) do
See 'onetemplate create' and 'onetemplate instantiate'
EOT
command :create, create_desc, :file,
:options=>[OneVMHelper::MULTIPLE]+OpenNebulaHelper::OPTIONS do
command :create, create_desc, [:file, nil],
:options=>[OneVMHelper::MULTIPLE]+
OpenNebulaHelper::TEMPLATE_OPTIONS do
number = options[:multiple] || 1
exit_code=nil
res=OpenNebulaHelper.create_template(options)
if res.first!=0
STDERR.puts res.last
next -1
end
if args[0]
if OpenNebulaHelper.create_template_options_used?(options)
STDERR.puts "You can not use both template file and template"<<
" creation options."
next -1
end
begin
template=File.read(args[0])
rescue
STDERR.puts "Error reading template."
next -1
end
else
template=''
end
template<<res.last
number.times do
exit_code=helper.create_resource(options) do |vm|
template=File.read(args[0])
error=vm.allocate(template)
end
@ -183,7 +209,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
shutdown_desc = <<-EOT.unindent
Shuts down the given VM.
Shuts down the given VM. The VM life cycle will end.
States: RUNNING
EOT
@ -194,6 +220,19 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
poweroff_desc = <<-EOT.unindent
Powers off the given VM. The VM will remain in the poweroff state, and
can be powered on with the 'onevm restart' command.
States: RUNNING
EOT
command :poweroff, poweroff_desc, [:range,:vmid_list] do
helper.perform_actions(args[0],options,"shutting down") do |vm|
vm.poweroff
end
end
reboot_desc = <<-EOT.unindent
Reboots the given VM, this is equivalent to execute the reboot command
from the VM console.
@ -267,9 +306,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
restart_desc = <<-EOT.unindent
Forces a re-deployment of the given VM, issuing a boot action.
Boots the given VM.
States: UNKNOWN, BOOT
States: UNKNOWN, BOOT, POWEROFF
EOT
command :restart, restart_desc, [:range,:vmid_list] do
@ -456,7 +495,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :list, list_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS do
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS+
[OpenNebulaHelper::DESCRIBE] do
helper.list_pool(options, false, args[0])
end

View File

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

View File

@ -26,8 +26,10 @@ module OpenNebulaCloudAuth
rc = user.info
if OpenNebula.is_error?(rc)
logger.error { "User #{username} could not be authenticated" }
logger.error { rc.message }
if logger
logger.error{ "User #{username} could not be authenticated"}
logger.error { rc.message }
end
return nil
end

View File

@ -43,15 +43,15 @@ setup()
if [ -f $ECONE_LOCK_FILE ]; then
if [ -f $ECONE_PID ]; then
ONEPID=`cat $ECONE_PID`
ps $ECONE_PID > /dev/null 2>&1
ECONEPID=`cat $ECONE_PID`
ps $ECONEPID > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "econe-server is still running (PID:$ECONE_PID). Please try 'occi-server stop' first."
echo "econe-server is still running (PID:$ECONEPID). Please try 'econe-server stop' first."
exit 1
fi
fi
echo "Stale .lock detected. Erasing it."
rm $LOCK_FILE
rm $ECONE_LOCK_FILE
fi
}
@ -62,6 +62,8 @@ start()
exit 1
fi
touch $ECONE_LOCK_FILE
# Start the econe-server daemon
ruby $ECONE_SERVER >$ECONE_LOG 2>$ECONE_LOG_ERROR &
@ -70,7 +72,7 @@ start()
if [ $LASTRC -ne 0 ]; then
echo "Error executing econe-server."
echo "Check $ECONE_LOG for more information"
echo "Check $ECONE_LOG_ERROR and $ECONE_LOG for more information"
exit 1
else
echo $LASTPID > $ECONE_PID
@ -81,7 +83,7 @@ start()
if [ $? -ne 0 ]; then
echo "Error executing econe-server."
echo "Check $ECONE_LOG for more information"
echo "Check $ECONE_LOG_ERROR and $ECONE_LOG for more information"
exit 1
fi
@ -105,6 +107,7 @@ stop()
# Remove pid files
rm -f $ECONE_PID > /dev/null 2>&1
rm -f $ECONE_LOCK_FILE > /dev/null 2>&1
echo "econe-server stopped"
}

View File

@ -28,8 +28,8 @@
:host: localhost
:port: 4567
# SSL proxy that serves the API (set if is being used)
#:ssl_server: fqdm.of.the.server
# SSL proxy URL that serves the API (set if is being used)
#:ssl_server: https://service.endpoint.fqdn:port/
#############################################################
# Auth

View File

@ -43,15 +43,15 @@ setup()
if [ -f $OCCI_LOCK_FILE ]; then
if [ -f $OCCI_PID ]; then
ONEPID=`cat $OCCI_PID`
ps $OCCI_PID > /dev/null 2>&1
OCCIPID=`cat $OCCI_PID`
ps $OCCIPID > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "OCCI Server is still running (PID:$OCCI_PID). Please try 'occi-server stop' first."
echo "OCCI Server is still running (PID:$OCCIPID). Please try 'occi-server stop' first."
exit 1
fi
fi
echo "Stale .lock detected. Erasing it."
rm $LOCK_FILE
rm $OCCI_LOCK_FILE
fi
}
@ -62,6 +62,8 @@ start()
exit 1
fi
touch $OCCI_LOCK_FILE
# Start the occi-server daemon
ruby $OCCI_SERVER >$OCCI_LOG 2>$OCCI_LOG_ERROR &
@ -70,7 +72,7 @@ start()
if [ $LASTRC -ne 0 ]; then
echo "Error executing occi-server."
echo "Check $OCCI_LOG for more information"
echo "Check $OCCI_LOG_ERROR and $OCCI_LOG for more information"
exit 1
else
echo $LASTPID > $OCCI_PID
@ -81,7 +83,7 @@ start()
if [ $? -ne 0 ]; then
echo "Error executing occi-server."
echo "Check $OCCI_LOG for more information"
echo "Check $OCCI_LOG_ERROR and $OCCI_LOG for more information"
exit 1
fi

View File

@ -58,7 +58,7 @@ class OCCIServer < CloudServer
if config[:ssl_server]
@base_url=config[:ssl_server]
else
@base_url="http://#{config[:server]}:#{config[:port]}"
@base_url="http://#{config[:host]}:#{config[:port]}"
end
@client = client

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------- #
# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
# #
@ -72,6 +73,9 @@ class VirtualMachineOCCI < VirtualMachine
"REBOOT" => { :from => ["ACTIVE"], :action => :reboot},
"RESET" => { :from => ["ACTIVE"], :action => :reset},
"SHUTDOWN" => { :from => ["ACTIVE"], :action => :shutdown},
"RESTART" => { :from => ["ACTIVE"], :action => :restart},
"RESUBMIT" => { :from => ["ACTIVE", "FAILED"], :action => :resubmit},
"POWEROFF" => { :from => ["ACTIVE"], :action => :poweroff},
"DONE" => { :from => VM_STATE, :action => :finalize}
}

View File

@ -150,6 +150,7 @@ end
before do
cache_control :no_store
content_type 'application/xml', :charset => 'utf-8'
unless request.path=='/ui/login' || request.path=='/ui'
if !authorized?
begin
@ -245,6 +246,7 @@ helpers do
def treat_response(result,rc)
if OpenNebula::is_error?(result)
logger.error {result.message}
content_type 'text/plain', :charset => 'utf-8'
halt rc, result.message
end
@ -325,6 +327,7 @@ post '/compute/:id/action' do
when 'detachdisk' then
@occi_server.detach_disk(request, params, xml)
else
content_type 'text/plain', :charset => 'utf-8'
halt 403, "Action #{xml['PERFORM']} not supported"
end
@ -421,6 +424,7 @@ post '/ui/config' do
begin
body = JSON.parse(request.body.read)
rescue
content_type 'text/plain', :charset => 'utf-8'
[500, "POST Config: Error parsing configuration JSON"]
end
@ -446,6 +450,7 @@ post '/ui/logout' do
end
get '/ui' do
content_type 'text/html', :charset => 'utf-8'
if !authorized?
return File.read(File.dirname(__FILE__)+'/ui/templates/login.html')
end
@ -462,6 +467,7 @@ get '/ui' do
end
post '/ui/upload' do
content_type 'application/json', :charset => 'utf-8'
#so we can re-use occi post_storage()
request.params['file'] = {:tempfile => request.env['rack.input']}
result,rc = @occi_server.post_storage(request)
@ -469,11 +475,13 @@ post '/ui/upload' do
end
post '/ui/startvnc/:id' do
content_type 'application/json', :charset => 'utf-8'
vm_id = params[:id]
@occi_server.startvnc(vm_id, settings.vnc)
end
get '/ui/accounting' do
content_type 'application/json', :charset => 'utf-8'
@occi_server.get_user_accounting(params)
end

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenNebula\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-06 12:23+0200\n"
"POT-Creation-Date: 2012-09-18 13:27+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -50,18 +50,18 @@ msgstr ""
msgid "All"
msgstr ""
#: ../public/js/plugins/storage.js:27 ../public/js/plugins/storage.js:345
#: ../public/js/plugins/storage.js:27 ../public/js/plugins/storage.js:382
#: ../public/js/plugins/network.js:27 ../public/js/plugins/network.js:278
#: ../public/js/plugins/compute.js:64 ../public/js/plugins/compute.js:538
#: ../public/js/plugins/compute.js:583 ../public/js/plugins/compute.js:628
#: ../public/js/plugins/compute.js:64 ../public/js/plugins/compute.js:585
#: ../public/js/plugins/compute.js:637
msgid "ID"
msgstr ""
#: ../public/js/plugins/storage.js:28 ../public/js/plugins/storage.js:45
#: ../public/js/plugins/storage.js:349 ../public/js/plugins/network.js:28
#: ../public/js/plugins/network.js:41 ../public/js/plugins/network.js:282
#: ../public/js/plugins/compute.js:65 ../public/js/plugins/compute.js:542
#: ../public/js/plugins/compute.js:587 ../public/js/plugins/compute.js:632
#: ../public/js/plugins/storage.js:107 ../public/js/plugins/storage.js:386
#: ../public/js/plugins/network.js:28 ../public/js/plugins/network.js:41
#: ../public/js/plugins/network.js:282 ../public/js/plugins/compute.js:65
#: ../public/js/plugins/compute.js:589 ../public/js/plugins/compute.js:641
msgid "Name"
msgstr ""
@ -77,7 +77,7 @@ msgstr ""
msgid "Name that the Image will get."
msgstr ""
#: ../public/js/plugins/storage.js:50 ../public/js/plugins/storage.js:353
#: ../public/js/plugins/storage.js:50 ../public/js/plugins/storage.js:390
msgid "Description"
msgstr ""
@ -85,8 +85,7 @@ msgstr ""
msgid "Human readable description of the image."
msgstr ""
#: ../public/js/plugins/storage.js:57 ../public/js/plugins/storage.js:357
#: ../public/js/plugins/compute.js:595
#: ../public/js/plugins/storage.js:57 ../public/js/plugins/storage.js:394
msgid "Type"
msgstr ""
@ -134,7 +133,7 @@ msgstr ""
msgid "Public scope of the image"
msgstr ""
#: ../public/js/plugins/storage.js:88 ../public/js/plugins/storage.js:361
#: ../public/js/plugins/storage.js:88 ../public/js/plugins/storage.js:398
msgid "Persistent"
msgstr ""
@ -142,8 +141,8 @@ msgstr ""
msgid "Persistence of the image"
msgstr ""
#: ../public/js/plugins/storage.js:95 ../public/js/plugins/network.js:56
#: ../public/js/plugins/compute.js:103
#: ../public/js/plugins/storage.js:95 ../public/js/plugins/storage.js:112
#: ../public/js/plugins/network.js:56 ../public/js/plugins/compute.js:103
msgid "Close"
msgstr ""
@ -152,75 +151,89 @@ msgstr ""
msgid "Create"
msgstr ""
#: ../public/js/plugins/storage.js:214 ../public/js/plugins/network.js:158
#: ../public/js/plugins/compute.js:323
msgid "Refresh list"
#: ../public/js/plugins/storage.js:104
msgid "Choose a new name for the image"
msgstr ""
#: ../public/js/plugins/storage.js:219 ../public/js/plugins/network.js:164
#: ../public/js/plugins/compute.js:329
#: ../public/js/plugins/storage.js:105
msgid "Several image are selected, please choose prefix to name the new copies"
msgstr ""
#: ../public/js/plugins/storage.js:108
msgid "Prefix"
msgstr ""
#: ../public/js/plugins/storage.js:114 ../public/js/plugins/storage.js:270
msgid "Clone"
msgstr ""
#: ../public/js/plugins/storage.js:245 ../public/js/plugins/network.js:164
#: ../public/js/plugins/compute.js:355
msgid "+ New"
msgstr ""
#: ../public/js/plugins/storage.js:223
#: ../public/js/plugins/storage.js:249
msgid "Make persistent"
msgstr ""
#: ../public/js/plugins/storage.js:227
#: ../public/js/plugins/storage.js:253
msgid "Make non persistent"
msgstr ""
#: ../public/js/plugins/storage.js:234 ../public/js/plugins/network.js:169
#: ../public/js/plugins/storage.js:260 ../public/js/plugins/network.js:169
msgid "Publish"
msgstr ""
#: ../public/js/plugins/storage.js:238 ../public/js/plugins/network.js:174
#: ../public/js/plugins/storage.js:264 ../public/js/plugins/network.js:174
msgid "Unpublish"
msgstr ""
#: ../public/js/plugins/storage.js:244 ../public/js/plugins/network.js:179
#: ../public/js/plugins/compute.js:381
#: ../public/js/plugins/storage.js:274 ../public/js/plugins/network.js:179
#: ../public/js/plugins/compute.js:422
msgid "Delete"
msgstr ""
#: ../public/js/plugins/storage.js:250 ../public/js/plugins/storage.js:337
#: ../public/js/plugins/storage.js:280 ../public/js/plugins/storage.js:374
msgid "Image information"
msgstr ""
#: ../public/js/plugins/storage.js:258
#: ../public/js/plugins/storage.js:287
msgid "Add storage"
msgstr ""
#: ../public/js/plugins/storage.js:264 ../public/js/plugins/dashboard.js:46
#: ../public/customize/custom.js:68
#: ../public/js/plugins/storage.js:294
msgid "Clone image"
msgstr ""
#: ../public/js/plugins/storage.js:300 ../public/customize/custom.js:68
msgid "Storage"
msgstr ""
#: ../public/js/plugins/storage.js:341
#: ../public/js/plugins/storage.js:378
msgid "Image"
msgstr ""
#: ../public/js/plugins/storage.js:342 ../public/js/plugins/network.js:275
#: ../public/js/plugins/storage.js:379 ../public/js/plugins/network.js:275
msgid "information"
msgstr ""
#: ../public/js/plugins/storage.js:365
#: ../public/js/plugins/storage.js:402
msgid "Filesystem type"
msgstr ""
#: ../public/js/plugins/storage.js:369
#: ../public/js/plugins/storage.js:406
msgid "Size (Mb)"
msgstr ""
#: ../public/js/plugins/storage.js:503
#: ../public/js/plugins/storage.js:537
msgid "You must specify a name"
msgstr ""
#: ../public/js/plugins/storage.js:521
#: ../public/js/plugins/storage.js:555
msgid "You must specify size and FS type"
msgstr ""
#: ../public/js/plugins/storage.js:528
#: ../public/js/plugins/storage.js:562
msgid "You must select a file to upload"
msgstr ""
@ -240,8 +253,9 @@ msgstr ""
msgid "Create network"
msgstr ""
#: ../public/js/plugins/network.js:199 ../public/js/plugins/compute.js:91
#: ../public/js/plugins/compute.js:396 ../public/js/plugins/compute.js:655
#: ../public/js/plugins/network.js:199 ../public/js/plugins/dashboard.js:62
#: ../public/js/plugins/compute.js:91 ../public/js/plugins/compute.js:437
#: ../public/js/plugins/compute.js:664
msgid "Networks"
msgstr ""
@ -269,50 +283,105 @@ msgstr ""
msgid "Please provide a network address"
msgstr ""
#: ../public/js/plugins/dashboard.js:37
msgid "Current resources"
#: ../public/js/plugins/dashboard.js:18 ../public/js/plugins/dashboard.js:262
#: ../public/js/plugins/compute.js:32
msgid "CPU"
msgstr ""
#: ../public/js/plugins/dashboard.js:42 ../public/js/plugins/compute.js:409
#: ../public/js/plugins/dashboard.js:22 ../public/js/plugins/dashboard.js:249
#: ../public/js/plugins/compute.js:37
msgid "Memory"
msgstr ""
#: ../public/js/plugins/dashboard.js:26
msgid "Net transfer rates"
msgstr ""
#: ../public/js/plugins/dashboard.js:52
msgid "Resources and quotas"
msgstr ""
#: ../public/js/plugins/dashboard.js:56 ../public/js/plugins/compute.js:450
#: ../public/customize/custom.js:64
msgid "Compute"
msgstr ""
#: ../public/js/plugins/dashboard.js:50 ../public/customize/custom.js:72
msgid "Network"
#: ../public/js/plugins/dashboard.js:58
msgid "Storage quotas"
msgstr ""
#: ../public/js/plugins/dashboard.js:62
msgid "Useful links"
#: ../public/js/plugins/dashboard.js:60 ../public/js/plugins/compute.js:86
msgid "Images"
msgstr ""
#: ../public/js/plugins/dashboard.js:81
#: ../public/js/plugins/dashboard.js:73
msgid "Usages"
msgstr ""
#: ../public/js/plugins/dashboard.js:77
msgid "From"
msgstr ""
#: ../public/js/plugins/dashboard.js:78
msgid "To"
msgstr ""
#: ../public/js/plugins/dashboard.js:79
#: ../../../../../sunstone/public/js/sunstone-util.js:746
msgid "Update"
msgstr ""
#: ../public/js/plugins/dashboard.js:126
msgid "Create new compute resource"
msgstr ""
#: ../public/js/plugins/dashboard.js:82 ../public/js/plugins/dashboard.js:96
#: ../public/js/plugins/dashboard.js:110
#: ../public/js/plugins/dashboard.js:127 ../public/js/plugins/dashboard.js:141
#: ../public/js/plugins/dashboard.js:155
msgid "See more"
msgstr ""
#: ../public/js/plugins/dashboard.js:95
#: ../public/js/plugins/dashboard.js:140
msgid "Create new storage resource"
msgstr ""
#: ../public/js/plugins/dashboard.js:109
#: ../public/js/plugins/dashboard.js:154
msgid "Create new network resource"
msgstr ""
#: ../public/js/plugins/dashboard.js:120
#: ../public/js/plugins/dashboard.js:163
msgid "Useful links"
msgstr ""
#: ../public/js/plugins/dashboard.js:175
msgid "Dashboard"
msgstr ""
#: ../public/js/plugins/compute.js:32 ../public/js/plugins/compute.js:554
msgid "CPU"
#: ../public/js/plugins/dashboard.js:238
msgid "Virtual Machines quotas"
msgstr ""
#: ../public/js/plugins/compute.js:37 ../public/js/plugins/compute.js:558
msgid "Memory"
#: ../public/js/plugins/dashboard.js:274
msgid "Storage size"
msgstr ""
#: ../public/js/plugins/dashboard.js:287
msgid "Number of images"
msgstr ""
#: ../public/js/plugins/dashboard.js:296
msgid "Image quota"
msgstr ""
#: ../public/js/plugins/dashboard.js:302
msgid "RVMs"
msgstr ""
#: ../public/js/plugins/dashboard.js:311
msgid "Network quota"
msgstr ""
#: ../public/js/plugins/dashboard.js:317
msgid "Leases"
msgstr ""
#: ../public/js/plugins/compute.js:42
@ -323,11 +392,11 @@ msgstr ""
msgid "Network reception"
msgstr ""
#: ../public/js/plugins/compute.js:65 ../public/js/plugins/compute.js:550
#: ../public/js/plugins/compute.js:65 ../public/js/plugins/compute.js:597
msgid "State"
msgstr ""
#: ../public/js/plugins/compute.js:66 ../public/js/plugins/compute.js:636
#: ../public/js/plugins/compute.js:66 ../public/js/plugins/compute.js:645
msgid "IP"
msgstr ""
@ -335,306 +404,329 @@ msgstr ""
msgid "VM Name"
msgstr ""
#: ../public/js/plugins/compute.js:80 ../public/js/plugins/compute.js:546
#: ../public/js/plugins/compute.js:80 ../public/js/plugins/compute.js:593
msgid "Instance type"
msgstr ""
#: ../public/js/plugins/compute.js:82 ../public/js/plugins/compute.js:1010
#: ../public/js/plugins/compute.js:82 ../public/js/plugins/compute.js:1038
msgid "Loading"
msgstr ""
#: ../public/js/plugins/compute.js:86
msgid "Images"
msgstr ""
#: ../public/js/plugins/compute.js:97
msgid "Create # VMs"
msgstr ""
#: ../public/js/plugins/compute.js:99
msgid "You can use the wildcard &#37;. When creating several VMs, &#37; will be replaced with a different number starting from 0 in each of them"
msgid "You can use the wildcard &#37;i. When creating several VMs, &#37;i will be replaced with a different number starting from 0 in each of them"
msgstr ""
#: ../public/js/plugins/compute.js:335
#: ../public/js/plugins/compute.js:361
msgid "Shutdown"
msgstr ""
#: ../public/js/plugins/compute.js:336
#: ../public/js/plugins/compute.js:362
msgid "This will shutdown the selected VMs"
msgstr ""
#: ../public/js/plugins/compute.js:344
#: ../public/js/plugins/compute.js:370
msgid "Suspend"
msgstr ""
#: ../public/js/plugins/compute.js:345
#: ../public/js/plugins/compute.js:371
msgid "This will suspend the selected VMs"
msgstr ""
#: ../public/js/plugins/compute.js:349
#: ../public/js/plugins/compute.js:375
msgid "Resume"
msgstr ""
#: ../public/js/plugins/compute.js:350
#: ../public/js/plugins/compute.js:376
msgid "This will resume the selected VMs in stopped or suspended states"
msgstr ""
#: ../public/js/plugins/compute.js:354
#: ../public/js/plugins/compute.js:380
msgid "Stop"
msgstr ""
#: ../public/js/plugins/compute.js:359
#: ../public/js/plugins/compute.js:385
msgid "Reboot"
msgstr ""
#: ../public/js/plugins/compute.js:364
#: ../public/js/plugins/compute.js:390
msgid "Reset"
msgstr ""
#: ../public/js/plugins/compute.js:369 ../public/js/plugins/compute.js:837
#: ../../../../../sunstone/public/js/sunstone.js:663
#: ../../../../../sunstone/public/js/sunstone.js:695
#: ../public/js/plugins/compute.js:395
msgid "Restart"
msgstr ""
#: ../public/js/plugins/compute.js:396
msgid "This will redeploy selected VMs"
msgstr ""
#: ../public/js/plugins/compute.js:400
msgid "Resubmit"
msgstr ""
#: ../public/js/plugins/compute.js:401
msgid "This will resubmits VMs to PENDING state"
msgstr ""
#: ../public/js/plugins/compute.js:405
msgid "Power Off"
msgstr ""
#: ../public/js/plugins/compute.js:406
msgid "This will send a power off signal to running VMs. They can be restarted later."
msgstr ""
#: ../public/js/plugins/compute.js:410
#: ../../../../../sunstone/public/js/sunstone.js:664
#: ../../../../../sunstone/public/js/sunstone.js:696
msgid "Cancel"
msgstr ""
#: ../public/js/plugins/compute.js:370
#: ../public/js/plugins/compute.js:411
msgid "This will cancel selected VMs"
msgstr ""
#: ../public/js/plugins/compute.js:374 ../public/js/plugins/compute.js:826
#: ../public/js/plugins/compute.js:415
msgid "Take snapshot"
msgstr ""
#: ../public/js/plugins/compute.js:382
#: ../public/js/plugins/compute.js:423
msgid "This will delete the selected VMs from the database"
msgstr ""
#: ../public/js/plugins/compute.js:388
#: ../public/js/plugins/compute.js:429
msgid "Compute resource"
msgstr ""
#: ../public/js/plugins/compute.js:392 ../public/js/plugins/compute.js:610
msgid "Disks"
#: ../public/js/plugins/compute.js:433 ../public/js/plugins/compute.js:619
msgid "Disks & Hotplugging"
msgstr ""
#: ../public/js/plugins/compute.js:403
#: ../public/js/plugins/compute.js:444
msgid "Create Virtual Machine"
msgstr ""
#: ../public/js/plugins/compute.js:530
#: ../public/js/plugins/compute.js:577
msgid "VM information"
msgstr ""
#: ../public/js/plugins/compute.js:534
#: ../public/js/plugins/compute.js:581
msgid "Virtual Machine information"
msgstr ""
#: ../public/js/plugins/compute.js:562
#: ../public/js/plugins/compute.js:601
msgid "Used CPU"
msgstr ""
#: ../public/js/plugins/compute.js:605
msgid "Used Memory"
msgstr ""
#: ../public/js/plugins/compute.js:609
msgid "Launch VNC session"
msgstr ""
#: ../public/js/plugins/compute.js:573
msgid "Disks information"
msgstr ""
#: ../public/js/plugins/compute.js:591
msgid "Target"
msgstr ""
#: ../public/js/plugins/compute.js:602 ../public/js/plugins/compute.js:933
msgid "No disks defined"
msgstr ""
#: ../public/js/plugins/compute.js:616
#: ../public/js/plugins/compute.js:625
msgid "Networks information"
msgstr ""
#: ../public/js/plugins/compute.js:640
#: ../public/js/plugins/compute.js:649
msgid "MAC"
msgstr ""
#: ../public/js/plugins/compute.js:647
#: ../public/js/plugins/compute.js:656
msgid "No networks defined"
msgstr ""
#: ../public/js/plugins/compute.js:661
#: ../public/js/plugins/compute.js:670
msgid "Monitoring information"
msgstr ""
#: ../public/js/plugins/compute.js:836
#: ../../../../../sunstone/public/js/sunstone.js:662
#: ../../../../../sunstone/public/js/sunstone.js:694
msgid "OK"
#: ../public/js/plugins/compute.js:708
msgid "Disks information - Save As and Detach"
msgstr ""
#: ../public/js/plugins/compute.js:859
msgid "Skipping VM "
#: ../public/js/plugins/compute.js:722
msgid "No disks to show"
msgstr ""
#: ../public/js/plugins/compute.js:860
msgid "No disk id or image name specified"
#: ../public/js/plugins/compute.js:733
msgid "Detach"
msgstr ""
#: ../public/js/plugins/compute.js:896
msgid "Saveas for VM with ID"
#: ../public/js/plugins/compute.js:735
msgid "Save"
msgstr ""
#: ../public/js/plugins/compute.js:899
msgid "Select disk"
#: ../public/js/plugins/compute.js:737
msgid "Save_as name"
msgstr ""
#: ../public/js/plugins/compute.js:901
msgid "Retrieving"
#: ../public/js/plugins/compute.js:755
msgid "Attach disk to running VM"
msgstr ""
#: ../public/js/plugins/compute.js:905
msgid "Image name"
#: ../public/js/plugins/compute.js:758
msgid "Select image"
msgstr ""
#: ../public/js/plugins/compute.js:925 ../public/js/plugins/compute.js:928
msgid "disk id"
#: ../public/js/plugins/compute.js:765
msgid "Target"
msgstr ""
#: ../public/js/plugins/compute.js:1003
#: ../public/js/plugins/compute.js:772
msgid "Attach"
msgstr ""
#: ../public/js/plugins/compute.js:821
msgid "Please select an image to attach"
msgstr ""
#: ../public/js/plugins/compute.js:1031
msgid "VNC connection"
msgstr ""
#: ../public/js/plugins/compute.js:1018
#: ../public/js/plugins/compute.js:1046
msgid "Canvas not supported."
msgstr ""
#: ../public/js/plugins/compute.js:1079 ../public/js/plugins/compute.js:1095
#: ../public/js/plugins/compute.js:1098 ../public/js/plugins/compute.js:1114
msgid "Open VNC Session"
msgstr ""
#: ../public/js/plugins/compute.js:1082 ../public/js/plugins/compute.js:1098
#: ../public/js/plugins/compute.js:1101 ../public/js/plugins/compute.js:1117
msgid "VNC Disabled"
msgstr ""
#: ../public/js/plugins/configuration.js:23
#: ../public/js/plugins/configuration.js:24
msgid "Self-Service UI Configuration"
msgstr ""
#: ../public/js/plugins/configuration.js:28
#: ../public/js/plugins/configuration.js:29
msgid "Language"
msgstr ""
#: ../public/js/plugins/configuration.js:31
msgid "English"
msgstr ""
#: ../public/js/plugins/configuration.js:32
msgid "Chinese"
msgid "English (US)"
msgstr ""
#: ../public/js/plugins/configuration.js:33
msgid "French (CA)"
msgid "Chinese (TW)"
msgstr ""
#: ../public/js/plugins/configuration.js:34
msgid "French (FR)"
msgid "French (CA)"
msgstr ""
#: ../public/js/plugins/configuration.js:35
msgid "German"
msgid "French (FR)"
msgstr ""
#: ../public/js/plugins/configuration.js:36
msgid "Italian"
msgid "German (DE)"
msgstr ""
#: ../public/js/plugins/configuration.js:37
msgid "Persian (IR)"
msgid "Italian (IT)"
msgstr ""
#: ../public/js/plugins/configuration.js:38
msgid "Portuguese (BR)"
msgid "Persian (IR)"
msgstr ""
#: ../public/js/plugins/configuration.js:39
msgid "Portuguese (PT)"
msgid "Portuguese (BR)"
msgstr ""
#: ../public/js/plugins/configuration.js:40
msgid "Slovak"
msgid "Portuguese (PT)"
msgstr ""
#: ../public/js/plugins/configuration.js:41
msgid "Spanish"
msgid "Slovak (SK)"
msgstr ""
#: ../public/js/plugins/configuration.js:63
#: ../public/js/plugins/configuration.js:42
msgid "Spanish (ES)"
msgstr ""
#: ../public/js/plugins/configuration.js:64
msgid "Configuration"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone.js:588
#: ../../../../../sunstone/public/js/sunstone.js:589
msgid "Previous action"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone.js:651
#: ../../../../../sunstone/public/js/sunstone.js:685
#: ../../../../../sunstone/public/js/sunstone.js:652
#: ../../../../../sunstone/public/js/sunstone.js:686
msgid "Confirmation of action"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone.js:657
#: ../../../../../sunstone/public/js/sunstone.js:658
msgid "You have to confirm this action."
msgstr ""
#: ../../../../../sunstone/public/js/sunstone.js:659
#: ../../../../../sunstone/public/js/sunstone.js:660
msgid "Do you want to proceed?"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone.js:690
#: ../../../../../sunstone/public/js/sunstone.js:663
#: ../../../../../sunstone/public/js/sunstone.js:695
msgid "OK"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone.js:691
msgid "You need to select something."
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:206
#: ../../../../../sunstone/public/js/sunstone-util.js:210
msgid "Submitted"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:223
#: ../../../../../sunstone/public/js/sunstone-util.js:227
msgid "Error"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:229
#: ../../../../../sunstone/public/js/sunstone-util.js:233
msgid "Info"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:361
#: ../../../../../sunstone/public/js/sunstone-util.js:365
msgid "Cannot contact server: is it running and reachable?"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:369
#: ../../../../../sunstone/public/js/sunstone-util.js:373
msgid "Network is unreachable: is OpenNebula running?"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:390
#: ../../../../../sunstone/public/js/sunstone-util.js:394
msgid "Unauthorized"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:581
#: ../../../../../sunstone/public/js/sunstone-util.js:801
#: ../../../../../sunstone/public/js/sunstone-util.js:585
#: ../../../../../sunstone/public/js/sunstone-util.js:807
msgid "Please select"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:724
#: ../../../../../sunstone/public/js/sunstone-util.js:730
msgid "Update template"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:730
#: ../../../../../sunstone/public/js/sunstone-util.js:736
msgid "Please, choose and modify the template you want to update"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:732
#: ../../../../../sunstone/public/js/sunstone-util.js:735
#: ../../../../../sunstone/public/js/sunstone-util.js:738
#: ../../../../../sunstone/public/js/sunstone-util.js:741
msgid "Select a template"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:740
msgid "Update"
msgstr ""
#: ../../../../../sunstone/public/js/sunstone-util.js:1020
#: ../../../../../sunstone/public/js/sunstone-util.js:1026
msgid "Please select an element"
msgstr ""
@ -666,6 +758,10 @@ msgstr ""
msgid "Storage pool is formed by several images. These images can contain from full operating systems to be used as base for compute resources, to simple data. OpenNebula Self-Service offers you the possibility to create or upload your own images."
msgstr ""
#: ../public/customize/custom.js:72
msgid "Network"
msgstr ""
#: ../public/customize/custom.js:74
msgid "Your compute resources connectivity is performed using pre-defined virtual networks. You can create and manage these networks using OpenNebula Self-Service."
msgstr ""

View File

@ -27,6 +27,23 @@ body {
padding: 0 10px 0 10px;
}
#footer {
padding: 9px 10px 10px 10px;
color: white;
text-align: center;
background-color: #353735;
border:0;
width: 100%;
height: 9px;
position: fixed;
bottom: 0;
font-size: 10.4px;
}
#footer a {
color: white;
text-decoration: underline;
}
#logo {
padding-top: 6px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

View File

@ -466,6 +466,18 @@ var OCCI = {
params.data.body = { state : "RESUME" };
OCCI.Action.update(params,OCCI.VM.resource,"resume");
},
"restart": function(params){
params.data.body = { state : "RESTART" };
OCCI.Action.update(params,OCCI.VM.resource,"restart");
},
"poweroff": function(params){
params.data.body = { state : "POWEROFF" };
OCCI.Action.update(params,OCCI.VM.resource,"poweroff");
},
"resubmit": function(params){
params.data.body = { state : "RESUBMIT" };
OCCI.Action.update(params,OCCI.VM.resource,"resubmit");
},
"done": function(params){
params.data.body = { state : "DONE" };
OCCI.Action.update(params,OCCI.VM.resource,"done");

View File

@ -291,6 +291,33 @@ var vm_actions = {
},
error: onError,
notify: true
},
"VM.restart" : {
type: "multiple",
call: OCCI.VM.restart,
callback: updateVMachineElement,
elements: vmElements,
error: onError,
notify: true
},
"VM.resubmit" : {
type: "multiple",
call: OCCI.VM.resubmit,
callback: updateVMachineElement,
elements: vmElements,
error: onError,
notify: true
},
"VM.poweroff" : {
type: "multiple",
call: OCCI.VM.poweroff,
callback: updateVMachineElement,
elements: vmElements,
error: onError,
notify: true
}
/*
@ -363,6 +390,21 @@ var vm_buttons = {
text: tr("Reset"),
tip: "This will perform a hard reset on selected VMs"
},
"VM.restart" : {
type: "confirm",
text: tr("Restart"),
tip: tr("This will redeploy selected VMs")
},
"VM.resubmit" : {
type: "confirm",
text: tr("Resubmit"),
tip: tr("This will resubmits VMs to PENDING state")
},
"VM.poweroff" : {
type : "confirm",
text: tr("Power Off"),
tip: tr("This will send a power off signal to running VMs. They can be restarted later.")
},
"VM.cancel" : {
type: "confirm",
text: tr("Cancel"),
@ -513,6 +555,7 @@ function VMStateBulletStr(vm){
case "HOLD":
case "STOPPED":
case "SUSPENDED":
case "POWEROFF":
state_html = '<img style="display:inline-block;margin-right:5px;;" src="images/yellow_bullet.png" alt="'+vm_state+'" title="'+vm_state+'" />';
break;
case "ACTIVE":
@ -886,7 +929,7 @@ function popUpCreateVMDialog(){
var href = location.protocol + "//" + location.host;
var disks = $('#disk_box option[clicked="clicked"]');
var disks = $('#disk_box option[clicked="clicked"]', dialog);
if (disks.length){
vm["DISK"] = [];
@ -896,7 +939,7 @@ function popUpCreateVMDialog(){
});
};
var nets = $('#network_box option[clicked="clicked"]');
var nets = $('#network_box option[clicked="clicked"]', dialog);
if (nets.length){
vm["NIC"] = [];

View File

@ -29,17 +29,17 @@ var config_tab_content =
<td class="key_td">' + tr("Language") + '</td>\
<td class="value_td">\
<select id="lang_sel" style="width:20em;">\
<option value="en_US">'+tr("English")+'</option>\
<option value="zh_TW">'+tr("Chinese")+' (TW)</option>\
<option value="en_US">'+tr("English (US)")+'</option>\
<option value="zh_TW">'+tr("Chinese (TW)")+'</option>\
<option value="fr_CA">'+tr("French (CA)")+'</option>\
<option value="fr_FR">'+tr("French (FR)")+'</option>\
<option value="de">'+tr("German")+'</option>\
<option value="it_IT">'+tr("Italian")+'</option>\
<option value="de">'+tr("German (DE)")+'</option>\
<option value="it_IT">'+tr("Italian (IT)")+'</option>\
<option value="fa_IR">'+tr("Persian (IR)")+'</option>\
<option value="pt_BR">'+tr("Portuguese (BR)")+'</option>\
<option value="pt_PT">'+tr("Portuguese (PT)")+'</option>\
<option value="sk_SK">'+tr("Slovak")+'</option>\
<option value="es_ES">'+tr("Spanish")+'</option>\
<option value="sk_SK">'+tr("Slovak (SK)")+'</option>\
<option value="es_ES">'+tr("Spanish (ES)")+'</option>\
</select>\
</td>\
</tr>\

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/favicon.ico" />
<title>OpenNebula Self-Service Login</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<link rel="stylesheet" type="text/css" href="vendor/jQueryUI/jquery-ui-1.8.16.custom.css" />
@ -51,5 +52,8 @@
</div>
</form>
</div>
<div id="footer" style="overflow:visible;">
<a href="http://opennebula.org" target="_blank">OpenNebula 3.7.0</a> by <a href="http://c12g.com" target="_blank">C12G Labs</a>.
</div>
</body>
</html>

View File

@ -3,7 +3,7 @@
<head>
<title>OpenNebula Self-Service</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="images/favicon.ico" />
<!-- Vendor Libraries -->
<link rel="stylesheet" type="text/css" href="vendor/dataTables/demo_table_jui.css" />
<link rel="stylesheet" type="text/css" href="vendor/jQueryUI/jquery-ui-1.8.16.custom.css" />
@ -81,7 +81,7 @@
</div>
<div id="footer" style="overflow:visible;" class="ui-layout-south">
Copyright 2002-2012 &copy; OpenNebula Project Leads (<a href="http://opennebula.org" target="_blank">OpenNebula.org</a>). All Rights Reserved. OpenNebula 3.7.0
<a href="http://opennebula.org" target="_blank">OpenNebula 3.7.0</a> by <a href="http://c12g.com" target="_blank">C12G Labs</a>.
</div>

View File

@ -91,6 +91,21 @@ EOF
function fs_size {
case $1 in
http://*/download|https://*/download)
BASE_URL=${1%%/download}
HEADERS=`wget -S --spider --no-check-certificate $BASE_URL 2>&1`
echo $HEADERS | grep "opennebula_marketplace" > /dev/null 2>&1
if [ $? -eq 0 ]; then
#URL is from market place
SIZE=`wget -O - -S --no-check-certificate $BASE_URL 2>&1 | grep size | cut -d: -f2`
else
#Not a marketplace URL
SIZE=`wget -S --spider --no-check-certificate $1 2>&1 | grep Content-Length | cut -d':' -f2`
fi
error=$?
;;
http://*|https://*)
SIZE=`wget -S --spider --no-check-certificate $1 2>&1 | grep Content-Length | cut -d':' -f2`
error=$?

View File

@ -77,6 +77,10 @@ void DispatchManager::trigger(Actions action, int _vid)
aname = "STOP_SUCCESS";
break;
case POWEROFF_SUCCESS:
aname = "POWEROFF_SUCCESS";
break;
case DONE:
aname = "DONE";
break;
@ -126,6 +130,10 @@ void DispatchManager::do_action(const string &action, void * arg)
{
stop_success_action(vid);
}
else if (action == "POWEROFF_SUCCESS")
{
poweroff_success_action(vid);
}
else if (action == "DONE")
{
done_action(vid);

View File

@ -209,6 +209,52 @@ error:
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int DispatchManager::poweroff (
int vid)
{
ostringstream oss;
VirtualMachine * vm;
vm = vmpool->get(vid,true);
if ( vm == 0 )
{
return -1;
}
oss << "Powering off VM " << vid;
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING )
{
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
lcm->trigger(LifeCycleManager::POWEROFF,vid);
}
else
{
goto error;
}
vm->unlock();
return 0;
error:
oss.str("");
oss << "Could not power off VM " << vid << ", wrong state.";
NebulaLog::log("DiM",Log::ERROR,oss);
vm->unlock();
return -2;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int DispatchManager::hold(
int vid)
{
@ -464,8 +510,6 @@ int DispatchManager::resume(
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
vm->set_state(VirtualMachine::ACTIVE);
vmpool->update(vm);
vm->log("DiM", Log::INFO, "New VM state is ACTIVE.");
@ -508,9 +552,10 @@ int DispatchManager::restart(int vid)
oss << "Restarting VM " << vid;
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::ACTIVE &&
if ((vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT))
|| vm->get_state() == VirtualMachine::POWEROFF )
{
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
@ -739,6 +784,7 @@ int DispatchManager::finalize(
switch (state)
{
case VirtualMachine::SUSPENDED:
case VirtualMachine::POWEROFF:
int cpu, mem, disk;
vm->get_requirements(cpu,mem,disk);
@ -799,6 +845,12 @@ int DispatchManager::resubmit(int vid)
switch (vm->get_state())
{
case VirtualMachine::POWEROFF:
NebulaLog::log("DiM",Log::ERROR,
"Cannot resubmit a powered off VM. Restart it first");
rc = -2;
break;
case VirtualMachine::SUSPENDED:
NebulaLog::log("DiM",Log::ERROR,
"Cannot resubmit a suspended VM. Resume it first");
@ -810,19 +862,30 @@ int DispatchManager::resubmit(int vid)
break;
case VirtualMachine::FAILED: //Cleanup VM host files
vm->log("DiM", Log::INFO, "New VM state is CLEANUP.");
vm->set_state(VirtualMachine::CLEANUP);
vm->set_state(VirtualMachine::ACTIVE);
vmpool->update(vm);
tm->trigger(TransferManager::EPILOG_DELETE,vid);
break;
case VirtualMachine::HOLD: // Move the VM to PENDING in any of these
case VirtualMachine::STOPPED:
vm->set_state(VirtualMachine::LCM_INIT);
vm->set_state(VirtualMachine::PENDING);
vmpool->update(vm);
vm->log("DiM", Log::INFO, "New VM state is PENDING.");
break;
case VirtualMachine::ACTIVE: //Cleanup VM resources before PENDING
lcm->trigger(LifeCycleManager::CLEAN,vid);
lcm->trigger(LifeCycleManager::CLEAN, vid);
break;
case VirtualMachine::DONE:
NebulaLog::log("DiM",Log::ERROR,
"Cannot resubmit a VM already in DONE state");

View File

@ -97,6 +97,45 @@ void DispatchManager::stop_success_action(int vid)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void DispatchManager::poweroff_success_action(int vid)
{
VirtualMachine * vm;
vm = vmpool->get(vid,true);
if ( vm == 0 )
{
return;
}
if ((vm->get_state() == VirtualMachine::ACTIVE) &&
(vm->get_lcm_state() == VirtualMachine::SHUTDOWN_POWEROFF))
{
vm->set_state(VirtualMachine::POWEROFF);
vm->set_state(VirtualMachine::LCM_INIT);
vmpool->update(vm);
vm->log("DiM", Log::INFO, "New VM state is POWEROFF");
}
else
{
ostringstream oss;
oss << "poweroff_success action received but VM " << vid
<< " not in ACTIVE state";
NebulaLog::log("DiM",Log::ERROR,oss);
}
vm->unlock();
return;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void DispatchManager::done_action(int vid)
{
VirtualMachine * vm;

View File

@ -17,8 +17,6 @@
#--------------------------------------------------------------------------- #
#Setup driver variables
DRIVER_NAME=`basename $0 | cut -d. -f1`
if [ -z "${ONE_LOCATION}" ]; then
DRIVERRC=/etc/one/${DRIVER_NAME}/${DRIVER_NAME}rc
MADCOMMON=/usr/lib/one/mads/madcommon.sh
@ -38,7 +36,7 @@ export_rc_vars $DRIVERRC
# Go to var directory ONE_LOCATION/var or /var/lib/one
cd $VAR_LOCATION
LOG_FILE=one_im_ssh_$DRIVER_NAME
LOG_FILE=$DRIVER_NAME
# Execute the actual MAD
execute_mad $*

View File

@ -22,4 +22,6 @@ else
MAD_LOCATION=$ONE_LOCATION/lib/mads
fi
export DRIVER_NAME="one_im_sh_${BASH_ARGV##* }"
exec $MAD_LOCATION/one_im_exec -l $*

View File

@ -22,4 +22,6 @@ else
MAD_LOCATION=$ONE_LOCATION/lib/mads
fi
export DRIVER_NAME="one_im_ssh_${BASH_ARGV##* }"
exec $MAD_LOCATION/one_im_exec $*

View File

@ -337,6 +337,52 @@ void LifeCycleManager::shutdown_action(int vid)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::poweroff_action(int vid)
{
VirtualMachine * vm;
vm = vmpool->get(vid,true);
if ( vm == 0 )
{
return;
}
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::RUNNING)
{
Nebula& nd = Nebula::instance();
VirtualMachineManager * vmm = nd.get_vmm();
//----------------------------------------------------
// SHUTDOWN_POWEROFF STATE
//----------------------------------------------------
vm->set_state(VirtualMachine::SHUTDOWN_POWEROFF);
vm->set_resched(false);
vmpool->update(vm);
vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN_POWEROFF");
//----------------------------------------------------
vmm->trigger(VirtualMachineManager::SHUTDOWN,vid);
}
else
{
vm->log("LCM", Log::ERROR, "poweroff_action, VM in a wrong state.");
}
vm->unlock();
return;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::restore_action(int vid)
{
VirtualMachine * vm;
@ -349,7 +395,7 @@ void LifeCycleManager::restore_action(int vid)
return;
}
if (vm->get_state() == VirtualMachine::ACTIVE)
if (vm->get_state() == VirtualMachine::SUSPENDED)
{
Nebula& nd = Nebula::instance();
VirtualMachineManager * vmm = nd.get_vmm();
@ -360,6 +406,7 @@ void LifeCycleManager::restore_action(int vid)
//----------------------------------------------------
// BOOT STATE (FROM SUSPEND)
//----------------------------------------------------
vm->set_state(VirtualMachine::ACTIVE);
vm->set_state(VirtualMachine::BOOT);
@ -449,9 +496,10 @@ void LifeCycleManager::restart_action(int vid)
return;
}
if (vm->get_state() == VirtualMachine::ACTIVE &&
if ((vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT))
vm->get_lcm_state() == VirtualMachine::BOOT ))
||vm->get_state() == VirtualMachine::POWEROFF)
{
Nebula& nd = Nebula::instance();
VirtualMachineManager * vmm = nd.get_vmm();
@ -460,12 +508,14 @@ void LifeCycleManager::restart_action(int vid)
// RE-START THE VM IN THE SAME HOST
//----------------------------------------------------
if (vm->get_lcm_state() == VirtualMachine::BOOT)
if (vm->get_state() == VirtualMachine::ACTIVE &&
vm->get_lcm_state() == VirtualMachine::BOOT)
{
vm->log("LCM", Log::INFO, "Sending BOOT command to VM again");
}
else
{
vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff
vm->set_state(VirtualMachine::BOOT);
vmpool->update(vm);
@ -550,8 +600,6 @@ void LifeCycleManager::clean_action(int vid)
clean_up_vm(vm);
dm->trigger(DispatchManager::RESUBMIT,vid);
vm->unlock();
}
@ -571,6 +619,8 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
VirtualMachine::LcmState state = vm->get_lcm_state();
int vid = vm->get_oid();
vm->log("LCM", Log::INFO, "New VM state is CLEANUP.");
vm->set_state(VirtualMachine::CLEANUP);
vm->set_resched(false);
vmpool->update(vm);
@ -597,6 +647,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
case VirtualMachine::RUNNING:
case VirtualMachine::UNKNOWN:
case VirtualMachine::SHUTDOWN:
case VirtualMachine::SHUTDOWN_POWEROFF:
case VirtualMachine::CANCEL:
case VirtualMachine::HOTPLUG:
vm->set_running_etime(the_time);

View File

@ -193,6 +193,10 @@ void LifeCycleManager::trigger(Actions action, int _vid)
aname = ACTION_FINALIZE;
break;
case POWEROFF:
aname = "POWEROFF";
break;
default:
delete vid;
return;
@ -338,6 +342,10 @@ void LifeCycleManager::do_action(const string &action, void * arg)
{
clean_action(vid);
}
else if (action == "POWEROFF")
{
poweroff_action(vid);
}
else if (action == ACTION_FINALIZE)
{
NebulaLog::log("LCM",Log::INFO,"Stopping Life-cycle Manager...");

View File

@ -367,6 +367,7 @@ void LifeCycleManager::shutdown_success_action(int vid)
{
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
DispatchManager * dm = nd.get_dm();
VirtualMachine * vm;
time_t the_time = time(0);
@ -377,25 +378,52 @@ void LifeCycleManager::shutdown_success_action(int vid)
return;
}
//----------------------------------------------------
// EPILOG STATE
//----------------------------------------------------
if ( vm->get_lcm_state() == VirtualMachine::SHUTDOWN )
{
//----------------------------------------------------
// EPILOG STATE
//----------------------------------------------------
vm->set_state(VirtualMachine::EPILOG);
vm->set_state(VirtualMachine::EPILOG);
vmpool->update(vm);
vmpool->update(vm);
vm->set_epilog_stime(the_time);
vm->set_epilog_stime(the_time);
vm->set_running_etime(the_time);
vm->set_running_etime(the_time);
vmpool->update_history(vm);
vmpool->update_history(vm);
vm->log("LCM", Log::INFO, "New VM state is EPILOG");
vm->log("LCM", Log::INFO, "New VM state is EPILOG");
//----------------------------------------------------
//----------------------------------------------------
tm->trigger(TransferManager::EPILOG,vid);
tm->trigger(TransferManager::EPILOG,vid);
}
else if (vm->get_lcm_state() == VirtualMachine::SHUTDOWN_POWEROFF)
{
//----------------------------------------------------
// POWEROFF STATE
//----------------------------------------------------
vm->set_running_etime(the_time);
vm->set_etime(the_time);
vm->set_vm_info();
vm->set_reason(History::STOP_RESUME);
vmpool->update_history(vm);
//----------------------------------------------------
dm->trigger(DispatchManager::POWEROFF_SUCCESS,vid);
}
else
{
vm->log("LCM",Log::ERROR,"shutdown_success_action, VM in a wrong state");
}
vm->unlock();
}
@ -536,6 +564,7 @@ void LifeCycleManager::epilog_success_action(int vid)
time_t the_time = time(0);
int cpu,mem,disk;
VirtualMachine::LcmState state;
DispatchManager::Actions action;
vm = vmpool->get(vid,true);
@ -545,14 +574,24 @@ void LifeCycleManager::epilog_success_action(int vid)
return;
}
if (vm->get_lcm_state() == VirtualMachine::EPILOG_STOP)
state = vm->get_lcm_state();
if ( state == VirtualMachine::EPILOG_STOP )
{
action = DispatchManager::STOP_SUCCESS;
}
else if (vm->get_lcm_state() == VirtualMachine::EPILOG)
else if ( state == VirtualMachine::EPILOG )
{
action = DispatchManager::DONE;
}
else if ( state == VirtualMachine::CLEANUP )
{
dm->trigger(DispatchManager::RESUBMIT, vid);
vm->unlock();
return;
}
else
{
vm->log("LCM",Log::ERROR,"epilog_success_action, VM in a wrong state");
@ -597,9 +636,19 @@ void LifeCycleManager::epilog_failure_action(int vid)
return;
}
vm->set_epilog_etime(the_time);
if ( vm->get_lcm_state() == VirtualMachine::CLEANUP )
{
Nebula& nd = Nebula::instance();
DispatchManager * dm = nd.get_dm();
failure_action(vm);
dm->trigger(DispatchManager::RESUBMIT, vid);
}
else
{
vm->set_epilog_etime(the_time);
failure_action(vm);
}
vm->unlock();

View File

@ -17,6 +17,7 @@
require 'socket'
require 'pp'
require 'rexml/document'
require 'zlib'
begin
require 'rubygems'
@ -155,7 +156,7 @@ class GangliaHost
return nil if !base64_info
info_yaml=Base64::decode64(base64_info)
info_yaml=Zlib::Inflate.inflate(Base64::decode64(base64_info))
info=YAML.load(info_yaml)
end

View File

@ -161,8 +161,6 @@ class SshStreamCommand < RemotesCommand
@remote_dir = remote_dir
@stream = SshStream.new(host, shell)
@stream.open
end
def run(command, stdin=nil, base_cmd = nil)

View File

@ -48,7 +48,7 @@ function execute_mad
MAD_LOG_PATH=/var/log/one/$LOG_FILE.log
else
MAD_EXEC_PATH=$ONE_LOCATION/lib/mads/$MAD_FILE.rb
MAD_LOG_PATH=$ONE_LOCATION/var/$LOG_FILE.log
MAD_LOG_PATH=$ONE_LOCATION/var/$LOG_FILE.log
fi
if [ -n "${ONE_MAD_DEBUG}" ]; then

View File

@ -49,7 +49,8 @@ public class VirtualMachine extends PoolElement{
"STOPPED",
"SUSPENDED",
"DONE",
"FAILED" };
"FAILED",
"POWEROFF" };
private static final String[] SHORT_VM_STATES =
{
@ -60,7 +61,8 @@ public class VirtualMachine extends PoolElement{
"stop",
"susp",
"done",
"fail" };
"fail",
"poff" };
private static final String[] LCM_STATE =
{
@ -81,7 +83,8 @@ public class VirtualMachine extends PoolElement{
"FAILURE",
"CLEANUP",
"UNKNOWN",
"HOTPLUG" };
"HOTPLUG",
"SHUTDOWN_POWEROFF" };
private static final String[] SHORT_LCM_STATES =
{
@ -102,7 +105,8 @@ public class VirtualMachine extends PoolElement{
"fail",
"clea",
"unkn",
"hotp" };
"hotp",
"poff" };
/**
* Creates a new VM representation.
@ -123,7 +127,6 @@ public class VirtualMachine extends PoolElement{
super(xmlElement, client);
}
// =================================
// Static XML-RPC methods
// =================================
@ -306,11 +309,12 @@ public class VirtualMachine extends PoolElement{
* <li>{@link VirtualMachine#resume()}</li>
* <li>{@link VirtualMachine#finalizeVM()}</li>
* <li>{@link VirtualMachine#restart()}</li>
* <li>{@link VirtualMachine#poweroff()}</li>
* </ul>
*
* @param action The action name to be performed, can be:<br/>
* "shutdown", "reboot", "hold", "release", "stop", "cancel", "suspend",
* "resume", "restart", "finalize".
* "resume", "restart", "finalize","poweroff".
* @return If an error occurs the error message contains the reason.
*/
protected OneResponse action(String action)

View File

@ -84,7 +84,13 @@ module OpenNebula
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def info()
super(DOCUMENT_METHODS[:info], 'DOCUMENT')
rc = super(DOCUMENT_METHODS[:info], 'DOCUMENT')
if !OpenNebula.is_error?(rc) && self['TYPE'].to_i != document_type
return OpenNebula::Error.new("[DocumentInfo] Error getting document [#{@pe_id}].")
end
return rc
end
# Allocates a new Document in OpenNebula
@ -102,6 +108,9 @@ module OpenNebula
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def delete()
rc = check_type()
return rc if OpenNebula.is_error?(rc)
return call(DOCUMENT_METHODS[:delete], @pe_id)
end
@ -112,6 +121,9 @@ module OpenNebula
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def update(new_template)
rc = check_type()
return rc if OpenNebula.is_error?(rc)
super(DOCUMENT_METHODS[:update], new_template)
end
@ -123,6 +135,9 @@ module OpenNebula
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def chown(uid, gid)
rc = check_type()
return rc if OpenNebula.is_error?(rc)
super(DOCUMENT_METHODS[:chown], uid, gid)
end
@ -133,6 +148,9 @@ module OpenNebula
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def chmod_octet(octet)
rc = check_type()
return rc if OpenNebula.is_error?(rc)
super(DOCUMENT_METHODS[:chmod], octet)
end
@ -143,6 +161,9 @@ module OpenNebula
# otherwise
def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u,
other_m, other_a)
rc = check_type()
return rc if OpenNebula.is_error?(rc)
super(DOCUMENT_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
group_m, group_a, other_u, other_m, other_a)
end
@ -154,6 +175,9 @@ module OpenNebula
# @return [Integer, OpenNebula::Error] The new Document ID in case
# of success, Error otherwise
def clone(name)
rc = check_type()
return rc if OpenNebula.is_error?(rc)
return Error.new('ID not defined') if !@pe_id
rc = @client.call(DOCUMENT_METHODS[:clone], @pe_id, name)
@ -198,5 +222,27 @@ module OpenNebula
chmod(-1, -1, -1, group_u, -1, -1, -1, -1, -1)
end
def check_type()
type = self['TYPE']
if type.nil? && @pe_id
rc = @client.call(DOCUMENT_METHODS[:info], @pe_id)
return rc if OpenNebula.is_error?(rc)
xmldoc = XMLElement.new
xmldoc.initialize_xml(rc, 'DOCUMENT')
type = xmldoc['TYPE']
end
if !type.nil? && type.to_i != document_type
return OpenNebula::Error.new(
"[DocumentInfo] Error getting document [#{@pe_id}].")
end
return nil
end
end
end

View File

@ -38,11 +38,12 @@ module OpenNebula
:detach => "vm.detach"
}
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED}
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
POWEROFF}
LCM_STATE=%w{LCM_INIT PROLOG BOOT RUNNING MIGRATE SAVE_STOP SAVE_SUSPEND
SAVE_MIGRATE PROLOG_MIGRATE PROLOG_RESUME EPILOG_STOP EPILOG
SHUTDOWN CANCEL FAILURE CLEANUP UNKNOWN HOTPLUG}
SHUTDOWN CANCEL FAILURE CLEANUP UNKNOWN HOTPLUG SHUTDOWN_POWEROFF}
SHORT_VM_STATES={
"INIT" => "init",
@ -52,7 +53,8 @@ module OpenNebula
"STOPPED" => "stop",
"SUSPENDED" => "susp",
"DONE" => "done",
"FAILED" => "fail"
"FAILED" => "fail",
"POWEROFF" => "poff"
}
SHORT_LCM_STATES={
@ -72,7 +74,8 @@ module OpenNebula
"FAILURE" => "fail",
"CLEANUP" => "clea",
"UNKNOWN" => "unkn",
"HOTPLUG" => "hotp"
"HOTPLUG" => "hotp",
"SHUTDOWN_POWEROFF" => "shut"
}
MIGRATE_REASON=%w{NONE ERROR STOP_RESUME USER CANCEL}
@ -148,6 +151,11 @@ module OpenNebula
action('shutdown')
end
# Powers off a running VM
def poweroff
action('poweroff')
end
# Reboots an already deployed VM
def reboot
action('reboot')

View File

@ -65,7 +65,8 @@ start()
ruby $OZONES_SERVER > $OZONES_LOG 2>$OZONES_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then
echo "Error executing $OZONES_SERVER, please check the log $OZONES_LOG"
echo "Error executing ozones-server."
echo "Check $OZONES_LOG_ERROR and $OZONES_LOG for more information"
exit 1
else
echo $LASTPID > $OZONES_PID
@ -75,7 +76,8 @@ start()
ps $LASTPID &> /dev/null
if [ $? -ne 0 ]; then
echo "Error executing $OZONES_SERVER, please check the log $OZONES_LOG"
echo "Error executing ozones-server."
echo "Check $OZONES_LOG_ERROR and $OZONES_LOG for more information"
exit 1
fi
@ -97,6 +99,7 @@ stop()
# Remove pid files
rm -f $OZONES_LOCK_FILE &> /dev/null
rm -f $OZONES_PID &> /dev/null
echo "ozones-server stopped"
}

View File

@ -191,6 +191,7 @@ end
before do
cache_control :no_store
content_type 'application/json', :charset => 'utf-8'
unless request.path=='/login' || request.path=='/'
unless authorized?
@ -224,6 +225,7 @@ end
# HTML Requests
##############################################################################
get '/' do
content_type 'text/html', :charset => 'utf-8'
return File.read(File.dirname(__FILE__)+
'/templates/login.html') unless authorized?
@ -236,6 +238,7 @@ get '/' do
end
get '/login' do
content_type 'text/html', :charset => 'utf-8'
File.read(File.dirname(__FILE__)+'/templates/login.html')
end
@ -253,9 +256,9 @@ end
##############################################################################
# Config and Logs
##############################################################################
get '/config' do
config
end
# get '/config' do
# config
# end
##############################################################################
# GET information

View File

@ -27,6 +27,23 @@ body {
padding: 0 10px 0 10px;
}
#footer {
padding: 9px 10px 10px 10px;
color: white;
text-align: center;
background-color: #353735;
border:0;
width: 100%;
height: 9px;
position: fixed;
bottom: 0;
font-size: 10.4px;
}
#footer a {
color: white;
text-decoration: underline;
}
#logo {
padding-top: 6px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

View File

@ -44,81 +44,86 @@ var oZones = {
"Helper": {
"resource_state": function(type, value)
{
var state;
switch(type)
{
case "HOST":
case "host":
return ["INIT",
"MONITORING_MONITORED",
"MONITORED",
"ERROR",
"DISABLED",
"MONITORING_ERROR"][value];
state = tr(["INIT",
"MONITORING_MONITORED",
"MONITORED",
"ERROR",
"DISABLED",
"MONITORING_ERROR"][value]);
break;
case "HOST_SIMPLE":
case "host_simple":
return ["INIT",
"UPDATE",
"ON",
"ERROR",
"OFF",
"RETRY"][value];
state = tr(["INIT",
"UPDATE",
"ON",
"ERROR",
"OFF",
"RETRY"][value]);
break;
case "VM":
case "vm":
return ["INIT",
"PENDING",
"HOLD",
"ACTIVE",
"STOPPED",
"SUSPENDED",
"DONE",
"FAILED"][value];
state = tr(["INIT",
"PENDING",
"HOLD",
"ACTIVE",
"STOPPED",
"SUSPENDED",
"DONE",
"FAILED",
"POWEROFF"][value]);
break;
case "VM_LCM":
case "vm_lcm":
return ["LCM_INIT",
"PROLOG",
"BOOT",
"RUNNING",
"MIGRATE",
"SAVE_STOP",
"SAVE_SUSPEND",
"SAVE_MIGRATE",
"PROLOG_MIGRATE",
"PROLOG_RESUME",
"EPILOG_STOP",
"EPILOG",
"SHUTDOWN",
"CANCEL",
"FAILURE",
"CLEANUP",
"UNKNOWN",
"HOTPLUG"][value];
state = tr(["LCM_INIT",
"PROLOG",
"BOOT",
"RUNNING",
"MIGRATE",
"SAVE_STOP",
"SAVE_SUSPEND",
"SAVE_MIGRATE",
"PROLOG_MIGRATE",
"PROLOG_RESUME",
"EPILOG_STOP",
"EPILOG",
"SHUTDOWN",
"CANCEL",
"FAILURE",
"CLEANUP",
"UNKNOWN",
"HOTPLUG",
"SHUTDOWN_POWEROFF"][value]);
break;
case "IMAGE":
case "image":
return ["INIT",
"READY",
"USED",
"DISABLED",
"LOCKED",
"ERROR",
"CLONE",
"DELETE",
"USED_PERS"][value];
state = tr(["INIT",
"READY",
"USED",
"DISABLED",
"LOCKED",
"ERROR",
"CLONE",
"DELETE",
"USED_PERS"][value]);
break;
case "VM_MIGRATE_REASON":
case "vm_migrate_reason":
return ["NONE",
"ERROR",
"STOP_RESUME",
"USER",
"CANCEL"][value];
state = tr(["NONE",
"ERROR",
"STOP_RESUME",
"USER",
"CANCEL"][value]);
break;
default:
return;
return value;
}
if (!state) state = value
return state;
},
"image_type": function(value)

View File

@ -3,6 +3,7 @@
<head>
<title>OpenNebula oZones</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="shortcut icon" href="images/favicon.ico" />
<!-- Vendor Libraries -->
<link rel="stylesheet" type="text/css" href="vendor/dataTables/demo_table_jui.css" />
@ -62,10 +63,10 @@
<a href="http://opennebula.org/community:community" target="_blank">Community</a>
</div>
</div>
<div id="footer" style="overflow:visible;" class="ui-layout-south">
Copyright 2002-2012 &copy; OpenNebula Project Leads (<a href="http://opennebula.org" target="_blank">OpenNebula.org</a>). All Rights Reserved. OpenNebula 3.7.0
</div>
<div id="footer" style="overflow:visible;" class="ui-layout-south">
<a href="http://opennebula.org" target="_blank">OpenNebula 3.7.0</a> by <a href="http://c12g.com" target="_blank">C12G Labs</a>.
</div>
<div id="dialogs">

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/favicon.ico" />
<title>OpenNebula oZones Login</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<link rel="stylesheet" type="text/css" href="vendor/jQueryUI/jquery-ui-1.8.16.custom.css" />
@ -47,5 +48,8 @@
</div>
</form>
</div>
<div id="footer" style="overflow:visible;">
<a href="http://opennebula.org" target="_blank">OpenNebula 3.7.0</a> by <a href="http://c12g.com" target="_blank">C12G Labs</a>.
</div>
</body>
</html>

View File

@ -328,6 +328,10 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
{
rc = dm->reset(id);
}
else if (action == "poweroff")
{
rc = dm->poweroff(id);
}
switch (rc)
{

View File

@ -69,8 +69,10 @@ start()
touch $SUNSTONE_LOCK_FILE
ruby $SUNSTONE_SERVER > $SUNSTONE_LOG 2>$SUNSTONE_LOG_ERROR &
LASTPID=$!
if [ $? -ne 0 ]; then
echo "Error executing $SUNSTONE_SERVER, please check the log $SUNSTONE_LOG"
echo "Error executing sunstone-server."
echo "Check $SUNSTONE_LOG_ERROR and $SUNSTONE_LOG for more information"
exit 1
else
echo $LASTPID > $SUNSTONE_PID
@ -80,7 +82,8 @@ start()
ps $LASTPID &> /dev/null
if [ $? -ne 0 ]; then
echo "Error executing $SUNSTONE_SERVER, please check the log $SUNSTONE_LOG"
echo "Error executing sunstone-server."
echo "Check $SUNSTONE_LOG_ERROR and $SUNSTONE_LOG for more information"
exit 1
fi
@ -102,6 +105,7 @@ stop()
# Remove pid files
rm -f $SUNSTONE_LOCK_FILE &> /dev/null
rm -f $SUNSTONE_PID &> /dev/null
echo "sunstone-server stopped"
}

View File

@ -29,6 +29,6 @@ env.Po('fa_IR.po')
env.Po('fr_FR.po')
env.Po('it_IT.po')
env.Po('pt_PT.po')
env.Po('ru.po')
env.Po('ru_RU.po')
env.Po('sk_SK.po')
env.Po('zh_TW.po')

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,7 @@ module OpenNebulaJSON
when "saveas" then self.save_as(action_hash['params'])
when "shutdown" then self.shutdown
when "reboot" then self.reboot
when "poweroff" then self.poweroff
when "resubmit" then self.resubmit
when "chown" then self.chown(action_hash['params'])
when "chmod" then self.chmod_octet(action_hash['params'])

View File

@ -28,6 +28,24 @@ body {
}
#footer {
padding: 9px 10px 10px 10px;
color: white;
text-align: center;
background-color: #353735;
border:0;
width: 100%;
height: 9px;
position: fixed;
bottom: 0;
font-size: 10.4px;
}
#footer a {
color: white;
text-decoration: underline;
}
#logo {
padding-top: 6px;
font-size: 1.1em;

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

View File

@ -44,11 +44,12 @@ var OpenNebula = {
"Helper": {
"resource_state": function(type, value)
{
var state;
switch(type)
{
case "HOST":
case "host":
return tr(["INIT",
state = tr(["INIT",
"MONITORING_MONITORED",
"MONITORED",
"ERROR",
@ -57,7 +58,7 @@ var OpenNebula = {
break;
case "HOST_SIMPLE":
case "host_simple":
return tr(["INIT",
state = tr(["INIT",
"UPDATE",
"ON",
"ERROR",
@ -66,18 +67,19 @@ var OpenNebula = {
break;
case "VM":
case "vm":
return tr(["INIT",
state = tr(["INIT",
"PENDING",
"HOLD",
"ACTIVE",
"STOPPED",
"SUSPENDED",
"DONE",
"FAILED"][value]);
"FAILED",
"POWEROFF"][value]);
break;
case "VM_LCM":
case "vm_lcm":
return tr(["LCM_INIT",
state = tr(["LCM_INIT",
"PROLOG",
"BOOT",
"RUNNING",
@ -94,11 +96,12 @@ var OpenNebula = {
"FAILURE",
"CLEANUP",
"UNKNOWN",
"HOTPLUG"][value]);
"HOTPLUG",
"SHUTDOWN_POWEROFF"][value]);
break;
case "IMAGE":
case "image":
return tr(["INIT",
state = tr(["INIT",
"READY",
"USED",
"DISABLED",
@ -110,15 +113,17 @@ var OpenNebula = {
break;
case "VM_MIGRATE_REASON":
case "vm_migrate_reason":
return tr(["NONE",
state = tr(["NONE",
"ERROR",
"STOP_RESUME",
"USER",
"CANCEL"][value]);
break;
default:
return;
return value;
}
if (!state) state = value
return state;
},
"image_type": function(value)
@ -201,14 +206,15 @@ var OpenNebula = {
//server requests helper methods
"create": function(params,resource){
"create": function(params, resource, path){
var callback = params.success;
var callback_error = params.error;
var data = params.data;
var request = OpenNebula.Helper.request(resource,"create", data);
var req_path = path ? path : resource.toLowerCase();
$.ajax({
url: resource.toLowerCase(),
url: req_path,
type: "POST",
dataType: "json",
data: JSON.stringify(data),
@ -222,14 +228,15 @@ var OpenNebula = {
});
},
"del": function(params,resource){
"del": function(params, resource, path){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var request = OpenNebula.Helper.request(resource,"delete", id);
var req_path = path ? path : resource.toLowerCase();
$.ajax({
url: resource.toLowerCase() + "/" + id,
url: req_path + "/" + id,
type: "DELETE",
success: function(){
return callback ? callback(request) : null;
@ -241,14 +248,15 @@ var OpenNebula = {
});
},
"list": function(params,resource){
"list": function(params, resource, path){
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var request = OpenNebula.Helper.request(resource,"list");
var req_path = path ? path : resource.toLowerCase();
$.ajax({
url: resource.toLowerCase(),
url: req_path,
type: "GET",
data: {timeout: timeout},
dataType: "json",
@ -266,7 +274,7 @@ var OpenNebula = {
},
//Subresource examples: "fetch_template", "log"...
"show": function(params,resource,subresource){
"show": function(params, resource, subresource, path){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
@ -274,7 +282,8 @@ var OpenNebula = {
OpenNebula.Helper.request(resource,subresource,id) :
OpenNebula.Helper.request(resource,"show", id);
var url = resource.toLowerCase() + "/" + id;
var req_path = path ? path : resource.toLowerCase();
var url = req_path + "/" + id;
url = subresource? url + "/" + subresource : url;
$.ajax({
@ -291,7 +300,7 @@ var OpenNebula = {
});
},
"chown": function(params,resource,chgrp){
"chown": function(params, resource, path){
var id = params.data.extra_param;
var action_obj = {"owner_id": id,
"group_id": "-1"};
@ -299,10 +308,11 @@ var OpenNebula = {
OpenNebula.Action.simple_action(params,
resource,
"chown",
action_obj);
action_obj,
path);
},
"chgrp": function(params,resource){
"chgrp": function(params, resource, path){
var id = params.data.extra_param;
var action_obj = {"owner_id": "-1",
"group_id": id};
@ -310,11 +320,12 @@ var OpenNebula = {
OpenNebula.Action.simple_action(params,
resource,
"chown",
action_obj);
action_obj,
path);
},
//Example: Simple action: publish. Simple action with action obj: deploy
"simple_action": function(params,resource,method,action_obj){
"simple_action": function(params, resource, method, action_obj, path){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
@ -328,8 +339,10 @@ var OpenNebula = {
request = OpenNebula.Helper.request(resource,method, id);
};
var req_path = path ? path : resource.toLowerCase();
$.ajax({
url: resource.toLowerCase() + "/" + id + "/action",
url: req_path + "/" + id + "/action",
type: "POST",
data: JSON.stringify(action),
success: function(){
@ -342,7 +355,7 @@ var OpenNebula = {
});
},
"monitor": function(params,resource,all){
"monitor": function(params, resource, all, path){
var callback = params.success;
var callback_error = params.error;
var data = params.data;
@ -350,7 +363,7 @@ var OpenNebula = {
var method = "monitor";
var request = OpenNebula.Helper.request(resource,method, data);
var url = resource.toLowerCase();
var url = path ? path : resource.toLowerCase();
url = all ? url + "/monitor" : url + "/" + params.data.id + "/monitor";
$.ajax({
@ -622,6 +635,9 @@ var OpenNebula = {
"resubmit": function(params){
OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"resubmit");
},
"poweroff" : function(params){
OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff");
},
"reboot" : function(params){
OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"reboot");
},

View File

@ -29,14 +29,14 @@ var config_tab_content =
<td class="key_td">' + tr("Language") + '</td>\
<td class="value_td">\
<select id="lang_sel" style="width:20em;">\
<option value="en_US">'+tr("English")+'</option>\
<option value="en_US">'+tr("English (US)")+'</option>\
<option value="zh_TW">'+tr("Chinese (TW)")+'</option>\
<option value="fr_FR">'+tr("French")+'</option>\
<option value="it_IT">'+tr("Italian")+'</option>\
<option value="fr_FR">'+tr("French (FR)")+'</option>\
<option value="it_IT">'+tr("Italian (IT)")+'</option>\
<option value="fa_IR">'+tr("Persian (IR)")+'</option>\
<option value="pt_PT">'+tr("Portuguese")+'</option>\
<option value="ru">'+tr("Russian")+'</option>\
<option value="sk_SK">'+tr("Slovak")+'</option>\
<option value="pt_PT">'+tr("Portuguese (PT)")+'</option>\
<option value="ru_RU">'+tr("Russian (RU)")+'</option>\
<option value="sk_SK">'+tr("Slovak (SK)")+'</option>\
</select>\
</td>\
</tr>\

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
var infra_tab_content =
'<table class="dashboard_table" id="infra_dashboard" style=>\
'<table class="dashboard_table" id="infra_dashboard">\
<tr>\
<td style="width:50%">\
<table style="width:100%">\

View File

@ -44,6 +44,9 @@ var market_actions = {
callback: function(request,response){
$('#img_name', $create_image_dialog).val(response['name']);
$('#img_path', $create_image_dialog).val(response['links']['download']['href']);
$('#src_path_select input[value="path"]', $create_image_dialog).trigger('click');
$('select#img_type', $create_image_dialog).val('OS');
$('select#img_type', $create_image_dialog).trigger('change');
//remove any options from the custom vars dialog box
$("#custom_var_image_box",$create_image_dialog).empty();

View File

@ -1605,12 +1605,14 @@ function setupCreateTemplateDialog(){
$('#PORT',section_graphics).parent().show();
$('#PASSWD',section_graphics).parent().show();
$('#KEYMAP',section_graphics).parent().show();
$('#LISTEN',section_graphics).parent().removeAttr('disabled');
$('#PORT',section_graphics).parent().removeAttr('disabled');
$('#PASSWD',section_graphics).parent().removeAttr('disabled');
$('#KEYMAP',section_graphics).parent().removeAttr('disabled');
break;
case "sdl":
$('#LISTEN',section_graphics).parent().show();
$('#LISTEN',section_graphics).parent().removeAttr('disabled');
$('#PORT',section_graphics).parent().hide();
$('#PASSWD',section_graphics).parent().hide();
$('#KEYMAP',section_graphics).parent().hide();
@ -1619,10 +1621,18 @@ function setupCreateTemplateDialog(){
$('#KEYMAP',section_graphics).parent().attr('disabled','disabled');
break;
default:
$('#LISTEN',section_graphics).parent().hide();
$('#PORT',section_graphics).parent().hide();
$('#PASSWD',section_graphics).parent().hide();
$('#KEYMAP',section_graphics).parent().hide();
$('#LISTEN',
section_graphics).parent().hide().attr('disabled',
'disabled');
$('#PORT',
section_graphics).parent().hide().attr('disabled',
'disabled');
$('#PASSWD',
section_graphics).parent().hide().attr('disabled',
'disabled');
$('#KEYMAP',
section_graphics).parent().hide().attr('disabled',
'disabled');
}
});

View File

@ -343,6 +343,15 @@ var vm_actions = {
notify: true
},
"VM.poweroff" : {
type: "multiple",
call: OpenNebula.VM.poweroff,
callback: vmShow,
elements: vmElements,
error: onError,
notify: true
},
"VM.saveas" : {
type: "single",
call: OpenNebula.VM.saveas,
@ -582,6 +591,11 @@ var vm_buttons = {
text: tr("Resubmit"),
tip: tr("This will resubmits VMs to PENDING state")
},
"VM.poweroff" : {
type : "confirm",
text: tr("Power Off"),
tip: tr("This will send a power off signal to running VMs. They can be restarted later.")
},
"VM.reboot" : {
type : "confirm",
text: tr("Reboot"),

View File

@ -87,7 +87,7 @@ enable_logging SUNSTONE_LOG, settings.config[:debug_level].to_i
begin
ENV["ONE_CIPHER_AUTH"] = SUNSTONE_AUTH
cloud_auth = CloudAuth.new(settings.config)
cloud_auth = CloudAuth.new(settings.config, settings.logger)
rescue => e
settings.logger.error {
"Error initializing authentication system" }
@ -120,8 +120,8 @@ helpers do
begin
result = settings.cloud_auth.auth(request.env, params)
rescue Exception => e
error 500, ""
logger.error { e.message }
return [500, ""]
end
if result.nil?
@ -183,6 +183,7 @@ end
before do
cache_control :no_store
content_type 'application/json', :charset => 'utf-8'
unless request.path=='/login' || request.path=='/'
halt 401 unless authorized?
@ -218,6 +219,7 @@ end
# HTML Requests
##############################################################################
get '/' do
content_type 'text/html', :charset => 'utf-8'
if !authorized?
return erb :login
end
@ -239,6 +241,7 @@ get '/' do
end
get '/login' do
content_type 'text/html', :charset => 'utf-8'
if !authorized?
erb :login
end
@ -290,6 +293,7 @@ post '/config' do
when "wss" then session[:wss] = value
end
end
[204,""]
end
get '/vm/:id/log' do

View File

@ -3,7 +3,7 @@
<head>
<title>OpenNebula Sunstone: Cloud Operations Center</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="images/favicon.ico" />
<!-- Vendor Libraries -->
<link rel="stylesheet" type="text/css" href="vendor/dataTables/demo_table_jui.css" />
<link rel="stylesheet" type="text/css" href="vendor/dataTables/ColVis.css" />
@ -94,7 +94,7 @@
</div>
</div>
<div id="footer" style="overflow:visible;" class="ui-layout-south">
Copyright 2002-2012 &copy; OpenNebula Project Leads (<a href="http://opennebula.org" target="_blank">OpenNebula.org</a>). All Rights Reserved. OpenNebula 3.7.0
<a href="http://opennebula.org" target="_blank">OpenNebula 3.7.0</a> by <a href="http://c12g.com" target="_blank">C12G Labs</a>.
</div>

View File

@ -1,8 +1,10 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/favicon.ico" />
<title>OpenNebula Sunstone Login</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<link rel="stylesheet" type="text/css" href="vendor/jQueryUI/jquery-ui-1.8.16.custom.css" />
<!-- Vendor Libraries -->
<script type="text/javascript" src="vendor/jQuery/jquery-1.7.2.min.js"></script>
@ -27,5 +29,9 @@
<%= erb :_login_standard %>
<% end %>
<div id="footer" style="overflow:visible;">
<a href="http://opennebula.org" target="_blank">OpenNebula 3.7.0</a> by <a href="http://c12g.com" target="_blank">C12G Labs</a>.
</div>
</body>
</html>

View File

@ -224,8 +224,12 @@ int TransferManager::prolog_transfer_command(
string format;
string tm_mad;
string ds_id;
string vm_ds_id;
int disk_index;
vm_ds_id = vm->get_ds_id();
disk->vector_value("DISK_ID", disk_index);
type = disk->vector_value("TYPE");
@ -253,7 +257,7 @@ int TransferManager::prolog_transfer_command(
<< vm->get_hostname() << ":"
<< vm->get_remote_system_dir() << "/disk." << disk_index << " "
<< vm->get_oid() << " "
<< "0"
<< vm_ds_id
<< endl;
}
else if ( type == "FS" )
@ -279,7 +283,7 @@ int TransferManager::prolog_transfer_command(
<< vm->get_hostname() << ":"
<< vm->get_remote_system_dir() << "/disk." << disk_index << " "
<< vm->get_oid() << " "
<< "0"
<< vm_ds_id
<< endl;
}
else
@ -386,8 +390,8 @@ void TransferManager::prolog_action(int vid)
goto error_history;
}
vm_tm_mad = vm->get_tm_mad();
tm_md = get();
vm_tm_mad = vm->get_tm_mad();
tm_md = get();
if ( tm_md == 0 || vm_tm_mad.empty() )
{
@ -455,7 +459,8 @@ void TransferManager::prolog_action(int vid)
xfr << vm->get_hostname() << ":"
<< vm->get_remote_system_dir() << "/disk." << num << " "
<< vm->get_oid() << " "
<< "0" << endl;
<< vm->get_ds_id()
<< endl;
}
xfr.close();
@ -1457,6 +1462,25 @@ void TransferManager::checkpoint_action(int vid)
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void TransferManager::migrate_transfer_command(
VirtualMachine * vm,
ostream& xfr)
{
// <PREMIGRATE/POSTMIGRATE> tm_mad SOURCE DST remote_system_dir vmid dsid
xfr << "MIGRATE " //TM action PRE or POST to be completed by VMM driver
<< vm->get_tm_mad() << " "
<< vm->get_hostname() << " "
<< vm->get_previous_hostname() << " "
<< vm->get_remote_system_dir() << " "
<< vm->get_oid() << " "
<< vm->get_ds_id()
<< endl;
}
/* ************************************************************************** */
/* MAD Loading */
/* ************************************************************************** */

View File

@ -96,8 +96,7 @@ void TransferManagerDriver::protocol(
return;
}
if ( vm->get_lcm_state() == VirtualMachine::CLEANUP ||
vm->get_lcm_state() == VirtualMachine::FAILURE ||
if ( vm->get_lcm_state() == VirtualMachine::FAILURE ||
vm->get_lcm_state() == VirtualMachine::LCM_INIT )
{
os.str("");
@ -128,6 +127,7 @@ void TransferManagerDriver::protocol(
case VirtualMachine::EPILOG:
case VirtualMachine::EPILOG_STOP:
case VirtualMachine::CLEANUP:
lcm_action = LifeCycleManager::EPILOG_SUCCESS;
break;
@ -164,6 +164,7 @@ void TransferManagerDriver::protocol(
case VirtualMachine::EPILOG:
case VirtualMachine::EPILOG_STOP:
case VirtualMachine::CLEANUP:
lcm_action = LifeCycleManager::EPILOG_FAILURE;
break;

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

@ -0,0 +1,29 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
# POSTMIGRATE SOURCE DST remote_system_dir vmid dsid template
# - SOURCE is the host where the VM is running
# - DST is the host where the VM is 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

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

@ -0,0 +1,29 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
# PREMIGRATE SOURCE DST remote_system_dir vmid dsid template
# - SOURCE is the host where the VM is running
# - DST is the host where the VM is 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

View File

@ -0,0 +1 @@
../common/dummy.sh

1
src/tm_mad/dummy/premigrate Symbolic link
View File

@ -0,0 +1 @@
../common/dummy.sh

View File

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

1
src/tm_mad/iscsi/premigrate Symbolic link
View File

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

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

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

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

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

View File

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

1
src/tm_mad/qcow2/premigrate Symbolic link
View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More