Currently libvirt's logging is so poor that it's difficult to determine
what was happening when a proglem occurred (especially on someone's
machines you don't know the detail.) This patch helps us to do that
by making additional logging available for the following events:
creating/defining/undefining domains
creating/defining/undefining/starting/stopping networks
creating/defining/undefining/starting/stopping storage pools
creating/defining/undefining/starting/stopping storage volumes.
Signed-off-by: Naoya Horiguchi <n-horiguchi(a)ah.jp.nec.com>
---
src/network/bridge_driver.c | 4 ++++
src/qemu/qemu_driver.c | 5 ++++-
src/storage/storage_driver.c | 12 ++++++++++++
3 files changed, 20 insertions(+), 1 deletions(-)
diff --git v0.8.8/src/network/bridge_driver.c v0.8.8/src/network/bridge_driver.c
index c4ee1e8..097e83a 100644
--- v0.8.8/src/network/bridge_driver.c
+++ v0.8.8/src/network/bridge_driver.c
@@ -1656,6 +1656,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
goto err5;
}
+ VIR_INFO(_("Starting up network '%s'"), network->def->name);
network->active = 1;
return 0;
@@ -2000,6 +2001,7 @@ static virNetworkPtr networkCreate(virConnectPtr conn, const char
*xml) {
goto cleanup;
}
+ VIR_INFO(_("Creating network '%s'"), network->def->name);
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup:
@@ -2069,6 +2071,7 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char
*xml) {
dnsmasqContextFree(dctx);
}
+ VIR_INFO(_("Defining network '%s'"), network->def->name);
ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup:
@@ -2148,6 +2151,7 @@ static int networkUndefine(virNetworkPtr net) {
}
+ VIR_INFO(_("Undefining network '%s'"), network->def->name);
virNetworkRemoveInactive(&driver->networks,
network);
network = NULL;
diff --git v0.8.8/src/qemu/qemu_driver.c v0.8.8/src/qemu/qemu_driver.c
index ab664a0..3b30d0f 100644
--- v0.8.8/src/qemu/qemu_driver.c
+++ v0.8.8/src/qemu/qemu_driver.c
@@ -3642,6 +3642,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char
*xml,
VIR_DOMAIN_EVENT_STARTED_BOOTED);
qemuDomainStartAudit(vm, "booted", true);
+ VIR_INFO(_("Creating domain '%s'"), vm->def->name);
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom) dom->id = vm->def->id;
@@ -4711,7 +4712,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
if (name == NULL)
goto cleanup;
- VIR_DEBUG("Saving state to %s", name);
+ VIR_INFO("Saving state to %s", name);
compressed = QEMUD_SAVE_FORMAT_RAW;
ret = qemudDomainSaveFlag(driver, dom, vm, name, compressed);
@@ -6438,6 +6439,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char
*xml) {
if (virDomainSaveConfig(driver->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) {
+ VIR_INFO(_("Defining domain '%s'"), vm->def->name);
virDomainRemoveInactive(&driver->domains,
vm);
vm = NULL;
@@ -6499,6 +6501,7 @@ static int qemudDomainUndefine(virDomainPtr dom) {
VIR_DOMAIN_EVENT_UNDEFINED,
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
+ VIR_INFO(_("Undefining domain '%s'"), vm->def->name);
virDomainRemoveInactive(&driver->domains,
vm);
vm = NULL;
diff --git v0.8.8/src/storage/storage_driver.c v0.8.8/src/storage/storage_driver.c
index 5373025..162ef7f 100644
--- v0.8.8/src/storage/storage_driver.c
+++ v0.8.8/src/storage/storage_driver.c
@@ -550,6 +550,7 @@ storagePoolCreate(virConnectPtr conn,
pool = NULL;
goto cleanup;
}
+ VIR_INFO(_("Creating storage pool '%s'"), pool->def->name);
pool->active = 1;
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid);
@@ -591,6 +592,7 @@ storagePoolDefine(virConnectPtr conn,
}
def = NULL;
+ VIR_INFO(_("Defining storage pool '%s'"), pool->def->name);
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid);
cleanup:
@@ -640,6 +642,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
VIR_FREE(pool->configFile);
VIR_FREE(pool->autostartLink);
+ VIR_INFO(_("Undefining storage pool '%s'"),
pool->def->name);
virStoragePoolObjRemove(&driver->pools, pool);
pool = NULL;
ret = 0;
@@ -687,6 +690,7 @@ storagePoolStart(virStoragePoolPtr obj,
goto cleanup;
}
+ VIR_INFO(_("Starting up storage pool '%s'"),
pool->def->name);
pool->active = 1;
ret = 0;
@@ -774,6 +778,7 @@ storagePoolDestroy(virStoragePoolPtr obj) {
virStoragePoolObjClearVols(pool);
pool->active = 0;
+ VIR_INFO(_("Shutting down storage pool '%s'"),
pool->def->name);
if (pool->configFile == NULL) {
virStoragePoolObjRemove(&driver->pools, pool);
@@ -830,6 +835,7 @@ storagePoolDelete(virStoragePoolPtr obj,
}
if (backend->deletePool(obj->conn, pool, flags) < 0)
goto cleanup;
+ VIR_INFO(_("Deleting storage pool '%s'"), pool->def->name);
ret = 0;
cleanup:
@@ -1355,6 +1361,8 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
}
+ VIR_INFO(_("Creating volume '%s' in storage pool '%s'"),
+ volobj->name, pool->def->name);
ret = volobj;
volobj = NULL;
voldef = NULL;
@@ -1513,6 +1521,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
goto cleanup;
}
+ VIR_INFO(_("Creating volume '%s' in storage pool '%s'"),
+ volobj->name, pool->def->name);
ret = volobj;
volobj = NULL;
@@ -1790,6 +1800,8 @@ storageVolumeDelete(virStorageVolPtr obj,
for (i = 0 ; i < pool->volumes.count ; i++) {
if (pool->volumes.objs[i] == vol) {
+ VIR_INFO(_("Deleting volume '%s' from storage pool
'%s'"),
+ vol->name, pool->def->name);
virStorageVolDefFree(vol);
vol = NULL;
--
1.7.3.4