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

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Hector Sanjuan 2012-04-09 13:33:49 +02:00
commit 3de79a15dd
43 changed files with 495 additions and 646 deletions

View File

@ -156,6 +156,25 @@ public:
// Environment & Configuration
// --------------------------------------------------------------
/**
* Returns the value of DEBUG_LEVEL in oned.conf file
* @return the debug level, to instantiate Log'ers
*/
Log::MessageType get_debug_level() const
{
Log::MessageType clevel = Log::ERROR;
int log_level_int;
nebula_configuration->get("DEBUG_LEVEL", log_level_int);
if (0 <= log_level_int && log_level_int <= 3 )
{
clevel = static_cast<Log::MessageType>(log_level_int);
}
return clevel;
}
/**
* Returns the value of ONE_LOCATION env variable. When this variable is
* not defined the nebula location is "/".

View File

@ -185,7 +185,6 @@ SHARE_DIRS="$SHARE_LOCATION/examples \
ETC_DIRS="$ETC_LOCATION/im_ec2 \
$ETC_LOCATION/vmm_ec2 \
$ETC_LOCATION/vmm_exec \
$ETC_LOCATION/tm \
$ETC_LOCATION/hm \
$ETC_LOCATION/auth \
$ETC_LOCATION/auth/certificates \
@ -227,7 +226,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \
$VAR_LOCATION/remotes/vnm/vmware \
$VAR_LOCATION/remotes/tm/ \
$VAR_LOCATION/remotes/tm/dummy \
$VAR_LOCATION/remotes/tm/lvm \
$VAR_LOCATION/remotes/tm/shared \
$VAR_LOCATION/remotes/tm/qcow2 \
$VAR_LOCATION/remotes/tm/ssh \
@ -392,7 +390,6 @@ INSTALL_FILES=(
TM_VMWARE_FILES:$VAR_LOCATION/remotes/tm/vmware
TM_ISCSI_FILES:$VAR_LOCATION/remotes/tm/iscsi
TM_DUMMY_FILES:$VAR_LOCATION/remotes/tm/dummy
TM_LVM_FILES:$VAR_LOCATION/remotes/tm/lvm
DATASTORE_DRIVER_COMMON_SCRIPTS:$VAR_LOCATION/remotes/datastore/
DATASTORE_DRIVER_DUMMY_SCRIPTS:$VAR_LOCATION/remotes/datastore/dummy
DATASTORE_DRIVER_FS_SCRIPTS:$VAR_LOCATION/remotes/datastore/fs
@ -539,7 +536,6 @@ INSTALL_ETC_FILES=(
VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2
VMM_EXEC_ETC_FILES:$ETC_LOCATION/vmm_exec
IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2
TM_LVM_ETC_FILES:$ETC_LOCATION/tm/
HM_ETC_FILES:$ETC_LOCATION/hm
AUTH_ETC_FILES:$ETC_LOCATION/auth
ECO_ETC_FILES:$ETC_LOCATION
@ -766,8 +762,9 @@ NETWORK_VMWARE_FILES="src/vnm_mad/remotes/vmware/clean \
# - SHARED TM, $VAR_LOCATION/tm/shared
# - QCOW2 TM, $VAR_LOCATION/tm/qcow2
# - SSH TM, $VAR_LOCATION/tm/ssh
# - dummy TM, $VAR_LOCATION/tm/dummy
# - LVM TM, $VAR_LOCATION/tm/lvm
# - DUMMY TM, $VAR_LOCATION/tm/dummy
# - VMWARE TM, $VAR_LOCATION/tm/vmware
# - ISCSI TM, $VAR_LOCATION/tm/iscsi
#-------------------------------------------------------------------------------
TM_FILES="src/tm_mad/tm_common.sh"
@ -808,14 +805,6 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \
src/tm_mad/dummy/context \
src/tm_mad/dummy/mvds"
TM_LVM_FILES="src/tm_mad/lvm/clone \
src/tm_mad/lvm/delete \
src/tm_mad/lvm/ln \
src/tm_mad/lvm/mkswap \
src/tm_mad/lvm/mkimage \
src/tm_mad/lvm/mv \
src/tm_mad/lvm/context"
TM_VMWARE_FILES="src/tm_mad/vmware/clone \
src/tm_mad/vmware/delete
src/tm_mad/vmware/ln \
@ -869,6 +858,7 @@ ONEDB_MIGRATOR_FILES="src/onedb/2.0_to_2.9.80.rb \
src/onedb/3.2.0_to_3.2.1.rb \
src/onedb/3.2.1_to_3.3.0.rb \
src/onedb/3.3.0_to_3.3.80.rb \
src/onedb/3.3.80_to_3.4.0.rb \
src/onedb/onedb.rb \
src/onedb/onedb_backend.rb"
@ -905,16 +895,6 @@ VMM_EXEC_ETC_FILES="src/vmm_mad/exec/vmm_execrc \
IM_EC2_ETC_FILES="src/im_mad/ec2/im_ec2rc \
src/im_mad/ec2/im_ec2.conf"
#-------------------------------------------------------------------------------
# Storage drivers config. files, to be installed under $ETC_LOCATION
# - shared, $ETC_LOCATION/tm_shared
# - ssh, $ETC_LOCATION/tm_ssh
# - dummy, $ETC_LOCATION/tm_dummy
# - lvm, $ETC_LOCATION/tm_lvm
#-------------------------------------------------------------------------------
TM_LVM_ETC_FILES="src/tm_mad/lvm/lvm.conf"
#-------------------------------------------------------------------------------
# Hook Manager driver config. files, to be installed under $ETC_LOCATION/hm
#-------------------------------------------------------------------------------
@ -1080,10 +1060,12 @@ OCCI_LIB_CLIENT_FILES="src/cloud/occi/lib/OCCIClient.rb"
OCCI_BIN_FILES="src/cloud/occi/bin/occi-server \
src/cloud/occi/bin/occi-compute \
src/cloud/occi/bin/occi-network \
src/cloud/occi/bin/occi-instance-type \
src/cloud/occi/bin/occi-storage"
OCCI_BIN_CLIENT_FILES="src/cloud/occi/bin/occi-compute \
src/cloud/occi/bin/occi-network \
src/cloud/occi/bin/occi-instance-type \
src/cloud/occi/bin/occi-storage"
OCCI_ETC_FILES="src/cloud/occi/etc/occi-server.conf"

View File

@ -21,12 +21,14 @@ if [ -z "$ONE_LOCATION" ]; then
ECONE_SERVER=/usr/lib/one/ruby/cloud/econe/econe-server.rb
ECONE_LOCK_FILE=/var/lock/one/.econe.lock
ECONE_LOG=/var/log/one/econe-server.log
ECONE_LOG_ERROR=/var/log/one/econe-server.error
ECONE_ETC=/etc/one/econe.conf
else
ECONE_PID=$ONE_LOCATION/var/econe-server.pid
ECONE_SERVER=$ONE_LOCATION/lib/ruby/cloud/econe/econe-server.rb
ECONE_LOCK_FILE=$ONE_LOCATION/var/.econe.lock
ECONE_LOG=$ONE_LOCATION/var/econe-server.log
ECONE_LOG_ERROR=$ONE_LOCATION/var/econe-server.error
ECONE_ETC=$ONE_LOCATION/etc/econe.conf
fi
@ -58,7 +60,7 @@ start()
fi
# Start the econe-server daemon
ruby $ECONE_SERVER > $ECONE_LOG 2>&1 &
ruby $ECONE_SERVER >$ECONE_LOG 2>$ECONE_LOG_ERROR &
LASTRC=$?
LASTPID=$!

View File

@ -75,6 +75,9 @@ Options:
--debug, -D
Enables verbosity
--verbose
Show resources in verbose mode
EOT
require 'occi/OCCIClient'
@ -83,13 +86,14 @@ require 'getoptlong'
include CloudCLI
opts = GetoptLong.new(
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT]
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT],
['--verbose', GetoptLong::NO_ARGUMENT]
)
url = nil
@ -98,6 +102,7 @@ password = nil
auth = nil
timeout = nil
debug = false
verbose = false
begin
opts.each do |opt, arg|
@ -118,6 +123,8 @@ begin
timeout = arg
when '--debug'
debug = true
when '--verbose'
verbose = true
end
end
rescue Exception => e
@ -139,7 +146,7 @@ end
case ARGV[0].downcase
when 'list'
rc = occi_client.get_vms
rc = occi_client.get_vms(verbose)
when 'create'
vm_xml = ARGV[1]

View File

@ -0,0 +1,147 @@
#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
TEMPLATES_LOCATION=ONE_LOCATION+"/etc/occi_templates"
CONF_LOCATION=ONE_LOCATION+"/etc"
end
$: << RUBY_LIB_LOCATION
$: << RUBY_LIB_LOCATION+"/cloud"
COMMANDS_HELP=<<-EOT
occi-instance-type - Retrieve instance types
Usage:
occi-instance-type <COMMAND> [OPTIONS]
Commands:
* list
lists available instance types
Options:
--help, -h
Show help
--username <id>, -U <id>
The username of the user
--password <key>, -P <key>
The password of the user
--url <url>, -R <url>
Set url as the web service url to use
--timeout <seconds>, -T <seconds>
Sets a timeout for the http connection
--debug, -D
Enables verbosity
--verbose
Show resources in verbose mode
EOT
require 'occi/OCCIClient'
require 'getoptlong'
include CloudCLI
opts = GetoptLong.new(
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT],
['--verbose', GetoptLong::NO_ARGUMENT]
)
url = nil
username = nil
password = nil
auth = nil
timeout = nil
debug = false
verbose = false
begin
opts.each do |opt, arg|
case opt
when '--help'
puts COMMANDS_HELP
return
when '--version'
puts CloudCLI.version_text
exit 0
when '--username'
username = arg
when '--password'
password = arg
when '--url'
url = arg
when '--timeout'
timeout = arg
when '--debug'
debug = true
when '--verbose'
verbose = true
end
end
rescue Exception => e
exit(-1)
end
begin
occi_client = OCCIClient::Client.new(url,username,password, timeout, debug)
rescue Exception => e
puts "#{cmd_name}: #{e.message}"
exit(-1)
end
if !ARGV[0]
puts "#{cmd_name}: [COMMAND] not present"
puts "#{cmd_name}: Execute #{cmd_name} -h for help."
exit(-1)
end
case ARGV[0].downcase
when 'list'
rc = occi_client.get_instance_types(verbose)
else
puts "Command #{ARGV[0]} not valid."
exit(-1)
end
if CloudClient::is_error?(rc)
puts rc.to_s()
exit(-1)
else
str, code = print_xml(rc)
puts str
exit(code)
end

View File

@ -76,25 +76,25 @@ Options:
--debug, -D
Enables verbosity
--multipart, -M
Use 'multipart-post' library instead of Curb/Curl
--verbose
Show resources in verbose mode
EOT
require 'occi/OCCIClient'
require 'CloudClient'
require 'getoptlong'
include CloudCLI
opts = GetoptLong.new(
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT]
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT],
['--verbose', GetoptLong::NO_ARGUMENT]
)
url = nil
@ -103,6 +103,7 @@ password = nil
auth = nil
timeout = nil
debug = false
verbose = false
begin
opts.each do |opt, arg|
@ -123,13 +124,14 @@ begin
timeout = arg
when '--debug'
debug = true
when '--verbose'
verbose = true
end
end
rescue Exception => e
exit(-1)
end
begin
occi_client = OCCIClient::Client.new(url,username,password,timeout,debug)
rescue Exception => e
@ -156,7 +158,7 @@ case ARGV[0].downcase
rc = occi_client.post_network(network_xml)
when 'list'
rc = occi_client.get_networks
rc = occi_client.get_networks(verbose)
when 'show'
network_id = ARGV[1]

View File

@ -21,12 +21,14 @@ if [ -z "$ONE_LOCATION" ]; then
OCCI_SERVER=/usr/lib/one/ruby/cloud/occi/occi-server.rb
OCCI_LOCK_FILE=/var/lock/one/.occi.lock
OCCI_LOG=/var/log/one/occi-server.log
OCCI_LOG_ERROR=/var/log/one/occi-server.error
OCCI_ETC=/etc/one/occi-server.conf
else
OCCI_PID=$ONE_LOCATION/var/occi-server.pid
OCCI_SERVER=$ONE_LOCATION/lib/ruby/cloud/occi/occi-server.rb
OCCI_LOCK_FILE=$ONE_LOCATION/var/.occi.lock
OCCI_LOG=$ONE_LOCATION/var/occi-server.log
OCCI_LOG_ERROR=$ONE_LOCATION/var/occi-server.error
OCCI_ETC=$ONE_LOCATION/etc/occi-server.conf
fi
@ -58,7 +60,7 @@ start()
fi
# Start the occi-server daemon
ruby $OCCI_SERVER > $OCCI_LOG 2>&1 &
ruby $OCCI_SERVER >$OCCI_LOG 2>$OCCI_LOG_ERROR &
LASTRC=$?
LASTPID=$!

View File

@ -79,6 +79,9 @@ Options:
--multipart, -M
Use 'multipart-post' library instead of Curb/Curl
--verbose
Show resources in verbose mode
EOT
require 'occi/OCCIClient'
@ -88,14 +91,15 @@ require 'getoptlong'
include CloudCLI
opts = GetoptLong.new(
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--multipart', '-M',GetoptLong::NO_ARGUMENT]
['--help', '-h',GetoptLong::NO_ARGUMENT],
['--version', '-v',GetoptLong::NO_ARGUMENT],
['--username', '-U',GetoptLong::REQUIRED_ARGUMENT],
['--password', '-P',GetoptLong::REQUIRED_ARGUMENT],
['--url', '-R',GetoptLong::REQUIRED_ARGUMENT],
['--debug', '-D',GetoptLong::NO_ARGUMENT],
['--timeout', '-T',GetoptLong::REQUIRED_ARGUMENT],
['--multipart', '-M',GetoptLong::NO_ARGUMENT],
['--verbose', GetoptLong::NO_ARGUMENT]
)
url = nil
@ -105,6 +109,7 @@ auth = nil
timeout = nil
debug = false
curb = true
verbose = false
begin
opts.each do |opt, arg|
@ -127,6 +132,8 @@ begin
debug = true
when '--multipart'
curb = false
when '--verbose'
verbose = true
end
end
rescue Exception => e
@ -159,7 +166,7 @@ case ARGV[0].downcase
rc = occi_client.post_image(image_xml, curb)
when 'list'
rc = occi_client.get_images
rc = occi_client.get_images(verbose)
when 'show'
image_id = ARGV[1]

View File

@ -74,8 +74,8 @@ module OCCIClient
######################################################################
# Retieves the available Instance types
######################################################################
def get_instance_types
get('/instance_type')
def get_instance_types(verbose=false)
get('/instance_type', verbose)
end
######################################################################
@ -89,8 +89,8 @@ module OCCIClient
######################################################################
# Retieves the pool of Virtual Machines
######################################################################
def get_vms
get('/compute')
def get_vms(verbose=false)
get('/compute', verbose)
end
######################################################################
@ -104,8 +104,8 @@ module OCCIClient
######################################################################
# Retieves the pool of Virtual Networks
######################################################################
def get_networks
get('/network')
def get_networks(verbose=false)
get('/network', verbose)
end
######################################################################
@ -202,8 +202,8 @@ module OCCIClient
######################################################################
# Retieves the pool of Images owned by the user
######################################################################
def get_images
get('/storage')
def get_images(verbose=false)
get('/storage', verbose)
end
@ -281,7 +281,8 @@ module OCCIClient
private
def get(path)
def get(path, verbose=false)
path += "?verbose=true" if verbose
url = URI.parse(@endpoint+path)
req = Net::HTTP::Get.new(url.path)

View File

@ -39,12 +39,28 @@ DRV_ACTION=$1
ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
SRC=`$XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE`
unset i XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \
/DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH)
SRC="${XPATH_ELEMENTS[0]}"
BASE_PATH="${XPATH_ELEMENTS[1]}"
BASENAME_SRC=`basename "${SRC##$BASE_PATH}"`
# ------------ Remove the image from the repository ------------
if [ -e $SRC ] ; then
if [ -f "$SRC" -a `dirname "$SRC"` = "$BASE_PATH" -a -n "$BASENAME_SRC" ]
then
log "Removing $SRC from the image repository"
exec_and_log "rm -r $SRC" \
exec_and_log "rm -f $SRC" \
"Error deleting $SRC"
else
log_error "Bad formed or unavailable Image source: ${SRC}"
exit 1
fi

View File

@ -72,7 +72,15 @@ function generate_image_path {
$CANONICAL_STR
EOF
)
echo "${BASE_PATH}/`echo $CANONICAL_MD5 | cut -d ' ' -f1`"
IMAGE_HASH=$(echo $CANONICAL_MD5 | cut -d ' ' -f1)
IMAGE_HASH=$(basename "$IMAGE_HASH")
if [ -z "$IMAGE_HASH" -o -z "$BASE_PATH" ]; then
log_error "Error generating the path in generate_image_path."
exit 1
fi
echo "${BASE_PATH}/${IMAGE_HASH}"
}
#-------------------------------------------------------------------------------

View File

@ -39,12 +39,28 @@ DRV_ACTION=$1
ID=$2
XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION"
SRC=`$XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE`
unset i XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \
/DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH)
SRC="${XPATH_ELEMENTS[0]}"
BASE_PATH="${XPATH_ELEMENTS[1]}"
BASENAME_SRC=`basename "${SRC##$BASE_PATH}"`
# ------------ Remove the image from the repository ------------
if [ -e $SRC ] ; then
if [ -d "$SRC" -a `dirname "$SRC"` = "$BASE_PATH" -a -n "$BASENAME_SRC" ]
then
log "Removing $SRC from the image repository"
exec_and_log "rm -r $SRC" \
"Error deleting $SRC"
else
log_error "Bad formed or unavailable Image source: ${SRC}"
exit 1
fi

View File

@ -30,7 +30,7 @@ LVS=lvs
LN=ln
MD5SUM=md5sum
MKFS=mkfs
MKISOFS=mkisofs
MKISOFS=genisoimage
MKSWAP=mkswap
QEMU_IMG=qemu-img
READLINK=readlink

View File

@ -85,18 +85,11 @@ void Nebula::start()
try
{
string log_fname;
int log_level_int;
Log::MessageType clevel = Log::ERROR;
string log_fname;
Log::MessageType clevel;
log_fname = log_location + "oned.log";
nebula_configuration->get("DEBUG_LEVEL", log_level_int);
if (0 <= log_level_int && log_level_int <= 3 )
{
clevel = static_cast<Log::MessageType>(log_level_int);
}
clevel = get_debug_level();
// Initializing ONE Daemon log system

View File

@ -178,7 +178,7 @@ module OpenNebula
def update(xml_method, new_template)
return Error.new('ID not defined') if !@pe_id
new_template ||= template_xml.delete("\n").gsub(/\s+/m,'')
new_template ||= template_xml
rc = @client.call(xml_method,@pe_id, new_template)
rc = nil if !OpenNebula.is_error?(rc)

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require "rexml/document"

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require "rexml/document"
include REXML

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require "rexml/document"
include REXML

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require "rexml/document"
include REXML

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require 'digest/sha1'
require "rexml/document"

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require 'digest/sha1'
require "rexml/document"

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require "rexml/document"
include REXML

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
module Migrator
def db_version

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
module Migrator
def db_version

View File

@ -1,17 +1,18 @@
# -------------------------------------------------------------------------- *
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# Licensed under the Apache License, Version 2.0 (the "License"); you may *
# not use this file except in compliance with the License. You may obtain *
# a copy of the License at *
# *
# http://www.apache.org/licenses/LICENSE-2.0 *
# *
# Unless required by applicable law or agreed to in writing, software *
# distributed under the License is distributed on an "AS IS" BASIS, *
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
# See the License for the specific language governing permissions and *
# limitations under the License. *
# -------------------------------------------------------------------------- *
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
require "rexml/document"
include REXML

27
src/tm_mad/lvm/ln → src/onedb/3.3.80_to_3.4.0.rb Executable file → Normal file
View File

@ -1,5 +1,3 @@
#!/bin/bash
# -------------------------------------------------------------------------- #
# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
# #
@ -16,19 +14,16 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
SRC=$1
DST=$2
module Migrator
def db_version
"3.4.0"
end
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
TM_COMMANDS_LOCATION=/usr/lib/one/tm_commands/
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
TM_COMMANDS_LOCATION=$ONE_LOCATION/lib/tm_commands/
fi
def one_version
"OpenNebula 3.4.0"
end
. $TMCOMMON
log "Link $SRC_PATH (non shared dir, will clone)"
#exec_and_log "ln -s $SRC_PATH $DST_PATH"
exec $TM_COMMANDS_LOCATION/ssh/tm_clone.sh $SRC $DST
def up
return true
end
end

View File

@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# 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 #

View File

@ -1,5 +1,5 @@
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# 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 #

View File

@ -1,5 +1,5 @@
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# 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 #

View File

@ -28,6 +28,9 @@
#include <sstream>
#include <unistd.h>
#include <sys/types.h>
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -443,8 +443,9 @@ Attribute * Template::single_xml_att(const xmlNode * node)
Attribute * attr = 0;
xmlNode * child = node->children;
if( child != 0 && (child->type == XML_TEXT_NODE ||
child->type == XML_CDATA_SECTION_NODE))
if( child->next == 0 && child != 0 &&
(child->type == XML_TEXT_NODE ||
child->type == XML_CDATA_SECTION_NODE))
{
attr = new SingleAttribute(
reinterpret_cast<const char *>(node->name),
@ -464,7 +465,12 @@ Attribute * Template::vector_xml_att(const xmlNode * node)
xmlNode * child = node->children;
xmlNode * grandchild = 0;
if(child != 0 && child->type == XML_ELEMENT_NODE)
while(child != 0 && child->type != XML_ELEMENT_NODE)
{
child = child->next;
}
if(child != 0)
{
attr = new VectorAttribute(
reinterpret_cast<const char *>(node->name));

View File

@ -1,87 +0,0 @@
#!/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. #
#--------------------------------------------------------------------------- #
SRC=$1
DST=$2
SIZE=$3
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
LVMRC=/etc/one/tm_lvm/tm_lvmrc
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
LVMRC=$ONE_LOCATION/etc/tm_lvm/tm_lvmrc
fi
. $TMCOMMON
. $LVMRC
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
SRC_HOST=`arg_host $SRC`
DST_HOST=`arg_host $DST`
if [ -z $SIZE ] ; then
SIZE=$DEFAULT_LV_SIZE
fi
LV_NAME=`get_lv_name $DST_PATH`
log "$1 $2"
log "DST: $DST_PATH"
DST_DIR=`dirname $DST_PATH`
log "Creating directory $DST_DIR"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
case $SRC in
#------------------------------------------------------------------------------
#Get the image from http repository and dump it to a new LV
#------------------------------------------------------------------------------
http://*)
log "Creating LV $LV_NAME"
exec_and_log "$SSH $DST_HOST $SUDO $LVCREATE -L$SIZE -n $LV_NAME $VG_NAME"
exec_and_log "$SSH $DST_HOST ln -s /dev/$VG_NAME/$LV_NAME $DST_PATH"
log "Dumping Image into /dev/$VG_NAME/$LV_NAME"
exec_and_log "eval $SSH $DST_HOST '$WGET $SRC -q -O- | $SUDO $DD of=/dev/$VG_NAME/$LV_NAME bs=64k'"
;;
#------------------------------------------------------------------------------
#Make a snapshot from the given dev (already in DST_HOST)
#------------------------------------------------------------------------------
*:/dev/*)
log "Cloning LV $LV_NAME"
exec_and_log "$SSH $DST_HOST $SUDO $LVCREATE -s -L$SIZE -n $LV_NAME $SRC_PATH"
exec_and_log "$SSH $DST_HOST ln -s /dev/$VG_NAME/$LV_NAME $DST_PATH"
;;
#------------------------------------------------------------------------------
#Get the image from SRC_HOST and dump it to a new LV
#------------------------------------------------------------------------------
*)
log "Creating LV $LV_NAME"
exec_and_log "$SSH $DST_HOST $SUDO $LVCREATE -L$SIZE -n $LV_NAME $VG_NAME"
exec_and_log "$SSH $DST_HOST ln -s /dev/$VG_NAME/$LV_NAME $DST_PATH"
log "Dumping Image"
exec_and_log "eval cat $SRC_PATH | $SSH $DST_HOST $SUDO $DD of=/dev/$VG_NAME/$LV_NAME bs=64k"
;;
esac

View File

@ -1,67 +0,0 @@
#!/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. #
#--------------------------------------------------------------------------- #
while (( "$#" )); do
if [ "$#" == "1" ]; then
DST=$1
else
SRC="$SRC $1"
fi
shift
done
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
DST_PATH=`arg_path $DST`
DST_DIR=`dirname $DST_PATH`
DST_FILE=`basename $DST_PATH`
DST_HASH=`echo -n $DST | $MD5SUM | $AWK '{print $1}'`
if [ -z "$ONE_LOCATION" ]; then
TMP_DIR="/var/lib/one/$DST_HASH"
else
TMP_DIR="$ONE_LOCATION/var/$DST_HASH"
fi
ISO_DIR="$TMP_DIR/isofiles"
exec_and_log "mkdir -p $ISO_DIR"
for f in $SRC; do
case $f in
http://*)
exec_and_log "$WGET -P $ISO_DIR $f"
;;
*)
exec_and_log "cp -R $f $ISO_DIR" \
"Error copying $f to $ISO_DIR"
;;
esac
done
exec_and_log "$MKISOFS -o $TMP_DIR/$DST_FILE -J -R $ISO_DIR"
exec_and_log "$SCP $TMP_DIR/$DST_FILE $DST"
exec_and_log "rm -rf $TMP_DIR"

View File

@ -1,42 +0,0 @@
#!/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. #
#--------------------------------------------------------------------------- #
SRC=$1
DST=$2
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
LVMRC=/etc/one/tm_lvm/tm_lvmrc
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
LVMRC=$ONE_LOCATION/etc/tm_lvm/tm_lvmrc
fi
. $TMCOMMON
. $LVMRC
SRC_PATH=`arg_path $SRC`
SRC_HOST=`arg_host $SRC`
VID=`get_vid $SRC_PATH`
log "Deleting remote LVs"
exec_and_log "$SSH $SRC_HOST $SUDO $LVREMOVE -f \$(echo $VG_NAME/\$($SUDO $LVS --noheadings $VG_NAME|$AWK '{print \$1}'|grep lv-one-$VID))"
log "Deleting $SRC_PATH"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"

View File

@ -1,38 +0,0 @@
# -------------------------------------------------------------------------- #
# 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. #
#--------------------------------------------------------------------------- #
# -------------------------------------------------------------------------- #
# Volume Group to create logical volumes or snapshots in the cluster nodes #
VG_NAME=
# Default size for logical volumes if not specified
DEFAULT_LV_SIZE="1G"
# -------------------------------------------------------------------------- #
# Helper functions for the LVM plugin #
# -------------------------------------------------------------------------- #
function get_vid {
echo $1 |$SED -e 's%^.*/([^/]*)/images.*$%\1%'
}
function get_lv_name {
VID=`get_vid $1`
DISK=`echo $1|$AWK -F. '{printf $NF}'`
echo "lv-one-$VID-$DISK"
}

View File

@ -1,40 +0,0 @@
#!/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. #
#--------------------------------------------------------------------------- #
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
SIZE=$1
FSTYPE=$2
DST=$3
DST_PATH=`arg_path $DST`
DST_HOST=`arg_host $DST`
DST_DIR=`dirname $DST_PATH`
MKFS_CMD=`mkfs_command $DST_PATH $FSTYPE`
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SSH $DST_HOST $DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
exec_and_log "$SSH $DST_HOST $MKFS_CMD"
exec_and_log "$SSH $DST_HOST chmod a+rw $DST_PATH"

View File

@ -1,43 +0,0 @@
#!/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. #
#--------------------------------------------------------------------------- #
SIZE=$1
DST=$2
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
fi
. $TMCOMMON
DST_PATH=`arg_path $DST`
DST_HOST=`arg_host $DST`
DST_DIR=`dirname $DST_PATH`
log "Creating ${SIZE}Mb image in $DST_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SSH $DST_HOST $DD if=/dev/zero of=$DST_PATH bs=1 count=1 seek=${SIZE}M"
log "Initializing swap space"
exec_and_log "$SSH $DST_HOST $MKSWAP $DST_PATH"
exec_and_log "$SSH $DST_HOST chmod a+w $DST_PATH"

View File

@ -1,79 +0,0 @@
#!/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. #
#--------------------------------------------------------------------------- #
SRC=$1
DST=$2
if [ -z "${ONE_LOCATION}" ]; then
TMCOMMON=/usr/lib/one/mads/tm_common.sh
LVMRC=/etc/one/tm_lvm/tm_lvmrc
else
TMCOMMON=$ONE_LOCATION/lib/mads/tm_common.sh
LVMRC=$ONE_LOCATION/etc/tm_lvm/tm_lvmrc
fi
. $TMCOMMON
. $LVMRC
SRC_PATH=`arg_path $SRC`
DST_PATH=`arg_path $DST`
SRC_HOST=`arg_host $SRC`
DST_HOST=`arg_host $DST`
DST_DIR=`dirname $DST_PATH`
VID=`get_vid $SRC_PATH`
if [ -z $SIZE ] ; then
SIZE=$DEFAULT_LV_SIZE
fi
# Check that we are not stopping, migrating or resuming
if echo `basename $SRC_PATH`|grep -vq '^disk'; then
log_error "This TM does not support stop, migrating or resuming."
exit 1
fi
if [ "$SRC_HOST" != "$HOSTNAME" ]; then
log "Dumping LV to disk image"
echo "if [ -L "$SRC_PATH" ]; then
lv=\$(readlink $SRC_PATH)
rm $SRC_PATH
touch $SRC_PATH
$SUDO $DD if=\$lv of=$SRC_PATH bs=64k
else
exit 1
fi" | $SSH $SRC_HOST "$BASH -s"
[ "$?" != "0" ] && log_error "Error dumping LV to disk image"
log "Deleting remote LVs"
exec_and_log "$SSH $SRC_HOST $SUDO $LVREMOVE -f \$(echo $VG_NAME/\$($SUDO $LVS --noheadings $VG_NAME|$AWK '{print \$1}'|grep lv-one-$VID))"
fi
log "Moving $SRC_PATH"
exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR"
exec_and_log "$SCP -r $SRC $DST"
exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH"
if [ "$DST_HOST" != "$HOSTNAME" ]; then
log_error "This TM does not support resuming."
fi

View File

@ -170,7 +170,10 @@ int VirtualMachine::select(SqlDB * db)
//--------------------------------------------------------------------------
try
{
_log = new FileLog(nd.get_vm_log_filename(oid),Log::DEBUG);
Log::MessageType clevel;
clevel = nd.get_debug_level();
_log = new FileLog(nd.get_vm_log_filename(oid), clevel);
}
catch(exception &e)
{

View File

@ -22,10 +22,16 @@ source $(dirname $0)/../../scripts_common.sh
deploy_id=$1
file=$2
if [ ! -f $file ]; then
touch $file
chmod 666 $file
if [ -f $file ]; then
log "Moving old checkpoint file $file"
epoch=`date +%s`
exec_and_log "mv $file $file.$epoch" \
"Could not move $file to $file.$epoch"
fi
touch $file
chmod 666 $file
exec_and_log "virsh --connect $LIBVIRT_URI save $deploy_id $file" \
"Could not save $deploy_id to $file"

View File

@ -172,7 +172,7 @@ private
when *%w{running blocked shutdown dying idle}
'a'
when 'paused'
'p'
'-'
when 'crashed'
'e'
else
@ -242,7 +242,7 @@ module XEN
when *%w{r b s d}
'a'
when 'p'
'p'
'-'
when 'c'
'e'
else

View File

@ -21,5 +21,17 @@ source $(dirname $0)/../../scripts_common.sh
deploy_id=$1
function gdm {
$XM_LIST | grep "$deploy_id "
}
exec_and_log "$XM_CANCEL $deploy_id" \
"Could not destroy $deploy_id"
OUT=$(gdm)
while [ -n "$OUT" ]; do
sleep 1
OUT=$(gdm)
done

View File

@ -22,5 +22,13 @@ source $(dirname $0)/../../scripts_common.sh
deploy_id=$1
file=$2
if [ -f $file ]; then
log "Moving old checkpoint file $file"
epoch=`date +%s`
exec_and_log "mv $file $file.$epoch" \
"Could not move $file to $file.$epoch"
fi
exec_and_log "$XM_SAVE $deploy_id $file" \
"Could not save $deploy_id to $file"