提交 e2038d2d 编写于 作者: D Daniel P. Berrange

Replace use of umlReportError with virReportError

Update the UML driver to use virReportError instead of the
umlReportError custom macro
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 9093ab77
...@@ -522,7 +522,6 @@ msg_gen_function += regerror ...@@ -522,7 +522,6 @@ msg_gen_function += regerror
msg_gen_function += remoteError msg_gen_function += remoteError
msg_gen_function += statsError msg_gen_function += statsError
msg_gen_function += streamsReportError msg_gen_function += streamsReportError
msg_gen_function += umlReportError
msg_gen_function += vah_error msg_gen_function += vah_error
msg_gen_function += vah_warning msg_gen_function += vah_warning
msg_gen_function += vboxError msg_gen_function += vboxError
......
...@@ -87,7 +87,7 @@ virCapsPtr umlCapsInit(void) { ...@@ -87,7 +87,7 @@ virCapsPtr umlCapsInit(void) {
VIR_WARN("Failed to get host power management capabilities"); VIR_WARN("Failed to get host power management capabilities");
if (virGetHostUUID(caps->host.host_uuid)) { if (virGetHostUUID(caps->host.host_uuid)) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot get the host uuid")); "%s", _("cannot get the host uuid"));
goto error; goto error;
} }
...@@ -188,19 +188,19 @@ umlBuildCommandLineNet(virConnectPtr conn, ...@@ -188,19 +188,19 @@ umlBuildCommandLineNet(virConnectPtr conn,
virBufferAdd(&buf, def->ifname, -1); virBufferAdd(&buf, def->ifname, -1);
} }
if (def->data.ethernet.ipaddr) { if (def->data.ethernet.ipaddr) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet interface")); _("IP address not supported for ethernet interface"));
goto error; goto error;
} }
break; break;
case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_SERVER:
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP server networking type not supported")); _("TCP server networking type not supported"));
goto error; goto error;
case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_CLIENT:
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("TCP client networking type not supported")); _("TCP client networking type not supported"));
goto error; goto error;
...@@ -215,7 +215,7 @@ umlBuildCommandLineNet(virConnectPtr conn, ...@@ -215,7 +215,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
virNetworkPtr network = virNetworkLookupByName(conn, virNetworkPtr network = virNetworkLookupByName(conn,
def->data.network.name); def->data.network.name);
if (!network) { if (!network) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Network '%s' not found"), _("Network '%s' not found"),
def->data.network.name); def->data.network.name);
goto error; goto error;
...@@ -246,17 +246,17 @@ umlBuildCommandLineNet(virConnectPtr conn, ...@@ -246,17 +246,17 @@ umlBuildCommandLineNet(virConnectPtr conn,
break; break;
case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_INTERNAL:
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("internal networking type not supported")); _("internal networking type not supported"));
goto error; goto error;
case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_DIRECT:
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("direct networking type not supported")); _("direct networking type not supported"));
goto error; goto error;
case VIR_DOMAIN_NET_TYPE_HOSTDEV: case VIR_DOMAIN_NET_TYPE_HOSTDEV:
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("hostdev networking type not supported")); _("hostdev networking type not supported"));
goto error; goto error;
...@@ -265,7 +265,7 @@ umlBuildCommandLineNet(virConnectPtr conn, ...@@ -265,7 +265,7 @@ umlBuildCommandLineNet(virConnectPtr conn,
} }
if (def->script) { if (def->script) {
umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("interface script execution not supported by this driver")); _("interface script execution not supported by this driver"));
goto error; goto error;
} }
...@@ -331,7 +331,7 @@ umlBuildCommandLineChr(virDomainChrDefPtr def, ...@@ -331,7 +331,7 @@ umlBuildCommandLineChr(virDomainChrDefPtr def,
case VIR_DOMAIN_CHR_TYPE_TCP: case VIR_DOMAIN_CHR_TYPE_TCP:
if (def->source.data.tcp.listen != 1) { if (def->source.data.tcp.listen != 1) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only TCP listen is supported for chr device")); _("only TCP listen is supported for chr device"));
return NULL; return NULL;
} }
...@@ -370,7 +370,7 @@ umlBuildCommandLineChr(virDomainChrDefPtr def, ...@@ -370,7 +370,7 @@ umlBuildCommandLineChr(virDomainChrDefPtr def,
case VIR_DOMAIN_CHR_TYPE_UDP: case VIR_DOMAIN_CHR_TYPE_UDP:
case VIR_DOMAIN_CHR_TYPE_UNIX: case VIR_DOMAIN_CHR_TYPE_UNIX:
default: default:
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported chr device type %d"), def->source.type); _("unsupported chr device type %d"), def->source.type);
break; break;
} }
...@@ -433,7 +433,7 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn, ...@@ -433,7 +433,7 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn,
virDomainDiskDefPtr disk = vm->def->disks[i]; virDomainDiskDefPtr disk = vm->def->disks[i];
if (!STRPREFIX(disk->dst, "ubd")) { if (!STRPREFIX(disk->dst, "ubd")) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported disk type '%s'"), disk->dst); _("unsupported disk type '%s'"), disk->dst);
goto error; goto error;
} }
......
...@@ -70,11 +70,6 @@ struct uml_driver { ...@@ -70,11 +70,6 @@ struct uml_driver {
virHashTablePtr autodestroy; virHashTablePtr autodestroy;
}; };
# define umlReportError(code, ...) \
virReportErrorHelper(VIR_FROM_UML, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
virCapsPtr umlCapsInit (void); virCapsPtr umlCapsInit (void);
virCommandPtr umlBuildCommandLine(virConnectPtr conn, virCommandPtr umlBuildCommandLine(virConnectPtr conn,
......
...@@ -789,7 +789,7 @@ static int umlMonitorAddress(const struct uml_driver *driver, ...@@ -789,7 +789,7 @@ static int umlMonitorAddress(const struct uml_driver *driver,
memset(addr, 0, sizeof(*addr)); memset(addr, 0, sizeof(*addr));
addr->sun_family = AF_UNIX; addr->sun_family = AF_UNIX;
if (virStrcpyStatic(addr->sun_path, sockname) == NULL) { if (virStrcpyStatic(addr->sun_path, sockname) == NULL) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unix path %s too long for destination"), sockname); _("Unix path %s too long for destination"), sockname);
retval = -1; retval = -1;
} }
...@@ -889,7 +889,7 @@ static int umlMonitorCommand(const struct uml_driver *driver, ...@@ -889,7 +889,7 @@ static int umlMonitorCommand(const struct uml_driver *driver,
return -1; return -1;
} }
if (virStrcpyStatic(req.data, cmd) == NULL) { if (virStrcpyStatic(req.data, cmd) == NULL) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Command %s too long for destination"), cmd); _("Command %s too long for destination"), cmd);
return -1; return -1;
} }
...@@ -974,13 +974,13 @@ static int umlStartVMDaemon(virConnectPtr conn, ...@@ -974,13 +974,13 @@ static int umlStartVMDaemon(virConnectPtr conn,
size_t i; size_t i;
if (virDomainObjIsActive(vm)) { if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s", virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("VM is already active")); _("VM is already active"));
return -1; return -1;
} }
if (!vm->def->os.kernel) { if (!vm->def->os.kernel) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("no kernel specified")); _("no kernel specified"));
return -1; return -1;
} }
...@@ -1155,14 +1155,14 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn, ...@@ -1155,14 +1155,14 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
if (uml_driver->privileged) { if (uml_driver->privileged) {
if (STRNEQ (conn->uri->path, "/system") && if (STRNEQ (conn->uri->path, "/system") &&
STRNEQ (conn->uri->path, "/session")) { STRNEQ (conn->uri->path, "/session")) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected UML URI path '%s', try uml:///system"), _("unexpected UML URI path '%s', try uml:///system"),
conn->uri->path); conn->uri->path);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }
} else { } else {
if (STRNEQ (conn->uri->path, "/session")) { if (STRNEQ (conn->uri->path, "/session")) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected UML URI path '%s', try uml:///session"), _("unexpected UML URI path '%s', try uml:///session"),
conn->uri->path); conn->uri->path);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
...@@ -1171,7 +1171,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn, ...@@ -1171,7 +1171,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
/* URI was good, but driver isn't active */ /* URI was good, but driver isn't active */
if (uml_driver == NULL) { if (uml_driver == NULL) {
umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("uml state driver is not active")); _("uml state driver is not active"));
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }
...@@ -1284,7 +1284,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn, ...@@ -1284,7 +1284,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, NULL); virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup; goto cleanup;
} }
...@@ -1308,7 +1308,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn, ...@@ -1308,7 +1308,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, NULL); virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup; goto cleanup;
} }
...@@ -1332,7 +1332,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn, ...@@ -1332,7 +1332,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, NULL); virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup; goto cleanup;
} }
...@@ -1356,7 +1356,7 @@ static int umlDomainIsActive(virDomainPtr dom) ...@@ -1356,7 +1356,7 @@ static int umlDomainIsActive(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid); obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!obj) { if (!obj) {
umlReportError(VIR_ERR_NO_DOMAIN, NULL); virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup; goto cleanup;
} }
ret = virDomainObjIsActive(obj); ret = virDomainObjIsActive(obj);
...@@ -1378,7 +1378,7 @@ static int umlDomainIsPersistent(virDomainPtr dom) ...@@ -1378,7 +1378,7 @@ static int umlDomainIsPersistent(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid); obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!obj) { if (!obj) {
umlReportError(VIR_ERR_NO_DOMAIN, NULL); virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup; goto cleanup;
} }
ret = obj->persistent; ret = obj->persistent;
...@@ -1399,7 +1399,7 @@ static int umlDomainIsUpdated(virDomainPtr dom) ...@@ -1399,7 +1399,7 @@ static int umlDomainIsUpdated(virDomainPtr dom)
obj = virDomainFindByUUID(&driver->domains, dom->uuid); obj = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!obj) { if (!obj) {
umlReportError(VIR_ERR_NO_DOMAIN, NULL); virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup; goto cleanup;
} }
ret = obj->updated; ret = obj->updated;
...@@ -1421,7 +1421,7 @@ static int umlGetVersion(virConnectPtr conn, unsigned long *version) { ...@@ -1421,7 +1421,7 @@ static int umlGetVersion(virConnectPtr conn, unsigned long *version) {
uname(&ut); uname(&ut);
if (virParseVersionString(ut.release, &driver->umlVersion, true) < 0) { if (virParseVersionString(ut.release, &driver->umlVersion, true) < 0) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse version %s"), ut.release); _("cannot parse version %s"), ut.release);
goto cleanup; goto cleanup;
} }
...@@ -1520,14 +1520,14 @@ static int umlDomainShutdownFlags(virDomainPtr dom, ...@@ -1520,14 +1520,14 @@ static int umlDomainShutdownFlags(virDomainPtr dom,
vm = virDomainFindByID(&driver->domains, dom->id); vm = virDomainFindByID(&driver->domains, dom->id);
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id); _("no domain with matching id %d"), dom->id);
goto cleanup; goto cleanup;
} }
#if 0 #if 0
if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) { if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) {
umlReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("shutdown operation failed")); _("shutdown operation failed"));
goto cleanup; goto cleanup;
} }
...@@ -1561,7 +1561,7 @@ umlDomainDestroyFlags(virDomainPtr dom, ...@@ -1561,7 +1561,7 @@ umlDomainDestroyFlags(virDomainPtr dom,
umlDriverLock(driver); umlDriverLock(driver);
vm = virDomainFindByID(&driver->domains, dom->id); vm = virDomainFindByID(&driver->domains, dom->id);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching id %d"), dom->id); _("no domain with matching id %d"), dom->id);
goto cleanup; goto cleanup;
} }
...@@ -1603,7 +1603,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) { ...@@ -1603,7 +1603,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
...@@ -1633,7 +1633,7 @@ umlDomainGetMaxMemory(virDomainPtr dom) ...@@ -1633,7 +1633,7 @@ umlDomainGetMaxMemory(virDomainPtr dom)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
...@@ -1658,13 +1658,13 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) { ...@@ -1658,13 +1658,13 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (newmax < vm->def->mem.cur_balloon) { if (newmax < vm->def->mem.cur_balloon) {
umlReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("cannot set max memory lower than current memory")); _("cannot set max memory lower than current memory"));
goto cleanup; goto cleanup;
} }
...@@ -1691,19 +1691,19 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) { ...@@ -1691,19 +1691,19 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (virDomainObjIsActive(vm)) { if (virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s", virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot set memory of an active domain")); _("cannot set memory of an active domain"));
goto cleanup; goto cleanup;
} }
if (newmem > vm->def->mem.max_balloon) { if (newmem > vm->def->mem.max_balloon) {
umlReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("cannot set memory higher than max memory")); _("cannot set memory higher than max memory"));
goto cleanup; goto cleanup;
} }
...@@ -1728,7 +1728,7 @@ static int umlDomainGetInfo(virDomainPtr dom, ...@@ -1728,7 +1728,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
...@@ -1739,7 +1739,7 @@ static int umlDomainGetInfo(virDomainPtr dom, ...@@ -1739,7 +1739,7 @@ static int umlDomainGetInfo(virDomainPtr dom,
info->cpuTime = 0; info->cpuTime = 0;
} else { } else {
if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) { if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) {
umlReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("cannot read cputime for domain")); _("cannot read cputime for domain"));
goto cleanup; goto cleanup;
} }
...@@ -1774,7 +1774,7 @@ umlDomainGetState(virDomainPtr dom, ...@@ -1774,7 +1774,7 @@ umlDomainGetState(virDomainPtr dom,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
...@@ -1803,7 +1803,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom, ...@@ -1803,7 +1803,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
...@@ -1855,7 +1855,7 @@ static int umlDomainStartWithFlags(virDomainPtr dom, unsigned int flags) { ...@@ -1855,7 +1855,7 @@ static int umlDomainStartWithFlags(virDomainPtr dom, unsigned int flags) {
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
...@@ -1934,13 +1934,13 @@ static int umlDomainUndefineFlags(virDomainPtr dom, ...@@ -1934,13 +1934,13 @@ static int umlDomainUndefineFlags(virDomainPtr dom,
umlDriverLock(driver); umlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
if (!vm->persistent) { if (!vm->persistent) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s", virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot undefine transient domain")); _("cannot undefine transient domain"));
goto cleanup; goto cleanup;
} }
...@@ -1980,14 +1980,14 @@ static int umlDomainAttachUmlDisk(struct uml_driver *driver, ...@@ -1980,14 +1980,14 @@ static int umlDomainAttachUmlDisk(struct uml_driver *driver,
for (i = 0 ; i < vm->def->ndisks ; i++) { for (i = 0 ; i < vm->def->ndisks ; i++) {
if (STREQ(vm->def->disks[i]->dst, disk->dst)) { if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
umlReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("target %s already exists"), disk->dst); _("target %s already exists"), disk->dst);
return -1; return -1;
} }
} }
if (!disk->src) { if (!disk->src) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("disk source path is missing")); "%s", _("disk source path is missing"));
goto error; goto error;
} }
...@@ -2034,13 +2034,13 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml) ...@@ -2034,13 +2034,13 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
if (!vm) { if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot attach device on inactive domain")); "%s", _("cannot attach device on inactive domain"));
goto cleanup; goto cleanup;
} }
...@@ -2057,12 +2057,12 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml) ...@@ -2057,12 +2057,12 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml)
if (ret == 0) if (ret == 0)
dev->data.disk = NULL; dev->data.disk = NULL;
} else { } else {
umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk bus '%s' cannot be hotplugged."), _("disk bus '%s' cannot be hotplugged."),
virDomainDiskBusTypeToString(dev->data.disk->bus)); virDomainDiskBusTypeToString(dev->data.disk->bus));
} }
} else { } else {
umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("device type '%s' cannot be attached"), _("device type '%s' cannot be attached"),
virDomainDeviceTypeToString(dev->type)); virDomainDeviceTypeToString(dev->type));
goto cleanup; goto cleanup;
...@@ -2086,7 +2086,7 @@ umlDomainAttachDeviceFlags(virDomainPtr dom, ...@@ -2086,7 +2086,7 @@ umlDomainAttachDeviceFlags(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
umlReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot modify the persistent configuration of a domain")); "%s", _("cannot modify the persistent configuration of a domain"));
return -1; return -1;
} }
...@@ -2111,7 +2111,7 @@ static int umlDomainDetachUmlDisk(struct uml_driver *driver, ...@@ -2111,7 +2111,7 @@ static int umlDomainDetachUmlDisk(struct uml_driver *driver,
} }
if (i == vm->def->ndisks) { if (i == vm->def->ndisks) {
umlReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("disk %s not found"), dev->data.disk->dst); _("disk %s not found"), dev->data.disk->dst);
return -1; return -1;
} }
...@@ -2152,13 +2152,13 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) { ...@@ -2152,13 +2152,13 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) {
if (!vm) { if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot detach device on inactive domain")); "%s", _("cannot detach device on inactive domain"));
goto cleanup; goto cleanup;
} }
...@@ -2173,11 +2173,11 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) { ...@@ -2173,11 +2173,11 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) {
if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_UML) if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_UML)
ret = umlDomainDetachUmlDisk(driver, vm, dev); ret = umlDomainDetachUmlDisk(driver, vm, dev);
else { else {
umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("This type of disk cannot be hot unplugged")); _("This type of disk cannot be hot unplugged"));
} }
} else { } else {
umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("This type of device cannot be hot unplugged")); "%s", _("This type of device cannot be hot unplugged"));
} }
...@@ -2198,7 +2198,7 @@ umlDomainDetachDeviceFlags(virDomainPtr dom, ...@@ -2198,7 +2198,7 @@ umlDomainDetachDeviceFlags(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
umlReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("cannot modify the persistent configuration of a domain")); "%s", _("cannot modify the persistent configuration of a domain"));
return -1; return -1;
} }
...@@ -2217,7 +2217,7 @@ static int umlDomainGetAutostart(virDomainPtr dom, ...@@ -2217,7 +2217,7 @@ static int umlDomainGetAutostart(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
...@@ -2243,13 +2243,13 @@ static int umlDomainSetAutostart(virDomainPtr dom, ...@@ -2243,13 +2243,13 @@ static int umlDomainSetAutostart(virDomainPtr dom,
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
if (!vm->persistent) { if (!vm->persistent) {
umlReportError(VIR_ERR_OPERATION_INVALID, "%s", virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot set autostart for transient domain")); _("cannot set autostart for transient domain"));
goto cleanup; goto cleanup;
} }
...@@ -2318,20 +2318,20 @@ umlDomainBlockPeek(virDomainPtr dom, ...@@ -2318,20 +2318,20 @@ umlDomainBlockPeek(virDomainPtr dom,
umlDriverUnlock(driver); umlDriverUnlock(driver);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, "%s", virReportError(VIR_ERR_NO_DOMAIN, "%s",
_("no domain with matching uuid")); _("no domain with matching uuid"));
goto cleanup; goto cleanup;
} }
if (!path || path[0] == '\0') { if (!path || path[0] == '\0') {
umlReportError(VIR_ERR_INVALID_ARG, "%s", virReportError(VIR_ERR_INVALID_ARG, "%s",
_("NULL or empty path")); _("NULL or empty path"));
goto cleanup; goto cleanup;
} }
/* Check the path belongs to this domain. */ /* Check the path belongs to this domain. */
if (!(actual = virDomainDiskPathByName(vm->def, path))) { if (!(actual = virDomainDiskPathByName(vm->def, path))) {
umlReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("invalid path '%s'"), path); _("invalid path '%s'"), path);
goto cleanup; goto cleanup;
} }
...@@ -2385,13 +2385,13 @@ umlDomainOpenConsole(virDomainPtr dom, ...@@ -2385,13 +2385,13 @@ umlDomainOpenConsole(virDomainPtr dom,
virUUIDFormat(dom->uuid, uuidstr); virUUIDFormat(dom->uuid, uuidstr);
vm = virDomainFindByUUID(&driver->domains, dom->uuid); vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) { if (!vm) {
umlReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching uuid '%s'"), uuidstr); _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup; goto cleanup;
} }
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
umlReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running")); "%s", _("domain is not running"));
goto cleanup; goto cleanup;
} }
...@@ -2412,14 +2412,14 @@ umlDomainOpenConsole(virDomainPtr dom, ...@@ -2412,14 +2412,14 @@ umlDomainOpenConsole(virDomainPtr dom,
} }
if (!chr) { if (!chr) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find console device '%s'"), _("cannot find console device '%s'"),
dev_name ? dev_name : _("default")); dev_name ? dev_name : _("default"));
goto cleanup; goto cleanup;
} }
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
umlReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("character device %s is not using a PTY"), dev_name); _("character device %s is not using a PTY"), dev_name);
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册