Exemple #1
0
 def check_status_of_instance():
     status, err = process("sudo vzctl status %s | awk '{print $5}'"
                           % str(instance_info.local_id))
     if string_in_list(status, ["running"]):
         self.assertEqual("running", status.strip())
         return True
     else:
         return False
Exemple #2
0
 def check_process_alive_via_local_ovz(self):
     init_re = ("[\w\W\|\-\s\d,]*nova-guest "
                "--flagfile=/etc/nova/nova.conf nova[\W\w\s]*")
     init_proc = re.compile(init_re)
     guest_re = ("[\w\W\|\-\s]*/usr/bin/nova-guest "
                 "--flagfile=/etc/nova/nova.conf[\W\w\s]*")
     guest_proc = re.compile(guest_re)
     apt = re.compile("[\w\W\|\-\s]*apt-get[\w\W\|\-\s]*")
     while True:
         guest_process, err = process("pstree -ap %s | grep nova-guest"
                                      % instance_info.pid)
         if not string_in_list(guest_process, ["nova-guest"]):
             time.sleep(10)
         else:
             if apt.match(guest_process):
                 time.sleep(10)
             else:
                 init = init_proc.match(guest_process)
                 guest = guest_proc.match(guest_process)
                 if init and guest:
                     assert_true(True, init.group())
                 else:
                     assert_false(False, guest_process)
                 break