def METHOD_NAME(vm, speed=None, buf_size=None):
    vm.launch()
    ret = vm.qmp('blockdev-add',
                     node_name='source',
                     driver='null-co',
                     size=1048576)
    assert ret['return'] == {}
    ret = vm.qmp('blockdev-add',
                     node_name='target',
                     driver='null-co',
                     size=1048576)
    assert ret['return'] == {}
    if speed is not None:
        ret = vm.qmp('blockdev-mirror',
                         job_id='mirror',
                         device='source',
                         target='target',
                         sync='full',
                         speed=speed,
                         buf_size=buf_size)
    else:
        ret = vm.qmp('blockdev-mirror',
                         job_id='mirror',
                         device='source',
                         target='target',
                         sync='full')
    assert ret['return'] == {}