Ejemplo n.º 1
0
        public TaskContext(PrepareVmInformation bootInfo, ILogger logger, IServiceResolver serviceResolver)
        {
            Invariant.ArgumentNotNull((object)bootInfo, "bootInfo");
            this.ServiceResolver  = serviceResolver;
            this._JobInfo         = new JobInfo();
            this._JobInfo.Options = new JobOptions();
            this._JobInfo.Options.OculiOptions   = new OculiOptions();
            this._JobInfo.Options.ClusterOptions = new ClusterOptions();
            this._JobInfo.JobPersistedState      = new JobPersistedState();
            this._JobInfo.JobPersistedState.OculiPersistedState = new OculiPersistedState();
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo            = new MachineInfo();
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ServerInfo = new ServerInfo();
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ServerInfo.OperatingSystem = new OperatingSystemInfo();
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ProductInfo = new ProductInfo();
            this._JobInfo.JobPersistedState.OculiPersistedState.State = new JobState()
            {
                HasError  = false,
                HighLevel = "CREATED",
                IsInSync  = false,
                LowLevel  = "Created"
            };
            this._Logger             = (ILogger) new LoggerWrapper(logger);
            this._JobInfoWrapper     = (ITaskInfoWrapper) new Oculi.Jobs.Context.TaskInfoWrapper(this._JobInfo, (IOculiCredentialHelper)null);
            this._StateContext       = new JobStateContext(this);
            this.Factory             = (ICommandFactory) new CommandFactory(this);
            this.Invoker             = (ICommandInvoker) new CommandInvoker(this.Factory);
            this.LocalDiskManagement = new LocalDiskManagement(this);
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ServerInfo.OperatingSystem.Version      = bootInfo.OSVersion;
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ServerInfo.OperatingSystem.Architecture = bootInfo.CPUArchitecture;
            this._JobInfo.Options.OculiOptions.Hypervisor = bootInfo.Hypervisor;
            this._JobInfo.JobType = "Oculi";
            this._JobInfo.Options.ClusterOptions.TargetIsCluster          = false;
            this._JobInfo.Options.OculiOptions.IsSourceHostCluster        = false;
            this._JobInfo.JobPersistedState.OculiPersistedState.Nics      = ((IEnumerable <VirtualNetworkInterfaceInfo>)bootInfo.NetworkInterfaceInfo).Select <VirtualNetworkInterfaceInfo, OculiInternalVirtualNetworkInterfaceInfo>((Func <VirtualNetworkInterfaceInfo, OculiInternalVirtualNetworkInterfaceInfo>)(nic => OculiInternalVirtualNetworkInterfaceInfo.Create(nic))).ToArray <OculiInternalVirtualNetworkInterfaceInfo>();
            this._JobInfo.JobPersistedState.OculiPersistedState.VmVersion = bootInfo.VmVersion;
            OculiPersistedState vraPersistedState = this._JobInfo.JobPersistedState.OculiPersistedState;

            OculiVolumePersistedState[] volumePersistedStateArray = new OculiVolumePersistedState[1];
            int index = 0;
            OculiVolumePersistedState volumePersistedState = new OculiVolumePersistedState();

            volumePersistedState.MountPoint = bootInfo.SystemVolumeMountPath;
            int num = 1;

            volumePersistedState.IsSystemDrive = num != 0;
            string str = bootInfo.WindowsDir.Substring(0, 1);

            volumePersistedState.Name              = str;
            volumePersistedStateArray[index]       = volumePersistedState;
            vraPersistedState.VolumePersistedState = volumePersistedStateArray;
            this.LocalDiskManagement.FillVolumeInfoFromMountPath(this.JobInfoWrapper.VolumePersistedState[0]);
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ServerInfo.SystemRoot      = bootInfo.WindowsDir;
            this._JobInfo.JobPersistedState.OculiPersistedState.SourceMachineInfo.ServerInfo.SystemVolume    = bootInfo.WindowsDir.Substring(0, 2);
            this._JobInfo.JobPersistedState.OculiPersistedState.OculiVirtualizationConnectionInfo            = new VirtualizationConnectionInfo();
            this._JobInfo.JobPersistedState.OculiPersistedState.OculiVirtualizationConnectionInfo.RepsetName = "";
            this._JobInfo.Options.OculiOptions.VMInfo = new VMInfo();
            this._JobInfoWrapper.TargetOSVersion      = OculiService.TargetHostOperatingSystemInfo.Version;
        }
Ejemplo n.º 2
0
 public TaskContext(PrepareVmInformation bootInfo, ILogger logger)
 {
 }