private void VerifyMigrationAllowed(IXenObject ixo, List <VM> vms)
        {
            CrossPoolMigrateCanMigrateFilter cmd = new CrossPoolMigrateCanMigrateFilter(ixo, vms);

            Assert.That(cmd.FailureFound, Is.False, "failure found");
            Assert.That(cmd.Reason, Is.Null, "failure message");
        }
 public void VerifyThrowsArgumentNullException()
 {
     foreach (TestData data in TestCasesArgumentNullException)
     {
         Assert.Throws <ArgumentNullException>(() => { var filter = new CrossPoolMigrateCanMigrateFilter(data.Item1, data.Item2, WizardMode.Migrate); });
     }
 }
 public void VerifyMigrationNotAllowedCurrentServer()
 {
     foreach (TestData data in TestCasesMigrationNotAllowedCurrentServer)
     {
         var filter = new CrossPoolMigrateCanMigrateFilter(data.Item1, data.Item2, WizardMode.Migrate);
         Assert.True(filter.FailureFound, "Expected to find failure");
         Assert.That(filter.Reason, Is.Null.Or.Empty); //Did not expect failure reason
     }
 }
示例#4
0
 public void VerifyMigrationAllowed()
 {
     foreach (TestData data in TestCasesMigrationAllowed)
     {
         var filter = new CrossPoolMigrateCanMigrateFilter(data.Item1, data.Item2, WizardMode.Migrate);
         Assert.False(filter.FailureFound, "Did not expect to find failure");
         Assert.IsNullOrEmpty(filter.Reason, "Did not expect failure reason");
     }
 }
        public void VerifyMigrationNotAllowed()
        {
            Init();
            foreach (TestData data in TestCasesMigrationNotAllowedIfAssertion)
            {
                Assert.That(data.vms.Count, Is.AtLeast(1), "VM count needs to be at least 1 for this test");

                //fakeVM will say a failure is found if vm ref is set to Failure.INTERNAL_ERROR
                data.vms[0].opaque_ref = Failure.INTERNAL_ERROR;
                Assert.That(data.vms[0].opaque_ref, Is.EqualTo(Failure.INTERNAL_ERROR));

                CrossPoolMigrateCanMigrateFilter cmd = new CrossPoolMigrateCanMigrateFilter(data.ixo, data.vms);
                Assert.That(cmd.FailureFound, Is.True, "failure found");
                Assert.That(cmd.Reason, Is.EqualTo(Failure.INTERNAL_ERROR), "failure message");
            }
        }
示例#6
0
        public static bool CanExecute(VM vm, Host preselectedHost)
        {
            bool failureFound = false;

            if (preselectedHost != null)
            {
                failureFound = new CrossPoolMigrateCanMigrateFilter(preselectedHost, new List <VM> {
                    vm
                }).FailureFound;
            }

            return(!failureFound &&
                   vm.allowed_operations != null &&
                   vm.allowed_operations.Contains(vm_operations.migrate_send) &&
                   !Helpers.CrossPoolMigrationRestrictedWithWlb(vm.Connection) &&
                   vm.SRs.ToList().All(sr => sr != null && !sr.HBALunPerVDI) &&
                   (preselectedHost == null || vm.Connection.Resolve(vm.resident_on) != preselectedHost)); //Not the same as the pre-selected host
        }
示例#7
0
        protected override bool CanExecute(VM vm)
        {
            bool failureFound = false;

            if (preSelectedHost != null)
            {
                failureFound = new CrossPoolMigrateCanMigrateFilter(preSelectedHost, new List <VM> {
                    vm
                }).FailureFound;
            }

            return(!failureFound &&
                   vm.allowed_operations != null &&
                   vm.allowed_operations.Contains(vm_operations.migrate_send) &&
                   !Helpers.WlbEnabledAndConfigured(vm.Connection) &&
                   vm.SRs.ToList().All(sr => sr != null && !sr.HBALunPerVDI) &&
                   vm.Connection.Resolve(vm.resident_on) != preSelectedHost); //Not the same as the pre-selected host
        }
        protected override bool CanExecute(VM vm)
        {
            if (preSelectedHost == null)
            {
                return(CanExecute(vm, preSelectedHost));
            }

            var filter = new CrossPoolMigrateCanMigrateFilter(preSelectedHost, new List <VM> {
                vm
            }, WizardMode.Migrate);
            var canExecute = CanExecute(vm, preSelectedHost, filter);

            if (string.IsNullOrEmpty(filter.Reason))
            {
                cantExecuteReasons.Remove(vm);
            }
            else
            {
                cantExecuteReasons[vm] = filter.Reason;
            }
            return(canExecute);
        }
 public void VerifyNullListArgsThrow()
 {
     bool failureFound = new CrossPoolMigrateCanMigrateFilter(singlePool, null).FailureFound;
 }