public NewVMApplianceWizard(Pool pool) : base(pool.Connection) { InitializeComponent(); xenTabPageRBAC = new RBACWarningPage(); xenTabPageVMs = new NewVMGroupVMsPage<VM_appliance>(); xenTabPageName = new NewVMApplianceNamePage(); xenTabPageFinish = new NewVMApplianceFinishPage(); xenTabPageVMOrderAndDelays = new NewVMApplianceVMOrderAndDelaysPage(); Pool = pool; xenTabPageVMs.Pool = pool; #region RBAC Warning Page Checks if (Pool.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(Pool.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //do nothing } else { RBACWarningPage.WizardPermissionCheck check = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_APPLIANCE); check.AddApiCheck("VM_appliance.async_create"); check.Blocking = true; xenTabPageRBAC.AddPermissionChecks(xenConnection, check); AddPage(xenTabPageRBAC, 0); } #endregion xenTabPageVMOrderAndDelays.Pool = pool; AddPages(xenTabPageName, xenTabPageVMs, xenTabPageVMOrderAndDelays, xenTabPageFinish); }
public NewPolicyWizard(Pool pool) : base(pool.Connection) { InitializeComponent(); xenTabPagePolicy = new NewPolicyPolicyNamePage(); xenTabPageSnapshotType = new NewPolicySnapshotTypePage(); xenTabPageSnapshotFrequency = new NewPolicySnapshotFrequencyPage(); xenTabPageVMsPage = new NewVMGroupVMsPage<VMPP>(); xenTabPageArchive = new NewPolicyArchivePage(); xenTabPageEmail = new NewPolicyEmailPage(); xenTabPageFinish = new NewPolicyFinishPage(); xenTabPageRBAC = new RBACWarningPage(); Pool = pool; xenTabPageVMsPage.Pool = pool; xenTabPageEmail.Pool = pool; xenTabPageArchive.Pool = pool; xenTabPageSnapshotFrequency.Pool = pool; #region RBAC Warning Page Checks if (Pool.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(Pool.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //do nothing } else { RBACWarningPage.WizardPermissionCheck check = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VMPP); check.AddApiCheck("VMPP.async_create"); check.Blocking = true; xenTabPageRBAC.AddPermissionChecks(xenConnection, check); AddPage(xenTabPageRBAC, 0); } #endregion AddPages(xenTabPagePolicy, xenTabPageVMsPage, xenTabPageSnapshotType, xenTabPageSnapshotFrequency, xenTabPageArchive, xenTabPageEmail, xenTabPageFinish); }
public NewVMWizard(IXenConnection connection, VM template, Host affinity) : base(connection) { InitializeComponent(); page_1_Template = new Page_Template(); page_1b_BiosLocking = new Page_CopyBiosStrings(); page_2_Name = new Page_Name(); page_3_InstallationMedia = new Page_InstallationMedia(); page_4_HomeServer = new Page_HomeServer(); page_5_CpuMem = new Page_CpuMem(); page_6_Storage = new Page_Storage(); page_7_Networking = new Page_Networking(); page_8_Finish = new Page_Finish(); page_RbacWarning = new RBACWarningPage(); page_6b_LunPerVdi = new LunPerVdiNewVMMappingPage { Connection = xenConnection }; pageVgpu = new GpuEditPage(); page_CloudConfigParameters = new Page_CloudConfigParameters(); #region RBAC Warning Page Checks if (connection.Session.IsLocalSuperuser || Helpers.GetMaster(connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //page_RbacWarning.DisableStep = true; } else { // Check to see if they can even create a VM var createCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_BLOCK); foreach (RbacMethod method in CreateVMAction.StaticRBACDependencies) createCheck.AddApiCheck(method); createCheck.Blocking = true; // Check to see if they can set memory values var memCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_MEM); memCheck.AddApiCheck("vm.set_memory_limits"); memCheck.WarningAction = new RBACWarningPage.PermissionCheckActionDelegate(delegate() { // no point letting them continue page_5_CpuMem.DisableMemoryControls(); }); // Check to see if they can set the VM's affinity var affinityCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_AFFINITY); affinityCheck.ApiCallsToCheck.Add("vm.set_affinity"); affinityCheck.WarningAction = new RBACWarningPage.PermissionCheckActionDelegate(delegate() { page_4_HomeServer.DisableStep = true; BlockAffinitySelection = true; Program.Invoke(this, RefreshProgress); }); page_RbacWarning.AddPermissionChecks(xenConnection, createCheck, affinityCheck, memCheck); if (Helpers.ClearwaterSp1OrGreater(xenConnection) && Helpers.GpuCapability(xenConnection)) { var vgpuCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_GPU); vgpuCheck.ApiCallsToCheck.Add("vgpu.create"); vgpuCheck.WarningAction = new RBACWarningPage.PermissionCheckActionDelegate(() => { pageVgpu.DisableStep = true; Program.Invoke(this, RefreshProgress); }); page_RbacWarning.AddPermissionChecks(xenConnection, vgpuCheck); } AddPage(page_RbacWarning, 0); } #endregion page_8_Finish.SummaryRetreiver = GetSummary; AddPages(page_1_Template, page_2_Name, page_3_InstallationMedia, page_4_HomeServer, page_5_CpuMem, page_6_Storage, page_7_Networking, page_8_Finish); m_affinity = affinity; page_1_Template.SelectedTemplate = template; page_1b_BiosLocking.Affinity = affinity; page_3_InstallationMedia.Affinity = affinity; page_4_HomeServer.Affinity = affinity; page_6_Storage.Affinity = affinity; }
private void ConfigureRbacPage(bool disasterRecoveryTask) { if (!_rbac) return; xenTabPageRbacWarning.Connection = xenConnection; xenTabPageRbacWarning.ClearPermissionChecks(); var warningMessage = (_srToReattach == null && !disasterRecoveryTask) ? Messages.RBAC_WARNING_SR_WIZARD_CREATE : Messages.RBAC_WARNING_SR_WIZARD_ATTACH; RBACWarningPage.WizardPermissionCheck check = new RBACWarningPage.WizardPermissionCheck(warningMessage) { Blocking = true }; check.AddApiCheckRange(new RbacMethodList("SR.probe")); if (_srToReattach == null) { // create check.AddApiCheckRange(SrCreateAction.StaticRBACDependencies); } else if (disasterRecoveryTask && SR.SupportsDatabaseReplication(xenConnection, _srToReattach)) { // "Attach SR needed for DR" case check.AddApiCheckRange(DrTaskCreateAction.StaticRBACDependencies); } else { // reattach check.AddApiCheckRange(SrReattachAction.StaticRBACDependencies); } xenTabPageRbacWarning.AddPermissionChecks(xenConnection, check); }
private void ConfigureRbacPage() { if (ConnectionDoesNotRequireRBAC(xenConnection) && ConnectionDoesNotRequireRBAC(TargetConnection)) return; m_pageTargetRbac.ClearPermissionChecks(); RBACWarningPage.WizardPermissionCheck migrateCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_CROSS_POOL_MIGRATE_VM_BLOCKED) { Blocking = true }; migrateCheck.AddApiCheckRange(VMCrossPoolMigrateAction.StaticRBACDependencies); m_pageTargetRbac.AddPermissionChecks(xenConnection, migrateCheck); if (!xenConnection.Equals(TargetConnection)) m_pageTargetRbac.AddPermissionChecks(TargetConnection, migrateCheck); AddAfterPage(m_pageDestination, m_pageTargetRbac); }
private void ConfigureRbacPage(IXenConnection selectedConnection) { if (selectedConnection == null || selectedConnection.Session.IsLocalSuperuser || Helpers.GetMaster(selectedConnection).external_auth_type == Auth.AUTH_TYPE_NONE) return; m_pageRbac.ClearPermissionChecks(); m_ignoreAffinitySet = false; switch (m_typeOfImport) { case ImportType.Ovf: case ImportType.Vhd: { var check = m_typeOfImport == ImportType.Ovf ? new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_IMPORT_WIZARD_APPLIANCE) {Blocking = true} : new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_IMPORT_WIZARD_IMAGE) {Blocking = true}; check.AddApiCheckRange(ApplianceAction.StaticRBACDependencies); m_pageRbac.AddPermissionChecks(selectedConnection, check); AddAfterPage(m_pageHost, m_pageRbac); } break; case ImportType.Xva: { //Check to see if they can import VMs at all var importCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_IMPORT_WIZARD_XVA) {Blocking = true}; importCheck.ApiCallsToCheck.AddRange(ImportVmAction.ConstantRBACRequirements); //Check to see if they can set the VM's affinity var affinityCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_IMPORT_WIZARD_AFFINITY); affinityCheck.ApiCallsToCheck.Add("vm.set_affinity"); affinityCheck.WarningAction = new RBACWarningPage.PermissionCheckActionDelegate(delegate { //We cannot allow them to set the affinity, so we are only going //to offer them the choice of connection, not specific host m_ignoreAffinitySet = true; }); m_pageRbac.AddPermissionChecks(selectedConnection, importCheck, affinityCheck); AddAfterPage(m_pageXvaHost, m_pageRbac); } break; } //set page Connection after the page has been added to the wizard //(because the Connection is reset when the page is added m_pageRbac.Connection = selectedConnection; }
public DRFailoverWizard(Pool pool, DRWizardType wizardType) : base(pool.Connection) { InitializeComponent(); RBACWarningPage = new RBACWarningPage(); DRFailoverWizardFirstPage = new DRFailoverWizardFirstPage(); DRFailoverWizardStoragePage1 = new DRFailoverWizardStoragePage(); DRFailoverWizardPrecheckPage1 = new DRFailoverWizardPrecheckPage(); DRFailoverWizardRecoverPage1 = new DRFailoverWizardRecoverPage(); DRFailoverWizardAppliancesPage1 = new DRFailoverWizardAppliancesPage(); DRFailoverWizardWelcomePage = new DRFailoverWizardWelcomePage(); DRFailoverWizardReportPage1 = new DRFailoverWizardReportPage(); Pool = pool; WizardType = wizardType; #region RBAC Warning Page Checks if (Pool.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(Pool.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { } else { RBACWarningPage.WizardPermissionCheck check = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_DR_WIZARD_MESSAGE); check.AddApiCheck("DR_task.async_create"); check.Blocking = true; RBACWarningPage.AddPermissionChecks(xenConnection, check); AddPage(RBACWarningPage, 0); } #endregion DRFailoverWizardReportPage1.SummaryRetreiver = GetSummaryReport; DRFailoverWizardWelcomePage.WizardTypeChanged += DRFailoverWizardWelcomePage_WizardTypeChanged; DRFailoverWizardWelcomePage.SetWizardType(wizardType); DRFailoverWizardRecoverPage1.ReportStarted += DRFailoverWizardRecoverPage1_ReportStarted; DRFailoverWizardRecoverPage1.ReportLineGot += DRFailoverWizardRecoverPage1_ReportLineGot; DRFailoverWizardRecoverPage1.ReportActionResultGot += DRFailoverWizardRecoverPage1_ReportActionResultGot; DRFailoverWizardAppliancesPage1.Pool = pool; DRFailoverWizardPrecheckPage1.Pool = pool; DRFailoverWizardStoragePage1.NewDrTaskIntroduced += NewDrTaskIntroduced; DRFailoverWizardPrecheckPage1.NewDrTaskIntroduced += NewDrTaskIntroduced; DRFailoverWizardPrecheckPage1.SrIntroduced += DRFailoverWizardPrecheckPage1_SrIntroduced; AddPages(DRFailoverWizardWelcomePage, DRFailoverWizardFirstPage, DRFailoverWizardStoragePage1, DRFailoverWizardAppliancesPage1, DRFailoverWizardPrecheckPage1, DRFailoverWizardRecoverPage1, DRFailoverWizardReportPage1); }