[ros-diffs] [janderwald] 33496: - move hardcoded xen configuration name to config file

janderwald at svn.reactos.org janderwald at svn.reactos.org
Tue May 13 18:22:32 CEST 2008


Author: janderwald
Date: Tue May 13 11:22:31 2008
New Revision: 33496

URL: http://svn.reactos.org/svn/reactos?rev=33496&view=rev
Log:
- move hardcoded xen configuration name to config file

Modified:
    trunk/reactos/tools/sysreg/rosboot_test.cpp
    trunk/reactos/tools/sysreg/rosboot_test.h
    trunk/reactos/tools/sysreg/txtmode.cfg

Modified: trunk/reactos/tools/sysreg/rosboot_test.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.cpp?rev=33496&r1=33495&r2=33496&view=diff
==============================================================================
--- trunk/reactos/tools/sysreg/rosboot_test.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/sysreg/rosboot_test.cpp [iso-8859-1] Tue May 13 11:22:31 2008
@@ -66,6 +66,7 @@
 	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 @@
     }
 
 //---------------------------------------------------------------------------------------
-    bool RosBootTest::configureXen()
+    bool RosBootTest::configureXen(ConfigParser &conf_parser)
     {
         if (!xenGetCaps())
         {
@@ -674,8 +675,9 @@
             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 @@
         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 @@
         }
         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 @@
         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 @@
             if (!file)
             {
                 cerr << "Error: failed to launch emulator" << endl;
-                cleanup();
+                cleanup(conf_parser);
                 return false;
             }
             char buffer[128];
@@ -840,7 +845,7 @@
             {
                 cerr << "Error: pid file w/o pid!!! " << endl;
                 fclose(file);
-                cleanup();
+                cleanup(conf_parser);
                 return false;
             }
             m_Pid = atoi(buffer);
@@ -856,10 +861,10 @@
         OsSupport::setAlarm(m_MaxTime, GetCurrentProcessId());
 #endif
 
-        bool ret = analyzeDebugData();
-    cleanup();
-
-	return ret;
+    bool ret = analyzeDebugData();
+    cleanup(conf_parser);
+
+    return ret;
 }
 //---------------------------------------------------------------------------------------
     void RosBootTest::dumpCheckpoints()

Modified: trunk/reactos/tools/sysreg/rosboot_test.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/rosboot_test.h?rev=33496&r1=33495&r2=33496&view=diff
==============================================================================
--- trunk/reactos/tools/sysreg/rosboot_test.h [iso-8859-1] (original)
+++ trunk/reactos/tools/sysreg/rosboot_test.h [iso-8859-1] Tue May 13 11:22:31 2008
@@ -57,6 +57,7 @@
 		static string ROS_EMU_MEM;
 		static string ROS_BOOT_CMD;
 		static string XEN_CONFIG_FILE;
+		static string XEN_CONFIG_NAME;
 
 //---------------------------------------------------------------------------------------
 ///
@@ -109,10 +110,10 @@
     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

Modified: trunk/reactos/tools/sysreg/txtmode.cfg
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/txtmode.cfg?rev=33496&r1=33495&r2=33496&view=diff
==============================================================================
--- trunk/reactos/tools/sysreg/txtmode.cfg [iso-8859-1] (original)
+++ trunk/reactos/tools/sysreg/txtmode.cfg [iso-8859-1] Tue May 13 11:22:31 2008
@@ -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_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=



More information about the Ros-diffs mailing list