mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
crit: Files now sit in another image
When merging files into one image we've forgotten about crit x feature that scans image files by names. https://github.com/xemul/criu/issues/381 The patch was made for master (as in criu-dev there was problem with pstree_item.pid parsing), but should apply to dev smoothly. Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
b6d397e460
commit
babc8b3d74
1 changed files with 28 additions and 4 deletions
32
crit/crit
32
crit/crit
|
|
@ -89,8 +89,32 @@ def explore_ps(opts):
|
|||
print "%7s%7s%7s %s" % ('PID', 'PGID', 'SID', 'COMM')
|
||||
show_ps(psr, opts)
|
||||
|
||||
files_img = None
|
||||
|
||||
def ftype_find_in_files(opts, ft, fid):
|
||||
global files_img
|
||||
|
||||
if files_img is None:
|
||||
try:
|
||||
files_img = pycriu.images.load(dinf(opts, "files.img"))['entries']
|
||||
except:
|
||||
files_img = []
|
||||
|
||||
if len(files_img) == 0:
|
||||
return None
|
||||
|
||||
for f in files_img:
|
||||
if f['id'] == fid:
|
||||
return f
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def ftype_find_in_image(opts, ft, fid, img):
|
||||
f = ftype_find_in_files(opts, ft, fid)
|
||||
if f:
|
||||
return f[ft['field']]
|
||||
|
||||
if ft['img'] == None:
|
||||
ft['img'] = pycriu.images.load(dinf(opts, img))['entries']
|
||||
for f in ft['img']:
|
||||
|
|
@ -111,13 +135,13 @@ def ftype_unix(opts, ft, fid):
|
|||
if not ux:
|
||||
return 'unix[?]'
|
||||
|
||||
n = ux['name'] and ' %s' % ux['name'].decode('base64') or ''
|
||||
n = ux['name'] and ' %s' % ux['name'] or ''
|
||||
return 'unix[%d (%d)%s]' % (ux['ino'], ux['peer'], n)
|
||||
|
||||
file_types = {
|
||||
'REG': {'get': ftype_reg, 'img': None},
|
||||
'PIPE': {'get': ftype_pipe, 'img': None},
|
||||
'UNIXSK': {'get': ftype_unix, 'img': None},
|
||||
'REG': {'get': ftype_reg, 'img': None, 'field': 'reg'},
|
||||
'PIPE': {'get': ftype_pipe, 'img': None, 'field': 'pipe'},
|
||||
'UNIXSK': {'get': ftype_unix, 'img': None, 'field': 'usk'},
|
||||
}
|
||||
|
||||
def ftype_gen(opts, ft, fid):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue