Exemple #1
0
 def dump_trash (self, expire_days):
     if not os.path.exists (self.dev):
         raise Exception ("%s not exist" % (self.dev))
     if os.path.exists (self.trash_dev):
         vps_common.lv_delete (self.trash_dev)
     vps_common.lv_rename (self.dev, self.trash_dev)
     self._set_expire_days (expire_days)
Exemple #2
0
 def dump_trash(self, expire_days):
     if not os.path.exists(self.dev):
         raise Exception("%s not exist" % (self.dev))
     if os.path.exists(self.trash_dev):
         vps_common.lv_delete(self.trash_dev)
     vps_common.lv_rename(self.dev, self.trash_dev)
     self._set_expire_days(expire_days)
Exemple #3
0
 def dump_trash(self):
     if not os.path.exists(self.dev):
         raise Exception("%s not exist" % (self.dev))
     self.destroy_limit()
     if os.path.exists(self.trash_dev):
         vps_common.lv_delete(self.trash_dev)
     vps_common.lv_rename(self.dev, self.trash_dev)
     self.trash_date = datetime.date.today()
Exemple #4
0
 def dump_trash(self):
     if not os.path.exists(self.dev):
         raise Exception("%s not exist" % (self.dev))
     self.destroy_limit()
     if os.path.exists(self.trash_dev):
         vps_common.lv_delete(self.trash_dev)
     vps_common.lv_rename(self.dev, self.trash_dev)
     self.trash_date = datetime.date.today()
Exemple #5
0
    def snapshot_sync(self, dev, speed=None, log_file=None):
        snapshot_name = "sync_%s" % (os.path.basename(dev))
        snapshot_dev = "/dev/%s/%s" % (conf.VPS_LVM_VGNAME, snapshot_name)

        if not os.path.exists(snapshot_dev):
            vps_common.lv_snapshot(dev, snapshot_name, conf.VPS_LVM_VGNAME)
        self.logger.info("made snapshot %s for %s" % (snapshot_dev, dev))
        try:
            self.sync_partition(
                snapshot_dev, partition_name=os.path.basename(dev), speed=speed,
                log_file=log_file)
        finally:
            vps_common.lv_delete(snapshot_dev)
            self.logger.info("delete snapshot %s" % (snapshot_dev))
Exemple #6
0
    def snapshot_sync(self, dev, speed=None, log_file=None):
        snapshot_name = "sync_%s" % (os.path.basename(dev))
        snapshot_dev = "/dev/%s/%s" % (conf.VPS_LVM_VGNAME, snapshot_name)

        if not os.path.exists(snapshot_dev):
            vps_common.lv_snapshot(dev, snapshot_name, conf.VPS_LVM_VGNAME)
        self.logger.info("made snapshot %s for %s" % (snapshot_dev, dev))
        try:
            self.sync_partition(snapshot_dev,
                                partition_name=os.path.basename(dev),
                                speed=speed,
                                log_file=log_file)
        finally:
            vps_common.lv_delete(snapshot_dev)
            self.logger.info("delete snapshot %s" % (snapshot_dev))
Exemple #7
0
 def delete(self):
     if os.path.exists(self.dev):
         for i in xrange(5):
             try:
                 self.destroy_limit()
                 vps_common.lv_delete(self.dev)
                 break
             except CommandException, e:
                 print e
                 # there maybe bug in udev under ubuntu12.04 that prevent LV
                 # to be removed
                 if e.msg.find('deactivate open') >= 0 or e.msg.find('in used'):
                     time.sleep(1)
                     print "try again"
                     continue
                 raise e
Exemple #8
0
 def delete(self):
     if os.path.exists(self.dev):
         for i in xrange(5):
             try:
                 self.destroy_limit()
                 vps_common.lv_delete(self.dev)
                 break
             except CommandException, e:
                 print e
                 # there maybe bug in udev under ubuntu12.04 that prevent LV
                 # to be removed
                 if e.msg.find('deactivate open') >= 0 or e.msg.find(
                         'in used'):
                     time.sleep(1)
                     print "try again"
                     continue
                 raise e
Exemple #9
0
 def delete (self):
     #TODO check whether in use !!!!!!!!!
     if os.path.exists (self.dev):
         vps_common.lv_delete (self.dev)
     if os.path.exists (self.trash_dev):
         vps_common.lv_delete (self.trash_dev)
Exemple #10
0
 def delete_trash(self):
     if os.path.exists(self.trash_dev):
         vps_common.lv_delete(self.trash_dev)
Exemple #11
0
 def delete(self):
     #TODO check whether in use !!!!!!!!!
     if os.path.exists(self.dev):
         vps_common.lv_delete(self.dev)
     if os.path.exists(self.trash_dev):
         vps_common.lv_delete(self.trash_dev)
Exemple #12
0
 def delete_trash(self):
     if os.path.exists(self.trash_dev):
         vps_common.lv_delete(self.trash_dev)