put .timestamp file inside /var/lib/lxc//
[tests.git] / system / TestPlc.py
index 86f31f4..cbdb2d2 100644 (file)
@@ -179,7 +179,7 @@ class TestPlc:
     #command gets run in the plc's vm
     def host_to_guest(self,command):
         if self.options.plcs_use_lxc:
-            return "ssh -o StrictHostKeyChecking=no %s %s"%(self.hostname(),command)
+            return "ssh -o StrictHostKeyChecking=no %s %s"%(self.vserverip,command)
         else:
             return "vserver %s exec %s"%(self.vservername,command)
     
@@ -191,14 +191,14 @@ class TestPlc:
 
     def vm_timestamp_path (self):
         if self.options.plcs_use_lxc:
-            return "/var/lib/lxc/%s.timestamp"%(self.vservername)
+            return "/var/lib/lxc/%s/%s.timestamp"%(self.vservername,self.vservername)
         else:
             return "/vservers/%s.timestamp"%(self.vservername)
 
     #start/stop the vserver
     def start_guest_in_host(self):
         if self.options.plcs_use_lxc:
-            return "lxc-start --name=%s"%(self.vservername)
+            return "lxc-start --daemon --name=%s"%(self.vservername)
         else:
             return "vserver %s start"%(self.vservername)
     
@@ -367,8 +367,13 @@ class TestPlc:
         domain=socket.gethostname().split('.',1)[1]
         fqdn="%s.%s"%(self.plc_spec['host_box'],domain)
         print "export BUILD=%s"%self.options.buildname
-        print "export PLCHOST=%s"%fqdn
-        print "export GUEST=%s"%self.plc_spec['vservername']
+        if self.options.plcs_use_lxc:
+            print "export PLCHOSTLXC=%s"%fqdn
+        else:
+            print "export PLCHOSTVS=%s"%fqdn
+        print "export GUESTNAME=%s"%self.plc_spec['vservername']
+        vplcname=self.plc_spec['vservername'].split('-')[-1]
+        print "export GUESTHOSTNAME=%s.%s"%(vplcname,domain)
         # find hostname of first node
         (hostname,qemubox) = self.all_node_infos()[0]
         print "export KVMHOST=%s.%s"%(qemubox,domain)
@@ -487,7 +492,7 @@ class TestPlc:
         # a first approx. is to store the timestamp close to the VM root like vs does
         stamp_path=self.vm_timestamp_path ()
         stamp_dir = os.path.dirname (stamp_path)
-        utils.system(self.test_ssh.actual_command("mkdir -p %s"%stamp_dir)
+        utils.system(self.test_ssh.actual_command("mkdir -p %s"%stamp_dir))
         return utils.system(self.test_ssh.actual_command("echo %d > %s"%(now,stamp_path)))==0
         
     # this is called inconditionnally at the beginning of the test sequence 
@@ -497,6 +502,7 @@ class TestPlc:
         stamp_path=self.vm_timestamp_path()
         self.run_in_host("rm -f %s"%stamp_path)
         if self.options.plcs_use_lxc:
+            self.run_in_host("lxc-stop --name %s"%self.vservername)
             self.run_in_host("lxc-destroy --name %s"%self.vservername)
             return True
         else: