extend logging to record configuration-related changes

Currently libvirt's default logging is limited and it is difficult to
determine what was happening when a proglem occurred (especially on a
machines where one don't know the detail.)  This patch helps 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.

* AUTHORS: add Naoya Horiguchi
* src/network/bridge_driver.c src/qemu/qemu_driver.c
  src/storage/storage_driver.c: provide more VIR_INFO logging
This commit is contained in:
Naoya Horiguchi 2011-03-30 09:19:47 +08:00 committed by Daniel Veillard
parent 1613912dc2
commit 343a27aff8
4 changed files with 21 additions and 1 deletions

View File

@ -163,6 +163,7 @@ Patches have also been contributed by:
Minoru Usui <usui@mxm.nes.nec.co.jp>
Tiziano Mueller <dev-zero@gentoo.org>
Thibault VINCENT <thibault.vincent@smartjog.com>
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
[....send patches to get your name here....]

View File

@ -1731,6 +1731,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
goto err5;
}
VIR_INFO(_("Starting up network '%s'"), network->def->name);
network->active = 1;
return 0;
@ -2104,6 +2105,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:
@ -2175,6 +2177,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:
@ -2261,6 +2264,7 @@ static int networkUndefine(virNetworkPtr net) {
}
VIR_INFO(_("Undefining network '%s'"), network->def->name);
virNetworkRemoveInactive(&driver->networks,
network);
network = NULL;

View File

@ -2146,7 +2146,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);
@ -3637,6 +3637,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;
@ -3649,6 +3650,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
VIR_DOMAIN_EVENT_DEFINED_ADDED :
VIR_DOMAIN_EVENT_DEFINED_UPDATED);
VIR_INFO(_("Creating domain '%s'"), vm->def->name);
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom) dom->id = vm->def->id;
@ -3698,6 +3700,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;

View File

@ -551,6 +551,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);
@ -592,6 +593,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:
@ -641,6 +643,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;
@ -688,6 +691,7 @@ storagePoolStart(virStoragePoolPtr obj,
goto cleanup;
}
VIR_INFO(_("Starting up storage pool '%s'"), pool->def->name);
pool->active = 1;
ret = 0;
@ -775,6 +779,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);
@ -831,6 +836,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:
@ -1356,6 +1362,8 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
}
VIR_INFO(_("Creating volume '%s' in storage pool '%s'"),
volobj->name, pool->def->name);
ret = volobj;
volobj = NULL;
voldef = NULL;
@ -1514,6 +1522,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
goto cleanup;
}
VIR_INFO(_("Creating volume '%s' in storage pool '%s'"),
volobj->name, pool->def->name);
ret = volobj;
volobj = NULL;
@ -1918,6 +1928,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;