mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
parent
6fdc67f6bd
commit
fa69b9aa1a
@ -16,8 +16,6 @@
|
||||
|
||||
#include "HostHookTest.h"
|
||||
|
||||
string HostHookTest::db_name;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
static string db_name = "ONE_test_database";
|
||||
|
||||
class HostHookTest : public CppUnit::TestFixture
|
||||
{
|
||||
@ -60,8 +61,6 @@ private:
|
||||
int rc;
|
||||
|
||||
public:
|
||||
static string db_name;
|
||||
|
||||
|
||||
void setUp()
|
||||
{
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
#include "LifeCycleManagerTest.h"
|
||||
|
||||
string LifeCycleManagerTest::db_name;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
@ -62,7 +62,7 @@ static string hostname = "test_hostname";
|
||||
static string vmm_mad = "vmm_mad";
|
||||
static string tm_mad = "tm_mad";
|
||||
static string vmdir = "vmdir";
|
||||
|
||||
static string db_name = "ONE_test_database";
|
||||
|
||||
class LifeCycleManagerTest : public CppUnit::TestFixture
|
||||
{
|
||||
@ -98,35 +98,35 @@ class LifeCycleManagerTest : public CppUnit::TestFixture
|
||||
|
||||
CPPUNIT_TEST ( prolog_migrate_to_boot );
|
||||
CPPUNIT_TEST ( prolog_migrate_to_failed );
|
||||
// CPPUNIT_TEST ( prolog_migrate_to_pending );
|
||||
CPPUNIT_TEST ( prolog_migrate_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( cancel_to_done );
|
||||
CPPUNIT_TEST ( cancel_to_running );
|
||||
// CPPUNIT_TEST ( cancel_to_pending );
|
||||
CPPUNIT_TEST ( cancel_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( migrate_to_running );
|
||||
CPPUNIT_TEST ( migrate_to_failed );
|
||||
// CPPUNIT_TEST ( migrate_to_pending );
|
||||
CPPUNIT_TEST ( migrate_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( save_suspend_to_suspended );
|
||||
CPPUNIT_TEST ( save_suspend_to_running );
|
||||
// CPPUNIT_TEST ( save_suspend_to_pending );
|
||||
CPPUNIT_TEST ( save_suspend_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( shutdown_to_epilog );
|
||||
CPPUNIT_TEST ( shutdown_to_running );
|
||||
// CPPUNIT_TEST ( shutdown_to_pending );
|
||||
CPPUNIT_TEST ( shutdown_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( save_stop_to_epilog_stop );
|
||||
CPPUNIT_TEST ( save_stop_to_running );
|
||||
// CPPUNIT_TEST ( save_stop_to_pending );
|
||||
CPPUNIT_TEST ( save_stop_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( epilog_to_done );
|
||||
CPPUNIT_TEST ( epilog_to_failed );
|
||||
// CPPUNIT_TEST ( epilog_to_pending );
|
||||
CPPUNIT_TEST ( epilog_to_pending );
|
||||
|
||||
CPPUNIT_TEST ( epilog_stop_to_stop );
|
||||
CPPUNIT_TEST ( epilog_stop_to_failed );
|
||||
// CPPUNIT_TEST ( epilog_stop_to_pending );
|
||||
CPPUNIT_TEST ( epilog_stop_to_pending );
|
||||
|
||||
CPPUNIT_TEST_SUITE_END ();
|
||||
|
||||
@ -267,8 +267,6 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
static string db_name;
|
||||
|
||||
|
||||
void setUp()
|
||||
{
|
||||
@ -396,7 +394,6 @@ public:
|
||||
vm->unlock();
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
@ -691,6 +688,30 @@ public:
|
||||
wait_assert(vm, VirtualMachine::FAILED);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void prolog_migrate_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
|
||||
vm->add_history(hid,hostname,vmdir,vmm_mad,tm_mad);
|
||||
|
||||
rc = vmpool->update_history(vm);
|
||||
CPPUNIT_ASSERT( rc == 0 );
|
||||
|
||||
vmpool->update(vm); //Insert last_seq in the DB
|
||||
|
||||
vmm_actions.push_back(LifeCycleManager::SAVE_SUCCESS);
|
||||
vmm->set_actions(vmm_actions);
|
||||
|
||||
dm->migrate(vm);
|
||||
|
||||
wait_assert(vm, VirtualMachine::ACTIVE,VirtualMachine::PROLOG_MIGRATE );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void cancel_to_done()
|
||||
@ -719,6 +740,18 @@ public:
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::RUNNING );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void cancel_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
dm->cancel(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::CANCEL );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void migrate_to_running()
|
||||
@ -765,6 +798,28 @@ public:
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::RUNNING );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void migrate_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
|
||||
vm->add_history(hid,hostname,vmdir,vmm_mad,tm_mad);
|
||||
rc = vmpool->update_history(vm);
|
||||
CPPUNIT_ASSERT( rc == 0 );
|
||||
|
||||
vmpool->update(vm); //Insert last_seq in the DB
|
||||
|
||||
CPPUNIT_ASSERT( vm->hasHistory() );
|
||||
CPPUNIT_ASSERT( vm->hasPreviousHistory() );
|
||||
|
||||
dm->live_migrate(vm);
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::MIGRATE );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void save_suspend_to_suspended()
|
||||
@ -793,6 +848,18 @@ public:
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::RUNNING );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void save_suspend_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
dm->suspend(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::SAVE_SUSPEND );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void shutdown_to_epilog()
|
||||
@ -821,6 +888,18 @@ public:
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::RUNNING );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void shutdown_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
dm->shutdown(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::SHUTDOWN );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void save_stop_to_epilog_stop()
|
||||
@ -849,6 +928,19 @@ public:
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::RUNNING );
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void save_stop_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
dm->stop(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::SAVE_STOP );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void epilog_to_done()
|
||||
@ -883,6 +975,22 @@ public:
|
||||
wait_assert(vm, VirtualMachine::FAILED );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void epilog_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
|
||||
vmm_actions.push_back(LifeCycleManager::SHUTDOWN_SUCCESS);
|
||||
vmm->set_actions(vmm_actions);
|
||||
|
||||
dm->shutdown(vm->get_oid());
|
||||
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::EPILOG );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@ -918,6 +1026,23 @@ public:
|
||||
wait_assert(vm, VirtualMachine::FAILED );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void epilog_stop_to_pending()
|
||||
{
|
||||
vm = allocate_running(0);
|
||||
|
||||
vmm_actions.push_back(LifeCycleManager::SAVE_SUCCESS);
|
||||
vmm->set_actions(vmm_actions);
|
||||
|
||||
dm->stop(vm->get_oid());
|
||||
|
||||
wait_assert(vm, VirtualMachine::ACTIVE, VirtualMachine::EPILOG_STOP );
|
||||
|
||||
rc = dm->resubmit(vm->get_oid());
|
||||
wait_assert(vm, VirtualMachine::PENDING);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user