コード例 #1
0
ファイル: criu.py プロジェクト: NoMore201/criu
	def wait_pid(self, pid):
		req		= rpc.criu_req()
		req.type	= rpc.WAIT_PID
		req.pid	 = pid

		resp = self._send_req_and_recv_resp(req)

		if not resp.success:
			raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

		return resp.status
コード例 #2
0
ファイル: criu.py プロジェクト: tmp6154/criu
    def wait_pid(self, pid):
        req = rpc.criu_req()
        req.type = rpc.WAIT_PID
        req.pid = pid

        resp = self._send_req_and_recv_resp(req)

        if not resp.success:
            raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

        return resp.status
コード例 #3
0
ファイル: criu.py プロジェクト: ranjansv/VAS-CRIU
    def check(self):
        """
		Checks whether the kernel support is up-to-date.
		"""
        req = rpc.criu_req()
        req.type = rpc.CHECK

        resp = self._send_req_and_recv_resp(req)

        if not resp.success:
            raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)
コード例 #4
0
ファイル: criu.py プロジェクト: hqhq/criu
	def check(self):
		"""
		Checks whether the kernel support is up-to-date.
		"""
		req		= rpc.criu_req()
		req.type	= rpc.CHECK

		resp = self._send_req_and_recv_resp(req)

		if not resp.success:
			raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)
コード例 #5
0
ファイル: criu.py プロジェクト: NoMore201/criu
	def page_server_chld(self):
		req		= rpc.criu_req()
		req.type	= rpc.PAGE_SERVER_CHLD
		req.opts.MergeFrom(self.opts)
		req.keep_open   = True

		resp = self._send_req_and_recv_resp(req)

		if not resp.success:
			raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

		return resp.ps
コード例 #6
0
ファイル: criu.py プロジェクト: tmp6154/criu
    def page_server_chld(self):
        req = rpc.criu_req()
        req.type = rpc.PAGE_SERVER_CHLD
        req.opts.MergeFrom(self.opts)
        req.keep_open = True

        resp = self._send_req_and_recv_resp(req)

        if not resp.success:
            raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

        return resp.ps
コード例 #7
0
ファイル: config_file.py プロジェクト: mihalicyn/criu
def setup_criu_dump_request():
    # Create criu msg, set it's type to dump request
    # and set dump options. Checkout more options in protobuf/rpc.proto
    req = rpc.criu_req()
    req.type = rpc.DUMP
    req.opts.leave_running = True
    req.opts.log_level = 4
    req.opts.log_file = log_file
    req.opts.images_dir_fd = os.open(args['dir'], os.O_DIRECTORY)
    # Not necessary, just for testing
    req.opts.tcp_established = True
    req.opts.shell_job = True
    return req
コード例 #8
0
ファイル: config_file.py プロジェクト: xemul/criu
def setup_criu_dump_request():
	# Create criu msg, set it's type to dump request
	# and set dump options. Checkout more options in protobuf/rpc.proto
	req = rpc.criu_req()
	req.type = rpc.DUMP
	req.opts.leave_running = True
	req.opts.log_level = 4
	req.opts.log_file = log_file
	req.opts.images_dir_fd = os.open(args['dir'], os.O_DIRECTORY)
	# Not necessary, just for testing
	req.opts.tcp_established = True
	req.opts.shell_job = True
	return req
コード例 #9
0
ファイル: criu.py プロジェクト: ranjansv/VAS-CRIU
    def dump(self):
        """
		Checkpoint a process/tree identified by opts.pid.
		"""
        req = rpc.criu_req()
        req.type = rpc.DUMP
        req.opts.MergeFrom(self.opts)

        resp = self._send_req_and_recv_resp(req)

        if not resp.success:
            raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

        return resp.dump
コード例 #10
0
ファイル: criu.py プロジェクト: hqhq/criu
	def restore(self):
		"""
		Restore a process/tree.
		"""
		req		= rpc.criu_req()
		req.type	= rpc.RESTORE
		req.opts.MergeFrom(self.opts)

		resp = self._send_req_and_recv_resp(req)

		if not resp.success:
			raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

		return resp.restore
コード例 #11
0
ファイル: criu.py プロジェクト: hqhq/criu
	def dump(self):
		"""
		Checkpoint a process/tree identified by opts.pid.
		"""
		req 		= rpc.criu_req()
		req.type	= rpc.DUMP
		req.opts.MergeFrom(self.opts)

		resp = self._send_req_and_recv_resp(req)

		if not resp.success:
			raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

		return resp.dump
コード例 #12
0
ファイル: criu.py プロジェクト: ranjansv/VAS-CRIU
    def restore(self):
        """
		Restore a process/tree.
		"""
        req = rpc.criu_req()
        req.type = rpc.RESTORE
        req.opts.MergeFrom(self.opts)

        resp = self._send_req_and_recv_resp(req)

        if not resp.success:
            raise CRIUExceptionExternal(req.type, resp.type, resp.cr_errno)

        return resp.restore
コード例 #13
0
ファイル: p_haul_iters.py プロジェクト: avagin/p.haul
	def make_dump_req(self, typ):
		#
		# Prepare generic request for (pre)dump
		#

		req = cr_rpc.criu_req()
		req.type = typ
		req.opts.pid = self.pid
		req.opts.ps.address = self.target_host
		req.opts.ps.port = self.th.get_ps_port()
		req.opts.track_mem = True

		req.opts.images_dir_fd = self.img.image_dir_fd()
		req.opts.work_dir_fd = self.img.work_dir_fd()
		p_img = self.img.prev_image_dir()
		if p_img:
			req.opts.parent_img = p_img
		if not self.fs.persistent_inodes():
			req.opts.force_irmap = True
		req.opts.force_irmap = True

		return req
コード例 #14
0
ファイル: restore-loop.py プロジェクト: shubham95/CRIU_T
import rpc_pb2 as rpc
import argparse

parser = argparse.ArgumentParser(description="Test ability to restore a process from images using CRIU RPC")
parser.add_argument('socket', type = str, help = "CRIU service socket")
parser.add_argument('dir', type = str, help = "Directory where CRIU images could be found")

args = vars(parser.parse_args())

# Connect to service socket
s = socket.socket(socket.AF_UNIX, socket.SOCK_SEQPACKET)
s.connect(args['socket'])

# Create criu msg, set it's type to dump request
# and set dump options. Checkout more options in protobuf/rpc.proto
req			= rpc.criu_req()
req.type		= rpc.RESTORE
req.opts.images_dir_fd	= os.open(args['dir'], os.O_DIRECTORY)
# As the dumped process is running with setsid this should not
# be necessary. There seems to be a problem for this testcase
# in combination with alpine's setsid.
# The dump is now done with -j and the restore also.
req.opts.shell_job      = True

# Send request
s.send(req.SerializeToString())

# Recv response
resp		= rpc.criu_resp()
MAX_MSG_SIZE	= 1024
resp.ParseFromString(s.recv(MAX_MSG_SIZE))
コード例 #15
0
ファイル: errno.py プロジェクト: xiicloud/criu
 def get_base_req(self):
     req = rpc.criu_req()
     req.opts.log_level = 4
     req.opts.images_dir_fd = self.imgs_fd
     return req
コード例 #16
0
ファイル: p_haul_criu.py プロジェクト: avagin/p.haul
	def ack_notify(self):
		req = cr_rpc.criu_req()
		req.type = cr_rpc.NOTIFY
		req.notify_success = True
		self.cs.send(req.SerializeToString())
コード例 #17
0
ファイル: errno.py プロジェクト: maxwell92/criu
	def get_base_req(self):
		req			= rpc.criu_req()
		req.opts.log_level	= 4
		req.opts.images_dir_fd	= self.imgs_fd
		return req