'Tests that the xml is logged when creating the domain with flags
fails'

def test_create_domain_with_flags_fails(self):

    fake_xml = '<test>this    is    a    test</test>'
    fake_domain = FakeVirtDomain(fake_xml)
    def fake_createWithFlags(launch_flags):
        raise fakelibvirt.libvirtError('virDomainCreateWithFlags()    failed')
    self.log_error_called = False
    def fake_error(msg, *args, **kwargs):
        self.log_error_called = True
        self.assertIn(fake_xml, (msg % args))
    self.stubs.Set(fake_domain, 'createWithFlags', fake_createWithFlags)
    self.stubs.Set(nova.virt.libvirt.guest.LOG, 'error', fake_error)
    self.create_fake_libvirt_mock()
    self.mox.ReplayAll()
    drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
    self.assertRaises(fakelibvirt.libvirtError, drvr._create_domain, domain=fake_domain)
    self.assertTrue(self.log_error_called)
