'Deleting newest snapshot of a file-based image when the domain is
not running should trigger a blockRebase using qemu-img not libvirt.
In this test, we rebase the image with another image as backing file.'

@mock.patch.object(host.Host, 'has_min_version', mock.Mock(return_value=True))
@mock.patch('nova.virt.libvirt.guest.Guest.is_active', mock.Mock(return_value=False))
@mock.patch('nova.virt.images.qemu_img_info', return_value=mock.Mock(file_format='fake_fmt'))
@mock.patch('nova.utils.execute')
def test_volume_snapshot_delete_when_dom_not_running(self, mock_execute, mock_qemu_img_info):

    (mock_domain, guest) = self._setup_block_rebase_domain_and_guest_mocks(self.dom_xml)
    instance = objects.Instance(**self.inst)
    snapshot_id = 'snapshot-1234'
    with mock.patch.object(self.drvr._host, 'get_guest', return_value=guest):
        self.drvr._volume_snapshot_delete(self.c, instance, self.volume_uuid, snapshot_id, self.delete_info_1)
    mock_qemu_img_info.assert_called_once_with('snap.img')
    mock_execute.assert_called_once_with('qemu-img', 'rebase', '-b', 'snap.img', '-F', 'fake_fmt', 'disk1_file')
