Example #1
0
	def _img_open_and_strip(self, name, single = False, pid = None):
		"""
		Load criu image and strip it from magic and redundant list.
		"""
		path = self._imgs_dir + "/" + name
		if pid:
			path += "-"+str(pid)
		path += ".img"

		with open(path) as f:
			img = images.load(f)

		if single:
			return img["entries"][0]
		else:
			return img["entries"]
Example #2
0
def criu_get_stats(img, file_name):
	with open(os.path.join(img.work_dir(), file_name)) as f:
		stats_dict = images.load(f)
		stats = images.stats_pb2.stats_entry()
		images.pb2dict.dict2pb(stats_dict['entries'][0], stats)
		return stats