From 149c5afb1eafdb07a407dee5e192ca5aaead487f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 15 Jun 2011 19:18:25 +0200 Subject: [PATCH] Feature #591: add tests for onedb upgrade. For now, only the DB schema is compared --- src/onedb/test/2.2/one.db | Bin 0 -> 35840 bytes src/onedb/test/compare_schema.rb | 40 +++ src/onedb/test/create.sh | 141 ++++++++++ src/onedb/test/oned.conf | 433 +++++++++++++++++++++++++++++++ src/onedb/test/test.sh | 63 +++++ 5 files changed, 677 insertions(+) create mode 100644 src/onedb/test/2.2/one.db create mode 100644 src/onedb/test/compare_schema.rb create mode 100755 src/onedb/test/create.sh create mode 100644 src/onedb/test/oned.conf create mode 100755 src/onedb/test/test.sh diff --git a/src/onedb/test/2.2/one.db b/src/onedb/test/2.2/one.db new file mode 100644 index 0000000000000000000000000000000000000000..5e62d3ad7ddb7dca834c28f8bab144b79e311fc3 GIT binary patch literal 35840 zcmeHQTWnm%d7e45Bqi$ZI-w{=)lnGPB2015Wv_y&W=*bSR=jyh$yQQhbM{=Mt@q|# zlCc7{1<53c&=(``eN7lP&z9yYGhVk$%eClM(y|9FC)?3R( zEq=3Jwc}>hXfBs)@#UsbGJdZfuQ%*k%`UA}jCi@$S~e<`bB$)X1uS-a)o8}0)oQh9 ztyHVGmfid8-FN?Y_U?O#-)Y!;rg85fbo+Q%1`HRML47zGa2FZgy%(0@-Fpa;#*kk+ zlpCXkW4!GMKuHt;dPA#E2PFdNv^>O1+)jNzq~(3+eQ3G2pYqFPbxq6VI4ci_GwOu% zUAIVj_dXv2&Z|fK(y^;`jF+BxxYA>tN`Ief{XTp?pdYF=Tupv^RNuEpd`&%^3D;DA zI88}MOVL&as#$q%a74=U&o=ov$AAoK?Q6X|axSb9C) zYkde042_K7FZV4QrHZ{;EjH@)ihGkL3;EnqUS7&QKa-c;Ncn8NY{}DeOZm(Bg1k_e zp3N1m%UAN($5(>*@tRS!<)!?~OXC#-wksO-O2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f57128fa30 --- /dev/null +++ b/src/onedb/test/compare_schema.rb @@ -0,0 +1,40 @@ + +if ARGV.length != 2 + puts "This script requires two file paths to sqlite DBs" + exit -1 +end + + +file_path_a = ARGV[0] +file_path_b = ARGV[1] + +lines_a = Array.new +lines_b = Array.new + + +# The sqlite3 command is used to dump the DB schema it to +# a file + +`sqlite3 #{file_path_a} ".schema" > #{file_path_a}.schema` +`sqlite3 #{file_path_b} ".schema" > #{file_path_b}.schema` + +# Read the lines into an array +File.open( "#{file_path_a}.schema" ) do |f| + lines_a = f.readlines +end + +File.open( "#{file_path_b}.schema" ) do |f| + lines_b = f.readlines +end + + +diff_array = (lines_a | lines_b) - (lines_a & lines_b) + +if !diff_array.empty? + puts "Schema does not match. Conflictive lines:" + puts diff_array + + exit -1 +end + +exit 0 \ No newline at end of file diff --git a/src/onedb/test/create.sh b/src/onedb/test/create.sh new file mode 100755 index 0000000000..d40c5437b3 --- /dev/null +++ b/src/onedb/test/create.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +TWO_SERIES="no" +#TWO_SERIES="yes" + + +TMP_FILE="tmp_file" + + +# 5 Hosts and Clusters + +for i in 0 1 2 3 4; do + onehost create host_$i im_dummy vmm_dummy tm_dummy +done + +# 3 Fixed VNets + +for i in 0 1 2; do + ( echo "NAME = vnet_fixed_$i" + echo "TYPE = FIXED" + echo "BRIDGE = vbr1" + echo "LEASES = [IP=192.168.$i.1]" + echo "LEASES = [IP=192.168.$i.2]" + echo "LEASES = [IP=192.168.$i.3]" + echo "LEASES = [IP=192.168.$i.4]" + echo "LEASES = [IP=192.168.$i.5]" + ) > $TMP_FILE + + onevnet create $TMP_FILE + + rm $TMP_FILE +done + +# 2 Ranged VNets + +for i in 3 4; do + ( echo "NAME = vnet_ranged_$i" + echo "TYPE = RANGED" + echo "BRIDGE = vbr0" + echo "NETWORK_SIZE = C" + echo "NETWORK_ADDRESS = 192.168.$i.0" + ) > $TMP_FILE + + onevnet create $TMP_FILE + + rm $TMP_FILE +done + +# 5 Images + +for i in 0 1 2 3 4; do + ( echo "NAME = image_$i" + echo "TYPE = DATABLOCK" + echo "PATH = /dev/null" + ) > $TMP_FILE + + oneimage create $TMP_FILE + + rm $TMP_FILE +done + +# 5 Users + +for i in 0 1 2 3 4; do + oneuser create user_$i pass_$i +done + +# 5 VMs + +for i in 0 1 2 3 4; do + ( echo "NAME = one-$i " + echo "CPU = $i " + echo "MEMORY = 512 " + + echo "OS = [ " + echo " kernel = vmlinuz, " + echo " initrd = initrd.img, " + echo " root = sda ] " + echo "DISK = [ IMAGE_ID = $i ] " + + echo "DISK = [ " + echo " type = swap, " + echo " size = 1024, " + echo " readonly = no ] " + + echo "NIC = [ NETWORK_ID = $i ] " + + echo "REQUIREMENTS = \"CPUSPEED > 1000\" " + echo "RANK = FREECPU " + echo "CONTEXT = [ files = \"/dev/null\" ] " + ) > $TMP_FILE + + if [ $TWO_SERIES == "yes" ]; then + onevm create $TMP_FILE + else + onetemplate create $TMP_FILE + onetemplate instantiate $i + fi + + onevm deploy $i $i +done + +echo -n "Waiting until all VMs are running " + +while [ $(onevm list | grep -c runn) -ne 5 ]; do + echo -n "." + sleep 0.5s +done + +echo " ok" + +# Wait for some monitorization data +sleep 3s + +onevm migrate 0 1 +while [ $(onevm list | grep -c runn) -ne 5 ]; do sleep 0.5s; done + +onevm livemigrate 1 2 +while [ $(onevm list | grep -c runn) -ne 5 ]; do sleep 0.5s; done + +onevm shutdown 2 +while [ $(onevm list | grep -c runn) -ne 4 ]; do sleep 0.5s; done + +onevm delete 3 +while [ $(onevm list | grep -c runn) -ne 3 ]; do sleep 0.5s; done + +onehost disable 3 +oneimage persistent 3 +onevnet publish 2 +onevnet unpublish 3 + +# Wait for some monitorization data +sleep 3s + +mkdir -p results/xml_files + +for obj in host vnet image vm; do + for i in 0 1 2 3 4; do + one$obj show -x $i > results/xml_files/$obj-$i.xml + done +done diff --git a/src/onedb/test/oned.conf b/src/onedb/test/oned.conf new file mode 100644 index 0000000000..e65954acec --- /dev/null +++ b/src/onedb/test/oned.conf @@ -0,0 +1,433 @@ +#******************************************************************************* +# OpenNebula Configuration file +#******************************************************************************* + +#******************************************************************************* +# Daemon configuration attributes +#------------------------------------------------------------------------------- +# MANAGER_TIMER: Time in seconds the core uses to evaluate periodical functions. +# HOST_MONITORING_INTERVAL and VM_POLLING_INTERVAL can not have smaller values +# than MANAGER_TIMER. +# +# HOST_MONITORING_INTERVAL: Time in seconds between host monitorization. +# +# VM_POLLING_INTERVAL: Time in seconds between virtual machine monitorization. +# (use 0 to disable VM monitoring). +# +# VM_DIR: Remote path to store the VM images, it should be shared between all +# the cluster nodes to perform live migrations. This variable is the default +# for all the hosts in the cluster. VM_DIR IS ONLY FOR THE NODES AND *NOT* THE +# FRONT-END +# +# SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management +# scripts. +# +# PORT: Port where oned will listen for xmlrpc calls. +# +# DB: Configuration attributes for the database backend +# backend : can be sqlite or mysql (default is sqlite) +# server : (mysql) host name or an IP address for the MySQL server +# port : (mysql) port for the connection to the server. +# If set to 0, the default port is used. +# user : (mysql) user's MySQL login ID +# passwd : (mysql) the password for user +# db_name : (mysql) the database name +# +# VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT + +# VMID +# +# DEBUG_LEVEL: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG +#******************************************************************************* + +#MANAGER_TIMER=30 + +HOST_MONITORING_INTERVAL = 1 + +VM_POLLING_INTERVAL = 1 + +#VM_DIR=/srv/cloud/one/var + +SCRIPTS_REMOTE_DIR=/var/tmp/one + +PORT=2888 + +DB = [ backend = "sqlite" ] + +# Sample configuration for MySQL +# DB = [ backend = "mysql", +# server = "localhost", +# port = 0, +# user = "oneadmin", +# passwd = "oneadmin", +# db_name = "opennebula" ] + +VNC_BASE_PORT = 5900 + +DEBUG_LEVEL=3 + +#******************************************************************************* +# Physical Networks configuration +#******************************************************************************* +# NETWORK_SIZE: Here you can define the default size for the virtual networks +# +# MAC_PREFIX: Default MAC prefix to be used to create the auto-generated MAC +# addresses is defined here (this can be overrided by the Virtual Network +# template) +#******************************************************************************* + +NETWORK_SIZE = 254 + +MAC_PREFIX = "02:00" + +#******************************************************************************* +# Image Repository Configuration +#******************************************************************************* +# DEFAULT_IMAGE_TYPE: This can take values +# OS Image file holding an operating system +# CDROM Image file holding a CDROM +# DATABLOCK Image file holding a datablock, +# always created as an empty block +# DEFAULT_DEVICE_PREFIX: This can be set to +# hd IDE prefix +# sd SCSI +# xvd XEN Virtual Disk +# vd KVM virtual disk +#******************************************************************************* +DEFAULT_IMAGE_TYPE = "OS" +DEFAULT_DEVICE_PREFIX = "hd" + +#******************************************************************************* +# Information Driver Configuration +#******************************************************************************* +# You can add more information managers with different configurations but make +# sure it has different names. +# +# name : name for this information manager +# +# executable: path of the information driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, usually a probe configuration file, +# can be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +IM_MAD = [ + name = "im_kvm", + executable = "one_im_ssh", + arguments = "-r 0 -t 15 kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_xen", +# executable = "one_im_ssh", +# arguments = "xen" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Information Driver Manager Configuration +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_ec2", +# executable = "one_im_ec2", +# arguments = "im_ec2/im_ec2.conf" ] +#------------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Ganglia Information Driver Manager Configuration +#----------------------------------------------------------------------------- +#IM_MAD = [ +# name = "im_ganglia", +# executable = "one_im_sh", +# arguments = "ganglia" ] +#----------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Information Driver Manager Configuration +#------------------------------------------------------------------------------- +IM_MAD = [ name="im_dummy", executable="one_im_dummy"] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Virtualization Driver Configuration +#******************************************************************************* +# You can add more virtualization managers with different configurations but +# make sure it has different names. +# +# name : name of the virtual machine manager driver +# +# executable: path of the virtualization driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable +# +# default : default values and configuration parameters for the driver, can +# be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +# +# type : driver type, supported drivers: xen, kvm, xml +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -p name of the poll probe (executed locally) +#------------------------------------------------------------------------------- +VM_MAD = [ + name = "vmm_kvm", + executable = "one_vmm_ssh", + arguments = "-t 15 -r 0 kvm", + default = "vmm_ssh/vmm_ssh_kvm.conf", + type = "kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -l do not perform the VM polling in the node +# -p name of the poll probe (executed locally) +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmm_xen", +# executable = "one_vmm_ssh", +# arguments = "xen", +# default = "vmm_ssh/vmm_ssh_xen.conf", +# type = "xen" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Virtualization Driver Manager Configuration +# arguments: default values for the EC2 driver, can be an absolute path or +# relative to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was +# installed in /). +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmm_ec2", +# executable = "one_vmm_ec2", +# arguments = "vmm_ec2/vmm_ec2.conf", +# type = "xml" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Virtualization Driver Configuration +#------------------------------------------------------------------------------- +VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Transfer Manager Driver Configuration +#******************************************************************************* +# You can add more transfer managers with different configurations but make +# sure it has different names. +# name : name for this transfer driver +# +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, usually a commands configuration file +# , can be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# NFS Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +TM_MAD = [ + name = "tm_nfs", + executable = "one_tm", + arguments = "tm_nfs/tm_nfs.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# SSH Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +#TM_MAD = [ +# name = "tm_ssh", +# executable = "one_tm", +# arguments = "tm_ssh/tm_ssh.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +TM_MAD = [ + name = "tm_dummy", + executable = "one_tm", + arguments = "tm_dummy/tm_dummy.conf" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# LVM Transfer Manager Driver Configuration +#------------------------------------------------------------------------------- +#TM_MAD = [ +# name = "tm_lvm", +# executable = "one_tm", +# arguments = "tm_lvm/tm_lvm.conf" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Image Manager Driver Configuration +#******************************************************************************* +# Drivers to manage the image repository, specialized for the storage backend +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable +#******************************************************************************* +#------------------------------------------------------------------------------- +# FS based Image Manager Driver Configuration +# -t number of threads, i.e. number of repo operations at the same time +#------------------------------------------------------------------------------- +IMAGE_MAD = [ + executable = "one_image", + arguments = "fs -t 15" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Hook Manager Configuration +#******************************************************************************* +# The Driver (HM_MAD), used to execute the Hooks +# executable: path of the hook driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, can be an absolute path or relative +# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed +# in /) +# +# Virtual Machine Hooks (VM_HOOK) defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the VM is created (onevm create) +# - RUNNING, after the VM is successfully booted +# - SHUTDOWN, after the VM is shutdown +# - STOP, after the VM is stopped (including VM image transfers) +# - DONE, after the VM is deleted or shutdown +# - FAILED, when the VM enters the failed state +# command : path can be absolute or relative to $ONE_LOCATION/share/hooks +# case of self-contained installation or relative to +# /usr/share/one/hooks in case of system-wide installation +# arguments : for the hook. You can access to VM information with $ +# - $VMID, the ID of the virtual machine +# - $TEMPLATE, the VM template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host where the VM was +# allocated +# - NO, The hook is executed in the OpenNebula server (default) +# +# +# Host Hooks (HOST_HOOK) defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the Host is created (onehost create) +# - ERROR, when the Host enters the error state +# - DISABLE, when the Host is disabled +# command : path can be absolute or relative to $ONE_LOCATION/share/hooks +# case of self-contained installation or relative to +# /usr/share/one/hooks in case of system-wide installation +# arguments : for the hook. You can use the following Host information: +# - $HID, the ID of the host +# - $TEMPLATE, the Host template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host +# - NO, The hook is executed in the OpenNebula server (default) +#------------------------------------------------------------------------------- + +HM_MAD = [ + executable = "one_hm" ] + +#------------------------------------------------------------------------------- + +#------------------------------ Fault Tolerance Hooks -------------------------- +# This hook is used to perform recovery actions when a host fails. The VMs +# running in the host can be deleted (use -d option) or resubmitted (-r) in +# other host +# Last argument (force) can be "y", so suspended VMs in the host will be +# resubmitted/deleted, or "n", so suspended VMs in the host will be ignored +# +#HOST_HOOK = [ +# name = "error", +# on = "ERROR", +# command = "host_error.rb", +# arguments = "$HID -r n", +# remote = "no" ] +#------------------------------------------------------------------------------- +# This two hooks can be used to automatically delete or resubmit VMs that reach +# the "failed" state. This way, the administrator doesn't have to interact +# manually to release its resources or retry the deployment. +# +# Only one of them should be uncommented. +#------------------------------------------------------------------------------- +# +#VM_HOOK = [ +# name = "on_failure_delete", +# on = "FAILED", +# command = "/usr/bin/env onevm delete", +# arguments = "$VMID" ] +# +#VM_HOOK = [ +# name = "on_failure_resubmit", +# on = "FAILED", +# command = "/usr/bin/env onevm resubmit", +# arguments = "$VMID" ] +#------------------------------------------------------------------------------- + +#-------------------------------- ebtables Hook--------------------------------- +# You can use these two hooks to isolate networks at the ethernet level so the +# traffic generated in different virtual networks can not be seen in others. +# +# All the network configuration will be done in the cluster nodes, these are the +# additional requisites: +# - ebtables package installed +# - sudoers configured so oneadmin can execute ebtables without password +# +# NOTE: Change the first command for ebtables-xen if you are using Xen +# +#VM_HOOK = [ +# name = "ebtables-start", +# on = "running", +# command = "ebtables-kvm", # or ebtables-xen +# arguments = "one-$VMID", +# remote = "yes" ] +# +#VM_HOOK = [ +# name = "ebtables-flush", +# on = "done", +# command = "ebtables-flush", +# arguments = "", +# remote = "yes" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Auth Manager Configuration +#******************************************************************************* +# The Driver (AUTHM_MAD) that will be used to authenticate and authorize +# OpenNebula requests. If not defined OpenNebula will use the built-in auth +# policies +# executable: path of the auth driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, can be an absolute path or relative +# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed +# in /) +#------------------------------------------------------------------------------- + +#AUTH_MAD = [ +# executable = "one_auth_mad" ] diff --git a/src/onedb/test/test.sh b/src/onedb/test/test.sh new file mode 100755 index 0000000000..f3db5d19e1 --- /dev/null +++ b/src/onedb/test/test.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +if [ -z $ONE_LOCATION ]; then + echo "ONE_LOCATION not defined." + exit -1 +fi + +ONEDCONF_LOCATION="$ONE_LOCATION/etc/oned.conf" + +if [ -f $ONEDCONF_LOCATION ]; then + echo "$ONEDCONF_LOCATION has to be overwritten, move it to a safe place." + exit -1 +fi + +cp oned.conf $ONEDCONF_LOCATION + +export ONE_XMLRPC=http://localhost:2888/RPC2 +export PATH=$ONE_LOCATION/bin:$PATH + +if [ -z $ONE_LOCATION ]; then + echo "ONE_LOCATION not defined." + exit -1 +fi + +VAR_LOCATION="$ONE_LOCATION/var" + +if [ -f $VAR_LOCATION/one.db ]; then + echo "$VAR_LOCATION/one.db has to be overwritten, move it to a safe place." + exit -1 +fi + + +echo "Starting oned, some resources will be created" + +PID=$$ + +oned -f & + +sleep 2s; + +mkdir results + +./create.sh + +pkill -P $PID oned +sleep 2s; +pkill -9 -P $PID oned + +echo "All resources created, now 2.2 DB will be upgraded." + +cp $VAR_LOCATION/one.db results/one.db.3.0 +cp 2.2/one.db results/one.db.upgraded + +onedb upgrade --sqlite results/one.db.upgraded --backup results/one.db.backup + +echo "Done. Upgraded DB and the one created will be compared." + +ruby compare_schema.rb results/one.db.upgraded results/one.db.3.0 + +CODE=$? + + +exit $CODE \ No newline at end of file