[one-users] problem with vifs
ahernandez at tesla.cujae.edu.cu
ahernandez at tesla.cujae.edu.cu
Thu Feb 28 12:03:48 PST 2013
Hi Tino, Thanks for you fast answer
In the Firt Problem when write:
bash -xv /var/lib/one/remotes/datastore/vmfs/cp
PERTX0RSSVZFUl9BQ1RJT05fREFUQT48SU1BR0U+PElEPjEwNTwvSUQ+PFVJRD4wPC9VSUQ+PEdJRD4wPC9HSUQ+PFVOQU1FPm9uZWFkbWluPC9VTkFNRT48R05BTUU+b25lYWRtaW48L0dOQU1FPjxOQU1FPnNjZW5hcmlvMi4xKHZtZnMpPC9OQU1FPjxQRVJNSVNTSU9OUz48T1dORVJfVT4xPC9PV05FUl9VPjxPV05FUl9NPjE8L09XTkVSX00+PE9XTkVSX0E+MDwvT1dORVJfQT48R1JPVVBfVT4wPC9HUk9VUF9VPjxHUk9VUF9NPjA8L0dST1VQX00+PEdST1VQX0E+MDwvR1JPVVBfQT48T1RIRVJfVT4wPC9PVEhFUl9VPjxPVEhFUl9NPjA8L09USEVSX00+PE9USEVSX0E+MDwvT1RIRVJfQT48L1BFUk1JU1NJT05TPjxUWVBFPjA8L1RZUEU+PERJU0tfVFlQRT4wPC9ESVNLX1RZUEU+PFBFUlNJU1RFTlQ+MDwvUEVSU0lTVEVOVD48UkVHVElNRT4xMzYxNTQxMTUwPC9SRUdUSU1FPjxTT1VSQ0U+PC9TT1VSQ0U+PFBBVEg+L29wZW5uZWJ1bGEvdHR5bGludXgudm1kay50YXIuYnoyPC9QQVRIPjxGU1RZUEU+PC9GU1RZUEU+PFNJWkU+MjM8L1NJWkU+PFNUQVRFPjQ8L1NUQVRFPjxSVU5OSU5HX1ZNUz4wPC9SVU5OSU5HX1ZNUz48Q0xPTklOR19PUFM+MDwvQ0xPTklOR19PUFM+PENMT05JTkdfSUQ+LTE8L0NMT05JTkdfSUQ+PERBVEFTVE9SRV9JRD4xMjU8L0RBVEFTVE9SRV9JRD48REFUQVNUT1JFPmVzY2VuYXJpbzIuMSh2b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wv
VEVNUExBVEU+PC9EQVRBU1RPUkU+PC9EU19EUklWRVJfQUNUSU9OX0RBVEE+
105
I obtain this: (Is long, and for this read it in stride):
#!/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.
#
#---------------------------------------------------------------------------
#
###############################################################################
# This script is used to copy a VM image (SRC) to the image repository
as DST
# Several SRC types are supported
###############################################################################
# -------- Set up the environment to source common tools & conf
------------
if [ -z "${ONE_LOCATION}" ]; then
LIB_LOCATION=/usr/lib/one
VMWARERC=/etc/one/vmwarerc
else
LIB_LOCATION=$ONE_LOCATION/lib
VMWARERC=$ONE_LOCATION/etc/vmwarerc
fi
+ '[' -z '' ']'
+ LIB_LOCATION=/usr/lib/one
+ VMWARERC=/etc/one/vmwarerc
. $LIB_LOCATION/sh/scripts_common.sh
+ . /usr/lib/one/sh/scripts_common.sh
#
--------------------------------------------------------------------------
#
# 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.
#
#---------------------------------------------------------------------------
#
export LANG=C
++ export LANG=C
++ LANG=C
# Paths for utilities
export PATH=/bin:/sbin:/usr/bin:$PATH
++ export
PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
++
PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
AWK=awk
++ AWK=awk
BASH=bash
++ BASH=bash
CUT=cut
++ CUT=cut
DATE=date
++ DATE=date
DD=dd
++ DD=dd
DU=du
++ DU=du
GREP=grep
++ GREP=grep
ISCSIADM=iscsiadm
++ ISCSIADM=iscsiadm
LVCREATE=lvcreate
++ LVCREATE=lvcreate
LVREMOVE=lvremove
++ LVREMOVE=lvremove
LVS=lvs
++ LVS=lvs
LN=ln
++ LN=ln
MD5SUM=md5sum
++ MD5SUM=md5sum
MKFS=mkfs
++ MKFS=mkfs
MKISOFS=genisoimage
++ MKISOFS=genisoimage
MKSWAP=mkswap
++ MKSWAP=mkswap
QEMU_IMG=qemu-img
++ QEMU_IMG=qemu-img
READLINK=readlink
++ READLINK=readlink
SCP=scp
++ SCP=scp
SED=sed
++ SED=sed
SSH=ssh
++ SSH=ssh
SUDO=sudo
++ SUDO=sudo
SYNC=sync
++ SYNC=sync
TAR=tar
++ TAR=tar
TGTADM=tgtadm
++ TGTADM=tgtadm
TGTADMIN=tgt-admin
++ TGTADMIN=tgt-admin
VMKFSTOOLS=vmkfstools
++ VMKFSTOOLS=vmkfstools
WGET=wget
++ WGET=wget
if [ "x$(uname -s)" = "xLinux" ]; then
SED="$SED -r"
else
SED="/usr/bin/sed -E"
fi
uname -s)"
uname -s)
uname -s
+++ uname -s
++ '[' xLinux = xLinux ']'
++ SED='sed -r'
# Used for log messages
SCRIPT_NAME=`basename $0`
basename $0
+++ basename /var/lib/one/remotes/datastore/vmfs/cp
++ SCRIPT_NAME=cp
#
------------------------------------------------------------------------------
# Path manipulation functions
#
------------------------------------------------------------------------------
# Takes out unneeded slashes. Repeated and final directory slashes:
# /some//path///somewhere/ -> /some/path/somewhere
function fix_dir_slashes
{
dirname "$1/file" | $SED 's/\/+/\//g'
}
#
------------------------------------------------------------------------------
# Log functions
#
------------------------------------------------------------------------------
# Formats date for logs
function log_date
{
$DATE +"%a %b %d %T %Y"
}
# Logs a message, alias to log_info
function log
{
log_info "$1"
}
# Log function that knows how to deal with severities and adds the
# script name
function log_function
{
echo "$1: $SCRIPT_NAME: $2" 1>&2
}
# Logs an info message
function log_info
{
log_function "INFO" "$1"
}
# Logs an error message
function log_error
{
log_function "ERROR" "$1"
}
# Logs a debug message
function log_debug
{
log_function "DEBUG" "$1"
}
# This function is used to pass error message to the mad
function error_message
{
(
echo "ERROR MESSAGE --8<------"
echo "$1"
echo "ERROR MESSAGE ------>8--"
) 1>&2
}
# Executes a command, if it fails returns error message and exits
# If a second parameter is present it is used as the error message when
# the command fails
function exec_and_log
{
message=$2
EXEC_LOG_ERR=`$1 2>&1 1>/dev/null`
EXEC_LOG_RC=$?
if [ $EXEC_LOG_RC -ne 0 ]; then
log_error "Command \"$1\" failed: $EXEC_LOG_ERR"
if [ -n "$2" ]; then
error_message "$2"
else
error_message "Error executing $1: $EXEC_LOG_ERR"
fi
exit $EXEC_LOG_RC
fi
}
# Like exec_and_log but the first argument is the number of seconds
# before here is timeout and kills the command
#
# NOTE: if the command is killed because a timeout the exit code
# will be 143 = 128+15 (SIGHUP)
function timeout_exec_and_log
{
TIMEOUT=$1
shift
CMD="$1"
exec_and_log "$CMD" &
CMD_PID=$!
# timeout process
(
sleep $TIMEOUT
kill $CMD_PID 2>/dev/null
log_error "Timeout executing $CMD"
error_message "Timeout executing $CMD"
exit -1
) &
TIMEOUT_PID=$!
# stops the execution until the command finalizes
wait $CMD_PID 2>/dev/null
CMD_CODE=$?
# if the script reaches here the command finished before it
# consumes timeout seconds so we can kill timeout process
kill $TIMEOUT_PID 2>/dev/null 1>/dev/null
wait $TIMEOUT_PID 2>/dev/null
# checks the exit code of the command and exits if it is not 0
if [ "x$CMD_CODE" != "x0" ]; then
exit $CMD_CODE
fi
}
# Parameters are times (seconds) and monitoring command (or function).
# Executes monitoring command until it is successful (VM is no longer
# running) or the timeout is reached.
function retry
{
times=$1
function=$2
count=1
ret=$($function)
error=$?
while [ $count -lt $times -a "$error" != "0" ]; do
sleep 1
count=$(( $count + 1 ))
ret=$($function)
error=$?
done
[ "x$error" = "x0" ]
}
# Parameters are deploy_id and cancel command. If the last command is
# unsuccessful and $FORCE_DESTROY=yes then calls cancel command
function force_shutdown {
error=$?
deploy_id=$1
command=$2
if [ "x$error" != "x0" ]; then
if [ "$FORCE_DESTROY" = "yes" ]; then
log_error "Timeout shutting down $deploy_id. Destroying it"
$($command)
sleep 2
else
error_message "Timed out shutting down $deploy_id"
exit -1
fi
fi
}
# This function will return a command that upon execution will format a
# filesystem with its proper parameters based on the filesystem type
function mkfs_command {
DST=$1
FSTYPE=${2:-ext3}
SIZE=${3:-0}
# Specific options for different FS
case "$FSTYPE" in
"ext2"|"ext3"|"ext4"|"ntfs")
OPTS="-F"
;;
"reiserfs")
OPTS="-f -q"
;;
"jfs")
OPTS="-q"
;;
"raw")
echo ""
return 0
;;
"swap")
echo "$MKSWAP $DST"
return 0
;;
"qcow2")
echo "$QEMU_IMG create -f qcow2 $DST ${SIZE}M"
return 0
;;
"vmdk_"*)
VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2`
echo "WHICH_SUDO=\$(which sudo) ; \
[ ! -z \"\$WHICH_SUDO\" -a -f \"\$WHICH_SUDO\" ] &&
SUDO=\"sudo\" ; \
\$SUDO $VMKFSTOOLS -U $DST/disk.vmdk; \
\$SUDO $VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE}
$DST/disk.vmdk"
return 0
;;
*)
OPTS=""
;;
esac
echo "$MKFS -t $FSTYPE $OPTS $DST"
}
#This function executes $2 at $1 host and report error $3
function ssh_exec_and_log
{
SSH_EXEC_ERR=`$SSH $1 sh -s 2>&1 1>/dev/null <<EOF
$2
EOF`
SSH_EXEC_RC=$?
if [ $SSH_EXEC_RC -ne 0 ]; then
log_error "Command \"$2\" failed: $SSH_EXEC_ERR"
if [ -n "$3" ]; then
error_message "$3"
else
error_message "Error executing $2: $SSH_EXEC_ERR"
fi
exit $SSH_EXEC_RC
fi
}
#Creates path ($2) at $1
function ssh_make_path
{
SSH_EXEC_ERR=`$SSH $1 sh -s 2>&1 1>/dev/null <<EOF
if [ ! -d $2 ]; then
mkdir -p $2
fi
EOF`
SSH_EXEC_RC=$?
if [ $? -ne 0 ]; then
error_message "Error creating directory $2 at $1:
$SSH_EXEC_ERR"
exit $SSH_EXEC_RC
fi
}
#
------------------------------------------------------------------------------
# iSCSI functions
#
------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Returns the command to create a new target
# @param $1 - ID of the image
# @param $2 - Target Host
# @param $3 - Device
# @return the command to create a new target
#-------------------------------------------------------------------------------
function tgtadm_target_new {
ID="$1"
IQN="$2"
echo "$TGTADM --lld iscsi --op new --mode target --tid $ID "\
"--targetname $IQN"
}
function tgtadm_target_bind_all {
ID="$1"
echo "$TGTADM --lld iscsi --op bind --mode target --tid $ID -I ALL"
}
function tgtadm_logicalunit_new {
ID="$1"
DEV="$2"
echo "$TGTADM --lld iscsi --op new --mode logicalunit --tid $ID "\
"--lun 1 --backing-store $DEV"
}
function tgtadm_target_delete {
ID="$1"
echo "$TGTADM --lld iscsi --op delete --mode target --tid $ID"
}
function tgtadm_get_tid_for_iqn {
IQN="$1"
echo "$TGTADM --lld iscsi --op show --mode target | \
grep \"$IQN\" | awk '{split(\$2,tmp,\":\"); print(tmp[1]);}'"
}
function tgtadm_next_tid {
echo "$TGTADM --lld iscsi --op show --mode target | \
$GREP \"Target\" | tail -n 1 | \
$AWK '{split(\$2,tmp,\":\"); print tmp[1]+1;}'"
}
function tgt_admin_dump_config {
FILE_PATH="$1"
echo "$TGTADMIN --dump |sudo tee $FILE_PATH > /dev/null 2>&1"
}
###
function iscsiadm_discovery {
TARGET_HOST="$1"
echo "$ISCSIADM -m discovery -t st -p $TARGET_HOST"
}
function iscsiadm_login {
IQN="$1"
TARGET_HOST="$2"
echo "$ISCSIADM -m node --targetname $IQN -p $TARGET_HOST --login"
}
function iscsiadm_logout {
IQN="$1"
echo "$ISCSIADM -m node --targetname $IQN --logout"
}
function is_iscsi {
if echo "$NO_ISCSI"|grep -q "\b$1\b"; then
return 1
else
return 0
fi
}
function iqn_get_lv_name {
IQN="$1"
TARGET=`echo "$IQN"|$CUT -d: -f2`
echo $TARGET|$AWK -F. '{print $(NF)}'
}
function iqn_get_vg_name {
IQN="$1"
TARGET=`echo "$IQN"|$CUT -d: -f2`
echo $TARGET|$AWK -F. '{print $(NF-1)}'
}
function iqn_get_host {
IQN="$1"
TARGET=`echo "$IQN"|$CUT -d: -f2`
LV_NAME=$(iqn_get_lv_name "$IQN")
VG_NAME=$(iqn_get_vg_name "$IQN")
echo ${TARGET%%.$VG_NAME.$LV_NAME}
}
function vmfs_create_remote_path {
DS_ID=$1
# Create DST in DST_HOST
if [ "$USE_SSH" == "yes" ]; then
exec_and_log "ssh_make_path $DST_HOST $DST" \
"Cannot create $DST in $DST_HOST"
else
exec_and_log "vifs $VI_PARAMS --mkdir [$DS_ID]$DST_FOLDER" \
"Cannot create [$DS_ID]$DST_FOLDER in $DST_HOST"
fi
}
function vmfs_set_up {
if [ "$USE_SSH" != "yes" ]; then
USERNAME=`echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f
3|tr -d '"')`
PASSWORD=`echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f
3|tr -d '"')`
if [ -z $PASSWORD ]; then
VI_PARAMS="--server $DST_HOST --username $USERNAME
--password \"\""
# VI_PARAMS="--server das-vsilo23.cimex.com.cu --username
$USERNAME --password \"\""
else
# VI_PARAMS="--server $DST_HOST --username $USERNAME
--password $PASSWORD"
VI_PARAMS="--server das-vsilo23.cimex.com.cu --username
$USERNAME --password $PASSWORD"
fi
fi
}
function vmfs_create_double_path {
DS_ID=$1
FIRST_FOLDER=$2
SECOND_FOLDER=$3
# Two calls needed since vifs cannot do a mkdir -p
vifs $VI_PARAMS --force --mkdir [$DS_ID]$FIRST_FOLDER &> /dev/null
vifs $VI_PARAMS --force --mkdir
[$DS_ID]$FIRST_FOLDER/$SECOND_FOLDER &> /dev/null
}
DRIVER_PATH=$(dirname $0)
dirname $0)
dirname $0
++ dirname /var/lib/one/remotes/datastore/vmfs/cp
+ DRIVER_PATH=/var/lib/one/remotes/datastore/vmfs
source ${DRIVER_PATH}/../libfs.sh
+ source /var/lib/one/remotes/datastore/vmfs/../libfs.sh
#!/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.
#
#---------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
# Set up environment variables
# @param $1 - Datastore base_path
# @param $2 - Restricted directories
# @param $3 - Safe dirs
# @param $4 - Umask for new file creation (default: 0007)
# @return sets the following environment variables
# - RESTRICTED_DIRS: Paths that cannot be used to register images
# - SAFE_DIRS: Paths that are safe to specify image paths
# - BASE_PATH: Path where the images will be stored
#------------------------------------------------------------------------------
function set_up_datastore {
#
# Load the default configuration for FS datastores
#
BASE_PATH="$1"
RESTRICTED_DIRS="$2"
SAFE_DIRS="$3"
UMASK="$4"
if [ -z "${ONE_LOCATION}" ]; then
VAR_LOCATION=/var/lib/one/
ETC_LOCATION=/etc/one/
else
VAR_LOCATION=$ONE_LOCATION/var/
ETC_LOCATION=$ONE_LOCATION/etc/
fi
#
# RESTRICTED AND SAFE DIRS (from default configuration)
#
RESTRICTED_DIRS="$VAR_LOCATION $ETC_LOCATION $HOME/ $RESTRICTED_DIRS"
export BASE_PATH
export RESTRICTED_DIRS
export SAFE_DIRS
if [ -n "$UMASK" ]; then
umask $UMASK
else
umask 0007
fi
}
#-------------------------------------------------------------------------------
# Generates an unique image path. Requires BASE_PATH to be set
# @return path for the image (empty if error)
#-------------------------------------------------------------------------------
function generate_image_path {
CANONICAL_STR="`$DATE +%s`:$ID"
CANONICAL_MD5=$($MD5SUM - << EOF
$CANONICAL_STR
EOF
)
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}"
}
#-------------------------------------------------------------------------------
# Set up the arguments for the downloader script
# @param $1 - MD5 string
# @param $2 - SHA1 string
# @param $3 - NO_DECOMPRESS
# @param $4 - SRC
# @param $5 - DST
# @return downloader.sh util arguments
#-------------------------------------------------------------------------------
function set_downloader_args {
HASHES=" "
if [ -n "$1" ]; then
HASHES="--md5 $1"
fi
if [ -n "$2" ]; then
HASHES="$HASHES --sha1 $2"
fi
if [ "$3" = "yes" -o "$3" = "Yes" -o "$3" = "YES" ]; then
HASHES="$HASHES --nodecomp"
fi
echo "$HASHES $4 $5"
}
#-------------------------------------------------------------------------------
# Computes the size of an image
# @param $1 - Path to the image
# @return size of the image in Mb
#-------------------------------------------------------------------------------
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 "market" > /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 -E "^
*\"size\": \"?[0-9]+\"?$"|tr -dc 0-9`
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=$?
;;
*)
if [ -d "$1" ]; then
SIZE=`du -sb "$1" | cut -f1`
error=$?
else
SIZE=`stat -c %s "$1"`
error=$?
fi
;;
esac
if [ $error -ne 0 ]; then
SIZE=0
else
SIZE=$((($SIZE+1048575)/1048576))
fi
echo "$SIZE"
}
#-------------------------------------------------------------------------------
# Checks if a path is safe for copying the image from
# @param $1 - Path to the image
# @return 0 if the path is safe, 1 otherwise
#-------------------------------------------------------------------------------
function check_restricted {
for path in $SAFE_DIRS ; do
if [ -n "`readlink -f $1 | grep -E "^$path"`" ] ; then
echo 0
return
fi
done
for path in $RESTRICTED_DIRS ; do
if [ -n "`readlink -f $1 | grep -E "^$path"`" ] ; then
echo 1
return
fi
done
echo 0
}
#-------------------------------------------------------------------------------
# Gets the ESX host to be used as bridge to register a VMware disk
# Implements a round robin for the bridges
# @param $1 - Path to the list of ESX hosts to be used as bridges
# @return host to be used as bridge
#-------------------------------------------------------------------------------
function get_destination_host {
HOSTS_ARRAY=($BRIDGE_LIST)
ARRAY_INDEX=`expr $1 % ${#HOSTS_ARRAY[@]}`
echo ${HOSTS_ARRAY[$ARRAY_INDEX]}
}
source ${DRIVER_PATH}/vmfs.conf
+ source /var/lib/one/remotes/datastore/vmfs/vmfs.conf
#
--------------------------------------------------------------------------
#
# 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.
#
#---------------------------------------------------------------------------
#
# Default values in case they are not defined in the Datastore template
DS_TMP_DIR=/var/lib/one/tmp
++ DS_TMP_DIR=/var/lib/one/tmp
#DS_TMP_DIR=/home/oneadmin/tmp_images
# Whether the VMFS Datastore driver should use to invoke the VMFS
native commands
# * remote API calls (value set to "no")
# * ssh connection (value set to "yes")
DS_USE_SSH=no
++ DS_USE_SSH=no
BRIDGE_LIST=das-vsilo23.cimex.com.cu
++ BRIDGE_LIST=das-vsilo23.cimex.com.cu
# -------- Get cp and datastore arguments from OpenNebula core
------------
DRV_ACTION=$1
+
DRV_ACTION=PERTX0RSSVZFUl9BQ1RJT05fREFUQT48SU1BR0U+PElEPjEwNTwvSUQ+PFVJRD4wPC9VSUQ+PEdJRD4wPC9HSUQ+PFVOQU1FPm9uZWFkbWluPC9VTkFNRT48R05BTUU+b25lYWRtaW48L0dOQU1FPjxOQU1FPnNjZW5hcmlvMi4xKHZtZnMpPC9OQU1FPjxQRVJNSVNTSU9OUz48T1dORVJfVT4xPC9PV05FUl9VPjxPV05FUl9NPjE8L09XTkVSX00+PE9XTkVSX0E+MDwvT1dORVJfQT48R1JPVVBfVT4wPC9HUk9VUF9VPjxHUk9VUF9NPjA8L0dST1VQX00+PEdST1VQX0E+MDwvR1JPVVBfQT48T1RIRVJfVT4wPC9PVEhFUl9VPjxPVEhFUl9NPjA8L09USEVSX00+PE9USEVSX0E+MDwvT1RIRVJfQT48L1BFUk1JU1NJT05TPjxUWVBFPjA8L1RZUEU+PERJU0tfVFlQRT4wPC9ESVNLX1RZUEU+PFBFUlNJU1RFTlQ+MDwvUEVSU0lTVEVOVD48UkVHVElNRT4xMzYxNTQxMTUwPC9SRUdUSU1FPjxTT1VSQ0U+PC9TT1VSQ0U+PFBBVEg+L29wZW5uZWJ1bGEvdHR5bGludXgudm1kay50YXIuYnoyPC9QQVRIPjxGU1RZUEU+PC9GU1RZUEU+PFNJWkU+MjM8L1NJWkU+PFNUQVRFPjQ8L1NUQVRFPjxSVU5OSU5HX1ZNUz4wPC9SVU5OSU5HX1ZNU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xVU1RFUl9JRD48Q0xVU1RFUj5jbHVzdGVyIzE8L0NMVVNURVI+PElNQUdFUz48L0lNQUdFUz48VEVNUExBVEU+PERJU0tfVFlQRT48IVtDREFUQVtibG9ja11dPjwvRElTS19UWVBFPjxEU19NQUQ+PCFbQ0RBVEFbdm1mc11dPjwvRFNfTUFEPjxUTV9NQUQ+PCFbQ0RBVEFbdm1mc11dPjwvVE1f
TUFEPjwv
VEVNUExBVEU+PC9EQVRBU1RPUkU+PC9EU19EUklWRVJfQUNUSU9OX0RBVEE+'
unset i XPATH_ELEMENTS
+ unset i XPATH_ELEMENTS
while IFS= read -r -d '' element; do
XPATH_ELEMENTS[i++]="$element"
done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \
/DS_DRIVER_ACTION_DATA/DATASTORE/ID \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS
\
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_USE_SSH \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_TMP_DIR \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK \
/DS_DRIVER_ACTION_DATA/IMAGE/PATH \
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5 \
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1 \
/DS_DRIVER_ACTION_DATA/IMAGE/ID \
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS)
+ IFS=
+ read -r -d '' element
$XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH
/DS_DRIVER_ACTION_DATA/DATASTORE/ID
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_USE_SSH
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_TMP_DIR
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK
/DS_DRIVER_ACTION_DATA/IMAGE/PATH
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1
/DS_DRIVER_ACTION_DATA/IMAGE/ID
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS
++ /var/lib/one/remotes/datastore/vmfs/../xpath.rb -b
PERTX0RSSVZFUl9BQ1RJT05fREFUQT48SU1BR0U+PElEPjEwNTwvSUQ+PFVJRD4wPC9VSUQ+PEdJRD4wPC9HSUQ+PFVOQU1FPm9uZWFkbWluPC9VTkFNRT48R05BTUU+b25lYWRtaW48L0dOQU1FPjxOQU1FPnNjZW5hcmlvMi4xKHZtZnMpPC9OQU1FPjxQRVJNSVNTSU9OUz48T1dORVJfVT4xPC9PV05FUl9VPjxPV05FUl9NPjE8L09XTkVSX00+PE9XTkVSX0E+MDwvT1dORVJfQT48R1JPVVBfVT4wPC9HUk9VUF9VPjxHUk9VUF9NPjA8L0dST1VQX00+PEdST1VQX0E+MDwvR1JPVVBfQT48T1RIRVJfVT4wPC9PVEhFUl9VPjxPVEhFUl9NPjA8L09USEVSX00+PE9USEVSX0E+MDwvT1RIRVJfQT48L1BFUk1JU1NJT05TPjxUWVBFPjA8L1RZUEU+PERJU0tfVFlQRT4wPC9ESVNLX1RZUEU+PFBFUlNJU1RFTlQ+MDwvUEVSU0lTVEVOVD48UkVHVElNRT4xMzYxNTQxMTUwPC9SRUdUSU1FPjxTT1VSQ0U+PC9TT1VSQ0U+PFBBVEg+L29wZW5uZWJ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DwvU1lTVEVNPjxESVNLX1RZUEU+MDwvRElTS19UWVBFPjxDTFVTVEVSX0lEPjEwMDwvQ0xVU1RFUl9JRD48Q0xVU1RFUj5jbHVzdGVyIzE8L0NMVVNURVI+PElNQUdFUz48L0lNQUdFUz48VEVNUExBVEU+PERJU0tfVFlQRT48IVtDREFUQVtibG9ja11dPjwvRElTS19UWVBFPjxEU19NQUQ+PCFbQ0RBVEFbdm1mc11dPjwvRFNfTUFEPjxUTV9NQUQ+PCFbQ0RBVEFbdm1mc11dPjwvVE1f
TUFEPjwv
VEVNUExBVEU+PC9EQVRBU1RPUkU+PC9EU19EUklWRVJfQUNUSU9OX0RBVEE+
/DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH
/DS_DRIVER_ACTION_DATA/DATASTORE/ID
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_USE_SSH
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_TMP_DIR
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK
/DS_DRIVER_ACTION_DATA/IMAGE/PATH
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5
/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1
/DS_DRIVER_ACTION_DATA/IMAGE/ID
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS
+ XPATH_ELEMENTS[i++]=/var/lib/one/datastores/125
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=125
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=/opennebula/ttylinux.vmdk.tar.bz2
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=105
+ IFS=
+ read -r -d '' element
+ XPATH_ELEMENTS[i++]=
+ IFS=
+ read -r -d '' element
BASE_PATH="${XPATH_ELEMENTS[0]}"
+ BASE_PATH=/var/lib/one/datastores/125
DS_ID="${XPATH_ELEMENTS[1]}"
+ DS_ID=125
RESTRICTED_DIRS="${XPATH_ELEMENTS[2]}"
+ RESTRICTED_DIRS=
SAFE_DIRS="${XPATH_ELEMENTS[3]}"
+ SAFE_DIRS=
BRIDGE_LIST="${XPATH_ELEMENTS[4]}"
+ BRIDGE_LIST=
USE_SSH="${XPATH_ELEMENTS[5]:-$DS_USE_SSH}"
+ USE_SSH=no
TMP_DIR="${XPATH_ELEMENTS[6]:-$DS_TMP_DIR}"
+ TMP_DIR=/var/lib/one/tmp
UMASK="${XPATH_ELEMENTS[7]}"
+ UMASK=
SRC="${XPATH_ELEMENTS[8]}"
+ SRC=/opennebula/ttylinux.vmdk.tar.bz2
MD5="${XPATH_ELEMENTS[9]}"
+ MD5=
SHA1="${XPATH_ELEMENTS[10]}"
+ SHA1=
IMAGE_ID="${XPATH_ELEMENTS[11]}"
+ IMAGE_ID=105
NO_DECOMPRESS="${XPATH_ELEMENTS[12]}"
+ NO_DECOMPRESS=
FE_DST=`generate_image_path`
generate_image_path
++ generate_image_path
$DATE +%s
+++ date +%s
++ CANONICAL_STR=1361562312:105
$MD5SUM - << EOF
$CANONICAL_STR
EOF
)
$MD5SUM - << EOF
$CANONICAL_STR
EOF
+++ md5sum -
++ CANONICAL_MD5='45b888649cdbdbdce99f8de78ac459c7 -'
echo $CANONICAL_MD5 | cut -d ' ' -f1)
echo $CANONICAL_MD5 | cut -d ' ' -f1
+++ cut -d ' ' -f1
+++ echo 45b888649cdbdbdce99f8de78ac459c7 -
++ IMAGE_HASH=45b888649cdbdbdce99f8de78ac459c7
basename "$IMAGE_HASH")
basename "$IMAGE_HASH"
+++ basename 45b888649cdbdbdce99f8de78ac459c7
++ IMAGE_HASH=45b888649cdbdbdce99f8de78ac459c7
++ '[' -z 45b888649cdbdbdce99f8de78ac459c7 -o -z
/var/lib/one/datastores/125 ']'
++ echo /var/lib/one/datastores/125/45b888649cdbdbdce99f8de78ac459c7
+ FE_DST=/var/lib/one/datastores/125/45b888649cdbdbdce99f8de78ac459c7
DST_FOLDER=`basename $FE_DST`
basename $FE_DST
++ basename
/var/lib/one/datastores/125/45b888649cdbdbdce99f8de78ac459c7
+ DST_FOLDER=45b888649cdbdbdce99f8de78ac459c7
DST="/vmfs/volumes/$DS_ID/$DST_FOLDER"
+ DST=/vmfs/volumes/125/45b888649cdbdbdce99f8de78ac459c7
DST_HOST=`get_destination_host $IMAGE_ID`
get_destination_host $IMAGE_ID
++ get_destination_host 105
++ HOSTS_ARRAY=($BRIDGE_LIST)
expr $1 % ${#HOSTS_ARRAY[@]}
+++ expr 105 % 0
expr: division by zero
++ ARRAY_INDEX=
++ echo
+ DST_HOST=
#DST_HOST='das-vsilo23.cimex.com.cu'
# ------------ Set up datastore -------------
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK"
+ set_up_datastore /var/lib/one/datastores/125 '' '' ''
+ BASE_PATH=/var/lib/one/datastores/125
+ RESTRICTED_DIRS=
+ SAFE_DIRS=
+ UMASK=
+ '[' -z '' ']'
+ VAR_LOCATION=/var/lib/one/
+ ETC_LOCATION=/etc/one/
+ RESTRICTED_DIRS='/var/lib/one/ /etc/one/ /home/oneadmin/ '
+ export BASE_PATH
+ export RESTRICTED_DIRS
+ export SAFE_DIRS
+ '[' -n '' ']'
+ umask 0007
vmfs_set_up
+ vmfs_set_up
+ '[' no '!=' yes ']'
echo $(cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')
cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"')
cat $VMWARERC |grep ":username:"|cut -d":" -f 3|tr -d '"'
+++ grep :username:
+++ cut -d: -f 3
+++ tr -d '"'
+++ cat /etc/one/vmwarerc
++ echo oneadmin
+ USERNAME=oneadmin
echo $(cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')
cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"')
cat $VMWARERC |grep ":password:"|cut -d":" -f 3|tr -d '"'
+++ tr -d '"'
+++ grep :password:
+++ cat /etc/one/vmwarerc
+++ cut -d: -f 3
++ echo DataCimex
+ PASSWORD=DataCimex
+ '[' -z DataCimex ']'
+ VI_PARAMS='--server das-vsilo23.cimex.com.cu --username oneadmin
--password DataCimex'
vmfs_create_remote_path $DS_ID
+ vmfs_create_remote_path 125
+ DS_ID=125
+ '[' no == yes ']'
+ exec_and_log 'vifs --server das-vsilo23.cimex.com.cu --username
oneadmin --password DataCimex --mkdir
[125]45b888649cdbdbdce99f8de78ac459c7' 'Cannot create
[125]45b888649cdbdbdce99f8de78ac459c7 in '
+ message='Cannot create [125]45b888649cdbdbdce99f8de78ac459c7 in '
$1 2>&1 1>/dev/null
++ vifs --server das-vsilo23.cimex.com.cu --username oneadmin
--password DataCimex --mkdir '[125]45b888649cdbdbdce99f8de78ac459c7'
+ EXEC_LOG_ERR='Unable to create directory [125]
45b888649cdbdbdce99f8de78ac459c7:
Invalid datastore format '\''125'\''.'
+ EXEC_LOG_RC=1
+ '[' 1 -ne 0 ']'
+ log_error 'Command "vifs --server das-vsilo23.cimex.com.cu --username
oneadmin --password DataCimex --mkdir
[125]45b888649cdbdbdce99f8de78ac459c7" failed: Unable to create
directory [125] 45b888649cdbdbdce99f8de78ac459c7:
Invalid datastore format '\''125'\''.'
+ log_function ERROR 'Command "vifs --server das-vsilo23.cimex.com.cu
--username oneadmin --password DataCimex --mkdir
[125]45b888649cdbdbdce99f8de78ac459c7" failed: Unable to create
directory [125] 45b888649cdbdbdce99f8de78ac459c7:
Invalid datastore format '\''125'\''.'
+ echo 'ERROR: cp: Command "vifs --server das-vsilo23.cimex.com.cu
--username oneadmin --password DataCimex --mkdir
[125]45b888649cdbdbdce99f8de78ac459c7" failed: Unable to create
directory [125] 45b888649cdbdbdce99f8de78ac459c7:
Invalid datastore format '\''125'\''.'
ERROR: cp: Command "vifs --server das-vsilo23.cimex.com.cu --username
oneadmin --password DataCimex --mkdir
[125]45b888649cdbdbdce99f8de78ac459c7" failed: Unable to create
directory [125] 45b888649cdbdbdce99f8de78ac459c7:
Invalid datastore format '125'.
+ '[' -n 'Cannot create [125]45b888649cdbdbdce99f8de78ac459c7 in ' ']'
+ error_message 'Cannot create [125]45b888649cdbdbdce99f8de78ac459c7 in
'
+ echo 'ERROR MESSAGE --8<------'
ERROR MESSAGE --8<------
+ echo 'Cannot create [125]45b888649cdbdbdce99f8de78ac459c7 in '
Cannot create [125]45b888649cdbdbdce99f8de78ac459c7 in
+ echo 'ERROR MESSAGE ------>8--'
ERROR MESSAGE ------>8--
+ exit 1
IN THE SECOND PROBLEM:
although I am not convinced create a disk how fs (because if need
defined FORMAT, need defined the volative disk how FS and not SWAP,
because obtain error), but I think in that you say that later I format
disk how swap.
If I create Template with this DISK:
DISK=[
IMAGE="scenario2.3(ssh)",
IMAGE_UNAME="oneadmin" ]
DISK=[
FORMAT="vmdk_thin",
SIZE="512",
TYPE="fs" ]
I fix the problem, but appears other problem with the network driver
This is the log:
Fri Feb 22 10:45:52 2013 [TM][D]: Message received: LOG I 26 mkimage:
Making filesystem of 512M and type vmdk_thin at
das-vsilo23.cimex.com.cu:/vmfs/volumes/opennebula_NFS/0/26/disk.1
Fri Feb 22 10:45:52 2013 [TM][D]: Message received: LOG I 26 ExitCode:
0
Fri Feb 22 10:45:52 2013 [TM][D]: Message received: TRANSFER SUCCESS 26
-
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG I 26 Command
execution fail: /var/lib/one/remotes/vnm/vmware/pre
PFZNPjxJRD4yNjwvSUQ+PFVJRD4wPC9VSUQ+PEdJRD4wPC9HSUQ+PFVOQU1FPm9uZWFkbWluPC9VTkFNRT48R05BTUU+b25lYWRtaW48L0dOQU1FPjxOQU1FPm9uZS0yNjwvTkFNRT48UEVSTUlTU0lPTlM+PE9XTkVSX1U+MTwvT1dORVJfVT48T1dORVJfTT4xPC9PV05FUl9NPjxPV05FUl9BPjA8L09XTkVSX0E+PEdST1VQX1U+MDwvR1JPVVBfVT48R1JPVVBfTT4wPC9HUk9VUF9NPjxHUk9VUF9BPjA8L0dST1VQX0E+PE9USEVSX1U+MDwvT1RIRVJfVT48T1RIRVJfTT4wPC9PVEhFUl9NPjxPVEhFUl9BPjA8L09USEVSX0E+PC9QRVJNSVNTSU9OUz48TEFTVF9QT0xMPjA8L0xBU1RfUE9MTD48U1RBVEU+MzwvU1RBVEU+PExDTV9TVEFURT4yPC9MQ01fU1RBVEU+PFJFU0NIRUQ+MDwvUkVTQ0hFRD48U1RJTUU+MTM2MTU1ODcxNjwvU1RJTUU+PEVUSU1FPjA8L0VUSU1FPjxERVBMT1lfSUQvPjxNRU1PUlk+MDwvTUVNT1JZPjxDUFU+MDwvQ1BVPjxORVRfVFg+MDwvTkVUX1RYPjxORVRfUlg+MDwvTkVUX1JYPjxURU1QTEFURT48Q1BVPjwhW0NEQVRBWzFdXT48L0NQVT48RElTSz48Q0xPTkU+PCFbQ0RBVEFbWUVTXV0+PC9DTE9ORT48REFUQVNUT1JFPjwhW0NEQVRBW2VzY2VuYXJpbzIuMyh2bXdhcmUsc3NoKV1dPjwvREFUQVNUT1JFPjxEQVRBU1RPUkVfSUQ+PCFbQ0RBVEFbMTI2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jxTVElNRT4xMzYxNTU4NzI4PC9TVElNRT48RVRJTUU+MDwvRVRJTUU+PFZNTU1BRD52bW1fdm13YXJlPC9WTU1NQUQ+PFZOTU1BRD52bXdhcmU8L1ZOTU1BRD48VE1NQUQ+c3NoPC9UTU1BRD48RFNfTE9DQVRJT04+L3ZtZnMvdm9sdW1lcy9vcGVubmVidWxhX05GUzwvRFNfTE9DQVRJT04+PERTX0lEPjA8L0RTX0lEPjxQU1RJTUU+MTM2MTU1ODcyODwvUFNUSU1FPjxQRVRJTUU+MTM2MTU1ODc1MjwvUEVUSU1FPjxSU1RJTUU+MTM2MTU1ODc1MjwvUlNUSU1FPjxSRVRJTUU+MDwvUkVUSU1FPjxFU1RJTUU+MDwvRVNUSU1FPjxFRVRJTUU+MDwvRUVUSU1FPjxSRUFTT04+MDwvUkVBU09OPjwvSElTVE9SWT48L0hJU1RPUllfUkVDT1JEUz48L1ZNPg==
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG I 26 pre:
Executed "/usr/bin/vicfg-vswitch --username=oneadmin
--password=DataCimex --server=das-vsilo23.cimex.com.cu --check-pg
one-pg-1 Gestion".
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG E 26 pre:
Error executing: /usr/bin/vicfg-vswitch --username=oneadmin
--password=DataCimex --server=das-vsilo23.cimex.com.cu --add-pg one-pg-1
Gestion err: The object or item referred to could not be found.
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG I 26 ExitCode:
1
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG I 26 out:
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG I 26 ExitCode:
0
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: LOG I 26 Failed to
execute network driver operation: pre.
Fri Feb 22 10:45:57 2013 [VMM][D]: Message received: DEPLOY FAILURE 26
-
ONE IDEA ABOUT THIS NEW PROBLEM IN THE SECOND PROBLEM???????
El 2013-02-28 12:53, Tino Vazquez escribió:
> Hi,
>
> The set up seems to be fine.
>
> First problem
> -------------------
>
> What is the output of the following in the front-end?
>
> bash -xv /var/lib/one/remotes/datastore/vmfs/cp
>
>
PERTX0RSSVZFUl9BQ1RJT05fREFUQT48SU1BR0U+PElEPjEwNTwvSUQ+PFVJRD4wPC9VSUQ+PEdJRD4wPC9HSUQ+PFVOQU1FPm9uZWFkbWluPC9VTkFNRT48R05BTUU+b25lYWRtaW48L0dOQU1FPjxOQU1FPnNjZW5hcmlvMi4xKHZtZnMpPC9OQU1FPjxQRVJNSVNTSU9OUz48T1dORVJfVT4xPC9PV05FUl9VPjxPV05FUl9NPjE8L09XTkVSX00+PE9XTkVSX0E+MDwvT1dORVJfQT48R1JPVVBfVT4wPC9HUk9VUF9VPjxHUk9VUF9NPjA8L0dST1VQX00+PEdST1VQX0E+MDwvR1JPVVBfQT48T1RIRVJfVT4wPC9PVEhFUl9VPjxPVEhFUl9NPjA8L09USEVSX00+PE9USEVSX0E+MDwvT1RIRVJfQT48L1BFUk1JU1NJT05TPjxUWVBFPjA8L1RZUEU+PERJU0tfVFlQRT4wPC9ESVNLX1RZUEU+PFBFUlNJU1RFTlQ+MDwvUEVSU0lTVEVOVD48UkVHVElNRT4xMzYxNTQxMTUwPC9SRUdUSU1FPjxTT1VSQ0U+PC9TT1VSQ0U+PFBBVEg+L29wZW5uZWJ1bGEvdHR5bGludXgudm1kay50YXIuYnoyPC9QQVRIPjxGU1RZUEU+PC9GU1RZUEU+PFNJWkU+MjM8L1NJWkU+PFNUQVRFPjQ8L1NUQVRFPjxSVU5OSU5HX1ZNUz4wPC9SVU5OSU5HX1ZNUz48Q0xPTklOR19PUFM+MDwvQ0xPTklOR19PUFM+PENMT05JTkdfSUQ+LTE8L0NMT05JTkdfSUQ+PERBVEFTVE9SRV9JRD4xMjU8L0RBVEFTVE9SRV9JRD48REFUQVNUT1JFPmVzY2VuYXJpbzIuMSh2bWZzX3ZtZnMpPC9EQVRBU1RPUkU+PFZNUz48L1ZNUz48VEVNUExBV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OX0RBVEE+
> 105
>
> Second problem
> -----------------------
>
> There is indeed no way to create swap images for VMware using the ssh
> drivers. The rationale behind creating the volatile images in the
> virt
> hosts is that one jump is saved (from wherever is create to the
> host).
> As stated in the documentation
> (http://opennebula.org/documentation:rel3.8:evmwareg [1])
>
> --At the time of defining a VM, a volatile disk can be described,
> which will be created in the remote ESX host. This is true for disks
> defined in the VM template, and also for the file needed in the
> “onevm
> attachdisk” operation. Here, it is not possible to format the disk,
> so
> it will appear as a raw device on the guest, which will then need to
> be formatted. Possible values for the FORMAT attribute (more info on
> this here [2]):
>
> *
> VMDK_THIN
> *
> VMDK_ZEROEDTHICK
> *
> VMDK_EAGERZEROEDTHICK
>
> --
>
> Regards,
>
> -Tino
>
> --
> Constantino Vázquez Blanco, PhD, MSc
> Project Engineer
> OpenNebula - The Open-Source Solution for Data Center Virtualization
> www.OpenNebula.org [3] | @tinova79 | @OpenNebula
>
> Links:
> ------
> [1] http://opennebula.org/documentation:rel3.8:evmwareg
> [2] http://communities.vmware.com/message/716009
> [3] http://www.OpenNebula.org
48 Aniversario de la Cujae, Una obra de la Revolucion Cubana | 2 de diciembre de 1964 | http://cujae.edu.cu
Consulte la enciclopedia colaborativa cubana. http://www.ecured.cu
More information about the Users
mailing list