private void ConfigureRbacPage(IXenConnection selectedConnection) { if (selectedConnection == null || selectedConnection.Session == 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 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 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); }
public NewPolicyWizardSpecific(Pool pool) : base(pool) { this.Text = VMGroup <T> .VMPolicyWizardTitle; xenTabPagePolicy = new NewPolicyPolicyNamePage(VMGroup <T> .VMPolicyNamePageText, VMGroup <T> .VMPolicyNamePageTextMore, VMGroup <T> .VMPolicyNamePageTabName, VMGroup <T> .VMPolicyNamePageTabText, VMGroup <T> .VMPolicyNamePageNameFieldText); xenTabPageSnapshotType = new NewPolicySnapshotTypePageSpecific <T>(); xenTabPageVMsPage = new NewVMGroupVMsPage <T>(); xenTabPageFinish = new NewPolicyFinishPage(VMGroup <T> .VMPolicyFinishPageText, VMGroup <T> .VMPolicyFinishPageCheckboxText, VMGroup <T> .VMPolicyFinishPageTitle); xenTabPageRBAC = new RBACWarningPage(); xenTabPageVMsPage.Pool = pool; xenTabPageSnapshotFrequency = new NewPolicySnapshotFrequencyPage(); 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; check = new RBACWarningPage.WizardPermissionCheck(VMGroup <T> .VMPolicyRBACWarning); check.AddApiCheck(VMGroup <T> .VMPolicyRBACapiCheck); check.Blocking = true; xenTabPageRBAC.AddPermissionChecks(xenConnection, check); AddPage(xenTabPageRBAC, 0); } #endregion AddPages(xenTabPagePolicy, xenTabPageVMsPage); AddPage(xenTabPageSnapshotType); AddPages(xenTabPageSnapshotFrequency); if (VMGroup <T> .isVMPolicyVMPP) { xenTabPageArchive = new NewPolicyArchivePage(); xenTabPageArchive.Pool = pool; AddPage(xenTabPageArchive); xenTabPageEmail = new NewPolicyEmailPage(); xenTabPageEmail.Pool = pool; AddPages(xenTabPageEmail); } AddPages(xenTabPageFinish); }
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 (Helpers.KolkataOrGreater(xenConnection) && !Helpers.FeatureForbidden(xenConnection, Host.CorosyncDisabled)) { check.AddApiCheckRange(new RbacMethodList("SR.probe_ext")); } 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); }
public HAWizard(Pool pool) : base(pool.Connection) { InitializeComponent(); xenTabPageIntro = new Intro(); m_pageRbac = new RBACWarningPage(); xenTabPageAssignPriorities = new AssignPriorities(); xenTabPageChooseSR = new ChooseSR(); xenTabPageHaFinish = new HAFinishPage(); this.pool = pool; _rbacNeeded = !pool.Connection.Session.IsLocalSuperuser && Helpers.GetMaster(pool.Connection).external_auth_type != Auth.AUTH_TYPE_NONE; AddPage(xenTabPageIntro); if (_rbacNeeded) { var check = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_HA_ENABLE_WARNING) { Blocking = true }; check.AddApiCheckRange( "vm.set_ha_restart_priority", "vm.set_order", "vm.set_start_delay", "pool.sync_database", "pool.ha_compute_hypothetical_max_host_failures_to_tolerate", "pool.set_ha_host_failures_to_tolerate", "pool.enable_ha", "sr.assert_can_host_ha_statefile" ); m_pageRbac.AddPermissionChecks(xenConnection, check); AddPage(m_pageRbac); } AddPage(xenTabPageChooseSR); xenTabPageChooseSR.Pool = pool; AddPage(xenTabPageAssignPriorities); xenTabPageAssignPriorities.ProtectVmsByDefault = true; xenTabPageAssignPriorities.Connection = pool.Connection;//set the connection again after the page has been added AddPage(xenTabPageHaFinish); }
public RestoreWizard(IXenObject xenModelObject) { this.InitializeComponent(); this._Message = base.Text = string.Format(Messages.RESTORE_VM_TITLE, Helpers.GetName(xenModelObject.Connection)); this.page_SetStorage = new Page_SetStorage(xenModelObject); this.page_SelectVM = new Page_SelectVM(); this.page_JobSettings = new Page_JobSettings(xenModelObject); this.page_JobSchedule = new Page_JobSchedule(); this.page_VMSettings = new Page_VMSettings(); this.page_Complete = new Page_Complete(); this.page_RbacWarning = new RBACWarningPage(); this._xenModelObject = xenModelObject; this.backup_info_list = new Dictionary <string, string>(); this.vmCheckedList = new List <AgentParamDataModel>(); this.restoreDataModel = new RestoreDataModel(); this.restore_info_list = new List <BackupRestoreConfig.ResultInfo>(); this.restoreListInfo = new BackupRestoreConfig.RestoreListInfo(); this.restore_vdi_list = new Dictionary <string, string>(); #region RBAC Warning Page Checks if (this._xenModelObject.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(this._xenModelObject.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //page_RbacWarning.DisableStep = true; } else { // Check to see if they can even create a VM RBACWarningPage.WizardPermissionCheck createCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_RESTORE); foreach (RbacMethod method in StaticRBACDependencies) { createCheck.AddApiCheck(method); } createCheck.Blocking = true; page_RbacWarning.AddPermissionChecks(this._xenModelObject.Connection, createCheck); AddPage(page_RbacWarning, 0); } #endregion base.AddPages(new XenTabPage[] { this.page_SetStorage, this.page_SelectVM, this.page_JobSettings, this.page_JobSchedule, this.page_VMSettings, this.page_Complete }); }
internal ReplicationWizard(IXenObject XenObject) { this.InitializeComponent(); this._xenModelObject = XenObject; this.repChoseVmPage = new ReplicationChoseVmPage(XenObject); this.repJobSettingPage = new ReplicationJobSettingPage(); this.synchronizationPage = new ReplicationSynchronizationPage(); this.schedulePage = new ReplicationSchedulePage(XenObject); this.vmSettingsPage = new ReplicationVMSettingsPage(); this.completePage = new ReplicationCompletePage(); this.page_RbacWarning = new RBACWarningPage(); #region RBAC Warning Page Checks if (this._xenModelObject.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(this._xenModelObject.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //page_RbacWarning.DisableStep = true; } else { // Check to see if they can even create a VM RBACWarningPage.WizardPermissionCheck createCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_REPLICATION); foreach (RbacMethod method in StaticRBACDependencies) { createCheck.AddApiCheck(method); } createCheck.Blocking = true; page_RbacWarning.AddPermissionChecks(this._xenModelObject.Connection, createCheck); AddPage(page_RbacWarning, 0); } #endregion base.AddPage(this.repChoseVmPage); base.AddPage(this.repJobSettingPage); base.AddPage(this.synchronizationPage); base.AddPage(this.schedulePage); base.AddPage(this.vmSettingsPage); base.AddPage(this.completePage); this.m_text = string.Format(Messages.REPLICATION_VM_TITLE, Helpers.GetName(XenObject.Connection)); }
public NewPolicyWizard(Pool pool) : base(pool.Connection) { InitializeComponent(); Pool = pool; this.Text = Messages.VMSS_WIZARD_TITLE; xenTabPagePolicy = new NewPolicyPolicyNamePage(Messages.NEW_VMSS_PAGE_TEXT, Messages.NEW_VMSS_PAGE_TEXT_MORE, Messages.VMSS_NAME, Messages.VMSS_NAME_TITLE, Messages.VMSS_NAME_FIELD_TEXT); xenTabPageSnapshotType = new NewPolicySnapshotTypePage(); xenTabPageVMsPage = new NewVMGroupVMsPage <VMSS>(); xenTabPageFinish = new NewPolicyFinishPage(Messages.VMSS_FINISH_PAGE_TEXT, Messages.VMSS_FINISH_PAGE_CHECKBOX_TEXT, Messages.VMSS_FINISH_TITLE); xenTabPageRBAC = new RBACWarningPage(); xenTabPageVMsPage.Pool = pool; xenTabPageSnapshotFrequency = new NewPolicySnapshotFrequencyPage(); 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; check = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VMSS); check.AddApiCheck("VMSS.async_create"); check.Blocking = true; xenTabPageRBAC.AddPermissionChecks(xenConnection, check); AddPage(xenTabPageRBAC, 0); } #endregion AddPages(xenTabPagePolicy, xenTabPageVMsPage); AddPage(xenTabPageSnapshotType); AddPages(xenTabPageSnapshotFrequency); AddPages(xenTabPageFinish); }
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); }
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 BackupWizard(IXenObject XenObject) { this._xenModelObject = XenObject; InitializeComponent(); base.Text = string.Format(Messages.BACKUP_VM_TITLE, HalsignHelpers.GetName(this._xenModelObject.Connection)); this.xenChoseVmBackupPage = new BackupChoseVmPage(XenObject); this.scheduleBackupPage = new BackupSchedulePage(); this.summaryBackupPage = new BackupSummaryPage(); this.optionsBackupPage = new BackupOptionsPage(); this.completeBackupPage = new BackupCompletePage(); this.page_RbacWarning = new RBACWarningPage(); #region RBAC Warning Page Checks if (this._xenModelObject.Connection.Session.IsLocalSuperuser || Helpers.GetMaster(this._xenModelObject.Connection).external_auth_type == Auth.AUTH_TYPE_NONE) { //page_RbacWarning.DisableStep = true; } else { // Check to see if they can even create a VM RBACWarningPage.WizardPermissionCheck createCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_BACKUP); foreach (RbacMethod method in StaticRBACDependencies) { createCheck.AddApiCheck(method); } createCheck.Blocking = true; page_RbacWarning.AddPermissionChecks(this._xenModelObject.Connection, createCheck); AddPage(page_RbacWarning, 0); } #endregion base.AddPage(this.xenChoseVmBackupPage); base.AddPage(this.scheduleBackupPage); base.AddPage(this.optionsBackupPage); base.AddPage(this.summaryBackupPage); base.AddPage(this.completeBackupPage); }
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_Cloud = new Page_Cloud(); page_6b_LunPerVdi = new LunPerVdiNewVMMappingPage { Connection = xenConnection }; #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 RBACWarningPage.WizardPermissionCheck 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 RBACWarningPage.WizardPermissionCheck 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 RBACWarningPage.WizardPermissionCheck 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, delegate { RefreshProgress(); }); }); page_RbacWarning.AddPermissionChecks(xenConnection, createCheck, affinityCheck, memCheck); 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; }