def METHOD_NAME(self, once: bool) -> None:
    res = self.vm.qmp('blockdev-add',
                      **{'node-name': 'source',
                         'driver': iotests.imgfmt,
                         'file': {
                             'driver': 'file',
                             'filename': source
                         }})
    self.assert_qmp(res, 'return', {})
    # blkdebug notes:
    # Enter state 2 on the first flush, which happens before the
    # job enters the READY state.  The second flush will happen
    # when the job is about to complete, and we want that one to
    # fail.
    res = self.vm.qmp('blockdev-add',
                      **{'node-name': 'target',
                         'driver': iotests.imgfmt,
                         'file': {
                             'driver': 'blkdebug',
                             'image': {
                                 'driver': 'file',
                                 'filename': target
                             },
                             'set-state': [{
                                 'event': 'flush_to_disk',
                                 'state': 1,
                                 'new_state': 2
                             }],
                             'inject-error': [{
                                 'event': 'flush_to_disk',
                                 'once': once,
                                 'immediately': True,
                                 'state': 2
                             }]}})
    self.assert_qmp(res, 'return', {})