Esempio n. 1
0
	def on_buttonSaveObj_clicked(self, object, data=None):
		connStor = ConnStorage(self.serInfo)
		dest_path = self.dialogFile.get_current_folder()
		if self.storInfo['objname'] is None:
		# 不提供针对整个容器的下载
#            connStor.download_container(self.storInfo['conname'], dest_path)
			pass
		else:
			connStor.download_object(self.storInfo['conname'], self.storInfo['objname'], dest_path)
		self.dialogFile.hide()
Esempio n. 2
0
 def on_buttonSaveObj_clicked(self, object, data=None):
     connStor = ConnStorage(self.serInfo)
     dest_path = self.dialogFile.get_current_folder()
     if self.storInfo['objname'] is None:
         # 不提供针对整个容器的下载
         #            connStor.download_container(self.storInfo['conname'], dest_path)
         pass
     else:
         connStor.download_object(self.storInfo['conname'],
                                  self.storInfo['objname'], dest_path)
     self.dialogFile.hide()
Esempio n. 3
0
 def on_buttonRecover1_clicked(self, object, data=None):
     conndb = ConnDatabase(self.serInfo)
     connstor = ConnStorage(self.serInfo)
     if self.storInfo['objname'][0] is not None:
         if 'glob' in self.storInfo['objname'][0]:
             # 从全局备份恢复
             connstor.download_object(self.storInfo['conname'][0],
                                      self.storInfo['objname'][0],
                                      conndb.conn.bkdir)
             conndb.conn.recover_glob(conndb.conn.bkdir + "/" +
                                      self.storInfo['objname'][0])
         elif 'incr' in self.storInfo['objname'][0]:
             # 从增量备份恢复
             timestop = float(connstor.head_object(self.storInfo['conname'][0], \
                self.storInfo['objname'][0]).get('x-timestamp'))
             dict_tmp = {}
             objlist = connstor.getContainerList(
                 self.storInfo['conname'][0])
             for objname in objlist:
                 if 'glob' in objname:
                     # 首先查找时间最近的一次全局备份
                     timestamp = float(connstor.head_object(self.storInfo['conname'][0], \
                        objname).get('x-timestamp'))
                     dict_tmp[timestamp] = objname
             glob_bakfile = max(dict_tmp.itervalues(), key=lambda k: k)
             glob_timestamp = dict_tmp.keys()[dict_tmp.values().index(
                 glob_bakfile)]
             dict_tmp.clear()
             for objname in objlist:
                 if 'incr' in objname:
                     # 然后查找该全局备份后所有的增量备份,到选中的增量备份为止
                     timestamp = float(connstor.head_object(self.storInfo['conname'][0], \
                        objname).get('x-timestamp'))
                     if timestamp >= glob_timestamp and timestamp <= timestop:
                         dict_tmp[timestamp] = objname
             # timestamp_list = sorted(dict_tmp.iterkeys(), key=lambda k:k[0])
             # incr_bakfile_list = []
             # for item in timestamp_list:
             # incr_bakfile_list.append(timestamp_list[item])
             incr_bakfile_list = sorted(dict_tmp.itervaluse(),
                                        key=lambda k: k[0])
             conndb.conn.recover_glob(glob_bakfile)
             conndb.conn.recover_incr(incr_bakfile_list)
         else:
             print 'Unkown backup file type!'
Esempio n. 4
0
	def on_buttonRecover1_clicked(self, object, data=None):
		conndb = ConnDatabase(self.serInfo)
		connstor = ConnStorage(self.serInfo)
		if self.storInfo['objname'][0] is not None:
			if 'glob' in self.storInfo['objname'][0]:
			# 从全局备份恢复
				connstor.download_object(self.storInfo['conname'][0], 
										self.storInfo['objname'][0], 
										conndb.conn.bkdir)
				conndb.conn.recover_glob(conndb.conn.bkdir + "/" + self.storInfo['objname'][0])
			elif 'incr' in self.storInfo['objname'][0]:
			# 从增量备份恢复
				timestop = float(connstor.head_object(self.storInfo['conname'][0], \
							self.storInfo['objname'][0]).get('x-timestamp'))
				dict_tmp = {}
				objlist = connstor.getContainerList(self.storInfo['conname'][0])
				for objname in objlist:
					if 'glob' in objname:
					# 首先查找时间最近的一次全局备份
						timestamp = float(connstor.head_object(self.storInfo['conname'][0], \
									objname).get('x-timestamp'))
						dict_tmp[timestamp] = objname
				glob_bakfile = max(dict_tmp.itervalues(), key = lambda k:k)
				glob_timestamp = dict_tmp.keys()[dict_tmp.values().index(glob_bakfile)]
				dict_tmp.clear()
				for objname in objlist:
					if 'incr' in objname:
					# 然后查找该全局备份后所有的增量备份,到选中的增量备份为止
						timestamp = float(connstor.head_object(self.storInfo['conname'][0], \
									objname).get('x-timestamp'))
						if timestamp >= glob_timestamp and timestamp <= timestop:
							dict_tmp[timestamp] = objname
				# timestamp_list = sorted(dict_tmp.iterkeys(), key=lambda k:k[0])
				# incr_bakfile_list = []
				# for item in timestamp_list:
				# incr_bakfile_list.append(timestamp_list[item])
				incr_bakfile_list = sorted(dict_tmp.itervaluse(), key=lambda k:k[0])
				conndb.conn.recover_glob(glob_bakfile)
				conndb.conn.recover_incr(incr_bakfile_list)
			else:
				print 'Unkown backup file type!'