From 74f90fc65a24ed55a5e23392237f61ff59d5fa85 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 13 May 2008 16:22:31 +0000 Subject: [PATCH] - move hardcoded xen configuration name to config file svn path=/trunk/; revision=33496 --- reactos/tools/sysreg/rosboot_test.cpp | 29 ++++++++++++++++----------- reactos/tools/sysreg/rosboot_test.h | 7 ++++--- reactos/tools/sysreg/txtmode.cfg | 12 ++++++++++- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/reactos/tools/sysreg/rosboot_test.cpp b/reactos/tools/sysreg/rosboot_test.cpp index 131ada08e32..460cd840177 100644 --- a/reactos/tools/sysreg/rosboot_test.cpp +++ b/reactos/tools/sysreg/rosboot_test.cpp @@ -66,6 +66,7 @@ namespace Sysreg_ string RosBootTest::ROS_EMU_MEM = "ROS_EMU_MEM"; string RosBootTest::ROS_BOOT_CMD = "ROS_BOOT_CMD"; string RosBootTest::XEN_CONFIG_FILE = "XEN_CONFIG_FILE"; + string RosBootTest::XEN_CONFIG_NAME = "XEN_CONFIG_NAME"; #ifdef __LINUX__ string RosBootTest::ROS_EMU_PATH = "ROS_EMU_PATH_LIN"; @@ -662,7 +663,7 @@ namespace Sysreg_ } //--------------------------------------------------------------------------------------- - bool RosBootTest::configureXen() + bool RosBootTest::configureXen(ConfigParser &conf_parser) { if (!xenGetCaps()) { @@ -674,8 +675,9 @@ namespace Sysreg_ cerr << "Xen configuration file missing" << endl; return false; } - - m_Src = "xm console reactos"; + m_Src = "xm console "; + string xen_name = "reactos"; + conf_parser.getStringValue(RosBootTest::XEN_CONFIG_NAME, xen_name); m_DataSource = new PipeReader(); m_BootCmd = m_EmuPath + "/xm create " + m_XenConfig; @@ -740,14 +742,17 @@ namespace Sysreg_ return true; } //--------------------------------------------------------------------------------------- - void RosBootTest::cleanup() + void RosBootTest::cleanup(ConfigParser &conf_parser) { m_DataSource->closeSource(); OsSupport::delayExecution(3); if (m_EmuType == EMU_TYPE_XEN) { - system("xm destroy reactos"); + string xen_name = "reactos"; + conf_parser.getStringValue(RosBootTest::XEN_CONFIG_NAME, xen_name); + string cmd = "xm destroy " + xen_name; + system(cmd.c_str ()); } else { @@ -791,7 +796,7 @@ namespace Sysreg_ } else if (m_EmuType == EMU_TYPE_XEN) { - if (!configureXen()) + if (!configureXen(conf_parser)) { cerr << "Error: failed to configure xen" << endl; return false; @@ -815,7 +820,7 @@ namespace Sysreg_ if (!m_DataSource->openSource(m_Src)) { cerr << "Error: failed to open data source with " << m_Src << endl; - cleanup(); + cleanup(conf_parser); return false; } #ifdef __LINUX__ @@ -832,7 +837,7 @@ namespace Sysreg_ if (!file) { cerr << "Error: failed to launch emulator" << endl; - cleanup(); + cleanup(conf_parser); return false; } char buffer[128]; @@ -840,7 +845,7 @@ namespace Sysreg_ { cerr << "Error: pid file w/o pid!!! " << endl; fclose(file); - cleanup(); + cleanup(conf_parser); return false; } m_Pid = atoi(buffer); @@ -856,10 +861,10 @@ namespace Sysreg_ OsSupport::setAlarm(m_MaxTime, GetCurrentProcessId()); #endif - bool ret = analyzeDebugData(); - cleanup(); + bool ret = analyzeDebugData(); + cleanup(conf_parser); - return ret; + return ret; } //--------------------------------------------------------------------------------------- void RosBootTest::dumpCheckpoints() diff --git a/reactos/tools/sysreg/rosboot_test.h b/reactos/tools/sysreg/rosboot_test.h index 6949f25465c..e2c0749cb7c 100644 --- a/reactos/tools/sysreg/rosboot_test.h +++ b/reactos/tools/sysreg/rosboot_test.h @@ -57,6 +57,7 @@ namespace Sysreg_ static string ROS_EMU_MEM; static string ROS_BOOT_CMD; static string XEN_CONFIG_FILE; + static string XEN_CONFIG_NAME; //--------------------------------------------------------------------------------------- /// @@ -109,10 +110,10 @@ namespace Sysreg_ bool readConfigurationValues(ConfigParser & conf_parser); bool configureQemu(); bool configureVmWare(); - bool configureXen(); + bool configureXen(ConfigParser &conf_parser); bool hasQemuNoRebootOption(); - void cleanup(); - bool xenGetCaps(); + void cleanup(ConfigParser &conf_parser); + bool xenGetCaps(); //--------------------------------------------------------------------------------------- /// /// dumpCheckpoints diff --git a/reactos/tools/sysreg/txtmode.cfg b/reactos/tools/sysreg/txtmode.cfg index 4a7c873d121..56dade648b6 100644 --- a/reactos/tools/sysreg/txtmode.cfg +++ b/reactos/tools/sysreg/txtmode.cfg @@ -2,7 +2,7 @@ ; ; This variable defines which emulator should be used to emulate ReactOS ; -;ROS_EMU_TYPE=[qemu|vmware] +;ROS_EMU_TYPE=[qemu|vmware|xen] ROS_EMU_TYPE=qemu @@ -98,3 +98,13 @@ ROS_DELAY_READ=4 ; ROS_BOOT_CMD=/usr/bin/qemu -serial stdio -m 64 -hda ~/reactos/qemu/ReactOS.hd -boot d -cdrom ~/reactos/qemu/bootcd.iso ; -no-reboot +; XEN_CONFIG_FILE +; +; Set this variable to path of xen config file when ROS_EMU_TYPE=xen is used +; XEN_CONFIG_FILE= + + +; XEN_CONFIG_NAME +; +; Set this variable to the name of xen station +; XEN_CONFIG_NAME=