Ejemplo n.º 1
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!'
Ejemplo n.º 2
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!'
Ejemplo n.º 3
0
    def connStorage(self, widgt, event):
        '''
		连接云存储,并根据返回数据显示到云存储信息列表。
		'''
        print "display the storage file"
        self.popMemuServer.hide()
        connStor = ConnStorage(self.serInfo)

        if len(self.storTable.get_columns()) == 0:
            columnTree = gtk.TreeViewColumn()
            cell = gtk.CellRendererText()
            columnTree.pack_start(cell, True)
            columnTree.add_attribute(cell, "text", 0)
            self.storTable.insert_column(columnTree, 0)
        else:
            print self.storTable.get_columns()

        if self.storTable.get_model() == None:
            treeStore = gtk.TreeStore(str)
        else:
            treeStore = self.storTable.get_model()
            treeStore.clear()

        conList = connStor.getContainerList()
        for con in conList:
            #            conName = []
            #            conName.append(con)
            item = treeStore.append(None, [con])  # 这里的conName必须为列表
            objlist = connStor.getObjectList(con)
            for obj in objlist:
                treeStore.append(item, [obj])

        self.storTable.set_model(treeStore)
        self.notebookR.set_current_page(1)
        self.statusbar.get_context_id('storConnInfo')
        self.statusbar.push(0, "显示云存储内容")
Ejemplo n.º 4
0
	def connStorage(self, widgt, event):
		'''
		连接云存储,并根据返回数据显示到云存储信息列表。
		'''
		print "display the storage file"
		self.popMemuServer.hide()
		connStor = ConnStorage(self.serInfo)
		
		if len(self.storTable.get_columns()) == 0:
			columnTree = gtk.TreeViewColumn()       
			cell = gtk.CellRendererText()
			columnTree.pack_start(cell, True)
			columnTree.add_attribute(cell, "text", 0)
			self.storTable.insert_column(columnTree, 0)
		else:
			print self.storTable.get_columns()
				
		if self.storTable.get_model() == None:
			treeStore = gtk.TreeStore(str)
		else:
			treeStore = self.storTable.get_model()
			treeStore.clear()
		
		conList = connStor.getContainerList()
		for con in conList:
#            conName = []
#            conName.append(con)
			item = treeStore.append(None, [con])  # 这里的conName必须为列表
			objlist = connStor.getObjectList(con)
			for obj in objlist:
				treeStore.append(item, [obj])

		self.storTable.set_model(treeStore)
		self.notebookR.set_current_page(1)
		self.statusbar.get_context_id('storConnInfo')
		self.statusbar.push(0, "显示云存储内容")