'Deleting newest snapshot -- blockRebase.'

@mock.patch('nova.virt.libvirt.guest.BlockDevice.is_job_complete')
def test_volume_snapshot_delete_1(self, mock_is_job_complete):

    fakelibvirt.__dict__.pop('VIR_DOMAIN_BLOCK_REBASE_RELATIVE')
    self.stubs.Set(libvirt_driver, 'libvirt', fakelibvirt)
    instance = objects.Instance(**self.inst)
    snapshot_id = 'snapshot-1234'
    domain = FakeVirtDomain(fake_xml=self.dom_xml)
    self.mox.StubOutWithMock(domain, 'XMLDesc')
    domain.XMLDesc(flags=0).AndReturn(self.dom_xml)
    self.mox.StubOutWithMock(self.drvr._host, 'get_domain')
    self.mox.StubOutWithMock(domain, 'blockRebase')
    self.mox.StubOutWithMock(domain, 'blockCommit')
    self.drvr._host.get_domain(instance).AndReturn(domain)
    domain.blockRebase('vda', 'snap.img', 0, flags=0)
    self.mox.ReplayAll()
    mock_is_job_complete.side_effect = (False, True)
    self.drvr._volume_snapshot_delete(self.c, instance, self.volume_uuid, snapshot_id, self.delete_info_1)
    self.mox.VerifyAll()
    self.assertEqual(2, mock_is_job_complete.call_count)
    fakelibvirt.__dict__.update({'VIR_DOMAIN_BLOCK_REBASE_RELATIVE': 8})
