[CRIU] [PATCH v3 18/33] proto: Add ns_hookup_entry description

Kirill Tkhai ktkhai at virtuozzo.com
Fri Feb 17 00:05:14 PST 2017



On 16.02.2017 22:59, Andrei Vagin wrote:
> On Thu, Feb 16, 2017 at 03:09:14PM +0300, Kirill Tkhai wrote:
>> New image format, generic for all namespaces.
>> Currently, it's for pid, net and user ns.
>>
>> v3: Move parent_id to pid and user ext
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>>  criu/image-desc.c            |    1 +
>>  criu/include/image-desc.h    |    1 +
>>  criu/include/magic.h         |    1 +
>>  criu/include/protobuf-desc.h |    1 +
>>  criu/protobuf-desc.c         |    1 +
>>  images/ns.proto              |   19 +++++++++++++++++++
>>  lib/py/images/images.py      |    1 +
>>  7 files changed, 25 insertions(+)
>>
>> diff --git a/criu/image-desc.c b/criu/image-desc.c
>> index fffaf5a01..336a50e6d 100644
>> --- a/criu/image-desc.c
>> +++ b/criu/image-desc.c
>> @@ -99,6 +99,7 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
>>  	FD_ENTRY(USERNS,	"userns-%d"),
>>  	FD_ENTRY(NETNF_CT,	"netns-ct-%d"),
>>  	FD_ENTRY(NETNF_EXP,	"netns-exp-%d"),
>> +	FD_ENTRY(NS_HOOKUP,	"ns-hookup"),
>>
>>  	[CR_FD_STATS] = {
>>  		.fmt	= "stats-%s",
>> diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
>> index 09d187d22..16d0183ff 100644
>> --- a/criu/include/image-desc.h
>> +++ b/criu/include/image-desc.h
>> @@ -107,6 +107,7 @@ enum {
>>  	CR_FD_EVENTPOLL_TFD,
>>
>>  	CR_FD_AUTOFS,
>> +	CR_FD_NS_HOOKUP,
>>
>>  	CR_FD_MAX
>>  };
>> diff --git a/criu/include/magic.h b/criu/include/magic.h
>> index deb54b1d0..34e766fa3 100644
>> --- a/criu/include/magic.h
>> +++ b/criu/include/magic.h
>> @@ -93,6 +93,7 @@
>>  #define SECCOMP_MAGIC		0x64413049 /* Kostomuksha */
>>  #define BINFMT_MISC_MAGIC	0x67343323 /* Apatity */
>>  #define AUTOFS_MAGIC		0x49353943 /* Sochi */
>> +#define NS_HOOKUP_MAGIC		0x55523343 /* Dnepropetrovsk */
>>
>>  #define IFADDR_MAGIC		RAW_IMAGE_MAGIC
>>  #define ROUTE_MAGIC		RAW_IMAGE_MAGIC
>> diff --git a/criu/include/protobuf-desc.h b/criu/include/protobuf-desc.h
>> index 6c76b494f..e45700b3d 100644
>> --- a/criu/include/protobuf-desc.h
>> +++ b/criu/include/protobuf-desc.h
>> @@ -70,6 +70,7 @@ enum {
>>  	PB_SK_QUEUES,
>>  	PB_IPCNS_MSG,
>>  	PB_IPCNS_MSG_ENT,
>> +	PB_NS_HOOKUP,
>>
>>  	PB_MAX,
>>  };
>> diff --git a/criu/protobuf-desc.c b/criu/protobuf-desc.c
>> index 05f3eb386..f3361ff5f 100644
>> --- a/criu/protobuf-desc.c
>> +++ b/criu/protobuf-desc.c
>> @@ -97,6 +97,7 @@ void cr_pb_init(void)
>>  	CR_PB_DESC(REMAP_FPATH,		RemapFilePath,	remap_file_path);
>>  	CR_PB_DESC(NETDEV,		NetDevice,	net_device);
>>  	CR_PB_MDESC_INIT(cr_pb_descs[PB_PAGEMAP_HEAD],	PagemapHead,	pagemap_head);
>> +	CR_PB_DESC(NS_HOOKUP,		NsHookup,	ns_hookup);
>>
>>  #include "protobuf-desc-gen.h"
>>  }
>> diff --git a/images/ns.proto b/images/ns.proto
>> index 7f7b09094..01cb032bf 100644
>> --- a/images/ns.proto
>> +++ b/images/ns.proto
>> @@ -16,4 +16,23 @@ message uid_gid_extent {
>>  message userns_entry {
>>  	repeated uid_gid_extent uid_map		= 1;
>>  	repeated uid_gid_extent gid_map 	= 2;
>> +	optional uint32		parent_id	= 3;
> 
> I've ignored my comment to the previous version:
> 
> """
> I think we need to move parent_id to pid_ext, because it will be used
> only for pid namespaces.
> 
> And I think userns_id has to be here, because it is required for all
> namespaces. In this case we will not need to create netns_entry2.
> 
> What do you think about this?
> """

I didn't ignore. Haven't you seen my reply on it?

"Hm, but user_ns has no link to a user_ns, so it's not generic."

>> +}
>> +
>> +message pidns_entry {
>> +	required uint32	userns_id		= 1;
>> +	optional uint32		parent_id	= 2;
>> +}
>> +
>> +message netns_entry2 {
>> +	required uint32	userns_id		= 1;
>> +}
>> +
>> +message ns_hookup_entry {
>> +	required uint32		id		= 1;
>> +	required uint32		ns_cflag	= 2;
>> +
>> +	optional userns_entry	user_ext	= 3;
>> +	optional pidns_entry	pid_ext		= 4;
>> +	optional netns_entry2	net_ext		= 5;
>>  }
>> diff --git a/lib/py/images/images.py b/lib/py/images/images.py
>> index c593a3b85..69f813c40 100644
>> --- a/lib/py/images/images.py
>> +++ b/lib/py/images/images.py
>> @@ -454,6 +454,7 @@ handlers = {
>>  	'USERNS'		: entry_handler(userns_entry),
>>  	'SECCOMP'		: entry_handler(seccomp_entry),
>>  	'AUTOFS'		: entry_handler(autofs_entry),
>> +	'NS_HOOKUP'	        : entry_handler(ns_hookup_entry),
>>  	}
>>
>>  def __rhandler(f):
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list