提交 343a27af 编写于 作者: N Naoya Horiguchi 提交者: Daniel Veillard

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
上级 1613912d
...@@ -163,6 +163,7 @@ Patches have also been contributed by: ...@@ -163,6 +163,7 @@ Patches have also been contributed by:
Minoru Usui <usui@mxm.nes.nec.co.jp> Minoru Usui <usui@mxm.nes.nec.co.jp>
Tiziano Mueller <dev-zero@gentoo.org> Tiziano Mueller <dev-zero@gentoo.org>
Thibault VINCENT <thibault.vincent@smartjog.com> Thibault VINCENT <thibault.vincent@smartjog.com>
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
[....send patches to get your name here....] [....send patches to get your name here....]
......
...@@ -1731,6 +1731,7 @@ networkStartNetworkDaemon(struct network_driver *driver, ...@@ -1731,6 +1731,7 @@ networkStartNetworkDaemon(struct network_driver *driver,
goto err5; goto err5;
} }
VIR_INFO(_("Starting up network '%s'"), network->def->name);
network->active = 1; network->active = 1;
return 0; return 0;
...@@ -2104,6 +2105,7 @@ static virNetworkPtr networkCreate(virConnectPtr conn, const char *xml) { ...@@ -2104,6 +2105,7 @@ static virNetworkPtr networkCreate(virConnectPtr conn, const char *xml) {
goto cleanup; goto cleanup;
} }
VIR_INFO(_("Creating network '%s'"), network->def->name);
ret = virGetNetwork(conn, network->def->name, network->def->uuid); ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup: cleanup:
...@@ -2175,6 +2177,7 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) { ...@@ -2175,6 +2177,7 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
dnsmasqContextFree(dctx); dnsmasqContextFree(dctx);
} }
VIR_INFO(_("Defining network '%s'"), network->def->name);
ret = virGetNetwork(conn, network->def->name, network->def->uuid); ret = virGetNetwork(conn, network->def->name, network->def->uuid);
cleanup: cleanup:
...@@ -2261,6 +2264,7 @@ static int networkUndefine(virNetworkPtr net) { ...@@ -2261,6 +2264,7 @@ static int networkUndefine(virNetworkPtr net) {
} }
VIR_INFO(_("Undefining network '%s'"), network->def->name);
virNetworkRemoveInactive(&driver->networks, virNetworkRemoveInactive(&driver->networks,
network); network);
network = NULL; network = NULL;
......
...@@ -2146,7 +2146,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags) ...@@ -2146,7 +2146,7 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
if (name == NULL) if (name == NULL)
goto cleanup; goto cleanup;
VIR_DEBUG("Saving state to %s", name); VIR_INFO("Saving state to %s", name);
compressed = QEMUD_SAVE_FORMAT_RAW; compressed = QEMUD_SAVE_FORMAT_RAW;
ret = qemudDomainSaveFlag(driver, dom, vm, name, compressed); ret = qemudDomainSaveFlag(driver, dom, vm, name, compressed);
...@@ -3637,6 +3637,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { ...@@ -3637,6 +3637,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
if (virDomainSaveConfig(driver->configDir, if (virDomainSaveConfig(driver->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
VIR_INFO(_("Defining domain '%s'"), vm->def->name);
virDomainRemoveInactive(&driver->domains, virDomainRemoveInactive(&driver->domains,
vm); vm);
vm = NULL; vm = NULL;
...@@ -3649,6 +3650,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) { ...@@ -3649,6 +3650,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
VIR_DOMAIN_EVENT_DEFINED_ADDED : VIR_DOMAIN_EVENT_DEFINED_ADDED :
VIR_DOMAIN_EVENT_DEFINED_UPDATED); VIR_DOMAIN_EVENT_DEFINED_UPDATED);
VIR_INFO(_("Creating domain '%s'"), vm->def->name);
dom = virGetDomain(conn, vm->def->name, vm->def->uuid); dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (dom) dom->id = vm->def->id; if (dom) dom->id = vm->def->id;
...@@ -3698,6 +3700,7 @@ static int qemudDomainUndefine(virDomainPtr dom) { ...@@ -3698,6 +3700,7 @@ static int qemudDomainUndefine(virDomainPtr dom) {
VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED,
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED); VIR_DOMAIN_EVENT_UNDEFINED_REMOVED);
VIR_INFO(_("Undefining domain '%s'"), vm->def->name);
virDomainRemoveInactive(&driver->domains, virDomainRemoveInactive(&driver->domains,
vm); vm);
vm = NULL; vm = NULL;
......
...@@ -551,6 +551,7 @@ storagePoolCreate(virConnectPtr conn, ...@@ -551,6 +551,7 @@ storagePoolCreate(virConnectPtr conn,
pool = NULL; pool = NULL;
goto cleanup; goto cleanup;
} }
VIR_INFO(_("Creating storage pool '%s'"), pool->def->name);
pool->active = 1; pool->active = 1;
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid); ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid);
...@@ -592,6 +593,7 @@ storagePoolDefine(virConnectPtr conn, ...@@ -592,6 +593,7 @@ storagePoolDefine(virConnectPtr conn,
} }
def = NULL; def = NULL;
VIR_INFO(_("Defining storage pool '%s'"), pool->def->name);
ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid); ret = virGetStoragePool(conn, pool->def->name, pool->def->uuid);
cleanup: cleanup:
...@@ -641,6 +643,7 @@ storagePoolUndefine(virStoragePoolPtr obj) { ...@@ -641,6 +643,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
VIR_FREE(pool->configFile); VIR_FREE(pool->configFile);
VIR_FREE(pool->autostartLink); VIR_FREE(pool->autostartLink);
VIR_INFO(_("Undefining storage pool '%s'"), pool->def->name);
virStoragePoolObjRemove(&driver->pools, pool); virStoragePoolObjRemove(&driver->pools, pool);
pool = NULL; pool = NULL;
ret = 0; ret = 0;
...@@ -688,6 +691,7 @@ storagePoolStart(virStoragePoolPtr obj, ...@@ -688,6 +691,7 @@ storagePoolStart(virStoragePoolPtr obj,
goto cleanup; goto cleanup;
} }
VIR_INFO(_("Starting up storage pool '%s'"), pool->def->name);
pool->active = 1; pool->active = 1;
ret = 0; ret = 0;
...@@ -775,6 +779,7 @@ storagePoolDestroy(virStoragePoolPtr obj) { ...@@ -775,6 +779,7 @@ storagePoolDestroy(virStoragePoolPtr obj) {
virStoragePoolObjClearVols(pool); virStoragePoolObjClearVols(pool);
pool->active = 0; pool->active = 0;
VIR_INFO(_("Shutting down storage pool '%s'"), pool->def->name);
if (pool->configFile == NULL) { if (pool->configFile == NULL) {
virStoragePoolObjRemove(&driver->pools, pool); virStoragePoolObjRemove(&driver->pools, pool);
...@@ -831,6 +836,7 @@ storagePoolDelete(virStoragePoolPtr obj, ...@@ -831,6 +836,7 @@ storagePoolDelete(virStoragePoolPtr obj,
} }
if (backend->deletePool(obj->conn, pool, flags) < 0) if (backend->deletePool(obj->conn, pool, flags) < 0)
goto cleanup; goto cleanup;
VIR_INFO(_("Deleting storage pool '%s'"), pool->def->name);
ret = 0; ret = 0;
cleanup: cleanup:
...@@ -1356,6 +1362,8 @@ storageVolumeCreateXML(virStoragePoolPtr obj, ...@@ -1356,6 +1362,8 @@ storageVolumeCreateXML(virStoragePoolPtr obj,
} }
VIR_INFO(_("Creating volume '%s' in storage pool '%s'"),
volobj->name, pool->def->name);
ret = volobj; ret = volobj;
volobj = NULL; volobj = NULL;
voldef = NULL; voldef = NULL;
...@@ -1514,6 +1522,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj, ...@@ -1514,6 +1522,8 @@ storageVolumeCreateXMLFrom(virStoragePoolPtr obj,
goto cleanup; goto cleanup;
} }
VIR_INFO(_("Creating volume '%s' in storage pool '%s'"),
volobj->name, pool->def->name);
ret = volobj; ret = volobj;
volobj = NULL; volobj = NULL;
...@@ -1918,6 +1928,8 @@ storageVolumeDelete(virStorageVolPtr obj, ...@@ -1918,6 +1928,8 @@ storageVolumeDelete(virStorageVolPtr obj,
for (i = 0 ; i < pool->volumes.count ; i++) { for (i = 0 ; i < pool->volumes.count ; i++) {
if (pool->volumes.objs[i] == vol) { if (pool->volumes.objs[i] == vol) {
VIR_INFO(_("Deleting volume '%s' from storage pool '%s'"),
vol->name, pool->def->name);
virStorageVolDefFree(vol); virStorageVolDefFree(vol);
vol = NULL; vol = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册