mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 16:15:19 +00:00
Replace use of PHYP_ERROR with virReportError
Update the Power-Hypervisor driver to use virReportError instead of the PHYP_ERROR custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
d9de122052
commit
0653554bc5
1
cfg.mk
1
cfg.mk
@ -506,7 +506,6 @@ sc_avoid_attribute_unused_in_header:
|
||||
# |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
|
||||
|
||||
msg_gen_function =
|
||||
msg_gen_function += PHYP_ERROR
|
||||
msg_gen_function += VIR_ERROR
|
||||
msg_gen_function += VMX_ERROR
|
||||
msg_gen_function += lxcError
|
||||
|
@ -64,10 +64,6 @@
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_PHYP
|
||||
|
||||
#define PHYP_ERROR(code, ...) \
|
||||
virReportErrorHelper(VIR_FROM_PHYP, code, __FILE__, __FUNCTION__, \
|
||||
__LINE__, __VA_ARGS__)
|
||||
|
||||
/*
|
||||
* URI: phyp://user@[hmc|ivm]/managed_system
|
||||
* */
|
||||
@ -1002,7 +998,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
}
|
||||
} else {
|
||||
if (auth == NULL || auth->cb == NULL) {
|
||||
PHYP_ERROR(VIR_ERR_AUTH_FAILED,
|
||||
virReportError(VIR_ERR_AUTH_FAILED,
|
||||
"%s", _("No authentication callback provided."));
|
||||
goto err;
|
||||
}
|
||||
@ -1010,7 +1006,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
username = virAuthGetUsername(conn, auth, "ssh", NULL, conn->uri->server);
|
||||
|
||||
if (username == NULL) {
|
||||
PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s",
|
||||
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
||||
_("Username request failed"));
|
||||
goto err;
|
||||
}
|
||||
@ -1023,7 +1019,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
|
||||
ret = getaddrinfo(hostname, "22", &hints, &ai);
|
||||
if (ret != 0) {
|
||||
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Error while getting %s address info"), hostname);
|
||||
goto err;
|
||||
}
|
||||
@ -1040,7 +1036,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
|
||||
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to connect to %s"), hostname);
|
||||
freeaddrinfo(ai);
|
||||
goto err;
|
||||
@ -1060,7 +1056,7 @@ connected:
|
||||
while ((rc = libssh2_session_startup(session, sock)) ==
|
||||
LIBSSH2_ERROR_EAGAIN) ;
|
||||
if (rc) {
|
||||
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Failure establishing SSH session."));
|
||||
goto disconnect;
|
||||
}
|
||||
@ -1083,7 +1079,7 @@ keyboard_interactive:
|
||||
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED
|
||||
|| rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) {
|
||||
if (auth == NULL || auth->cb == NULL) {
|
||||
PHYP_ERROR(VIR_ERR_AUTH_FAILED,
|
||||
virReportError(VIR_ERR_AUTH_FAILED,
|
||||
"%s", _("No authentication callback provided."));
|
||||
goto disconnect;
|
||||
}
|
||||
@ -1091,7 +1087,7 @@ keyboard_interactive:
|
||||
password = virAuthGetPassword(conn, auth, "ssh", username, conn->uri->server);
|
||||
|
||||
if (password == NULL) {
|
||||
PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s",
|
||||
virReportError(VIR_ERR_AUTH_FAILED, "%s",
|
||||
_("Password request failed"));
|
||||
goto disconnect;
|
||||
}
|
||||
@ -1102,7 +1098,7 @@ keyboard_interactive:
|
||||
LIBSSH2_ERROR_EAGAIN) ;
|
||||
|
||||
if (rc) {
|
||||
PHYP_ERROR(VIR_ERR_AUTH_FAILED,
|
||||
virReportError(VIR_ERR_AUTH_FAILED,
|
||||
"%s", _("Authentication failed"));
|
||||
goto disconnect;
|
||||
} else
|
||||
@ -1157,7 +1153,7 @@ phypOpen(virConnectPtr conn,
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
if (conn->uri->server == NULL) {
|
||||
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Missing server name in phyp:// URI"));
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
@ -1198,7 +1194,7 @@ phypOpen(virConnectPtr conn,
|
||||
*char_ptr = '\0';
|
||||
|
||||
if (contains_specialcharacters(conn->uri->path)) {
|
||||
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s",
|
||||
_("Error parsing 'path'. Invalid characters."));
|
||||
goto failure;
|
||||
@ -1206,7 +1202,7 @@ phypOpen(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if ((session = openSSHSession(conn, auth, &internal_socket)) == NULL) {
|
||||
PHYP_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Error while opening SSH session."));
|
||||
goto failure;
|
||||
}
|
||||
@ -1445,7 +1441,7 @@ phypDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
char *managed_system = phyp_driver->managed_system;
|
||||
|
||||
if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -3585,27 +3581,27 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (!def->mem.cur_balloon) {
|
||||
PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Field <memory> on the domain XML file is missing or has "
|
||||
"invalid value."));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!def->mem.max_balloon) {
|
||||
PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Field <currentMemory> on the domain XML file is missing or "
|
||||
"has invalid value."));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (def->ndisks < 1) {
|
||||
PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Domain XML must contain at least one <disk> element."));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!def->disks[0]->src) {
|
||||
PHYP_ERROR(VIR_ERR_XML_ERROR, "%s",
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Field <src> under <disk> on the domain XML file is "
|
||||
"missing."));
|
||||
goto cleanup;
|
||||
@ -3723,7 +3719,7 @@ phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user