return VIR_DRV_OPEN_DECLINED;
}
- HYPERV_ERROR(VIR_ERR_INVALID_ARG,
- _("Transport '%s' in URI scheme is not supported, try again "
- "without the transport part"), plus + 1);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Transport '%s' in URI scheme is not supported, try again "
+ "without the transport part"), plus + 1);
return VIR_DRV_OPEN_ERROR;
}
/* Require server part */
if (conn->uri->server == NULL) {
- HYPERV_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("URI is missing the server part"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("URI is missing the server part"));
return VIR_DRV_OPEN_ERROR;
}
/* Require auth */
if (auth == NULL || auth->cb == NULL) {
- HYPERV_ERROR(VIR_ERR_INVALID_ARG, "%s",
- _("Missing or invalid auth pointer"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Missing or invalid auth pointer"));
return VIR_DRV_OPEN_ERROR;
}
username = virAuthGetUsername(conn, auth, "hyperv", "administrator", conn->uri->server);
if (username == NULL) {
- HYPERV_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
+ virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed"));
goto cleanup;
}
}
password = virAuthGetPassword(conn, auth, "hyperv", username, conn->uri->server);
if (password == NULL) {
- HYPERV_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
+ virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed"));
goto cleanup;
}
priv->parsedUri->transport, username, password);
if (priv->client == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not create openwsman client"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not create openwsman client"));
goto cleanup;
}
if (wsmc_transport_init(priv->client, NULL) != 0) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize openwsman transport"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize openwsman transport"));
goto cleanup;
}
}
if (computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("%s is not a Hyper-V server"), conn->uri->server);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s is not a Hyper-V server"), conn->uri->server);
goto cleanup;
}
}
if (computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s"),
- "Win32_ComputerSystem");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s"),
+ "Win32_ComputerSystem");
goto cleanup;
}
}
if (computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s"),
- "Win32_ComputerSystem");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s"),
+ "Win32_ComputerSystem");
goto cleanup;
}
}
if (processorList == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s"),
- "Win32_Processor");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s"),
+ "Win32_Processor");
goto cleanup;
}
/* Fill struct */
if (virStrncpy(info->model, processorList->data->Name,
sizeof(info->model) - 1, sizeof(info->model)) == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("CPU model %s too long for destination"),
- processorList->data->Name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("CPU model %s too long for destination"),
+ processorList->data->Name);
goto cleanup;
}
}
if (computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
+ virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
goto cleanup;
}
}
if (computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_NO_DOMAIN,
- _("No domain with UUID %s"), uuid_string);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with UUID %s"), uuid_string);
goto cleanup;
}
}
if (computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_NO_DOMAIN,
- _("No domain with name %s"), name);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with name %s"), name);
goto cleanup;
}
if (computerSystem->data->EnabledState !=
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) {
- HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not active"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not active"));
goto cleanup;
}
if (computerSystem->data->EnabledState !=
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) {
- HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not paused"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not paused"));
goto cleanup;
}
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
in_transition) {
- HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not active or is in state transition"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not active or is in state transition"));
goto cleanup;
}
}
if (virtualSystemSettingData == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for domain %s"),
- "Msvm_VirtualSystemSettingData",
- computerSystem->data->ElementName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for domain %s"),
+ "Msvm_VirtualSystemSettingData",
+ computerSystem->data->ElementName);
goto cleanup;
}
}
if (processorSettingData == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for domain %s"),
- "Msvm_ProcessorSettingData",
- computerSystem->data->ElementName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for domain %s"),
+ "Msvm_ProcessorSettingData",
+ computerSystem->data->ElementName);
goto cleanup;
}
if (memorySettingData == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for domain %s"),
- "Msvm_MemorySettingData",
- computerSystem->data->ElementName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for domain %s"),
+ "Msvm_MemorySettingData",
+ computerSystem->data->ElementName);
goto cleanup;
}
}
if (virtualSystemSettingData == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for domain %s"),
- "Msvm_VirtualSystemSettingData",
- computerSystem->data->ElementName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for domain %s"),
+ "Msvm_VirtualSystemSettingData",
+ computerSystem->data->ElementName);
goto cleanup;
}
}
if (processorSettingData == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for domain %s"),
- "Msvm_ProcessorSettingData",
- computerSystem->data->ElementName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for domain %s"),
+ "Msvm_ProcessorSettingData",
+ computerSystem->data->ElementName);
goto cleanup;
}
if (memorySettingData == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for domain %s"),
- "Msvm_MemorySettingData",
- computerSystem->data->ElementName);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for domain %s"),
+ "Msvm_MemorySettingData",
+ computerSystem->data->ElementName);
goto cleanup;
}
}
if (virUUIDParse(computerSystem->data->Name, def->uuid) < 0) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse UUID from string '%s'"),
- computerSystem->data->Name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse UUID from string '%s'"),
+ computerSystem->data->Name);
return NULL;
}
}
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
- HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is already active or is in state transition"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is already active or is in state transition"));
goto cleanup;
}
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
in_transition) {
- HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not active or is in state transition"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain is not active or is in state transition"));
goto cleanup;
}
if (computerSystem->data->EnabledState !=
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
- HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain has no managed save image"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Domain has no managed save image"));
goto cleanup;
}
WsManFault *fault;
if (lastError != WS_LASTERR_OK) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Transport error during %s: %s (%d)"),
- detail, wsman_transport_get_last_error_string(lastError),
- lastError);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Transport error during %s: %s (%d)"),
+ detail, wsman_transport_get_last_error_string(lastError),
+ lastError);
return -1;
}
/* Check the HTTP response code and report an error if it's not 200 (OK),
* 400 (Bad Request) or 500 (Internal Server Error) */
if (responseCode != 200 && responseCode != 400 && responseCode != 500) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected HTTP response during %s: %d"),
- detail, responseCode);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected HTTP response during %s: %d"),
+ detail, responseCode);
return -1;
}
if (response == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Empty response during %s"), detail);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Empty response during %s"), detail);
return -1;
}
wsmc_get_fault_data(response, fault);
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("SOAP fault during %s: code '%s', subcode '%s', "
- "reason '%s', detail '%s'"),
- detail, NULLSTR(fault->code), NULLSTR(fault->subcode),
- NULLSTR(fault->reason), NULLSTR(fault->fault_detail));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SOAP fault during %s: code '%s', subcode '%s', "
+ "reason '%s', detail '%s'"),
+ detail, NULLSTR(fault->code), NULLSTR(fault->subcode),
+ NULLSTR(fault->reason), NULLSTR(fault->fault_detail));
wsmc_fault_destroy(fault);
return -1;
hypervObject *object;
if (list == NULL || *list != NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
options = wsmc_options_init();
if (options == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize options"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize options"));
goto cleanup;
}
filter = filter_create_simple(WSM_WQL_FILTER_DIALECT, query_string);
if (filter == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not create filter"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not create filter"));
goto cleanup;
}
node = ws_xml_get_soap_body(response);
if (node == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not lookup SOAP body"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup SOAP body"));
goto cleanup;
}
node = ws_xml_get_child(node, 0, XML_NS_ENUMERATION, WSENUM_PULL_RESP);
if (node == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not lookup pull response"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup pull response"));
goto cleanup;
}
node = ws_xml_get_child(node, 0, XML_NS_ENUMERATION, WSENUM_ITEMS);
if (node == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not lookup pull response items"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not lookup pull response items"));
goto cleanup;
}
className, resourceUri, NULL, 0, 0);
if (data == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not deserialize pull response item"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not deserialize pull response item"));
goto cleanup;
}
options = wsmc_options_init();
if (options == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not initialize options"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not initialize options"));
goto cleanup;
}
returnValue = ws_xml_get_xpath_value(response, (char *)"/s:Envelope/s:Body/p:RequestStateChange_OUTPUT/p:ReturnValue");
if (returnValue == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for %s invocation"),
- "ReturnValue", "RequestStateChange");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for %s invocation"),
+ "ReturnValue", "RequestStateChange");
goto cleanup;
}
if (virStrToLong_i(returnValue, NULL, 10, &returnCode) < 0) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse return code from '%s'"), returnValue);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse return code from '%s'"), returnValue);
goto cleanup;
}
instanceID = ws_xml_get_xpath_value(response, (char *)"/s:Envelope/s:Body/p:RequestStateChange_OUTPUT/p:Job/a:ReferenceParameters/w:SelectorSet/w:Selector[@Name='InstanceID']");
if (instanceID == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for %s invocation"),
- "InstanceID", "RequestStateChange");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for %s invocation"),
+ "InstanceID", "RequestStateChange");
goto cleanup;
}
}
if (concreteJob == NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not lookup %s for %s invocation"),
- "Msvm_ConcreteJob", "RequestStateChange");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not lookup %s for %s invocation"),
+ "Msvm_ConcreteJob", "RequestStateChange");
goto cleanup;
}
case MSVM_CONCRETEJOB_JOBSTATE_KILLED:
case MSVM_CONCRETEJOB_JOBSTATE_EXCEPTION:
case MSVM_CONCRETEJOB_JOBSTATE_SERVICE:
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Concrete job for %s invocation is in error state"),
- "RequestStateChange");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Concrete job for %s invocation is in error state"),
+ "RequestStateChange");
goto cleanup;
default:
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Concrete job for %s invocation is in unknown state"),
- "RequestStateChange");
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Concrete job for %s invocation is in unknown state"),
+ "RequestStateChange");
goto cleanup;
}
}
} else if (returnCode != CIM_RETURNCODE_COMPLETED_WITH_NO_ERROR) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Invocation of %s returned an error: %s (%d)"),
- "RequestStateChange", hypervReturnCodeToString(returnCode),
- returnCode);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invocation of %s returned an error: %s (%d)"),
+ "RequestStateChange", hypervReturnCodeToString(returnCode),
+ returnCode);
goto cleanup;
}
unsigned char uuid[VIR_UUID_BUFLEN];
if (domain == NULL || *domain != NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (virUUIDParse(computerSystem->data->Name, uuid) < 0) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR,
- _("Could not parse UUID from string '%s'"),
- computerSystem->data->Name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not parse UUID from string '%s'"),
+ computerSystem->data->Name);
return -1;
}
virBuffer query = VIR_BUFFER_INITIALIZER;
if (computerSystem == NULL || *computerSystem != NULL) {
- HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
}
if (*computerSystem == NULL) {
- HYPERV_ERROR(VIR_ERR_NO_DOMAIN,
- _("No domain with UUID %s"), uuid_string);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with UUID %s"), uuid_string);
return -1;
}