mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Merge branch 'one-2.0' of dsa-research.org:one into one-2.0
This commit is contained in:
commit
3130caf059
@ -36,6 +36,8 @@
|
||||
#include "PoolSQL.h"
|
||||
#include "Nebula.h"
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
// Use this macro in sub-classes to add all the tests defined here
|
||||
#define ALL_POOLTEST_CPPUNIT_TESTS() \
|
||||
CPPUNIT_TEST (oid_assignment); \
|
||||
@ -339,6 +341,9 @@ public:
|
||||
NebulaLog::log("Test", Log::INFO, "Test started");
|
||||
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
|
||||
SETUP_XML_WRITER(runner, "output.xml")
|
||||
|
||||
runner.addTest( suite );
|
||||
|
||||
if (sqlite_flag)
|
||||
@ -356,6 +361,8 @@ public:
|
||||
|
||||
runner.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
if (!log_flag)
|
||||
remove("test.log");
|
||||
|
||||
|
12
include/test/one_test_common.h
Normal file
12
include/test/one_test_common.h
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
#include <cppunit/XmlOutputter.h>
|
||||
|
||||
#define SETUP_XML_WRITER(runner, output) \
|
||||
ofstream outputFile(output); \
|
||||
CppUnit::XmlOutputter* outputter = \
|
||||
new CppUnit::XmlOutputter(&runner.result(), outputFile); \
|
||||
\
|
||||
runner.setOutputter(outputter);
|
||||
|
||||
#define END_XML_WRITER outputFile.close();
|
||||
|
40
install.sh
40
install.sh
@ -150,9 +150,7 @@ SHARE_DIRS="$SHARE_LOCATION/examples \
|
||||
ETC_DIRS="$ETC_LOCATION/im_kvm \
|
||||
$ETC_LOCATION/im_xen \
|
||||
$ETC_LOCATION/im_ec2 \
|
||||
$ETC_LOCATION/im_eh \
|
||||
$ETC_LOCATION/vmm_ec2 \
|
||||
$ETC_LOCATION/vmm_eh \
|
||||
$ETC_LOCATION/vmm_sh \
|
||||
$ETC_LOCATION/tm_nfs \
|
||||
$ETC_LOCATION/tm_ssh \
|
||||
@ -242,20 +240,18 @@ INSTALL_OCCI_CLIENT_FILES[2]="OCCI_BIN_CLIENT_FILES:$BIN_LOCATION"
|
||||
|
||||
INSTALL_ETC_FILES[0]="ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[1]="VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2"
|
||||
INSTALL_ETC_FILES[2]="VMM_EH_ETC_FILES:$ETC_LOCATION/vmm_eh"
|
||||
INSTALL_ETC_FILES[3]="VMM_SH_ETC_FILES:$ETC_LOCATION/vmm_sh"
|
||||
INSTALL_ETC_FILES[4]="IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2"
|
||||
INSTALL_ETC_FILES[5]="IM_EH_ETC_FILES:$ETC_LOCATION/im_eh"
|
||||
INSTALL_ETC_FILES[6]="TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs"
|
||||
INSTALL_ETC_FILES[7]="TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh"
|
||||
INSTALL_ETC_FILES[8]="TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy"
|
||||
INSTALL_ETC_FILES[9]="TM_LVM_ETC_FILES:$ETC_LOCATION/tm_lvm"
|
||||
INSTALL_ETC_FILES[10]="HM_ETC_FILES:$ETC_LOCATION/hm"
|
||||
INSTALL_ETC_FILES[11]="AUTH_ETC_FILES:$ETC_LOCATION/auth"
|
||||
INSTALL_ETC_FILES[14]="ECO_ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[15]="ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates"
|
||||
INSTALL_ETC_FILES[16]="OCCI_ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[17]="OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates"
|
||||
INSTALL_ETC_FILES[2]="VMM_SH_ETC_FILES:$ETC_LOCATION/vmm_sh"
|
||||
INSTALL_ETC_FILES[3]="IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2"
|
||||
INSTALL_ETC_FILES[4]="TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs"
|
||||
INSTALL_ETC_FILES[5]="TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh"
|
||||
INSTALL_ETC_FILES[6]="TM_DUMMY_ETC_FILES:$ETC_LOCATION/tm_dummy"
|
||||
INSTALL_ETC_FILES[7]="TM_LVM_ETC_FILES:$ETC_LOCATION/tm_lvm"
|
||||
INSTALL_ETC_FILES[8]="HM_ETC_FILES:$ETC_LOCATION/hm"
|
||||
INSTALL_ETC_FILES[9]="AUTH_ETC_FILES:$ETC_LOCATION/auth"
|
||||
INSTALL_ETC_FILES[10]="ECO_ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[11]="ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates"
|
||||
INSTALL_ETC_FILES[12]="OCCI_ETC_FILES:$ETC_LOCATION"
|
||||
INSTALL_ETC_FILES[13]="OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Binary files, to be installed under $BIN_LOCATION
|
||||
@ -325,16 +321,12 @@ MADS_LIB_FILES="src/mad/sh/madcommon.sh \
|
||||
src/vmm_mad/sh/one_vmm_sh \
|
||||
src/vmm_mad/ec2/one_vmm_ec2.rb \
|
||||
src/vmm_mad/ec2/one_vmm_ec2 \
|
||||
src/vmm_mad/eh/one_vmm_eh.rb \
|
||||
src/vmm_mad/eh/one_vmm_eh \
|
||||
src/vmm_mad/dummy/one_vmm_dummy.rb \
|
||||
src/vmm_mad/dummy/one_vmm_dummy \
|
||||
src/im_mad/im_ssh/one_im_ssh.rb \
|
||||
src/im_mad/im_ssh/one_im_ssh \
|
||||
src/im_mad/ec2/one_im_ec2.rb \
|
||||
src/im_mad/ec2/one_im_ec2 \
|
||||
src/im_mad/eh/one_im_eh.rb \
|
||||
src/im_mad/eh/one_im_eh \
|
||||
src/im_mad/dummy/one_im_dummy.rb \
|
||||
src/im_mad/dummy/one_im_dummy \
|
||||
src/tm_mad/one_tm \
|
||||
@ -429,21 +421,16 @@ ETC_FILES="share/etc/oned.conf \
|
||||
#-------------------------------------------------------------------------------
|
||||
# Virtualization drivers config. files, to be installed under $ETC_LOCATION
|
||||
# - ec2, $ETC_LOCATION/vmm_ec2
|
||||
# - eh, $ETC_LOCATION/vmm_eh
|
||||
# - sh, $ETC_LOCATION/vmm_sh
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
VMM_EC2_ETC_FILES="src/vmm_mad/ec2/vmm_ec2rc \
|
||||
src/vmm_mad/ec2/vmm_ec2.conf"
|
||||
|
||||
VMM_EH_ETC_FILES="src/vmm_mad/eh/vmm_ehrc \
|
||||
src/vmm_mad/eh/vmm_eh.conf"
|
||||
|
||||
VMM_SH_ETC_FILES="src/vmm_mad/sh/vmm_shrc \
|
||||
src/vmm_mad/sh/vmm_sh_kvm.conf \
|
||||
src/vmm_mad/sh/vmm_sh_xen.conf"
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Information drivers config. files, to be installed under $ETC_LOCATION
|
||||
# - ec2, $ETC_LOCATION/im_ec2
|
||||
@ -452,9 +439,6 @@ VMM_SH_ETC_FILES="src/vmm_mad/sh/vmm_shrc \
|
||||
IM_EC2_ETC_FILES="src/im_mad/ec2/im_ec2rc \
|
||||
src/im_mad/ec2/im_ec2.conf"
|
||||
|
||||
IM_EH_ETC_FILES="src/im_mad/eh/im_ehrc \
|
||||
src/im_mad/eh/im_eh.conf"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Storage drivers config. files, to be installed under $ETC_LOCATION
|
||||
# - nfs, $ETC_LOCATION/tm_nfs
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/bio.h>
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -291,10 +293,14 @@ int main(int argc, char ** argv)
|
||||
NebulaLog::init_log_system(NebulaLog::FILE, Log::DEBUG,"test.log");
|
||||
NebulaLog::log("Test", Log::INFO, "Test started");
|
||||
|
||||
SETUP_XML_WRITER(runner, "AuthManagerTest.xml");
|
||||
|
||||
runner.addTest(AuthManagerTest::suite());
|
||||
|
||||
runner.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
NebulaLog::finalize_log_system();
|
||||
|
||||
return 0;
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <TestCaller.h>
|
||||
#include <ui/text/TestRunner.h>
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern "C" void * addsub_loop(void *arg);
|
||||
@ -175,9 +177,13 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
|
||||
CppUnit::TextUi::TestRunner tr;
|
||||
|
||||
SETUP_XML_WRITER(tr, "action_manager.xml");
|
||||
|
||||
tr.addTest(ActionManagerTest::suite());
|
||||
tr.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ extern "C"
|
||||
#include <TestCaller.h>
|
||||
#include <ui/text/TestRunner.h>
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MemCollectorTest : public CppUnit::TestFixture
|
||||
@ -110,8 +112,12 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
CppUnit::TextUi::TestRunner tr;
|
||||
|
||||
SETUP_XML_WRITER(tr, "mem_collector.xml");
|
||||
|
||||
tr.addTest(MemCollectorTest::suite());
|
||||
tr.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <TestCaller.h>
|
||||
#include <ui/text/TestRunner.h>
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class SingleAttributeTest : public CppUnit::TestFixture
|
||||
@ -123,9 +125,13 @@ public:
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
CppUnit::TextUi::TestRunner tr;
|
||||
|
||||
SETUP_XML_WRITER(tr, "single_attribute.xml");
|
||||
|
||||
tr.addTest(SingleAttributeTest::suite());
|
||||
tr.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <TestCaller.h>
|
||||
#include <ui/text/TestRunner.h>
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class VectorAttributeTest : public CppUnit::TestFixture
|
||||
@ -156,9 +158,13 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
|
||||
CppUnit::TextUi::TestRunner tr;
|
||||
|
||||
SETUP_XML_WRITER(tr, "vector_attribute.xml");
|
||||
|
||||
tr.addTest(VectorAttributeTest::suite());
|
||||
tr.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
# Max memory that can be provided by ElasticHosts
|
||||
# These defaults allows for two machines with MEMORY=1024 and using 1 CPU
|
||||
|
||||
TOTAL_MEMORY=2048
|
||||
TOTAL_CPU=2
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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
|
||||
EHRC=/etc/one/im_eh/im_ehrc
|
||||
EHCONF=/etc/one/im_eh/im_eh.conf
|
||||
MADCOMMON=/usr/lib/one/mads/madcommon.sh
|
||||
VAR_LOCATION=/var/lib/one
|
||||
else
|
||||
EHRC=$ONE_LOCATION/etc/im_eh/im_ehrc
|
||||
EHCONF=$ONE_LOCATION/etc/im_eh/im_eh.conf
|
||||
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
|
||||
VAR_LOCATION=$ONE_LOCATION/var
|
||||
fi
|
||||
|
||||
. $MADCOMMON
|
||||
|
||||
# Export the vmm_mad specific rc
|
||||
export_rc_vars $EHRC
|
||||
|
||||
# Export max instance type usages
|
||||
export_rc_vars $EHCONF
|
||||
|
||||
# Go to var directory ONE_LOCATION/var or /var/lib/one
|
||||
cd $VAR_LOCATION
|
||||
|
||||
# Execute the actual MAD
|
||||
execute_mad $*
|
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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"
|
||||
end
|
||||
|
||||
$: << RUBY_LIB_LOCATION
|
||||
|
||||
require 'pp'
|
||||
require 'one_mad'
|
||||
|
||||
################
|
||||
# EC2 IM MAD #
|
||||
################
|
||||
|
||||
class IM < ONEMad
|
||||
|
||||
def initialize(sensors=nil)
|
||||
super(3, 4)
|
||||
end
|
||||
|
||||
def action_init(args)
|
||||
STDOUT.puts "INIT SUCCESS"
|
||||
STDOUT.flush
|
||||
end
|
||||
|
||||
def action_monitor(args)
|
||||
|
||||
totalmemory = ENV["TOTAL_MEMORY"].to_i
|
||||
totalcpu = 100 * ENV["TOTAL_CPU"].to_i
|
||||
|
||||
|
||||
STDOUT.puts "MONITOR SUCCESS " + args[1].to_s +
|
||||
"HOSTNAME=#{args[2]},TOTALMEMORY=#{totalmemory},TOTALCPU=#{totalcpu},CPUSPEED=1000,FREEMEMORY=#{totalmemory},FREECPU=#{totalcpu}"
|
||||
STDOUT.flush
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
im=IM.new(nil)
|
||||
im.loop
|
@ -168,11 +168,16 @@ private
|
||||
end
|
||||
|
||||
def get_first_runable
|
||||
action_index=@action_queue.index do |action|
|
||||
if action[:args][HOST_ARG]
|
||||
!@hosts.include? action[:args][HOST_ARG]
|
||||
action_index=nil
|
||||
@action_queue.each_with_index do |action, index|
|
||||
if action[:args][HOST_ARG]
|
||||
if !@hosts.include?(action[:args][HOST_ARG])
|
||||
action_index=index
|
||||
break
|
||||
end
|
||||
else
|
||||
true
|
||||
action_index=index
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
$: << '../'
|
||||
|
||||
require 'OpenNebula'
|
||||
require 'MockClient'
|
||||
require 'helpers/MockClient'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
|
@ -5,13 +5,13 @@ class MockClient
|
||||
|
||||
case xmlrpc_action
|
||||
when "one.vn.info"
|
||||
return File.read("xml_test/vnet.xml")
|
||||
return File.read("fixtures/vnet.xml")
|
||||
when "one.vn.allocate"
|
||||
return 3
|
||||
when "one.vn.delete"
|
||||
return nil
|
||||
when "one.vm.info"
|
||||
return File.read("xml_test/vm.xml")
|
||||
return File.read("fixtures/vm.xml")
|
||||
when "one.vm.allocate"
|
||||
return 6
|
||||
when "one.vm.delete"
|
||||
@ -23,7 +23,7 @@ class MockClient
|
||||
when "one.vm.migrate"
|
||||
return nil
|
||||
when "one.host.info"
|
||||
return File.read("xml_test/host.xml")
|
||||
return File.read("fixtures/host.xml")
|
||||
when "one.host.allocate"
|
||||
return 7
|
||||
when "one.host.delete"
|
||||
@ -33,13 +33,13 @@ class MockClient
|
||||
when "one.user.allocate"
|
||||
return 3
|
||||
when "one.user.info"
|
||||
return File.read("xml_test/user.xml")
|
||||
return File.read("fixtures/user.xml")
|
||||
when "one.user.delete"
|
||||
return nil
|
||||
when "one.cluster.allocate"
|
||||
return 5
|
||||
when "one.cluster.info"
|
||||
return File.read("xml_test/cluster.xml")
|
||||
return File.read("fixtures/cluster.xml")
|
||||
when "one.cluster.delete"
|
||||
return nil
|
||||
when "one.cluster.addhost"
|
||||
@ -47,15 +47,15 @@ class MockClient
|
||||
when "one.cluster.removehost"
|
||||
return nil
|
||||
when "one.vnpool.info"
|
||||
return File.read("xml_test/vnetpool.xml")
|
||||
return File.read("fixtures/vnetpool.xml")
|
||||
when "one.vmpool.info"
|
||||
return File.read("xml_test/vmpool.xml")
|
||||
return File.read("fixtures/vmpool.xml")
|
||||
when "one.hostpool.info"
|
||||
return File.read("xml_test/hostpool.xml")
|
||||
return File.read("fixtures/hostpool.xml")
|
||||
when "one.userpool.info"
|
||||
return File.read("xml_test/userpool.xml")
|
||||
return File.read("fixtures/userpool.xml")
|
||||
when "one.clusterpool.info"
|
||||
return File.read("xml_test/clusterpool.xml")
|
||||
return File.read("fixtures/clusterpool.xml")
|
||||
end
|
||||
end
|
||||
end
|
@ -32,6 +32,8 @@
|
||||
#include "MySqlDB.h"
|
||||
#include "SqlDB.h"
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* ************************************************************************* */
|
||||
@ -287,12 +289,16 @@ int main(int argc, char ** argv)
|
||||
cout << "\nRunning MySQL tests...\n";
|
||||
}
|
||||
|
||||
SETUP_XML_WRITER(runner, "pool.xml")
|
||||
|
||||
runner.addTest( PoolTest::suite() );
|
||||
runner.run();
|
||||
|
||||
if (!log_flag)
|
||||
remove("test.log");
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
NebulaLog::finalize_log_system();
|
||||
|
||||
return 0;
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "ObjectXML.h"
|
||||
#include "HostPoolXML.h"
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* ************************************************************************* */
|
||||
|
||||
@ -263,10 +265,15 @@ int main(int argc, char ** argv)
|
||||
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
|
||||
SETUP_XML_WRITER(runner, "HostXMLTest.xml")
|
||||
|
||||
runner.addTest(HostXMLTest::suite());
|
||||
runner.run();
|
||||
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
|
||||
// remove("test.log");
|
||||
NebulaLog::finalize_log_system();
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "VirtualMachinePoolXML.h"
|
||||
#include "HostPoolXML.h"
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* ************************************************************************* */
|
||||
|
||||
@ -317,9 +319,13 @@ int main(int argc, char ** argv)
|
||||
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
|
||||
SETUP_XML_WRITER(runner, "VirtualMachineXMLTest.xml")
|
||||
|
||||
runner.addTest(VirtualMachineXMLTest::suite());
|
||||
runner.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
remove("test.log");
|
||||
NebulaLog::finalize_log_system();
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "ObjectXML.h"
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* ************************************************************************* */
|
||||
|
||||
@ -331,9 +333,13 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
|
||||
SETUP_XML_WRITER(runner, "ObjectXMLTest.xml");
|
||||
|
||||
runner.addTest(ObjectXMLTest::suite());
|
||||
runner.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ main_env['ENV']['PATH']=os.environ['PATH']
|
||||
# Include dirs
|
||||
main_env.Append(CPPPATH=[
|
||||
cwd+'/../../../include',
|
||||
cwd+'/../../../../../include',
|
||||
'/usr/include/cppunit/'
|
||||
])
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <TestCaller.h>
|
||||
#include <ui/text/TestRunner.h>
|
||||
|
||||
#include "test/one_test_common.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* ************************************************************************* */
|
||||
@ -400,8 +402,12 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
CppUnit::TextUi::TestRunner tr;
|
||||
|
||||
SETUP_XML_WRITER(tr, "template.xml")
|
||||
|
||||
tr.addTest(TemplateTest::suite());
|
||||
tr.run();
|
||||
|
||||
END_XML_WRITER
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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
|
||||
DRIVERRC=/etc/one/vmm_eh/vmm_ehrc
|
||||
MADCOMMON=/usr/lib/one/mads/madcommon.sh
|
||||
VAR_LOCATION=/var/lib/one
|
||||
else
|
||||
DRIVERRC=$ONE_LOCATION/etc/vmm_eh/vmm_ehrc
|
||||
MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh
|
||||
VAR_LOCATION=$ONE_LOCATION/var
|
||||
fi
|
||||
|
||||
. $MADCOMMON
|
||||
|
||||
# Export the vmm_mad specific rc
|
||||
export_rc_vars $DRIVERRC
|
||||
|
||||
# Go to ONE_LOCATION
|
||||
cd $VAR_LOCATION
|
||||
|
||||
# Execute the actual MAD
|
||||
execute_mad $*
|
@ -1,178 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
EHAUTH = ENV["EHAUTH"]
|
||||
|
||||
if !EHAUTH
|
||||
puts "EHAUTH not set"
|
||||
exit -1
|
||||
end
|
||||
|
||||
ONE_LOCATION=ENV["ONE_LOCATION"]
|
||||
|
||||
if !ONE_LOCATION
|
||||
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
|
||||
else
|
||||
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
|
||||
end
|
||||
|
||||
$: << RUBY_LIB_LOCATION
|
||||
|
||||
require 'pp'
|
||||
require 'one_mad'
|
||||
require 'open3'
|
||||
|
||||
class DM < ONEMad
|
||||
|
||||
def initialize
|
||||
super(5, 4)
|
||||
end
|
||||
|
||||
def action_init(args)
|
||||
|
||||
send_message("INIT", "SUCCESS")
|
||||
|
||||
end
|
||||
|
||||
def action_deploy(args)
|
||||
|
||||
action_number=args[1]
|
||||
action_host=args[2]
|
||||
remote_deployment_file=args[3]
|
||||
|
||||
# Get local deployment file
|
||||
local_deployment_file=get_local_deployment_file(remote_deployment_file)
|
||||
|
||||
std_action("DEPLOY", "elastichosts -f #{local_deployment_file} servers create", args)
|
||||
|
||||
end
|
||||
|
||||
def action_shutdown(args)
|
||||
|
||||
std_action("SHUTDOWN", "elastichosts servers #{args[3]} shutdown", args)
|
||||
|
||||
end
|
||||
|
||||
def action_cancel(args)
|
||||
|
||||
std_action("SHUTDOWN", "elastichosts servers #{args[3]} destroy", args)
|
||||
|
||||
end
|
||||
|
||||
def action_checkpoint(args)
|
||||
|
||||
send_message("CHECKPOINT", "FAILURE", args[1], "action not supported for ElasticHost")
|
||||
|
||||
end
|
||||
|
||||
def action_save(args)
|
||||
|
||||
send_message("SAVE", "FAILURE", args[1], "action not supported for ElasticHost")
|
||||
|
||||
end
|
||||
|
||||
def action_restore(args)
|
||||
|
||||
send_message("RESTORE", "FAILURE", args[1], "action not supported for ElasticHost")
|
||||
|
||||
end
|
||||
|
||||
def action_poll(args)
|
||||
|
||||
std = Open3.popen3("elastichosts servers #{args[3]} info; echo ExitCode: $? 1>&2")
|
||||
|
||||
stdout=std[1].read
|
||||
stderr=std[2].read
|
||||
|
||||
exit_code=get_exit_code(stderr)
|
||||
|
||||
tx=0
|
||||
rx=0
|
||||
|
||||
if exit_code=="0"
|
||||
stdout.each_line{|line|
|
||||
cols=line.split(" ")
|
||||
case cols[0]
|
||||
when "rx"
|
||||
rx=cols[1]
|
||||
when "tx"
|
||||
tx=cols[1]
|
||||
end
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
send_message("POLL", "SUCCESS", args[1],"USEDCPU=0.0 NETTX=#{tx} NETRX=#{rx} USEDMEMORY=0")
|
||||
|
||||
end
|
||||
|
||||
###########################
|
||||
# Common action functions #
|
||||
###########################
|
||||
|
||||
def std_action(action, command, args)
|
||||
|
||||
std= Open3.popen3("#{command} ; echo ExitCode: $? 1>&2")
|
||||
|
||||
stdout=std[1].read
|
||||
stderr=std[2].read
|
||||
|
||||
exit_code=get_exit_code(stderr)
|
||||
|
||||
if exit_code=="0"
|
||||
domain_name=args[3]
|
||||
if action=="DEPLOY"
|
||||
remote_deployment_file=args[3]
|
||||
|
||||
# Get local deployment file
|
||||
local_deployment_file=get_local_deployment_file(remote_deployment_file)
|
||||
|
||||
domain_name = stdout
|
||||
end
|
||||
send_message(action, "SUCCESS", args[1], domain_name)
|
||||
else
|
||||
error_message=get_error_message(stderr)
|
||||
send_message(action, "FAILURE", args[1], error_message)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#########################################
|
||||
# Get information form xm create output #
|
||||
#########################################
|
||||
|
||||
# From STDERR if exit code == 1
|
||||
def get_exit_code(str)
|
||||
tmp=str.scan(/^ExitCode:.*$/)[0]
|
||||
if tmp
|
||||
return tmp.split(' ')[1]
|
||||
else
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
# From STDERR if exit code == 1
|
||||
def get_error_message(str)
|
||||
tmp=str.split(/\n/)
|
||||
return "Unknown error" if !tmp[0]
|
||||
tmp[0]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
dm=DM.new
|
||||
dm.loop
|
@ -1 +0,0 @@
|
||||
# Default configuration attributes for the ElasticHost driver
|
@ -1,25 +0,0 @@
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, 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. #
|
||||
#--------------------------------------------------------------------------- ##
|
||||
|
||||
# May be needed in some setups
|
||||
# CLASSPATH=""
|
||||
|
||||
#
|
||||
# Note: elastichosts command line script (download it here http://www.elastichosts.com/downloads/elastichosts)
|
||||
# MUST be in the PATH
|
||||
#
|
||||
|
||||
EHAUTH="<user uuid>:<secret_key>"
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
@ -52,8 +52,7 @@ info=`$virsh_cmd 2>/dev/null | awk "$AWK_SCRIPT"`
|
||||
|
||||
if [ -n "$info" ]; then
|
||||
echo $info
|
||||
exit 0
|
||||
else
|
||||
echo STATE=d
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
@ -58,8 +58,7 @@ info=`get_info $1 2>/dev/null | awk "$AWK_SCRIPT"`
|
||||
|
||||
if [ -n "$info" ]; then
|
||||
echo $info
|
||||
exit 0
|
||||
else
|
||||
echo STATE=d
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
|
||||
|
Loading…
x
Reference in New Issue
Block a user