Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }