storage: Replace storageLog with VIR_ERROR

This commit is contained in:
Matthias Bolte 2010-01-31 18:12:05 +01:00
parent 3ed42b0098
commit bfc34dca3b

View File

@ -40,11 +40,10 @@
#include "storage_conf.h" #include "storage_conf.h"
#include "memory.h" #include "memory.h"
#include "storage_backend.h" #include "storage_backend.h"
#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE #define VIR_FROM_THIS VIR_FROM_STORAGE
#define storageLog(msg...) fprintf(stderr, msg)
static virStorageDriverStatePtr driverState; static virStorageDriverStatePtr driverState;
static int storageDriverShutdown(void); static int storageDriverShutdown(void);
@ -70,8 +69,7 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
!virStoragePoolObjIsActive(pool)) { !virStoragePoolObjIsActive(pool)) {
virStorageBackendPtr backend; virStorageBackendPtr backend;
if ((backend = virStorageBackendForType(pool->def->type)) == NULL) { if ((backend = virStorageBackendForType(pool->def->type)) == NULL) {
storageLog("Missing backend %d", VIR_ERROR("Missing backend %d", pool->def->type);
pool->def->type);
virStoragePoolObjUnlock(pool); virStoragePoolObjUnlock(pool);
continue; continue;
} }
@ -79,9 +77,9 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
if (backend->startPool && if (backend->startPool &&
backend->startPool(NULL, pool) < 0) { backend->startPool(NULL, pool) < 0) {
virErrorPtr err = virGetLastError(); virErrorPtr err = virGetLastError();
storageLog("Failed to autostart storage pool '%s': %s", VIR_ERROR("Failed to autostart storage pool '%s': %s",
pool->def->name, err ? err->message : pool->def->name, err ? err->message :
"no error message found"); "no error message found");
virStoragePoolObjUnlock(pool); virStoragePoolObjUnlock(pool);
continue; continue;
} }
@ -90,9 +88,9 @@ storageDriverAutostart(virStorageDriverStatePtr driver) {
virErrorPtr err = virGetLastError(); virErrorPtr err = virGetLastError();
if (backend->stopPool) if (backend->stopPool)
backend->stopPool(NULL, pool); backend->stopPool(NULL, pool);
storageLog("Failed to autostart storage pool '%s': %s", VIR_ERROR("Failed to autostart storage pool '%s': %s",
pool->def->name, err ? err->message : pool->def->name, err ? err->message :
"no error message found"); "no error message found");
virStoragePoolObjUnlock(pool); virStoragePoolObjUnlock(pool);
continue; continue;
} }
@ -132,7 +130,6 @@ storageDriverStartup(int privileged) {
goto error; goto error;
if (virAsprintf(&base, "%s/.libvirt", userdir) == -1) { if (virAsprintf(&base, "%s/.libvirt", userdir) == -1) {
storageLog("out of memory in virAsprintf");
VIR_FREE(userdir); VIR_FREE(userdir);
goto out_of_memory; goto out_of_memory;
} }
@ -175,7 +172,7 @@ storageDriverStartup(int privileged) {
return 0; return 0;
out_of_memory: out_of_memory:
storageLog("virStorageStartup: out of memory"); virReportOOMError(NULL);
error: error:
VIR_FREE(base); VIR_FREE(base);
storageDriverUnlock(driverState); storageDriverUnlock(driverState);
@ -635,7 +632,7 @@ storagePoolUndefine(virStoragePoolPtr obj) {
if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) { if (unlink(pool->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
char ebuf[1024]; char ebuf[1024];
storageLog("Failed to delete autostart link '%s': %s", VIR_ERROR("Failed to delete autostart link '%s': %s",
pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf)); pool->autostartLink, virStrerror(errno, ebuf, sizeof ebuf));
} }