Beispiel #1
0
        IContainer RestoreContainerFromPath(string containerPath)
        {
            var id = Path.GetFileName(containerPath);

            var user      = ContainerUser.Restore(userManager, id);
            var directory = ContainerDirectory.Restore(fileSystem, containerPath);

            var jobObjectName = id;
            var jobObject     = new JobObject(jobObjectName);

            var environment   = new Dictionary <string, string>();
            var processHelper = new ProcessHelper();

            var containerDiskQuota = diskQuotaManager.CreateDiskQuotaControl(directory, user.SID);

            var dependencyHelper = new ContainerHostDependencyHelper();

            var bindMounts = new[]
            {
                new BindMount()
            };

            var container = new Container(
                id,
                id, // TODO: Recover the handle from container metadata
                user,
                directory,
                containerPropertiesService,
                tcpPortManager,
                jobObject,
                containerDiskQuota,
                processRunner,
                processRunner,
                processHelper,
                environment,
                dependencyHelper,
                bindMounts);

            return(container);
        }
Beispiel #2
0
        IContainer RestoreContainerFromPath(string containerPath)
        {
            var id = Path.GetFileName(containerPath);

            var user      = ContainerUser.Restore(userManager, id);
            var directory = ContainerDirectory.Restore(fileSystem, containerPath);

            var jobObjectName = id;
            var jobObject     = new JobObject(jobObjectName);

            var environment   = new Dictionary <string, string>();
            var processHelper = new ProcessHelper();

            var diskQuotaControl = new DiskQuotaControl();

            diskQuotaControl.UserNameResolution = UserNameResolutionConstants.dqResolveNone;
            diskQuotaControl.Initialize(directory.Volume, true);

            var dependencyHelper = new ContainerHostDependencyHelper();

            var container = new Container(
                id,
                id, // TODO: Recover the handle from container metadata
                user,
                directory,
                containerPropertiesService,
                tcpPortManager,
                jobObject,
                diskQuotaControl,
                processRunner,
                processRunner,
                processHelper,
                environment,
                dependencyHelper);

            return(container);
        }