예제 #1
0
    def test_migration(self, mock_run_job):

        # Test simple call
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [(mig.TGT_MGD_SYS, 'abc')], exp_timeout=1800 * 4)
        mig.migrate_lpar(self.lpar_w, 'abc')
        self.adpt.read.assert_called_once_with('LogicalPartition',
                                               '1234',
                                               suffix_parm='Migrate',
                                               suffix_type='do')
        # Test all parms
        self.adpt.read.reset_mock()
        parm_list = [(mig.TGT_MGD_SYS, 'abc'), (mig.TGT_RMT_HMC, 'host'),
                     (mig.TGT_RMT_HMC_USR, 'usr'), (mig.DEST_MSP, 'vios1'),
                     (mig.SRC_MSP, 'vios2'), (mig.SPP_ID, '5'),
                     (mig.OVS_OVERRIDE, '2'), (mig.VLAN_BRIDGE_OVERRIDE, '2')]
        mapping_list = [(mig.VFC_MAPPINGS, ['1/1/1', '3/3/3//3']),
                        (mig.VSCSI_MAPPINGS, ['2/2/2']),
                        (mig.VLAN_MAPPINGS,
                         ['001122334455/4', '001122334466/5/6 7'])]
        mock_run_job.side_effect = u.get_parm_checker(
            self,
            '1234',
            parm_list,
            exp_job_mappings=mapping_list,
            exp_timeout=1800 * 4)

        mig.migrate_lpar(
            self.lpar_w,
            'abc',
            tgt_mgmt_svr='host',
            tgt_mgmt_usr='******',
            virtual_fc_mappings=['1/1/1', '3/3/3//3'],
            virtual_scsi_mappings=['2/2/2'],
            vlan_mappings=['001122334455/4', '001122334466/5/6 7'],
            dest_msp_name='vios1',
            source_msp_name='vios2',
            spp_id='5',
            sdn_override=True,
            vlan_check_override=True)
        self.adpt.read.assert_called_once_with('LogicalPartition',
                                               '1234',
                                               suffix_parm='Migrate',
                                               suffix_type='do')
        # Test simple validation call
        self.adpt.read.reset_mock()
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [(mig.TGT_MGD_SYS, 'abc')], exp_timeout=1800 * 4)
        mock_run_job.reset_mock()
        mig.migrate_lpar(self.lpar_w, 'abc', validate_only=True)
        self.adpt.read.assert_called_once_with('LogicalPartition',
                                               '1234',
                                               suffix_parm='MigrateValidate',
                                               suffix_type='do')
예제 #2
0
    def test_request_master(self, mock_run_job):
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [(m_mode.CO_MGMT_MASTER_STATUS,
                            m_mode.MasterMode.NORMAL)], exp_timeout=1800)
        m_mode.request_master(self.msys_w)
        self.adpt.read.assert_called_once_with('ManagedSystem', '1234',
                                               suffix_parm='RequestMaster',
                                               suffix_type='do')
        self.adpt.reset_mock()
        mock_run_job.reset_mock()

        # Test temp mode
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [(m_mode.CO_MGMT_MASTER_STATUS,
                            m_mode.MasterMode.TEMP)], exp_timeout=1800)
        m_mode.request_master(self.msys_w, mode=m_mode.MasterMode.TEMP)
        self.adpt.read.assert_called_once_with('ManagedSystem', '1234',
                                               suffix_parm='RequestMaster',
                                               suffix_type='do')
예제 #3
0
    def test_migration(self, mock_run_job):

        # Test simple call
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [(mig.TGT_MGD_SYS, 'abc')], exp_timeout=1800)
        mig.migrate_lpar(self.lpar_w, 'abc')
        self.adpt.read.assert_called_once_with('LogicalPartition', '1234',
                                               suffix_parm='Migrate',
                                               suffix_type='do')
        # Test all parms
        self.adpt.read.reset_mock()
        parm_list = [(mig.TGT_MGD_SYS, 'abc'),
                     (mig.TGT_RMT_HMC, 'host'),
                     (mig.TGT_RMT_HMC_USR, 'usr'),
                     (mig.DEST_MSP, 'vios1'),
                     (mig.SRC_MSP, 'vios2')]
        mapping_list = [(mig.VFC_MAPPINGS, ['1/1/1', '3/3/3//3']),
                        (mig.VSCSI_MAPPINGS, ['2/2/2'])]
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', parm_list, exp_job_mappings=mapping_list,
            exp_timeout=1800)

        mig.migrate_lpar(self.lpar_w, 'abc',
                         tgt_mgmt_svr='host', tgt_mgmt_usr='******',
                         virtual_fc_mappings=['1/1/1', '3/3/3//3'],
                         virtual_scsi_mappings=['2/2/2'],
                         dest_msp_name='vios1', source_msp_name='vios2')
        self.adpt.read.assert_called_once_with('LogicalPartition', '1234',
                                               suffix_parm='Migrate',
                                               suffix_type='do')
        # Test simple validation call
        self.adpt.read.reset_mock()
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [(mig.TGT_MGD_SYS, 'abc')], exp_timeout=1800)
        mock_run_job.reset_mock()
        mig.migrate_lpar(self.lpar_w, 'abc', validate_only=True)
        self.adpt.read.assert_called_once_with('LogicalPartition', '1234',
                                               suffix_parm='MigrateValidate',
                                               suffix_type='do')
예제 #4
0
    def test_clone_uuid(self, mock_run_job):

        mock_resp = mock.MagicMock()
        mock_resp.entry = ent.Entry(
            {}, ent.Element('Dummy', self.adpt), self.adpt)
        self.adpt.read.side_effect = [mock_resp]
        mock_run_job.side_effect = tju.get_parm_checker(
            self, '1234', [('targetLparName', 'abc')])
        tpar.clone_uuid(self.adpt, '1234', 'abc')
        self.adpt.read.assert_called_once_with('LogicalPartition',
                                               root_id='1234',
                                               suffix_type='do',
                                               suffix_parm='CloneUUID')
예제 #5
0
    def test_request_master(self, mock_run_job):
        mock_run_job.side_effect = u.get_parm_checker(
            self,
            '1234', [(m_mode.CO_MGMT_MASTER_STATUS, m_mode.MasterMode.NORMAL)],
            exp_timeout=1800)
        m_mode.request_master(self.msys_w)
        self.adpt.read.assert_called_once_with('ManagedSystem',
                                               '1234',
                                               suffix_parm='RequestMaster',
                                               suffix_type='do')
        self.adpt.reset_mock()
        mock_run_job.reset_mock()

        # Test temp mode
        mock_run_job.side_effect = u.get_parm_checker(
            self,
            '1234', [(m_mode.CO_MGMT_MASTER_STATUS, m_mode.MasterMode.TEMP)],
            exp_timeout=1800)
        m_mode.request_master(self.msys_w, mode=m_mode.MasterMode.TEMP)
        self.adpt.read.assert_called_once_with('ManagedSystem',
                                               '1234',
                                               suffix_parm='RequestMaster',
                                               suffix_type='do')
예제 #6
0
    def test_migration_recover(self, mock_run_job):
        # Test simple call
        mig.migrate_recover(self.lpar_w)
        self.adpt.read.assert_called_once_with('LogicalPartition', '1234',
                                               suffix_parm='MigrateRecover',
                                               suffix_type='do')
        mock_run_job.assert_called_once_with(
            '1234', job_parms=[], timeout=1800)

        # Test simple call with force
        self.adpt.read.reset_mock()
        mock_run_job.reset_mock()
        mock_run_job.side_effect = u.get_parm_checker(
            self, '1234', [('Force', 'true')], exp_timeout=1800)
        mig.migrate_recover(self.lpar_w, force=True)

        self.adpt.read.assert_called_once_with('LogicalPartition', '1234',
                                               suffix_parm='MigrateRecover',
                                               suffix_type='do')
예제 #7
0
    def test_migration_recover(self, mock_run_job):
        # Test simple call
        mig.migrate_recover(self.lpar_w)
        self.adpt.read.assert_called_once_with('LogicalPartition',
                                               '1234',
                                               suffix_parm='MigrateRecover',
                                               suffix_type='do')
        mock_run_job.assert_called_once_with('1234',
                                             job_parms=[],
                                             timeout=1800)

        # Test simple call with force
        self.adpt.read.reset_mock()
        mock_run_job.reset_mock()
        mock_run_job.side_effect = u.get_parm_checker(self,
                                                      '1234',
                                                      [('Force', 'true')],
                                                      exp_timeout=1800)
        mig.migrate_recover(self.lpar_w, force=True)

        self.adpt.read.assert_called_once_with('LogicalPartition',
                                               '1234',
                                               suffix_parm='MigrateRecover',
                                               suffix_type='do')