コード例 #1
0
ファイル: Container.cs プロジェクト: florindragos/IronFrame
        public Container(
            string id,
            string handle,
            IContainerUser user,
            IContainerDirectory directory,
            IContainerPropertyService propertyService,
            ILocalTcpPortManager tcpPortManager,
            JobObject jobObject,
            DiskQuotaControl diskQuotaControl,
            IProcessRunner processRunner,
            IProcessRunner constrainedProcessRunner,
            ProcessHelper processHelper,
            Dictionary <string, string> defaultEnvironment,
            ContainerHostDependencyHelper dependencyHelper
            )
        {
            this.id                       = id;
            this.handle                   = handle;
            this.user                     = user;
            this.directory                = directory;
            this.propertyService          = propertyService;
            this.tcpPortManager           = tcpPortManager;
            this.jobObject                = jobObject;
            this.diskQuotaControl         = diskQuotaControl;
            this.processRunner            = processRunner;
            this.constrainedProcessRunner = constrainedProcessRunner;
            this.processHelper            = processHelper;
            this.dependencyHelper         = dependencyHelper;
            this.defaultEnvironment       = defaultEnvironment ?? new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            this.currentState = ContainerState.Active;
        }
コード例 #2
0
        public Container(
            string id,
            string handle,
            IContainerUser user,
            IContainerDirectory directory,
            IContainerPropertyService propertyService,
            ILocalTcpPortManager tcpPortManager,
            JobObject jobObject,
            DiskQuotaControl diskQuotaControl,
            IProcessRunner processRunner,
            IProcessRunner constrainedProcessRunner,
            ProcessHelper processHelper,
            Dictionary<string, string> defaultEnvironment,
            ContainerHostDependencyHelper dependencyHelper
            )
        {
            this.id = id;
            this.handle = handle;
            this.user = user;
            this.directory = directory;
            this.propertyService = propertyService;
            this.tcpPortManager = tcpPortManager;
            this.jobObject = jobObject;
            this.diskQuotaControl = diskQuotaControl;
            this.processRunner = processRunner;
            this.constrainedProcessRunner = constrainedProcessRunner;
            this.processHelper = processHelper;
            this.dependencyHelper = dependencyHelper;
            this.defaultEnvironment = defaultEnvironment ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            this.currentState = ContainerState.Active;
        }
コード例 #3
0
        public DiskQuotaControl CreateDiskQuotaControl(IContainerDirectory dir)
        {
            var diskQuotaControl = new DiskQuotaControl();

            diskQuotaControl.UserNameResolution = UserNameResolutionConstants.dqResolveNone;
            diskQuotaControl.Initialize(dir.Volume, true);
            return(diskQuotaControl);
        }
コード例 #4
0
        public IContainerDiskQuota CreateDiskQuotaControl(IContainerDirectory dir, string sid)
        {
            var diskQuotaControl = new DiskQuotaControl();

            diskQuotaControl.UserNameResolution = UserNameResolutionConstants.dqResolveNone;
            diskQuotaControl.Initialize(dir.Volume, true);
            return(new ContainerDiskQuota(diskQuotaControl, sid));
        }
コード例 #5
0
            public void DeletesDiskQuota()
            {
                var dskuser = Substitute.For <DIDiskQuotaUser>();

                DiskQuotaControl.FindUser(User.SID).Returns(dskuser);

                Container.Destroy();

                DiskQuotaControl.Received(1).DeleteUser(dskuser);
            }
コード例 #6
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);
        }
コード例 #7
0
 public ContainerDiskQuota(DiskQuotaControl diskQuotaControl, string sid)
 {
     this._diskQuotaControl = diskQuotaControl;
     this._sid    = sid;
     this._offset = Usage();
 }
コード例 #8
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;
        }
コード例 #9
0
 public ContainerDiskQuotaTests()
 {
     diskQuotaControl = Substitute.For <DiskQuotaControl>();
     quotaUser        = Substitute.For <DIDiskQuotaUser>();
     diskQuotaControl.FindUser(sid).Returns(quotaUser);
 }