'Validates the \'typical\' spawn flow of the spawn of an instance.'

@mock.patch('nova.virt.powervm.vm.create_lpar')
@mock.patch('pypowervm.tasks.partition.build_active_vio_feed_task', autospec=True)
@mock.patch('pypowervm.tasks.storage.add_lpar_storage_scrub_tasks', autospec=True)
def test_spawn_ops(self, mock_scrub, mock_bldftsk, mock_crt_lpar):

    self.drv.host_wrapper = 'sys'
    self.drv.disk_dvr = mock.create_autospec(ssp.SSPDiskAdapter, instance=True)
    mock_ftsk = pvm_tx.FeedTask('fake', [mock.Mock(spec=pvm_vios.VIOS)])
    mock_bldftsk.return_value = mock_ftsk
    self.drv.spawn('context', self.inst, 'img_meta', 'files', 'password')
    mock_crt_lpar.assert_called_once_with(self.adp, 'sys', self.inst)
    mock_bldftsk.assert_called_once_with(self.adp, xag={pvm_const.XAG.VIO_SMAP, pvm_const.XAG.VIO_FMAP})
    mock_scrub.assert_called_once_with([mock_crt_lpar.return_value.id], mock_ftsk, lpars_exist=True)
    self.drv.disk_dvr.create_disk_from_image.assert_called_once_with('context', self.inst, 'img_meta')
    self.drv.disk_dvr.attach_disk.assert_called_once_with(self.inst, self.drv.disk_dvr.create_disk_from_image.return_value, mock_ftsk)
    self.pwron.assert_called_once_with(self.adp, self.inst)
