Exemplo n.º 1
0
 def CreateLVMSnapshot(self):
     '''
     Create LVM Snapshot
     '''
     machines = self.tester.get_component_machines()
     for machine in machines:
         if machine.distro.name is "vmware":
             continue
         machine.sys("lvcreate -l 100%origin -s -n " + self.args.name + " `blkid -L rootfs`", code=0)
Exemplo n.º 2
0
 def CreateLVMSnapshot(self):
     '''
     Create LVM Snapshot
     '''
     machines = self.tester.get_component_machines()
     for machine in machines:
         if machine.distro.name is "vmware":
             continue
         machine.sys("lvcreate -l 100%origin -s -n " + self.args.name +
                     " `blkid -L rootfs`",
                     code=0)
Exemplo n.º 3
0
    def RestoreLVMSnapshot(self):
        '''
        Restore LVM Snapshot
        '''

        machines = self.tester.get_component_machines()
        check_file = "/root/merge-executed"
        for machine in machines:
            if machine.distro.name is "vmware":
                continue
            logical_volume = "/dev/vg01/" + self.args.name
            machine.sys("e2label " + logical_volume + " rootfs")
            machine.sys("touch " + check_file)
            machine.sys("lvconvert --merge " + logical_volume, code=0)
            try:
                machine.sys("reboot -f", timeout=2)
            except CommandTimeoutException:
                pass

        self.tester.sleep(30)

        for machine in machines:
            self.tester.ping(machine.hostname, poll_count=120)

        for machine in machines:
            def ssh_refresh():
                try:
                    machine.refresh_ssh()
                    return True
                except:
                    return False
            self.tester.wait_for_result(ssh_refresh, True, timeout=120)
            machine.sys('ls ' + check_file, code=2)
            def lv_gone():
                try:
                    machine.sys("lvdisplay " + logical_volume, code=5)
                    return True
                except:
                    return False
            self.tester.wait_for_result(lv_gone, True, timeout=240)
            machine.sys("lvcreate -l 100%origin -s -n " + logical_volume + " `blkid -L rootfs`", code=0)
Exemplo n.º 4
0
 def lv_gone():
     try:
         machine.sys("lvdisplay " + logical_volume, code=5)
         return True
     except:
         return False
Exemplo n.º 5
0
    def RestoreLVMSnapshot(self):
        '''
        Restore LVM Snapshot
        '''

        machines = self.tester.get_component_machines()
        check_file = "/root/merge-executed"
        for machine in machines:
            if machine.distro.name is "vmware":
                continue
            logical_volume = "/dev/vg01/" + self.args.name
            machine.sys("e2label " + logical_volume + " rootfs")
            machine.sys("touch " + check_file)
            machine.sys("lvconvert --merge " + logical_volume, code=0)
            try:
                machine.sys("reboot -f", timeout=2)
            except CommandTimeoutException:
                pass

        self.tester.sleep(30)

        for machine in machines:
            self.tester.ping(machine.hostname, poll_count=120)

        for machine in machines:

            def ssh_refresh():
                try:
                    machine.refresh_ssh()
                    return True
                except:
                    return False

            self.tester.wait_for_result(ssh_refresh, True, timeout=120)
            machine.sys('ls ' + check_file, code=2)

            def lv_gone():
                try:
                    machine.sys("lvdisplay " + logical_volume, code=5)
                    return True
                except:
                    return False

            self.tester.wait_for_result(lv_gone, True, timeout=240)
            machine.sys("lvcreate -l 100%origin -s -n " + logical_volume +
                        " `blkid -L rootfs`",
                        code=0)
Exemplo n.º 6
0
 def lv_gone():
     try:
         machine.sys("lvdisplay " + logical_volume, code=5)
         return True
     except:
         return False