示例#1
0
    def test_run_migration_which_is_in_running_state(self):
        """ Test run the migration which is already in running state"""
        test_migration = Migration(
            mount_points=self._mount_points,
            source=self._test_workload,
            migration_target=self._test_migration_target,
            migration_state=MigrationState.RUNNING)

        with self.assertRaises(Exception):
            test_migration.run()
示例#2
0
    def test_run_migration_without_c(self):
        """ Test migration without main mount point (C:\\ drive in this case)"""
        self._mount_points[0].name = 'D:\\'
        test_migration = Migration(
            mount_points=self._mount_points,
            source=self._test_workload,
            migration_target=self._test_migration_target,
            migration_state=MigrationState.NOT_STARTED)

        with self.assertRaises(Exception):
            test_migration.run()
示例#3
0
 def get(self):
     cnt = 0
     for taskcls in tasklist:
         task = taskcls()
         t = Migration.all().filter('name =', task.name).get()
         if t is None:
             task.call(self.response.out)
             m = Migration(name=task.name)
             m.put()
             self.response.out.write('Performed task: %s.<br/>' % task.name)
             cnt += 1
         else:
             logging.info('Task %s already performed' % task.name)
     self.response.out.write('%s tasks have been executed<br/>' % cnt)
示例#4
0
 def setUpClass(cls):
     """Makes default values"""
     cls._mount_points = [MountPoint(name='C:\\', size=42)]
     cls._credentials = Credentials(
         user_name='User',
         password='******',
         domain='xxx.com'
     )
     cls._test_workload = Workload(
         id=None,
         ip='111.11.11',
         credentials=cls._credentials,
         storage=cls._mount_points
     )
     cls._test_migration_target = MigrationTarget(
         cloud_type=CloudType.VSPHERE,
         cloud_credentials=cls._credentials,
         target_vm=cls._test_workload
     )
     cls._test_migration = Migration(
         mount_points=cls._mount_points,
         source=cls._test_workload,
         migration_target=cls._test_migration_target,
         migration_state=MigrationState.NOT_STARTED
     )
     cls.results_mock = CollectionResults()
示例#5
0
 def test_invalid_migrationtarget(self):
     """Test create the migration model with invalid type of migration target"""
     with self.assertRaises(Exception):
         Migration(mount_points=self._mount_points,
                   source=self._test_workload,
                   migration_target=111,
                   migration_state=MigrationState.RUNNING)
示例#6
0
    def get_migration(self, source_workload: Workload,
                      target_workload: Workload) -> Migration:
        target = self.migration_target.get_target(target_workload)

        return Migration(id=self.id,
                         mount_points=self.mount_points,
                         source=source_workload,
                         migration_target=target,
                         migration_state=self.state)
示例#7
0
    def test_valid_migration(self):
        """Test general properties of the migration model"""
        test_migration = Migration(
            mount_points=self._mount_points,
            source=self._test_workload,
            migration_target=self._test_migration_target,
            migration_state=MigrationState.NOT_STARTED)

        self.assertEqual(test_migration.mount_points, self._mount_points)
        self.assertEqual(test_migration.source, self._test_workload)
        self.assertEqual(test_migration.migration_target,
                         self._test_migration_target)
        self.assertEqual(test_migration.migration_state,
                         MigrationState.NOT_STARTED)
示例#8
0
def migration_task(task):
    task.call(out)
    m = Migration(name=task.name)
    m.put()