[libvirt] [PATCH 00/23] Convert remaining areas of code to use virReportError

This converts all the remaining areas of libvirt code to use the virReportError macro for reporting errors. As before this is a mechanical change which should be a no-op. cfg.mk | 25 daemon/libvirtd-config.c | 60 - daemon/remote.c | 214 ++-- daemon/stream.c | 22 src/cpu/cpu.c | 86 - src/cpu/cpu.h | 5 src/cpu/cpu_generic.c | 18 src/cpu/cpu_map.c | 22 src/cpu/cpu_x86.c | 132 +- src/esx/esx_driver.c | 422 ++++---- src/esx/esx_private.h | 4 src/esx/esx_storage_driver.c | 100 +- src/esx/esx_util.c | 74 - src/esx/esx_vi.c | 626 ++++++------ src/esx/esx_vi.h | 7 src/esx/esx_vi_methods.c | 12 src/esx/esx_vi_types.c | 216 ++-- src/fdstream.c | 69 - src/hyperv/hyperv_driver.c | 142 +- src/hyperv/hyperv_private.h | 4 src/hyperv/hyperv_util.c | 10 src/hyperv/hyperv_wmi.c | 114 +- src/libxl/libxl_conf.c | 42 src/libxl/libxl_conf.h | 4 src/libxl/libxl_driver.c | 614 ++++++------ src/locking/lock_driver_sanlock.c | 157 +-- src/locking/lock_manager.c | 30 src/network/bridge_driver.c | 344 +++---- src/nodeinfo.c | 104 +- src/openvz/openvz_conf.c | 132 +- src/openvz/openvz_conf.h | 4 src/openvz/openvz_driver.c | 282 ++--- src/openvz/openvz_util.c | 5 src/phyp/phyp_driver.c | 76 - src/qemu/qemu_agent.c | 142 +- src/qemu/qemu_capabilities.c | 16 src/qemu/qemu_cgroup.c | 26 src/qemu/qemu_command.c | 1066 +++++++++++----------- src/qemu/qemu_conf.c | 26 src/qemu/qemu_conf.h | 4 src/qemu/qemu_domain.c | 94 - src/qemu/qemu_driver.c | 1834 +++++++++++++++++++------------------- src/qemu/qemu_hostdev.c | 59 - src/qemu/qemu_hotplug.c | 362 +++---- src/qemu/qemu_migration.c | 284 ++--- src/qemu/qemu_monitor.c | 384 +++---- src/qemu/qemu_monitor_json.c | 546 +++++------ src/qemu/qemu_monitor_text.c | 532 +++++------ src/qemu/qemu_process.c | 216 ++-- src/remote/remote_driver.c | 310 +++--- src/rpc/gendispatch.pl | 24 src/security/security_apparmor.c | 94 - src/security/security_driver.c | 8 src/security/security_manager.c | 50 - src/security/security_manager.h | 5 src/security/security_selinux.c | 106 +- src/test/test_driver.c | 509 +++++----- src/uml/uml_conf.c | 24 src/uml/uml_conf.h | 5 src/uml/uml_driver.c | 108 +- src/vbox/vbox_driver.c | 20 src/vbox/vbox_tmpl.c | 779 ++++++++-------- src/vmware/vmware_conf.c | 56 - src/vmware/vmware_conf.h | 4 src/vmware/vmware_driver.c | 110 +- src/vmx/vmx.c | 738 +++++++-------- src/xen/block_stats.c | 54 - src/xen/xen_driver.c | 114 +- src/xen/xen_hypervisor.c | 211 ++-- src/xen/xen_inotify.c | 48 src/xen/xend_internal.c | 461 ++++----- src/xen/xm_internal.c | 134 +- src/xen/xs_internal.c | 40 src/xenapi/xenapi_driver.c | 12 src/xenxs/xen_sxpr.c | 256 ++--- src/xenxs/xen_xm.c | 220 ++-- src/xenxs/xenxs_private.h | 4 77 files changed, 7063 insertions(+), 7210 deletions(-)

From: "Daniel P. Berrange" <berrange@redhat.com> Update the linux bridge driver to use virReportError instead of the networkReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/network/bridge_driver.c | 344 ++++++++++++++++++++++--------------------- 2 files changed, 174 insertions(+), 171 deletions(-) diff --git a/cfg.mk b/cfg.mk index ed2838c..e83c8b0 100644 --- a/cfg.mk +++ b/cfg.mk @@ -515,7 +515,6 @@ msg_gen_function += VMX_ERROR msg_gen_function += XENXS_ERROR msg_gen_function += lxcError msg_gen_function += libxlError -msg_gen_function += networkReportError msg_gen_function += nodeReportError msg_gen_function += openvzError msg_gen_function += qemuReportError diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 9b1964b..2962580 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -70,10 +70,6 @@ #define VIR_FROM_THIS VIR_FROM_NETWORK -#define networkReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_NETWORK, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - /* Main driver state */ struct network_driver { virMutex lock; @@ -849,9 +845,9 @@ networkStartRadvd(virNetworkObjPtr network) prefix = virNetworkIpDefPrefix(ipdef); if (prefix < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("bridge '%s' has an invalid prefix"), - network->def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("bridge '%s' has an invalid prefix"), + network->def->bridge); goto cleanup; } if (!(netaddr = virSocketAddrFormat(&ipdef->address))) @@ -935,9 +931,9 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver, const char *forwardIf = virNetworkDefForwardIf(network->def, 0); if (prefix < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid prefix or netmask for '%s'"), - network->def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid prefix or netmask for '%s'"), + network->def->bridge); goto masqerr1; } @@ -947,9 +943,9 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver, prefix, network->def->bridge, forwardIf) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow forwarding from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow forwarding from '%s'"), + network->def->bridge); goto masqerr1; } @@ -961,9 +957,9 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver, prefix, network->def->bridge, forwardIf) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow forwarding to '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow forwarding to '%s'"), + network->def->bridge); goto masqerr2; } @@ -996,11 +992,11 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver, prefix, forwardIf, NULL) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - forwardIf ? - _("failed to add iptables rule to enable masquerading to %s") : - _("failed to add iptables rule to enable masquerading"), - forwardIf); + virReportError(VIR_ERR_SYSTEM_ERROR, + forwardIf ? + _("failed to add iptables rule to enable masquerading to %s") : + _("failed to add iptables rule to enable masquerading"), + forwardIf); goto masqerr3; } @@ -1010,11 +1006,11 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver, prefix, forwardIf, "udp") < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - forwardIf ? - _("failed to add iptables rule to enable UDP masquerading to %s") : - _("failed to add iptables rule to enable UDP masquerading"), - forwardIf); + virReportError(VIR_ERR_SYSTEM_ERROR, + forwardIf ? + _("failed to add iptables rule to enable UDP masquerading to %s") : + _("failed to add iptables rule to enable UDP masquerading"), + forwardIf); goto masqerr4; } @@ -1024,11 +1020,11 @@ networkAddMasqueradingIptablesRules(struct network_driver *driver, prefix, forwardIf, "tcp") < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - forwardIf ? - _("failed to add iptables rule to enable TCP masquerading to %s") : - _("failed to add iptables rule to enable TCP masquerading"), - forwardIf); + virReportError(VIR_ERR_SYSTEM_ERROR, + forwardIf ? + _("failed to add iptables rule to enable TCP masquerading to %s") : + _("failed to add iptables rule to enable TCP masquerading"), + forwardIf); goto masqerr5; } @@ -1109,9 +1105,9 @@ networkAddRoutingIptablesRules(struct network_driver *driver, const char *forwardIf = virNetworkDefForwardIf(network->def, 0); if (prefix < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid prefix or netmask for '%s'"), - network->def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid prefix or netmask for '%s'"), + network->def->bridge); goto routeerr1; } @@ -1121,9 +1117,9 @@ networkAddRoutingIptablesRules(struct network_driver *driver, prefix, network->def->bridge, forwardIf) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow routing from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow routing from '%s'"), + network->def->bridge); goto routeerr1; } @@ -1133,9 +1129,9 @@ networkAddRoutingIptablesRules(struct network_driver *driver, prefix, network->def->bridge, forwardIf) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow routing to '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow routing to '%s'"), + network->def->bridge); goto routeerr2; } @@ -1187,43 +1183,43 @@ networkAddGeneralIp6tablesRules(struct network_driver *driver, if (iptablesAddForwardRejectOut(driver->iptables, AF_INET6, network->def->bridge) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add ip6tables rule to block outbound traffic from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add ip6tables rule to block outbound traffic from '%s'"), + network->def->bridge); goto err1; } if (iptablesAddForwardRejectIn(driver->iptables, AF_INET6, network->def->bridge) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add ip6tables rule to block inbound traffic to '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add ip6tables rule to block inbound traffic to '%s'"), + network->def->bridge); goto err2; } /* Allow traffic between guests on the same bridge */ if (iptablesAddForwardAllowCross(driver->iptables, AF_INET6, network->def->bridge) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add ip6tables rule to allow cross bridge traffic on '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add ip6tables rule to allow cross bridge traffic on '%s'"), + network->def->bridge); goto err3; } /* allow DNS over IPv6 */ if (iptablesAddTcpInput(driver->iptables, AF_INET6, network->def->bridge, 53) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add ip6tables rule to allow DNS requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add ip6tables rule to allow DNS requests from '%s'"), + network->def->bridge); goto err4; } if (iptablesAddUdpInput(driver->iptables, AF_INET6, network->def->bridge, 53) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add ip6tables rule to allow DNS requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add ip6tables rule to allow DNS requests from '%s'"), + network->def->bridge); goto err5; } @@ -1274,17 +1270,17 @@ networkAddGeneralIptablesRules(struct network_driver *driver, if (iptablesAddTcpInput(driver->iptables, AF_INET, network->def->bridge, 67) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow DHCP requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow DHCP requests from '%s'"), + network->def->bridge); goto err1; } if (iptablesAddUdpInput(driver->iptables, AF_INET, network->def->bridge, 67) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow DHCP requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow DHCP requests from '%s'"), + network->def->bridge); goto err2; } @@ -1305,17 +1301,17 @@ networkAddGeneralIptablesRules(struct network_driver *driver, /* allow DNS requests through to dnsmasq */ if (iptablesAddTcpInput(driver->iptables, AF_INET, network->def->bridge, 53) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow DNS requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow DNS requests from '%s'"), + network->def->bridge); goto err3; } if (iptablesAddUdpInput(driver->iptables, AF_INET, network->def->bridge, 53) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow DNS requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow DNS requests from '%s'"), + network->def->bridge); goto err4; } @@ -1323,9 +1319,9 @@ networkAddGeneralIptablesRules(struct network_driver *driver, if (ipv4def && ipv4def->tftproot && iptablesAddUdpInput(driver->iptables, AF_INET, network->def->bridge, 69) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow TFTP requests from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow TFTP requests from '%s'"), + network->def->bridge); goto err5; } @@ -1333,26 +1329,26 @@ networkAddGeneralIptablesRules(struct network_driver *driver, if (iptablesAddForwardRejectOut(driver->iptables, AF_INET, network->def->bridge) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to block outbound traffic from '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to block outbound traffic from '%s'"), + network->def->bridge); goto err6; } if (iptablesAddForwardRejectIn(driver->iptables, AF_INET, network->def->bridge) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to block inbound traffic to '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to block inbound traffic to '%s'"), + network->def->bridge); goto err7; } /* Allow traffic between guests on the same bridge */ if (iptablesAddForwardAllowCross(driver->iptables, AF_INET, network->def->bridge) < 0) { - networkReportError(VIR_ERR_SYSTEM_ERROR, - _("failed to add iptables rule to allow cross bridge traffic on '%s'"), - network->def->bridge); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("failed to add iptables rule to allow cross bridge traffic on '%s'"), + network->def->bridge); goto err8; } @@ -1700,9 +1696,9 @@ networkCheckRouteCollision(virNetworkObjPtr network) if ((net_dest == addr_val) && (netmask.data.inet4.sin_addr.s_addr == mask_val)) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("Network is already in use by interface %s"), - iface); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Network is already in use by interface %s"), + iface); ret = -1; goto out; } @@ -1721,9 +1717,9 @@ networkAddAddrToBridge(virNetworkObjPtr network, int prefix = virNetworkIpDefPrefix(ipdef); if (prefix < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("bridge '%s' has an invalid netmask or IP address"), - network->def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("bridge '%s' has an invalid netmask or IP address"), + network->def->bridge); return -1; } @@ -1828,9 +1824,9 @@ networkStartNetworkVirtual(struct network_driver *driver, goto err4; if (virNetDevBandwidthSet(network->def->bridge, network->def->bandwidth) < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot set bandwidth limits on %s"), - network->def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot set bandwidth limits on %s"), + network->def->bridge); goto err5; } @@ -1962,8 +1958,8 @@ networkStartNetwork(struct network_driver *driver, int ret = 0; if (virNetworkObjIsActive(network)) { - networkReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("network is already active")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("network is already active")); return -1; } @@ -2064,8 +2060,8 @@ static virNetworkPtr networkLookupByUUID(virConnectPtr conn, network = virNetworkFindByUUID(&driver->networks, uuid); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } @@ -2087,8 +2083,8 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn, network = virNetworkFindByName(&driver->networks, name); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - _("no network with matching name '%s'"), name); + virReportError(VIR_ERR_NO_NETWORK, + _("no network with matching name '%s'"), name); goto cleanup; } @@ -2216,7 +2212,7 @@ static int networkIsActive(virNetworkPtr net) obj = virNetworkFindByUUID(&driver->networks, net->uuid); networkDriverUnlock(driver); if (!obj) { - networkReportError(VIR_ERR_NO_NETWORK, NULL); + virReportError(VIR_ERR_NO_NETWORK, NULL); goto cleanup; } ret = virNetworkObjIsActive(obj); @@ -2237,7 +2233,7 @@ static int networkIsPersistent(virNetworkPtr net) obj = virNetworkFindByUUID(&driver->networks, net->uuid); networkDriverUnlock(driver); if (!obj) { - networkReportError(VIR_ERR_NO_NETWORK, NULL); + virReportError(VIR_ERR_NO_NETWORK, NULL); goto cleanup; } ret = obj->persistent; @@ -2337,8 +2333,10 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) { if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET)) { if (ipdef->nranges || ipdef->nhosts) { if (ipv4def) { - networkReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("Multiple dhcp sections found. dhcp is supported only for a single IPv4 address on each network")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Multiple dhcp sections found. " + "dhcp is supported only for a " + "single IPv4 address on each network")); goto cleanup; } else { ipv4def = ipdef; @@ -2392,14 +2390,14 @@ static int networkUndefine(virNetworkPtr net) { network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } if (virNetworkObjIsActive(network)) { - networkReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("network is still active")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("network is still active")); goto cleanup; } @@ -2479,8 +2477,8 @@ static int networkStart(virNetworkPtr net) { network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } @@ -2502,14 +2500,14 @@ static int networkDestroy(virNetworkPtr net) { network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } if (!virNetworkObjIsActive(network)) { - networkReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("network is not active")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("network is not active")); goto cleanup; } @@ -2542,8 +2540,8 @@ static char *networkGetXMLDesc(virNetworkPtr net, networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } @@ -2570,15 +2568,15 @@ static char *networkGetBridgeName(virNetworkPtr net) { networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching id")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching id")); goto cleanup; } if (!(network->def->bridge)) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' does not have a bridge name."), - network->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' does not have a bridge name."), + network->def->name); goto cleanup; } @@ -2602,8 +2600,8 @@ static int networkGetAutostart(virNetworkPtr net, network = virNetworkFindByUUID(&driver->networks, net->uuid); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } @@ -2627,14 +2625,14 @@ static int networkSetAutostart(virNetworkPtr net, network = virNetworkFindByUUID(&driver->networks, net->uuid); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - "%s", _("no network with matching uuid")); + virReportError(VIR_ERR_NO_NETWORK, + "%s", _("no network with matching uuid")); goto cleanup; } if (!network->persistent) { - networkReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot set autostart for transient network")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot set autostart for transient network")); goto cleanup; } @@ -2763,9 +2761,9 @@ networkAllocateActualDevice(virDomainNetDefPtr iface) network = virNetworkFindByName(&driver->networks, iface->data.network.name); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - _("no network with matching name '%s'"), - iface->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, + _("no network with matching name '%s'"), + iface->data.network.name); goto cleanup; } @@ -2879,9 +2877,10 @@ networkAllocateActualDevice(virDomainNetDefPtr iface) * any error if exclusive use is required but could not be acquired). */ if ((netdef->nForwardIfs <= 0) && (netdef->nForwardPfs <= 0)) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' uses a direct mode, but has no forward dev and no interface pool"), - netdef->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' uses a direct mode, but " + "has no forward dev and no interface pool"), + netdef->name); goto cleanup; } else { virNetworkForwardIfDefPtr dev = NULL; @@ -2897,16 +2896,16 @@ networkAllocateActualDevice(virDomainNetDefPtr iface) if ((netdef->nForwardPfs > 0) && (netdef->nForwardIfs <= 0)) { if ((virNetDevGetVirtualFunctions(netdef->forwardPfs->dev, &vfname, &num_virt_fns)) < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get Virtual functions on %s"), - netdef->forwardPfs->dev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get Virtual functions on %s"), + netdef->forwardPfs->dev); goto cleanup; } if (num_virt_fns == 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("No Vf's present on SRIOV PF %s"), - netdef->forwardPfs->dev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No Vf's present on SRIOV PF %s"), + netdef->forwardPfs->dev); goto cleanup; } @@ -2957,9 +2956,10 @@ networkAllocateActualDevice(virDomainNetDefPtr iface) } /* dev points at the physical device we want to use */ if (!dev) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' requires exclusive access to interfaces, but none are available"), - netdef->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' requires exclusive access " + "to interfaces, but none are available"), + netdef->name); goto cleanup; } iface->data.network.actual->data.direct.linkdev = strdup(dev->dev); @@ -3020,24 +3020,26 @@ networkNotifyActualDevice(virDomainNetDefPtr iface) network = virNetworkFindByName(&driver->networks, iface->data.network.name); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - _("no network with matching name '%s'"), - iface->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, + _("no network with matching name '%s'"), + iface->data.network.name); goto cleanup; } actualDev = virDomainNetGetActualDirectDev(iface); if (!actualDev) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("the interface uses a direct mode, but has no source dev")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("the interface uses a direct " + "mode, but has no source dev")); goto cleanup; } netdef = network->def; if (netdef->nForwardIfs == 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' uses a direct mode, but has no forward dev and no interface pool"), - netdef->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' uses a direct mode, but " + "has no forward dev and no interface pool"), + netdef->name); goto cleanup; } else { int ii; @@ -3053,9 +3055,9 @@ networkNotifyActualDevice(virDomainNetDefPtr iface) } /* dev points at the physical device we want to use */ if (!dev) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' doesn't have dev='%s' in use by domain"), - netdef->name, actualDev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' doesn't have dev='%s' in use by domain"), + netdef->name, actualDev); goto cleanup; } @@ -3069,9 +3071,9 @@ networkNotifyActualDevice(virDomainNetDefPtr iface) iface->data.network.actual->data.direct.virtPortProfile && (iface->data.network.actual->data.direct.virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_8021QBH)))) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' claims dev='%s' is already in use by a different domain"), - netdef->name, actualDev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' claims dev='%s' is already in use by a different domain"), + netdef->name, actualDev); goto cleanup; } /* we are now assured of success, so mark the allocation */ @@ -3121,24 +3123,26 @@ networkReleaseActualDevice(virDomainNetDefPtr iface) network = virNetworkFindByName(&driver->networks, iface->data.network.name); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - _("no network with matching name '%s'"), - iface->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, + _("no network with matching name '%s'"), + iface->data.network.name); goto cleanup; } actualDev = virDomainNetGetActualDirectDev(iface); if (!actualDev) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("the interface uses a direct mode, but has no source dev")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("the interface uses a direct " + "mode, but has no source dev")); goto cleanup; } netdef = network->def; if (netdef->nForwardIfs == 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' uses a direct mode, but has no forward dev and no interface pool"), - netdef->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' uses a direct mode, but " + "has no forward dev and no interface pool"), + netdef->name); goto cleanup; } else { int ii; @@ -3152,9 +3156,9 @@ networkReleaseActualDevice(virDomainNetDefPtr iface) } /* dev points at the physical device we've been using */ if (!dev) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' doesn't have dev='%s' in use by domain"), - netdef->name, actualDev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' doesn't have dev='%s' in use by domain"), + netdef->name, actualDev); goto cleanup; } @@ -3208,9 +3212,9 @@ networkGetNetworkAddress(const char *netname, char **netaddr) network = virNetworkFindByName(&driver->networks, netname); networkDriverUnlock(driver); if (!network) { - networkReportError(VIR_ERR_NO_NETWORK, - _("no network with matching name '%s'"), - netname); + virReportError(VIR_ERR_NO_NETWORK, + _("no network with matching name '%s'"), + netname); goto cleanup; } netdef = network->def; @@ -3222,9 +3226,9 @@ networkGetNetworkAddress(const char *netname, char **netaddr) /* if there's an ipv4def, get it's address */ ipdef = virNetworkDefGetIpByIndex(netdef, AF_INET, 0); if (!ipdef) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' doesn't have an IPv4 address"), - netdef->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' doesn't have an IPv4 address"), + netdef->name); break; } addrptr = &ipdef->address; @@ -3244,9 +3248,9 @@ networkGetNetworkAddress(const char *netname, char **netaddr) dev_name = netdef->forwardIfs[0].dev; if (!dev_name) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' has no associated interface or bridge"), - netdef->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' has no associated interface or bridge"), + netdef->name); } break; } -- 1.7.10.4

On 07/18/2012 12:40 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the linux bridge driver to use virReportError instead of the networkReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/network/bridge_driver.c | 344 ++++++++++++++++++++++--------------------- 2 files changed, 174 insertions(+), 171 deletions(-)
@@ -849,9 +845,9 @@ networkStartRadvd(virNetworkObjPtr network)
prefix = virNetworkIpDefPrefix(ipdef); if (prefix < 0) { - networkReportError(VIR_ERR_INTERNAL_ERROR, - _("bridge '%s' has an invalid prefix"), - network->def->bridge); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("bridge '%s' has an invalid prefix"),
Double space; I pushed a cleanup as a separate patch, so you'll have a merge conflict. ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> Update the UML driver to use virReportError instead of the umlReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/uml/uml_conf.c | 24 +++++------ src/uml/uml_conf.h | 5 --- src/uml/uml_driver.c | 108 +++++++++++++++++++++++++------------------------- 4 files changed, 66 insertions(+), 72 deletions(-) diff --git a/cfg.mk b/cfg.mk index e83c8b0..5747b39 100644 --- a/cfg.mk +++ b/cfg.mk @@ -522,7 +522,6 @@ msg_gen_function += regerror msg_gen_function += remoteError msg_gen_function += statsError msg_gen_function += streamsReportError -msg_gen_function += umlReportError msg_gen_function += vah_error msg_gen_function += vah_warning msg_gen_function += vboxError diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 1c401e1..de1cf46 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -87,7 +87,7 @@ virCapsPtr umlCapsInit(void) { VIR_WARN("Failed to get host power management capabilities"); if (virGetHostUUID(caps->host.host_uuid)) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot get the host uuid")); goto error; } @@ -188,19 +188,19 @@ umlBuildCommandLineNet(virConnectPtr conn, virBufferAdd(&buf, def->ifname, -1); } if (def->data.ethernet.ipaddr) { - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("IP address not supported for ethernet interface")); goto error; } break; case VIR_DOMAIN_NET_TYPE_SERVER: - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("TCP server networking type not supported")); goto error; case VIR_DOMAIN_NET_TYPE_CLIENT: - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("TCP client networking type not supported")); goto error; @@ -215,7 +215,7 @@ umlBuildCommandLineNet(virConnectPtr conn, virNetworkPtr network = virNetworkLookupByName(conn, def->data.network.name); if (!network) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("Network '%s' not found"), def->data.network.name); goto error; @@ -246,17 +246,17 @@ umlBuildCommandLineNet(virConnectPtr conn, break; case VIR_DOMAIN_NET_TYPE_INTERNAL: - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("internal networking type not supported")); goto error; case VIR_DOMAIN_NET_TYPE_DIRECT: - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("direct networking type not supported")); goto error; case VIR_DOMAIN_NET_TYPE_HOSTDEV: - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("hostdev networking type not supported")); goto error; @@ -265,7 +265,7 @@ umlBuildCommandLineNet(virConnectPtr conn, } if (def->script) { - umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("interface script execution not supported by this driver")); goto error; } @@ -331,7 +331,7 @@ umlBuildCommandLineChr(virDomainChrDefPtr def, case VIR_DOMAIN_CHR_TYPE_TCP: 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")); return NULL; } @@ -370,7 +370,7 @@ umlBuildCommandLineChr(virDomainChrDefPtr def, case VIR_DOMAIN_CHR_TYPE_UDP: case VIR_DOMAIN_CHR_TYPE_UNIX: default: - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported chr device type %d"), def->source.type); break; } @@ -433,7 +433,7 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn, virDomainDiskDefPtr disk = vm->def->disks[i]; if (!STRPREFIX(disk->dst, "ubd")) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported disk type '%s'"), disk->dst); goto error; } diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h index f942116..13b4328 100644 --- a/src/uml/uml_conf.h +++ b/src/uml/uml_conf.h @@ -70,11 +70,6 @@ struct uml_driver { virHashTablePtr autodestroy; }; - -# define umlReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_UML, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - virCapsPtr umlCapsInit (void); virCommandPtr umlBuildCommandLine(virConnectPtr conn, diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 098ee7b..82957c8 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -791,7 +791,7 @@ static int umlMonitorAddress(const struct uml_driver *driver, memset(addr, 0, sizeof(*addr)); addr->sun_family = AF_UNIX; 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); retval = -1; } @@ -891,7 +891,7 @@ static int umlMonitorCommand(const struct uml_driver *driver, return -1; } if (virStrcpyStatic(req.data, cmd) == NULL) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("Command %s too long for destination"), cmd); return -1; } @@ -976,13 +976,13 @@ static int umlStartVMDaemon(virConnectPtr conn, size_t i; if (virDomainObjIsActive(vm)) { - umlReportError(VIR_ERR_OPERATION_INVALID, "%s", + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("VM is already active")); return -1; } if (!vm->def->os.kernel) { - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no kernel specified")); return -1; } @@ -1157,14 +1157,14 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn, if (uml_driver->privileged) { if (STRNEQ (conn->uri->path, "/system") && STRNEQ (conn->uri->path, "/session")) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected UML URI path '%s', try uml:///system"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } else { if (STRNEQ (conn->uri->path, "/session")) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected UML URI path '%s', try uml:///session"), conn->uri->path); return VIR_DRV_OPEN_ERROR; @@ -1173,7 +1173,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn, /* URI was good, but driver isn't active */ if (uml_driver == NULL) { - umlReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("uml state driver is not active")); return VIR_DRV_OPEN_ERROR; } @@ -1286,7 +1286,7 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1310,7 +1310,7 @@ static virDomainPtr umlDomainLookupByUUID(virConnectPtr conn, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1334,7 +1334,7 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1358,7 +1358,7 @@ static int umlDomainIsActive(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); umlDriverUnlock(driver); if (!obj) { - umlReportError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = virDomainObjIsActive(obj); @@ -1380,7 +1380,7 @@ static int umlDomainIsPersistent(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); umlDriverUnlock(driver); if (!obj) { - umlReportError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = obj->persistent; @@ -1401,7 +1401,7 @@ static int umlDomainIsUpdated(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); umlDriverUnlock(driver); if (!obj) { - umlReportError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = obj->updated; @@ -1423,7 +1423,7 @@ static int umlGetVersion(virConnectPtr conn, unsigned long *version) { uname(&ut); if (virParseVersionString(ut.release, &driver->umlVersion, true) < 0) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse version %s"), ut.release); goto cleanup; } @@ -1522,14 +1522,14 @@ static int umlDomainShutdownFlags(virDomainPtr dom, vm = virDomainFindByID(&driver->domains, dom->id); umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } #if 0 if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) { - umlReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("shutdown operation failed")); goto cleanup; } @@ -1563,7 +1563,7 @@ umlDomainDestroyFlags(virDomainPtr dom, umlDriverLock(driver); vm = virDomainFindByID(&driver->domains, dom->id); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1605,7 +1605,7 @@ static char *umlDomainGetOSType(virDomainPtr dom) { vm = virDomainFindByUUID(&driver->domains, dom->uuid); umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -1635,7 +1635,7 @@ umlDomainGetMaxMemory(virDomainPtr dom) char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1660,13 +1660,13 @@ static int umlDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } 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")); goto cleanup; } @@ -1693,19 +1693,19 @@ static int umlDomainSetMemory(virDomainPtr dom, unsigned long newmem) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (virDomainObjIsActive(vm)) { - umlReportError(VIR_ERR_OPERATION_INVALID, "%s", + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot set memory of an active domain")); goto cleanup; } 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")); goto cleanup; } @@ -1730,7 +1730,7 @@ static int umlDomainGetInfo(virDomainPtr dom, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -1741,7 +1741,7 @@ static int umlDomainGetInfo(virDomainPtr dom, info->cpuTime = 0; } else { if (umlGetProcessInfo(&(info->cpuTime), vm->pid) < 0) { - umlReportError(VIR_ERR_OPERATION_FAILED, "%s", + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("cannot read cputime for domain")); goto cleanup; } @@ -1776,7 +1776,7 @@ umlDomainGetState(virDomainPtr dom, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -1805,7 +1805,7 @@ static char *umlDomainGetXMLDesc(virDomainPtr dom, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -1857,7 +1857,7 @@ static int umlDomainStartWithFlags(virDomainPtr dom, unsigned int flags) { vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -1936,13 +1936,13 @@ static int umlDomainUndefineFlags(virDomainPtr dom, umlDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!vm->persistent) { - umlReportError(VIR_ERR_OPERATION_INVALID, "%s", + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot undefine transient domain")); goto cleanup; } @@ -1982,14 +1982,14 @@ static int umlDomainAttachUmlDisk(struct uml_driver *driver, for (i = 0 ; i < vm->def->ndisks ; i++) { 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); return -1; } } if (!disk->src) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("disk source path is missing")); goto error; } @@ -2036,13 +2036,13 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - umlReportError(VIR_ERR_OPERATION_INVALID, + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot attach device on inactive domain")); goto cleanup; } @@ -2059,12 +2059,12 @@ static int umlDomainAttachDevice(virDomainPtr dom, const char *xml) if (ret == 0) dev->data.disk = NULL; } else { - umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("disk bus '%s' cannot be hotplugged."), virDomainDiskBusTypeToString(dev->data.disk->bus)); } } else { - umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("device type '%s' cannot be attached"), virDomainDeviceTypeToString(dev->type)); goto cleanup; @@ -2088,7 +2088,7 @@ umlDomainAttachDeviceFlags(virDomainPtr dom, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); 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")); return -1; } @@ -2113,7 +2113,7 @@ static int umlDomainDetachUmlDisk(struct uml_driver *driver, } if (i == vm->def->ndisks) { - umlReportError(VIR_ERR_OPERATION_FAILED, + virReportError(VIR_ERR_OPERATION_FAILED, _("disk %s not found"), dev->data.disk->dst); return -1; } @@ -2154,13 +2154,13 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) { if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - umlReportError(VIR_ERR_OPERATION_INVALID, + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot detach device on inactive domain")); goto cleanup; } @@ -2175,11 +2175,11 @@ static int umlDomainDetachDevice(virDomainPtr dom, const char *xml) { if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_UML) ret = umlDomainDetachUmlDisk(driver, vm, dev); else { - umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This type of disk cannot be hot unplugged")); } } else { - umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("This type of device cannot be hot unplugged")); } @@ -2200,7 +2200,7 @@ umlDomainDetachDeviceFlags(virDomainPtr dom, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); 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")); return -1; } @@ -2219,7 +2219,7 @@ static int umlDomainGetAutostart(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -2245,13 +2245,13 @@ static int umlDomainSetAutostart(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!vm->persistent) { - umlReportError(VIR_ERR_OPERATION_INVALID, "%s", + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("cannot set autostart for transient domain")); goto cleanup; } @@ -2320,20 +2320,20 @@ umlDomainBlockPeek(virDomainPtr dom, umlDriverUnlock(driver); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, "%s", + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!path || path[0] == '\0') { - umlReportError(VIR_ERR_INVALID_ARG, "%s", + virReportError(VIR_ERR_INVALID_ARG, "%s", _("NULL or empty path")); goto cleanup; } /* Check the path belongs to this domain. */ if (!(actual = virDomainDiskPathByName(vm->def, path))) { - umlReportError(VIR_ERR_INVALID_ARG, + virReportError(VIR_ERR_INVALID_ARG, _("invalid path '%s'"), path); goto cleanup; } @@ -2387,13 +2387,13 @@ umlDomainOpenConsole(virDomainPtr dom, virUUIDFormat(dom->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - umlReportError(VIR_ERR_NO_DOMAIN, + virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - umlReportError(VIR_ERR_OPERATION_INVALID, + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); goto cleanup; } @@ -2414,14 +2414,14 @@ umlDomainOpenConsole(virDomainPtr dom, } if (!chr) { - umlReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find console device '%s'"), dev_name ? dev_name : _("default")); goto cleanup; } 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); goto cleanup; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the UML driver to use virReportError instead of the umlReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/uml/uml_conf.c | 24 +++++------ src/uml/uml_conf.h | 5 --- src/uml/uml_driver.c | 108 +++++++++++++++++++++++++------------------------- 4 files changed, 66 insertions(+), 72 deletions(-)
ACK, Peter.

From: "Daniel P. Berrange" <berrange@redhat.com> Update the VirtualBox driver to use virReportError instead of the vboxError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/vbox/vbox_driver.c | 20 +- src/vbox/vbox_tmpl.c | 779 ++++++++++++++++++++++++------------------------ 3 files changed, 396 insertions(+), 404 deletions(-) diff --git a/cfg.mk b/cfg.mk index 5747b39..5e433f9 100644 --- a/cfg.mk +++ b/cfg.mk @@ -524,7 +524,6 @@ msg_gen_function += statsError msg_gen_function += streamsReportError msg_gen_function += vah_error msg_gen_function += vah_warning -msg_gen_function += vboxError msg_gen_function += virConfError msg_gen_function += virCPUReportError msg_gen_function += virGenericReportError diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index d60143a..b340b7c 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -68,10 +68,6 @@ static virDriver vboxDriverDummy; #define VIR_FROM_THIS VIR_FROM_VBOX -#define vboxError(code, ...) \ - virReportErrorHelper(VIR_FROM_VBOX, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - int vboxRegister(void) { virDriverPtr driver; virNetworkDriverPtr networkDriver; @@ -162,28 +158,28 @@ static virDrvOpenStatus vboxOpenDummy(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("no VirtualBox driver path specified (try vbox:///session)")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("no VirtualBox driver path specified (try vbox:///session)")); return VIR_DRV_OPEN_ERROR; } if (uid != 0) { if (STRNEQ (conn->uri->path, "/session")) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } else { /* root */ if (STRNEQ (conn->uri->path, "/system") && STRNEQ (conn->uri->path, "/session")) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to initialize VirtualBox driver API")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to initialize VirtualBox driver API")); return VIR_DRV_OPEN_ERROR; } diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index e0e6db7..17e7e9a 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -141,10 +141,6 @@ typedef IMediumAttachment IHardDiskAttachment; #endif /* VBOX_API_VERSION >= 3001 */ -#define vboxError(code, ...) \ - virReportErrorHelper(VIR_FROM_VBOX, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - #define DEBUGPRUnichar(msg, strUtf16) \ if (strUtf16) {\ char *strUtf8 = NULL;\ @@ -901,8 +897,8 @@ vboxInitialize(vboxGlobalData *data) data->pFuncs->pfnGetEventQueue(&data->vboxQueue); if (data->vboxQueue == NULL) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("nsIEventQueue object is null")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("nsIEventQueue object is null")); goto cleanup; } @@ -910,14 +906,14 @@ vboxInitialize(vboxGlobalData *data) #endif /* !(VBOX_XPCOMC_VERSION == 0x00010000U) */ if (data->vboxObj == NULL) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("IVirtualBox object is null")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("IVirtualBox object is null")); goto cleanup; } if (data->vboxSession == NULL) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("ISession object is null")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("ISession object is null")); goto cleanup; } @@ -949,8 +945,8 @@ static int vboxExtractVersion(vboxGlobalData *data) { } if (ret != 0) - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not extract VirtualBox version")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not extract VirtualBox version")); return ret; } @@ -994,22 +990,22 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("no VirtualBox driver path specified (try vbox:///session)")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("no VirtualBox driver path specified (try vbox:///session)")); return VIR_DRV_OPEN_ERROR; } if (uid != 0) { if (STRNEQ (conn->uri->path, "/session")) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } else { /* root */ if (STRNEQ (conn->uri->path, "/system") && STRNEQ (conn->uri->path, "/session")) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } } @@ -1125,8 +1121,8 @@ static int vboxListDomains(virConnectPtr conn, int *ids, int nids) { rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Domains, rc=%08x"),(unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of Domains, rc=%08x"),(unsigned)rc); goto cleanup; } @@ -1162,8 +1158,8 @@ static int vboxNumOfDomains(virConnectPtr conn) { rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get number of Domains, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get number of Domains, rc=%08x"), (unsigned)rc); goto cleanup; } @@ -1226,16 +1222,16 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) { /* Internal vbox IDs start from 0, the public libvirt ID * starts from 1, so refuse id==0, and adjust the rest*/ if (id == 0) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), id); return NULL; } id = id - 1; rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=%08x"), (unsigned)rc); return NULL; } @@ -1294,8 +1290,8 @@ static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned ch rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=%08x"), (unsigned)rc); return NULL; } @@ -1364,8 +1360,8 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name) rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=%08x"), (unsigned)rc); return NULL; } @@ -1438,8 +1434,8 @@ static int vboxDomainIsActive(virDomainPtr dom) { rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=%08x"), (unsigned)rc); return ret; } @@ -1503,8 +1499,8 @@ static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED) vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -1528,8 +1524,8 @@ static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) { vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -1553,8 +1549,8 @@ static int vboxDomainSuspend(virDomainPtr dom) { vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1574,14 +1570,14 @@ static int vboxDomainSuspend(virDomainPtr dom) { VBOX_RELEASE(console); ret = 0; } else { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("error while suspending the domain")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("error while suspending the domain")); goto cleanup; } VBOX_SESSION_CLOSE(); } else { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine not in running state to suspend it")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine not in running state to suspend it")); goto cleanup; } } @@ -1605,8 +1601,8 @@ static int vboxDomainResume(virDomainPtr dom) { vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1626,14 +1622,14 @@ static int vboxDomainResume(virDomainPtr dom) { VBOX_RELEASE(console); ret = 0; } else { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("error while resuming the domain")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("error while resuming the domain")); goto cleanup; } VBOX_SESSION_CLOSE(); } else { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine not paused, so can't resume it")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine not paused, so can't resume it")); goto cleanup; } } @@ -1659,8 +1655,8 @@ static int vboxDomainShutdownFlags(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1672,12 +1668,12 @@ static int vboxDomainShutdownFlags(virDomainPtr dom, machine->vtbl->GetState(machine, &state); if (state == MachineState_Paused) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine paused, so can't power it down")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine paused, so can't power it down")); goto cleanup; } else if (state == MachineState_PoweredOff) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine already powered down")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine already powered down")); goto cleanup; } @@ -1717,8 +1713,8 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags) vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1739,8 +1735,8 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags) } VBOX_SESSION_CLOSE(); } else { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine not running, so can't reboot it")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine not running, so can't reboot it")); goto cleanup; } } @@ -1768,8 +1764,8 @@ vboxDomainDestroyFlags(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1781,8 +1777,8 @@ vboxDomainDestroyFlags(virDomainPtr dom, machine->vtbl->GetState(machine, &state); if (state == MachineState_PoweredOff) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine already powered down")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine already powered down")); goto cleanup; } @@ -1844,8 +1840,8 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) { vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); goto cleanup; } @@ -1857,8 +1853,8 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) { machine->vtbl->GetState(machine, &state); if (state != MachineState_PoweredOff) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("memory size can't be changed unless domain is powered down")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("memory size can't be changed unless domain is powered down")); goto cleanup; } @@ -1873,10 +1869,10 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) { machine->vtbl->SaveSettings(machine); ret = 0; } else { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the " - "domain to: %lu Kb, rc=%08x"), - memory, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the memory size of the " + "domain to: %lu Kb, rc=%08x"), + memory, (unsigned)rc); } } VBOX_SESSION_CLOSE(); @@ -1899,8 +1895,8 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) { rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=%08x"), (unsigned)rc); goto cleanup; } @@ -2010,8 +2006,8 @@ vboxDomainGetState(virDomainPtr dom, vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -2072,8 +2068,8 @@ static int vboxDomainSave(virDomainPtr dom, const char *path ATTRIBUTE_UNUSED) { /* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); return -1; } #endif @@ -2123,7 +2119,7 @@ vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, nsresult rc; if (flags != VIR_DOMAIN_AFFECT_LIVE) { - vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } @@ -2132,8 +2128,8 @@ vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, /* Get machine for the call to VBOX_SESSION_OPEN */ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); return -1; } #endif @@ -2147,19 +2143,19 @@ vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, machine->vtbl->SaveSettings(machine); ret = 0; } else { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of cpus of the domain " - "to: %u, rc=%08x"), - CPUCount, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the number of cpus of the domain " + "to: %u, rc=%08x"), + CPUCount, (unsigned)rc); } VBOX_RELEASE(machine); } else { - vboxError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); } } else { - vboxError(VIR_ERR_NO_DOMAIN, - _("can't open session to the domain with id %d"), dom->id); + virReportError(VIR_ERR_NO_DOMAIN, + _("can't open session to the domain with id %d"), dom->id); } VBOX_SESSION_CLOSE(); @@ -2181,7 +2177,7 @@ vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) PRUint32 maxCPUCount = 0; if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { - vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } @@ -2811,10 +2807,10 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { maxPortPerInst, maxSlotPerPort); if (!def->disks[diskCount]->dst) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not generate medium name for the disk " - "at: controller instance:%u, port:%d, slot:%d"), - deviceInst, devicePort, deviceSlot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not generate medium name for the disk " + "at: controller instance:%u, port:%d, slot:%d"), + deviceInst, devicePort, deviceSlot); VBOX_RELEASE(medium); VBOX_RELEASE(storageController); error = true; @@ -3451,9 +3447,9 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Defined Domains, rc=%08x"), - (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of Defined Domains, rc=%08x"), + (unsigned)rc); goto cleanup; } @@ -3501,9 +3497,9 @@ static int vboxNumOfDefinedDomains(virConnectPtr conn) { rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get number of Defined Domains, rc=%08x"), - (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get number of Defined Domains, rc=%08x"), + (unsigned)rc); goto cleanup; } @@ -3671,8 +3667,8 @@ vboxStartMachine(virDomainPtr dom, int i, IMachine *machine, #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc)) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("OpenRemoteSession/LaunchVMProcess failed, domain can't be started")); ret = -1; } else { PRBool completed = 0; @@ -3718,15 +3714,15 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) { virCheckFlags(0, -1); if (!dom->name) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Error while reading the domain name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Error while reading the domain name")); goto cleanup; } rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=%08x"), (unsigned)rc); goto cleanup; } @@ -3755,9 +3751,9 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) { (state == MachineState_Aborted) ) { ret = vboxStartMachine(dom, i, machine, &iid); } else { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine is not in poweroff|saved|" - "aborted state, so couldn't start it")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine is not in poweroff|saved|" + "aborted state, so couldn't start it")); ret = -1; } } @@ -3888,16 +3884,16 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the uuid of the file to " - "be attached to cdrom: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the uuid of the file to " + "be attached to cdrom: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file to cdrom: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file to cdrom: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("CD/DVDImage UUID:", dvduuid.value); } @@ -3952,10 +3948,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) rc = hardDisk->vtbl->imedium.GetId((IMedium *)hardDisk, &hdduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the uuid of the file to be " - "attached as harddisk: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the uuid of the file to be " + "attached as harddisk: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { if (def->disks[i]->readonly) { hardDisk->vtbl->SetType(hardDisk, @@ -3998,10 +3994,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) VBOX_UTF16_FREE(hddcnameUtf16); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file as " - "harddisk: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file as " + "harddisk: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("Attached HDD with UUID", hdduuid.value); } @@ -4044,18 +4040,18 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the uuid of the file to " - "be attached to floppy drive: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the uuid of the file to " + "be attached to floppy drive: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file to " - "floppy drive: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file to " + "floppy drive: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("floppyImage UUID", fduuid.value); } @@ -4232,20 +4228,20 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) } if (!medium) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Failed to attach the following disk/dvd/floppy " - "to the machine: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to attach the following disk/dvd/floppy " + "to the machine: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); VBOX_UTF16_FREE(mediumFileUtf16); continue; } rc = medium->vtbl->GetId(medium, &mediumUUID); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the uuid of the file to be attached " - "as harddisk/dvd/floppy: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the uuid of the file to be attached " + "as harddisk/dvd/floppy: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); VBOX_RELEASE(medium); VBOX_UTF16_FREE(mediumFileUtf16); continue; @@ -4283,10 +4279,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) &deviceInst, &devicePort, &deviceSlot)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the port/slot number of harddisk/" - "dvd/floppy to be attached: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the port/slot number of harddisk/" + "dvd/floppy to be attached: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); VBOX_RELEASE(medium); VBOX_UTF16_FREE(mediumUUID); VBOX_UTF16_FREE(mediumFileUtf16); @@ -4306,10 +4302,10 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) # endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file as harddisk/" - "dvd/floppy: %s, rc=%08x"), - def->disks[i]->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file as harddisk/" + "dvd/floppy: %s, rc=%08x"), + def->disks[i]->src, (unsigned)rc); } else { DEBUGIID("Attached HDD/DVD/Floppy with UUID", mediumUUID); } @@ -5080,29 +5076,29 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { VBOX_UTF16_FREE(machineNameUtf16); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not define a domain, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not define a domain, rc=%08x"), (unsigned)rc); goto cleanup; } rc = machine->vtbl->SetMemorySize(machine, VIR_DIV_UP(def->mem.cur_balloon, 1024)); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the domain to: %llu Kb, " - "rc=%08x"), - def->mem.cur_balloon, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the memory size of the domain to: %llu Kb, " + "rc=%08x"), + def->mem.cur_balloon, (unsigned)rc); } if (def->vcpus != def->maxvcpus) { - vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("current vcpu count must equal maximum")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("current vcpu count must equal maximum")); } rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of virtual CPUs to: %u, rc=%08x"), - def->maxvcpus, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the number of virtual CPUs to: %u, rc=%08x"), + def->maxvcpus, (unsigned)rc); } #if VBOX_API_VERSION < 3001 @@ -5118,10 +5114,10 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { (1 << VIR_DOMAIN_FEATURE_PAE)); #endif if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not change PAE status to: %s, rc=%08x"), - ((def->features) & (1 << VIR_DOMAIN_FEATURE_PAE)) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not change PAE status to: %s, rc=%08x"), + ((def->features) & (1 << VIR_DOMAIN_FEATURE_PAE)) + ? _("Enabled") : _("Disabled"), (unsigned)rc); } machine->vtbl->GetBIOSSettings(machine, &bios); @@ -5129,18 +5125,18 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { rc = bios->vtbl->SetACPIEnabled(bios, (def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI)); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not change ACPI status to: %s, rc=%08x"), - ((def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI)) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not change ACPI status to: %s, rc=%08x"), + ((def->features) & (1 << VIR_DOMAIN_FEATURE_ACPI)) + ? _("Enabled") : _("Disabled"), (unsigned)rc); } rc = bios->vtbl->SetIOAPICEnabled(bios, (def->features) & (1 << VIR_DOMAIN_FEATURE_APIC)); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not change APIC status to: %s, rc=%08x"), - ((def->features) & (1 << VIR_DOMAIN_FEATURE_APIC)) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not change APIC status to: %s, rc=%08x"), + ((def->features) & (1 << VIR_DOMAIN_FEATURE_APIC)) + ? _("Enabled") : _("Disabled"), (unsigned)rc); } VBOX_RELEASE(bios); } @@ -5148,8 +5144,8 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) { /* Register the machine before attaching other devices to it */ rc = data->vboxObj->vtbl->RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not define a domain, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not define a domain, rc=%08x"), (unsigned)rc); goto cleanup; } @@ -5302,8 +5298,8 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags) #else /* VBOX_API_VERSION >= 4000 */ rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); return -1; } @@ -5347,8 +5343,8 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags) #endif /* VBOX_API_VERSION >= 4000 */ ret = 0; } else { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not delete the domain, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not delete the domain, rc=%08x"), (unsigned)rc); } #if VBOX_API_VERSION >= 4000 @@ -5399,8 +5395,8 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -5442,18 +5438,18 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, if (dvdImage) { rc = dvdImage->vtbl->imedium.GetId((IMedium *)dvdImage, &dvduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the uuid of the file to " - "be attached to cdrom: %s, rc=%08x"), - dev->data.disk->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the uuid of the file to " + "be attached to cdrom: %s, rc=%08x"), + dev->data.disk->src, (unsigned)rc); } else { /* unmount the previous mounted image */ dvdDrive->vtbl->Unmount(dvdDrive); rc = dvdDrive->vtbl->MountImage(dvdDrive, dvduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file to cdrom: %s, rc=%08x"), - dev->data.disk->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file to cdrom: %s, rc=%08x"), + dev->data.disk->src, (unsigned)rc); } else { ret = 0; DEBUGIID("CD/DVD Image UUID:", dvduuid.value); @@ -5495,16 +5491,16 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, if (floppyImage) { rc = floppyImage->vtbl->imedium.GetId((IMedium *)floppyImage, &fduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("can't get the uuid of the file to be " - "attached to floppy drive: %s, rc=%08x"), - dev->data.disk->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("can't get the uuid of the file to be " + "attached to floppy drive: %s, rc=%08x"), + dev->data.disk->src, (unsigned)rc); } else { rc = floppyDrive->vtbl->MountImage(floppyDrive, fduuid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file to floppy drive: %s, rc=%08x"), - dev->data.disk->src, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file to floppy drive: %s, rc=%08x"), + dev->data.disk->src, (unsigned)rc); } else { ret = 0; DEBUGIID("attached floppy, UUID:", fduuid.value); @@ -5547,9 +5543,9 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach shared folder '%s', rc=%08x"), - dev->data.fs->dst, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach shared folder '%s', rc=%08x"), + dev->data.fs->dst, (unsigned)rc); } else { ret = 0; } @@ -5582,8 +5578,8 @@ vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if (flags & VIR_DOMAIN_AFFECT_CONFIG) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot modify the persistent configuration of a domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot modify the persistent configuration of a domain")); return -1; } @@ -5597,8 +5593,8 @@ static int vboxDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, VIR_DOMAIN_AFFECT_CONFIG, -1); if (flags & VIR_DOMAIN_AFFECT_CONFIG) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot modify the persistent configuration of a domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot modify the persistent configuration of a domain")); return -1; } @@ -5636,8 +5632,8 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -5667,9 +5663,9 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { if (dvdDrive) { rc = dvdDrive->vtbl->Unmount(dvdDrive); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not de-attach the mounted ISO, rc=%08x"), - (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not de-attach the mounted ISO, rc=%08x"), + (unsigned)rc); } else { ret = 0; } @@ -5688,10 +5684,10 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { if (enabled) { rc = floppyDrive->vtbl->Unmount(floppyDrive); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not attach the file " - "to floppy drive, rc=%08x"), - (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach the file " + "to floppy drive, rc=%08x"), + (unsigned)rc); } else { ret = 0; } @@ -5723,9 +5719,9 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { rc = machine->vtbl->RemoveSharedFolder(machine, nameUtf16); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not detach shared folder '%s', rc=%08x"), - dev->data.fs->dst, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not detach shared folder '%s', rc=%08x"), + dev->data.fs->dst, (unsigned)rc); } else { ret = 0; } @@ -5753,8 +5749,8 @@ vboxDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if (flags & VIR_DOMAIN_AFFECT_CONFIG) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot modify the persistent configuration of a domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot modify the persistent configuration of a domain")); return -1; } @@ -5775,9 +5771,9 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, rc = machine->vtbl->GetSnapshotCount(machine, &count); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get snapshot count for domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get snapshot count for domain %s"), + dom->name); goto error; } @@ -5795,9 +5791,9 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, rc = machine->vtbl->FindSnapshot(machine, empty.value, list); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc) || !list[0]) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get root snapshot for domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get root snapshot for domain %s"), + dom->name); goto error; } @@ -5808,16 +5804,16 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, unsigned int i; if (!list[next]) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("unexpected number of snapshots < %u"), count); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected number of snapshots < %u"), count); goto error; } rc = vboxArrayGet(&children, list[next], list[next]->vtbl->GetChildren); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not get children snapshots")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not get children snapshots")); goto error; } for (i = 0; i < children.count; i++) { @@ -5825,8 +5821,8 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, if (!child) continue; if (top == count) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("unexpected number of snapshots > %u"), count); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected number of snapshots > %u"), count); vboxArrayRelease(&children); goto error; } @@ -5871,8 +5867,8 @@ vboxDomainSnapshotGet(vboxGlobalData *data, rc = snapshots[i]->vtbl->GetName(snapshots[i], &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - vboxError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not get snapshot name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not get snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); @@ -5886,9 +5882,9 @@ vboxDomainSnapshotGet(vboxGlobalData *data, } if (!snapshot) { - vboxError(VIR_ERR_OPERATION_INVALID, - _("domain %s has no snapshots with name %s"), - dom->name, name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("domain %s has no snapshots with name %s"), + dom->name, name); goto cleanup; } @@ -5932,23 +5928,23 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, goto cleanup; if (def->ndisks) { - vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk snapshots not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk snapshots not supported yet")); goto cleanup; } vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } @@ -5962,9 +5958,9 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, if (NS_SUCCEEDED(rc)) rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not open VirtualBox session with domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not open VirtualBox session with domain %s"), + dom->name); goto cleanup; } @@ -5984,23 +5980,23 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, rc = console->vtbl->TakeSnapshot(console, name, description, &progress); if (NS_FAILED(rc) || !progress) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not take snapshot of domain %s"), dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not take snapshot of domain %s"), dom->name); goto cleanup; } progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &result); if (NS_FAILED(result)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not take snapshot of domain %s"), dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not take snapshot of domain %s"), dom->name); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get current snapshot of domain %s"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get current snapshot of domain %s"), dom->name); goto cleanup; } @@ -6042,8 +6038,8 @@ vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6056,9 +6052,9 @@ vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, rc = snap->vtbl->GetDescription(snap, &str16); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get description of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get description of snapshot %s"), + snapshot->name); goto cleanup; } if (str16) { @@ -6072,9 +6068,9 @@ vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, rc = snap->vtbl->GetTimeStamp(snap, ×tamp); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get creation time of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get creation time of snapshot %s"), + snapshot->name); goto cleanup; } /* timestamp is in milliseconds while creationTime in seconds */ @@ -6082,17 +6078,17 @@ vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, rc = snap->vtbl->GetParent(snap, &parent); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get parent of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get parent of snapshot %s"), + snapshot->name); goto cleanup; } if (parent) { rc = parent->vtbl->GetName(parent, &str16); if (NS_FAILED(rc) || !str16) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get name of parent of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get name of parent of snapshot %s"), + snapshot->name); goto cleanup; } VBOX_UTF16_TO_UTF8(str16, &str8); @@ -6105,9 +6101,9 @@ vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, rc = snap->vtbl->GetOnline(snap, &online); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get online state of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get online state of snapshot %s"), + snapshot->name); goto cleanup; } if (online) @@ -6147,8 +6143,8 @@ vboxDomainSnapshotNum(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6160,9 +6156,9 @@ vboxDomainSnapshotNum(virDomainPtr dom, rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get snapshot count for domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get snapshot count for domain %s"), + dom->name); goto cleanup; } @@ -6198,8 +6194,8 @@ vboxDomainSnapshotListNames(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6221,9 +6217,9 @@ vboxDomainSnapshotListNames(virDomainPtr dom, rc = machine->vtbl->FindSnapshot(machine, empty.value, snapshots); #endif /* VBOX_API_VERSION >= 4000 */ if (NS_FAILED(rc) || !snapshots[0]) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get root snapshot for domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get root snapshot for domain %s"), + dom->name); goto cleanup; } count = 1; @@ -6241,8 +6237,8 @@ vboxDomainSnapshotListNames(virDomainPtr dom, rc = snapshots[i]->vtbl->GetName(snapshots[i], &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - vboxError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not get snapshot name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not get snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); @@ -6287,8 +6283,8 @@ vboxDomainSnapshotLookupByName(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6319,15 +6315,15 @@ vboxDomainHasCurrentSnapshot(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot")); goto cleanup; } @@ -6361,8 +6357,8 @@ vboxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6371,23 +6367,23 @@ vboxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, rc = snap->vtbl->GetParent(snap, &parent); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get parent of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get parent of snapshot %s"), + snapshot->name); goto cleanup; } if (!parent) { - vboxError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("snapshot '%s' does not have a parent"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("snapshot '%s' does not have a parent"), + snapshot->name); goto cleanup; } rc = parent->vtbl->GetName(parent, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get name of parent of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get name of parent of snapshot %s"), + snapshot->name); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); @@ -6425,28 +6421,28 @@ vboxDomainSnapshotCurrent(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot")); goto cleanup; } if (!snapshot) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain has no snapshots")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain has no snapshots")); goto cleanup; } rc = snapshot->vtbl->GetName(snapshot, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot name")); goto cleanup; } @@ -6486,8 +6482,8 @@ vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6496,8 +6492,8 @@ vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, rc = machine->vtbl->GetCurrentSnapshot(machine, ¤t); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot")); goto cleanup; } if (!current) { @@ -6507,8 +6503,8 @@ vboxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, rc = current->vtbl->GetName(current, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot name")); goto cleanup; } @@ -6546,8 +6542,8 @@ vboxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6576,15 +6572,15 @@ vboxDomainSnapshotRestore(virDomainPtr dom, rc = snapshot->vtbl->GetId(snapshot, &iid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get snapshot UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get snapshot UUID")); goto cleanup; } rc = machine->vtbl->SetCurrentSnapshot(machine, iid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not restore snapshot for domain %s"), dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not restore snapshot for domain %s"), dom->name); goto cleanup; } @@ -6610,22 +6606,22 @@ vboxDomainSnapshotRestore(virDomainPtr dom, rc = machine->vtbl->GetId(machine, &domiid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain UUID")); goto cleanup; } rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) { - vboxError(VIR_ERR_OPERATION_INVALID, - _("domain %s is already running"), dom->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("domain %s is already running"), dom->name); goto cleanup; } @@ -6633,21 +6629,21 @@ vboxDomainSnapshotRestore(virDomainPtr dom, if (NS_SUCCEEDED(rc)) rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not open VirtualBox session with domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not open VirtualBox session with domain %s"), + dom->name); goto cleanup; } rc = console->vtbl->RestoreSnapshot(console, snapshot, &progress); if (NS_FAILED(rc) || !progress) { if (rc == VBOX_E_INVALID_VM_STATE) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot restore domain snapshot for running domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot restore domain snapshot for running domain")); } else { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not restore snapshot for domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not restore snapshot for domain %s"), + dom->name); } goto cleanup; } @@ -6655,8 +6651,8 @@ vboxDomainSnapshotRestore(virDomainPtr dom, progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &result); if (NS_FAILED(result)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not restore snapshot for domain %s"), dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not restore snapshot for domain %s"), dom->name); goto cleanup; } @@ -6690,8 +6686,8 @@ vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6701,31 +6697,31 @@ vboxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, rc = newSnapshot->vtbl->GetOnline(newSnapshot, &online); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get online state of snapshot %s"), - snapshot->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get online state of snapshot %s"), + snapshot->name); goto cleanup; } rc = machine->vtbl->GetCurrentSnapshot(machine, &prevSnapshot); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get current snapshot of domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get current snapshot of domain %s"), + dom->name); goto cleanup; } rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot revert snapshot of running domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot revert snapshot of running domain")); goto cleanup; } @@ -6763,8 +6759,8 @@ vboxDomainSnapshotDeleteSingle(vboxGlobalData *data, rc = snapshot->vtbl->GetId(snapshot, &iid.value); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get snapshot UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get snapshot UUID")); goto cleanup; } @@ -6775,11 +6771,11 @@ vboxDomainSnapshotDeleteSingle(vboxGlobalData *data, #endif if (NS_FAILED(rc) || !progress) { if (rc == VBOX_E_INVALID_VM_STATE) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot delete domain snapshot for running domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot delete domain snapshot for running domain")); } else { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not delete snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not delete snapshot")); } goto cleanup; } @@ -6787,8 +6783,8 @@ vboxDomainSnapshotDeleteSingle(vboxGlobalData *data, progress->vtbl->WaitForCompletion(progress, -1); progress->vtbl->GetResultCode(progress, &result); if (NS_FAILED(result)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not delete snapshot")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not delete snapshot")); goto cleanup; } @@ -6812,8 +6808,8 @@ vboxDomainSnapshotDeleteTree(vboxGlobalData *data, rc = vboxArrayGet(&children, snapshot, snapshot->vtbl->GetChildren); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get children snapshots")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get children snapshots")); goto cleanup; } @@ -6848,8 +6844,8 @@ vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, vboxIIDFromUUID(&domiid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(domiid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching UUID")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching UUID")); goto cleanup; } @@ -6859,8 +6855,8 @@ vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, rc = machine->vtbl->GetState(machine, &state); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } @@ -6873,8 +6869,8 @@ vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, if (state >= MachineState_FirstOnline && state <= MachineState_LastOnline) { - vboxError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot delete snapshots of running domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot delete snapshots of running domain")); goto cleanup; } @@ -6882,9 +6878,9 @@ vboxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, if (NS_SUCCEEDED(rc)) rc = data->vboxSession->vtbl->GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not open VirtualBox session with domain %s"), - dom->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not open VirtualBox session with domain %s"), + dom->name); goto cleanup; } @@ -8351,9 +8347,9 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool) { ret = hardDiskAccessible; } else { ret = -1; - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get number of volumes in the pool: %s, rc=%08x"), - pool->name, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get number of volumes in the pool: %s, rc=%08x"), + pool->name, (unsigned)rc); } return ret; @@ -8403,9 +8399,9 @@ static int vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names ret = numActive; } else { ret = -1; - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get the volume list in the pool: %s, rc=%08x"), - pool->name, (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get the volume list in the pool: %s, rc=%08x"), + pool->name, (unsigned)rc); } return ret; @@ -8485,8 +8481,8 @@ static virStorageVolPtr vboxStorageVolLookupByKey(virConnectPtr conn, const char return ret; if (virUUIDParse(key, uuid) < 0) { - vboxError(VIR_ERR_INVALID_ARG, - _("Could not parse UUID from '%s'"), key); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not parse UUID from '%s'"), key); return NULL; } @@ -8716,8 +8712,8 @@ static int vboxStorageVolDelete(virStorageVolPtr vol, virCheckFlags(0, -1); if (virUUIDParse(vol->key, uuid) < 0) { - vboxError(VIR_ERR_INVALID_ARG, - _("Could not parse UUID from '%s'"), vol->key); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not parse UUID from '%s'"), vol->key); return -1; } @@ -8765,8 +8761,8 @@ static int vboxStorageVolDelete(virStorageVolPtr vol, #if VBOX_API_VERSION >= 4000 rc = VBOX_OBJECT_GET_MACHINE(machineId.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); break; } #endif @@ -8885,8 +8881,8 @@ static int vboxStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr info return ret; if (virUUIDParse(vol->key, uuid) < 0) { - vboxError(VIR_ERR_INVALID_ARG, - _("Could not parse UUID from '%s'"), vol->key); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not parse UUID from '%s'"), vol->key); return ret; } @@ -8955,8 +8951,8 @@ static char *vboxStorageVolGetXMLDesc(virStorageVolPtr vol, unsigned int flags) memset(&def, 0, sizeof(def)); if (virUUIDParse(vol->key, uuid) < 0) { - vboxError(VIR_ERR_INVALID_ARG, - _("Could not parse UUID from '%s'"), vol->key); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not parse UUID from '%s'"), vol->key); return ret; } @@ -9062,8 +9058,8 @@ static char *vboxStorageVolGetPath(virStorageVolPtr vol) { nsresult rc; if (virUUIDParse(vol->key, uuid) < 0) { - vboxError(VIR_ERR_INVALID_ARG, - _("Could not parse UUID from '%s'"), vol->key); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not parse UUID from '%s'"), vol->key); return ret; } @@ -9130,22 +9126,23 @@ vboxDomainScreenshot(virDomainPtr dom, vboxIIDFromUUID(&iid, dom->uuid); rc = VBOX_OBJECT_GET_MACHINE(iid.value, &machine); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); return NULL; } rc = machine->vtbl->GetMonitorCount(machine, &max_screen); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to get monitor count")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to get monitor count")); VBOX_RELEASE(machine); return NULL; } if (screen >= max_screen) { - vboxError(VIR_ERR_INVALID_ARG, _("screen ID higher than monitor " - "count (%d)"), max_screen); + virReportError(VIR_ERR_INVALID_ARG, + _("screen ID higher than monitor " + "count (%d)"), max_screen); VBOX_RELEASE(machine); return NULL; } @@ -9182,8 +9179,8 @@ vboxDomainScreenshot(virDomainPtr dom, &bitsPerPixel); if (NS_FAILED(rc) || !width || !height) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to get screen resolution")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to get screen resolution")); goto endjob; } @@ -9192,8 +9189,8 @@ vboxDomainScreenshot(virDomainPtr dom, &screenDataSize, &screenData); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("failed to take screenshot")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("failed to take screenshot")); goto endjob; } @@ -9210,8 +9207,8 @@ vboxDomainScreenshot(virDomainPtr dom, } if (virFDStreamOpenFile(st, tmp, 0, 0, O_RDONLY) < 0) { - vboxError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to open stream")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to open stream")); goto endjob; } @@ -9280,8 +9277,8 @@ vboxListAllDomains(virConnectPtr conn, rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of domains, rc=%08x"), (unsigned)rc); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of domains, rc=%08x"), (unsigned)rc); goto cleanup; } @@ -9314,8 +9311,8 @@ vboxListAllDomains(virConnectPtr conn, if (MATCH(VIR_CONNECT_LIST_FILTERS_SNAPSHOT)) { rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount); if (NS_FAILED(rc)) { - vboxError(VIR_ERR_INTERNAL_ERROR, - _("could not get snapshot count for listed domains")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get snapshot count for listed domains")); goto cleanup; } if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) && -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the VirtualBox driver to use virReportError instead of the vboxError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/vbox/vbox_driver.c | 20 +- src/vbox/vbox_tmpl.c | 779 ++++++++++++++++++++++++------------------------ 3 files changed, 396 insertions(+), 404 deletions(-)
ACK. Peter

On 07/18/2012 12:40 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the VirtualBox driver to use virReportError instead of the vboxError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> ---
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> Update the test driver to use virReportError instead of the testError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/test/test_driver.c | 509 ++++++++++++++++++++++++------------------------ 1 file changed, 255 insertions(+), 254 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 061f687..990b20d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -115,10 +115,6 @@ static const virNodeInfo defaultNodeInfo = { }; -#define testError(code, ...) \ - virReportErrorHelper(VIR_FROM_TEST, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - static int testClose(virConnectPtr conn); static void testDomainEventQueue(testConnPtr driver, virDomainEventPtr event); @@ -348,8 +344,8 @@ testDomainGenerateIfname(virDomainDefPtr domdef) { return ifname; } - testError(VIR_ERR_INTERNAL_ERROR, - _("Exceeded max iface limit %d"), maxif); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Exceeded max iface limit %d"), maxif); return NULL; } @@ -527,8 +523,8 @@ static int testOpenDefault(virConnectPtr conn) { return VIR_DRV_OPEN_ERROR; } if (virMutexInit(&privconn->lock) < 0) { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(privconn); return VIR_DRV_OPEN_ERROR; } @@ -694,8 +690,8 @@ static int testOpenVolumesForPool(xmlDocPtr xml, char *absFile = testBuildFilename(file, relFile); VIR_FREE(relFile); if (!absFile) { - testError(VIR_ERR_INTERNAL_ERROR, "%s", - _("resolving volume filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resolving volume filename")); goto error; } @@ -767,8 +763,8 @@ static int testOpenFromFile(virConnectPtr conn, return VIR_DRV_OPEN_ERROR; } if (virMutexInit(&privconn->lock) < 0) { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(privconn); return VIR_DRV_OPEN_ERROR; } @@ -787,8 +783,8 @@ static int testOpenFromFile(virConnectPtr conn, } if (!xmlStrEqual(ctxt->node->name, BAD_CAST "node")) { - testError(VIR_ERR_XML_ERROR, "%s", - _("Root element is not 'node'")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Root element is not 'node'")); goto error; } @@ -805,8 +801,8 @@ static int testOpenFromFile(virConnectPtr conn, if (ret == 0) { nodeInfo->nodes = l; } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node cpu nodes value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node cpu nodes value")); goto error; } @@ -814,8 +810,8 @@ static int testOpenFromFile(virConnectPtr conn, if (ret == 0) { nodeInfo->sockets = l; } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node cpu sockets value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node cpu sockets value")); goto error; } @@ -823,8 +819,8 @@ static int testOpenFromFile(virConnectPtr conn, if (ret == 0) { nodeInfo->cores = l; } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node cpu cores value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node cpu cores value")); goto error; } @@ -832,8 +828,8 @@ static int testOpenFromFile(virConnectPtr conn, if (ret == 0) { nodeInfo->threads = l; } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node cpu threads value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node cpu threads value")); goto error; } @@ -844,24 +840,24 @@ static int testOpenFromFile(virConnectPtr conn, nodeInfo->cpus = l; } } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node cpu active value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node cpu active value")); goto error; } ret = virXPathLong("string(/node/cpu/mhz[1])", ctxt, &l); if (ret == 0) { nodeInfo->mhz = l; } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node cpu mhz value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node cpu mhz value")); goto error; } str = virXPathString("string(/node/cpu/model[1])", ctxt); if (str != NULL) { if (virStrcpyStatic(nodeInfo->model, str) == NULL) { - testError(VIR_ERR_INTERNAL_ERROR, - _("Model %s too big for destination"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Model %s too big for destination"), str); VIR_FREE(str); goto error; } @@ -872,8 +868,8 @@ static int testOpenFromFile(virConnectPtr conn, if (ret == 0) { nodeInfo->memory = l; } else if (ret == -2) { - testError(VIR_ERR_XML_ERROR, "%s", - _("invalid node memory value")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid node memory value")); goto error; } @@ -889,7 +885,8 @@ static int testOpenFromFile(virConnectPtr conn, char *absFile = testBuildFilename(file, relFile); VIR_FREE(relFile); if (!absFile) { - testError(VIR_ERR_INTERNAL_ERROR, "%s", _("resolving domain filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resolving domain filename")); goto error; } def = virDomainDefParseFile(privconn->caps, absFile, @@ -933,7 +930,8 @@ static int testOpenFromFile(virConnectPtr conn, char *absFile = testBuildFilename(file, relFile); VIR_FREE(relFile); if (!absFile) { - testError(VIR_ERR_INTERNAL_ERROR, "%s", _("resolving network filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resolving network filename")); goto error; } @@ -968,7 +966,8 @@ static int testOpenFromFile(virConnectPtr conn, char *absFile = testBuildFilename(file, relFile); VIR_FREE(relFile); if (!absFile) { - testError(VIR_ERR_INTERNAL_ERROR, "%s", _("resolving interface filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resolving interface filename")); goto error; } @@ -1004,8 +1003,8 @@ static int testOpenFromFile(virConnectPtr conn, char *absFile = testBuildFilename(file, relFile); VIR_FREE(relFile); if (!absFile) { - testError(VIR_ERR_INTERNAL_ERROR, "%s", - _("resolving pool filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resolving pool filename")); goto error; } @@ -1056,8 +1055,8 @@ static int testOpenFromFile(virConnectPtr conn, VIR_FREE(relFile); if (!absFile) { - testError(VIR_ERR_INTERNAL_ERROR, "%s", - _("resolving device filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("resolving device filename")); goto error; } @@ -1127,8 +1126,8 @@ static virDrvOpenStatus testOpen(virConnectPtr conn, if (!conn->uri->path || conn->uri->path[0] == '\0' || (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) { - testError(VIR_ERR_INVALID_ARG, - "%s", _("testOpen: supply a path or use test:///default")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("testOpen: supply a path or use test:///default")); return VIR_DRV_OPEN_ERROR; } @@ -1248,7 +1247,7 @@ static int testDomainIsActive(virDomainPtr dom) obj = virDomainFindByUUID(&privconn->domains, dom->uuid); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = virDomainObjIsActive(obj); @@ -1269,7 +1268,7 @@ static int testDomainIsPersistent(virDomainPtr dom) obj = virDomainFindByUUID(&privconn->domains, dom->uuid); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = obj->persistent; @@ -1347,7 +1346,7 @@ static virDomainPtr testLookupDomainByID(virConnectPtr conn, testDriverUnlock(privconn); if (dom == NULL) { - testError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1373,7 +1372,7 @@ static virDomainPtr testLookupDomainByUUID(virConnectPtr conn, testDriverUnlock(privconn); if (dom == NULL) { - testError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1399,7 +1398,7 @@ static virDomainPtr testLookupDomainByName(virConnectPtr conn, testDriverUnlock(privconn); if (dom == NULL) { - testError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1439,7 +1438,7 @@ static int testDestroyDomain (virDomainPtr domain) domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -1477,13 +1476,13 @@ static int testResumeDomain (virDomainPtr domain) testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virDomainObjGetState(privdom, NULL) != VIR_DOMAIN_PAUSED) { - testError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not paused"), - domain->name); + virReportError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not paused"), + domain->name); goto cleanup; } @@ -1519,14 +1518,14 @@ static int testPauseDomain (virDomainPtr domain) testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } state = virDomainObjGetState(privdom, NULL); if (state == VIR_DOMAIN_SHUTOFF || state == VIR_DOMAIN_PAUSED) { - testError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not running"), - domain->name); + virReportError(VIR_ERR_INTERNAL_ERROR, _("domain '%s' not running"), + domain->name); goto cleanup; } @@ -1563,13 +1562,13 @@ static int testShutdownDomainFlags(virDomainPtr domain, domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virDomainObjGetState(privdom, NULL) == VIR_DOMAIN_SHUTOFF) { - testError(VIR_ERR_INTERNAL_ERROR, - _("domain '%s' not running"), domain->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("domain '%s' not running"), domain->name); goto cleanup; } @@ -1613,7 +1612,7 @@ static int testRebootDomain (virDomainPtr domain, domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -1684,13 +1683,13 @@ static int testGetDomainInfo (virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (gettimeofday(&tv, NULL) < 0) { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("getting time of day")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("getting time of day")); goto cleanup; } @@ -1725,7 +1724,7 @@ testDomainGetState(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -1754,8 +1753,8 @@ testDomainSaveFlags(virDomainPtr domain, const char *path, virCheckFlags(0, -1); if (dxml) { - testError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("xml modification unsupported")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("xml modification unsupported")); return -1; } @@ -1764,7 +1763,7 @@ testDomainSaveFlags(virDomainPtr domain, const char *path, domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -1867,8 +1866,8 @@ testDomainRestoreFlags(virConnectPtr conn, virCheckFlags(0, -1); if (dxml) { - testError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("xml modification unsupported")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("xml modification unsupported")); return -1; } @@ -1887,8 +1886,8 @@ testDomainRestoreFlags(virConnectPtr conn, goto cleanup; } if (memcmp(magic, TEST_SAVE_MAGIC, sizeof(magic))) { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("mismatched header magic")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("mismatched header magic")); goto cleanup; } if (saferead(fd, (char*)&len, sizeof(len)) != sizeof(len)) { @@ -1898,8 +1897,8 @@ testDomainRestoreFlags(virConnectPtr conn, goto cleanup; } if (len < 1 || len > 8192) { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("length of metadata out of range")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("length of metadata out of range")); goto cleanup; } if (VIR_ALLOC_N(xml, len+1) < 0) { @@ -1973,7 +1972,7 @@ static int testDomainCoreDump(virDomainPtr domain, domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2037,7 +2036,7 @@ static unsigned long long testGetMaxMemory(virDomainPtr domain) { testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2062,7 +2061,7 @@ static int testSetMaxMemory(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2089,12 +2088,12 @@ static int testSetMemory(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (memory > privdom->def->mem.max_balloon) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2126,8 +2125,8 @@ testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - testError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2170,13 +2169,13 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, if ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) == 0 || (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_LIVE)) == (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_AFFECT_LIVE)) { - testError(VIR_ERR_INVALID_ARG, - _("invalid flag combination: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid flag combination: (0x%x)"), flags); return -1; } if (!nrCpus || (maxvcpus = testGetMaxVCPUs(domain->conn, NULL)) < nrCpus) { - testError(VIR_ERR_INVALID_ARG, - _("argument out of range: %d"), nrCpus); + virReportError(VIR_ERR_INVALID_ARG, + _("argument out of range: %d"), nrCpus); return -1; } @@ -2185,13 +2184,13 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_AFFECT_LIVE)) { - testError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot hotplug vcpus for an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot hotplug vcpus for an inactive domain")); goto cleanup; } @@ -2202,9 +2201,9 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus, maxvcpus = privdom->def->maxvcpus; if (nrCpus > maxvcpus) { - testError(VIR_ERR_INVALID_ARG, - _("requested cpu amount exceeds maximum (%d > %d)"), - nrCpus, maxvcpus); + virReportError(VIR_ERR_INVALID_ARG, + _("requested cpu amount exceeds maximum (%d > %d)"), + nrCpus, maxvcpus); goto cleanup; } @@ -2268,13 +2267,13 @@ static int testDomainGetVcpus(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virDomainObjIsActive(privdom)) { - testError(VIR_ERR_OPERATION_INVALID, - "%s",_("cannot list vcpus for an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s",_("cannot list vcpus for an inactive domain")); goto cleanup; } @@ -2354,19 +2353,19 @@ static int testDomainPinVcpu(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virDomainObjIsActive(privdom)) { - testError(VIR_ERR_OPERATION_INVALID, - "%s",_("cannot pin vcpus on an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s",_("cannot pin vcpus on an inactive domain")); goto cleanup; } if (vcpu > privdom->def->vcpus) { - testError(VIR_ERR_INVALID_ARG, "%s", - _("requested vcpu is higher than allocated vcpus")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("requested vcpu is higher than allocated vcpus")); goto cleanup; } @@ -2409,7 +2408,7 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2506,8 +2505,8 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn, testDriverLock(privconn); if (startCell > privconn->numCells) { - testError(VIR_ERR_INVALID_ARG, - "%s", _("Range exceeds available cells")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("Range exceeds available cells")); goto cleanup; } @@ -2537,13 +2536,13 @@ static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) { domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virDomainObjGetState(privdom, NULL) != VIR_DOMAIN_SHUTOFF) { - testError(VIR_ERR_INTERNAL_ERROR, - _("Domain '%s' is already running"), domain->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Domain '%s' is already running"), domain->name); goto cleanup; } @@ -2585,7 +2584,7 @@ static int testDomainUndefineFlags(virDomainPtr domain, domain->name); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2629,7 +2628,7 @@ static int testDomainGetAutostart(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2656,7 +2655,7 @@ static int testDomainSetAutostart(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2702,7 +2701,7 @@ testDomainGetSchedulerParamsFlags(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2752,7 +2751,7 @@ testDomainSetSchedulerParamsFlags(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -2795,13 +2794,13 @@ static int testDomainBlockStats(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } if (virDomainDiskIndexByName(privdom->def, path, false) < 0) { - testError(VIR_ERR_INVALID_ARG, - _("invalid path: %s"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path: %s"), path); goto error; } @@ -2842,7 +2841,7 @@ static int testDomainInterfaceStats(virDomainPtr domain, testDriverUnlock(privconn); if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } @@ -2855,8 +2854,8 @@ static int testDomainInterfaceStats(virDomainPtr domain, } if (!found) { - testError(VIR_ERR_INVALID_ARG, - _("invalid path, '%s' is not a known interface"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path, '%s' is not a known interface"), path); goto error; } @@ -2915,7 +2914,7 @@ static virNetworkPtr testLookupNetworkByUUID(virConnectPtr conn, testDriverUnlock(privconn); if (net == NULL) { - testError(VIR_ERR_NO_NETWORK, NULL); + virReportError(VIR_ERR_NO_NETWORK, NULL); goto cleanup; } @@ -2939,7 +2938,7 @@ static virNetworkPtr testLookupNetworkByName(virConnectPtr conn, testDriverUnlock(privconn); if (net == NULL) { - testError(VIR_ERR_NO_NETWORK, NULL); + virReportError(VIR_ERR_NO_NETWORK, NULL); goto cleanup; } @@ -3049,7 +3048,7 @@ static int testNetworkIsActive(virNetworkPtr net) obj = virNetworkFindByUUID(&privconn->networks, net->uuid); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_NETWORK, NULL); + virReportError(VIR_ERR_NO_NETWORK, NULL); goto cleanup; } ret = virNetworkObjIsActive(obj); @@ -3070,7 +3069,7 @@ static int testNetworkIsPersistent(virNetworkPtr net) obj = virNetworkFindByUUID(&privconn->networks, net->uuid); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_NETWORK, NULL); + virReportError(VIR_ERR_NO_NETWORK, NULL); goto cleanup; } ret = obj->persistent; @@ -3142,13 +3141,13 @@ static int testNetworkUndefine(virNetworkPtr network) { network->name); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virNetworkObjIsActive(privnet)) { - testError(VIR_ERR_OPERATION_INVALID, - _("Network '%s' is still running"), network->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Network '%s' is still running"), network->name); goto cleanup; } @@ -3175,13 +3174,13 @@ static int testNetworkStart(virNetworkPtr network) { testDriverUnlock(privconn); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virNetworkObjIsActive(privnet)) { - testError(VIR_ERR_OPERATION_INVALID, - _("Network '%s' is already running"), network->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Network '%s' is already running"), network->name); goto cleanup; } @@ -3204,7 +3203,7 @@ static int testNetworkDestroy(virNetworkPtr network) { network->name); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -3238,7 +3237,7 @@ static char *testNetworkGetXMLDesc(virNetworkPtr network, testDriverUnlock(privconn); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -3261,14 +3260,14 @@ static char *testNetworkGetBridgeName(virNetworkPtr network) { testDriverUnlock(privconn); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!(privnet->def->bridge)) { - testError(VIR_ERR_INTERNAL_ERROR, - _("network '%s' does not have a bridge name."), - privnet->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network '%s' does not have a bridge name."), + privnet->def->name); goto cleanup; } @@ -3295,7 +3294,7 @@ static int testNetworkGetAutostart(virNetworkPtr network, testDriverUnlock(privconn); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -3320,7 +3319,7 @@ static int testNetworkSetAutostart(virNetworkPtr network, testDriverUnlock(privconn); if (privnet == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -3462,7 +3461,7 @@ static virInterfacePtr testLookupInterfaceByName(virConnectPtr conn, testDriverUnlock(privconn); if (iface == NULL) { - testError(VIR_ERR_NO_INTERFACE, NULL); + virReportError(VIR_ERR_NO_INTERFACE, NULL); goto cleanup; } @@ -3487,12 +3486,12 @@ static virInterfacePtr testLookupInterfaceByMACString(virConnectPtr conn, testDriverUnlock(privconn); if (ifacect == 0) { - testError(VIR_ERR_NO_INTERFACE, NULL); + virReportError(VIR_ERR_NO_INTERFACE, NULL); goto cleanup; } if (ifacect > 1) { - testError(VIR_ERR_MULTIPLE_INTERFACES, NULL); + virReportError(VIR_ERR_MULTIPLE_INTERFACES, NULL); goto cleanup; } @@ -3514,7 +3513,7 @@ static int testInterfaceIsActive(virInterfacePtr iface) obj = virInterfaceFindByName(&privconn->ifaces, iface->name); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_INTERFACE, NULL); + virReportError(VIR_ERR_NO_INTERFACE, NULL); goto cleanup; } ret = virInterfaceObjIsActive(obj); @@ -3535,8 +3534,8 @@ static int testInterfaceChangeBegin(virConnectPtr conn, testDriverLock(privconn); if (privconn->transaction_running) { - testError(VIR_ERR_OPERATION_INVALID, - _("there is another transaction running.")); + virReportError(VIR_ERR_OPERATION_INVALID, + _("there is another transaction running.")); goto cleanup; } @@ -3563,8 +3562,9 @@ static int testInterfaceChangeCommit(virConnectPtr conn, testDriverLock(privconn); if (!privconn->transaction_running) { - testError(VIR_ERR_OPERATION_INVALID, _("no transaction running, " - "nothing to be committed.")); + virReportError(VIR_ERR_OPERATION_INVALID, + _("no transaction running, " + "nothing to be committed.")); goto cleanup; } @@ -3590,8 +3590,9 @@ static int testInterfaceChangeRollback(virConnectPtr conn, testDriverLock(privconn); if (!privconn->transaction_running) { - testError(VIR_ERR_OPERATION_INVALID, _("no transaction running, " - "nothing to rollback.")); + virReportError(VIR_ERR_OPERATION_INVALID, + _("no transaction running, " + "nothing to rollback.")); goto cleanup; } @@ -3625,7 +3626,7 @@ static char *testInterfaceGetXMLDesc(virInterfacePtr iface, testDriverUnlock(privconn); if (privinterface == NULL) { - testError(VIR_ERR_NO_INTERFACE, __FUNCTION__); + virReportError(VIR_ERR_NO_INTERFACE, __FUNCTION__); goto cleanup; } @@ -3677,7 +3678,7 @@ static int testInterfaceUndefine(virInterfacePtr iface) iface->name); if (privinterface == NULL) { - testError(VIR_ERR_NO_INTERFACE, NULL); + virReportError(VIR_ERR_NO_INTERFACE, NULL); goto cleanup; } @@ -3704,12 +3705,12 @@ static int testInterfaceCreate(virInterfacePtr iface, iface->name); if (privinterface == NULL) { - testError(VIR_ERR_NO_INTERFACE, NULL); + virReportError(VIR_ERR_NO_INTERFACE, NULL); goto cleanup; } if (privinterface->active != 0) { - testError(VIR_ERR_OPERATION_INVALID, NULL); + virReportError(VIR_ERR_OPERATION_INVALID, NULL); goto cleanup; } @@ -3737,12 +3738,12 @@ static int testInterfaceDestroy(virInterfacePtr iface, iface->name); if (privinterface == NULL) { - testError(VIR_ERR_NO_INTERFACE, NULL); + virReportError(VIR_ERR_NO_INTERFACE, NULL); goto cleanup; } if (privinterface->active == 0) { - testError(VIR_ERR_OPERATION_INVALID, NULL); + virReportError(VIR_ERR_OPERATION_INVALID, NULL); goto cleanup; } @@ -3809,7 +3810,7 @@ testStoragePoolLookupByUUID(virConnectPtr conn, testDriverUnlock(privconn); if (pool == NULL) { - testError(VIR_ERR_NO_STORAGE_POOL, NULL); + virReportError(VIR_ERR_NO_STORAGE_POOL, NULL); goto cleanup; } @@ -3833,7 +3834,7 @@ testStoragePoolLookupByName(virConnectPtr conn, testDriverUnlock(privconn); if (pool == NULL) { - testError(VIR_ERR_NO_STORAGE_POOL, NULL); + virReportError(VIR_ERR_NO_STORAGE_POOL, NULL); goto cleanup; } @@ -3952,7 +3953,7 @@ static int testStoragePoolIsActive(virStoragePoolPtr pool) obj = virStoragePoolObjFindByUUID(&privconn->pools, pool->uuid); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_STORAGE_POOL, NULL); + virReportError(VIR_ERR_NO_STORAGE_POOL, NULL); goto cleanup; } ret = virStoragePoolObjIsActive(obj); @@ -3973,7 +3974,7 @@ static int testStoragePoolIsPersistent(virStoragePoolPtr pool) obj = virStoragePoolObjFindByUUID(&privconn->pools, pool->uuid); testDriverUnlock(privconn); if (!obj) { - testError(VIR_ERR_NO_STORAGE_POOL, NULL); + virReportError(VIR_ERR_NO_STORAGE_POOL, NULL); goto cleanup; } ret = obj->configFile ? 1 : 0; @@ -4002,13 +4003,13 @@ testStoragePoolStart(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is already active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is already active"), pool->name); goto cleanup; } @@ -4035,8 +4036,8 @@ testStorageFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, pool_type = virStoragePoolTypeFromString(type); if (!pool_type) { - testError(VIR_ERR_INTERNAL_ERROR, - _("unknown storage pool type %s"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown storage pool type %s"), type); goto cleanup; } @@ -4056,8 +4057,8 @@ testStorageFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, case VIR_STORAGE_POOL_NETFS: if (!source || !source->hosts[0].name) { - testError(VIR_ERR_INVALID_ARG, - "%s", _("hostname must be specified for netfs sources")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("hostname must be specified for netfs sources")); goto cleanup; } @@ -4067,8 +4068,8 @@ testStorageFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, break; default: - testError(VIR_ERR_NO_SUPPORT, - _("pool type '%s' does not support source discovery"), type); + virReportError(VIR_ERR_NO_SUPPORT, + _("pool type '%s' does not support source discovery"), type); } cleanup: @@ -4097,8 +4098,8 @@ testStoragePoolCreate(virConnectPtr conn, if (!pool) pool = virStoragePoolObjFindByName(&privconn->pools, def->name); if (pool) { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("storage pool already exists")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("storage pool already exists")); goto cleanup; } @@ -4174,13 +4175,13 @@ testStoragePoolUndefine(virStoragePoolPtr pool) { pool->name); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is already active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is already active"), pool->name); goto cleanup; } @@ -4210,13 +4211,13 @@ testStoragePoolBuild(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is already active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is already active"), pool->name); goto cleanup; } ret = 0; @@ -4239,13 +4240,13 @@ testStoragePoolDestroy(virStoragePoolPtr pool) { pool->name); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } @@ -4281,13 +4282,13 @@ testStoragePoolDelete(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is already active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is already active"), pool->name); goto cleanup; } @@ -4316,13 +4317,13 @@ testStoragePoolRefresh(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } ret = 0; @@ -4347,7 +4348,7 @@ testStoragePoolGetInfo(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -4383,7 +4384,7 @@ testStoragePoolGetXMLDesc(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -4408,7 +4409,7 @@ testStoragePoolGetAutostart(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -4438,13 +4439,13 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!privpool->configFile) { - testError(VIR_ERR_INVALID_ARG, - "%s", _("pool has no config file")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("pool has no config file")); goto cleanup; } @@ -4471,13 +4472,13 @@ testStoragePoolNumVolumes(virStoragePoolPtr pool) { testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } @@ -4505,14 +4506,14 @@ testStoragePoolListVolumes(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } @@ -4551,22 +4552,22 @@ testStorageVolumeLookupByName(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } privvol = virStorageVolDefFindByName(privpool, name); if (!privvol) { - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching name '%s'"), name); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching name '%s'"), name); goto cleanup; } @@ -4608,8 +4609,8 @@ testStorageVolumeLookupByKey(virConnectPtr conn, testDriverUnlock(privconn); if (!ret) - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching key '%s'"), key); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching key '%s'"), key); return ret; } @@ -4642,8 +4643,8 @@ testStorageVolumeLookupByPath(virConnectPtr conn, testDriverUnlock(privconn); if (!ret) - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching path '%s'"), path); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching path '%s'"), path); return ret; } @@ -4666,13 +4667,13 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } @@ -4681,17 +4682,17 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool, goto cleanup; if (virStorageVolDefFindByName(privpool, privvol->name)) { - testError(VIR_ERR_OPERATION_FAILED, - "%s", _("storage vol already exists")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("storage vol already exists")); goto cleanup; } /* Make sure enough space */ if ((privpool->def->allocation + privvol->allocation) > privpool->def->capacity) { - testError(VIR_ERR_INTERNAL_ERROR, - _("Not enough free space in pool for volume '%s'"), - privvol->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Not enough free space in pool for volume '%s'"), + privvol->name); goto cleanup; } @@ -4750,13 +4751,13 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), pool->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), pool->name); goto cleanup; } @@ -4765,25 +4766,25 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, goto cleanup; if (virStorageVolDefFindByName(privpool, privvol->name)) { - testError(VIR_ERR_OPERATION_FAILED, - "%s", _("storage vol already exists")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("storage vol already exists")); goto cleanup; } origvol = virStorageVolDefFindByName(privpool, clonevol->name); if (!origvol) { - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching name '%s'"), - clonevol->name); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching name '%s'"), + clonevol->name); goto cleanup; } /* Make sure enough space */ if ((privpool->def->allocation + privvol->allocation) > privpool->def->capacity) { - testError(VIR_ERR_INTERNAL_ERROR, - _("Not enough free space in pool for volume '%s'"), - privvol->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Not enough free space in pool for volume '%s'"), + privvol->name); goto cleanup; } privpool->def->available = (privpool->def->capacity - @@ -4843,7 +4844,7 @@ testStorageVolumeDelete(virStorageVolPtr vol, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } @@ -4851,15 +4852,15 @@ testStorageVolumeDelete(virStorageVolPtr vol, privvol = virStorageVolDefFindByName(privpool, vol->name); if (privvol == NULL) { - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching name '%s'"), - vol->name); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching name '%s'"), + vol->name); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), vol->pool); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), vol->pool); goto cleanup; } @@ -4922,22 +4923,22 @@ testStorageVolumeGetInfo(virStorageVolPtr vol, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } privvol = virStorageVolDefFindByName(privpool, vol->name); if (privvol == NULL) { - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching name '%s'"), - vol->name); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching name '%s'"), + vol->name); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), vol->pool); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), vol->pool); goto cleanup; } @@ -4970,22 +4971,22 @@ testStorageVolumeGetXMLDesc(virStorageVolPtr vol, testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } privvol = virStorageVolDefFindByName(privpool, vol->name); if (privvol == NULL) { - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching name '%s'"), - vol->name); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching name '%s'"), + vol->name); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), vol->pool); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), vol->pool); goto cleanup; } @@ -5010,22 +5011,22 @@ testStorageVolumeGetPath(virStorageVolPtr vol) { testDriverUnlock(privconn); if (privpool == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; } privvol = virStorageVolDefFindByName(privpool, vol->name); if (privvol == NULL) { - testError(VIR_ERR_NO_STORAGE_VOL, - _("no storage vol with matching name '%s'"), - vol->name); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("no storage vol with matching name '%s'"), + vol->name); goto cleanup; } if (!virStoragePoolObjIsActive(privpool)) { - testError(VIR_ERR_OPERATION_INVALID, - _("storage pool '%s' is not active"), vol->pool); + virReportError(VIR_ERR_OPERATION_INVALID, + _("storage pool '%s' is not active"), vol->pool); goto cleanup; } @@ -5129,7 +5130,7 @@ testNodeDeviceLookupByName(virConnectPtr conn, const char *name) testDriverUnlock(driver); if (!obj) { - testError(VIR_ERR_NO_NODE_DEVICE, NULL); + virReportError(VIR_ERR_NO_NODE_DEVICE, NULL); goto cleanup; } @@ -5156,9 +5157,9 @@ testNodeDeviceGetXMLDesc(virNodeDevicePtr dev, testDriverUnlock(driver); if (!obj) { - testError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + virReportError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5182,9 +5183,9 @@ testNodeDeviceGetParent(virNodeDevicePtr dev) testDriverUnlock(driver); if (!obj) { - testError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + virReportError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5193,8 +5194,8 @@ testNodeDeviceGetParent(virNodeDevicePtr dev) if (!ret) virReportOOMError(); } else { - testError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no parent for this device")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no parent for this device")); } cleanup: @@ -5218,9 +5219,9 @@ testNodeDeviceNumOfCaps(virNodeDevicePtr dev) testDriverUnlock(driver); if (!obj) { - testError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + virReportError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5249,9 +5250,9 @@ testNodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames) testDriverUnlock(driver); if (!obj) { - testError(VIR_ERR_NO_NODE_DEVICE, - _("no node device with matching name '%s'"), - dev->name); + virReportError(VIR_ERR_NO_NODE_DEVICE, + _("no node device with matching name '%s'"), + dev->name); goto cleanup; } @@ -5356,7 +5357,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev) testDriverUnlock(driver); if (!obj) { - testError(VIR_ERR_NO_NODE_DEVICE, NULL); + virReportError(VIR_ERR_NO_NODE_DEVICE, NULL); goto out; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the test driver to use virReportError instead of the testError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/test/test_driver.c | 509 ++++++++++++++++++++++++------------------------ 1 file changed, 255 insertions(+), 254 deletions(-)
@@ -1973,7 +1972,7 @@ static int testDomainCoreDump(virDomainPtr domain, domain->name);
if (privdom == NULL) { - testError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto cleanup; }
Parts like this above probably also require "%s", treatment. ACK as the problem above persists longer. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the CPU helper APIs to use virReportError instead of the virCPUReportError custom macor Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/cpu/cpu.c | 86 ++++++++++++++++---------------- src/cpu/cpu.h | 5 -- src/cpu/cpu_generic.c | 18 +++---- src/cpu/cpu_map.c | 22 ++++----- src/cpu/cpu_x86.c | 132 ++++++++++++++++++++++++------------------------- 6 files changed, 129 insertions(+), 135 deletions(-) diff --git a/cfg.mk b/cfg.mk index 5e433f9..9dfb618 100644 --- a/cfg.mk +++ b/cfg.mk @@ -525,7 +525,6 @@ msg_gen_function += streamsReportError msg_gen_function += vah_error msg_gen_function += vah_warning msg_gen_function += virConfError -msg_gen_function += virCPUReportError msg_gen_function += virGenericReportError msg_gen_function += virLibConnError msg_gen_function += virLibDomainError diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 0ccbd4c..c7a08c0 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -54,8 +54,8 @@ cpuGetSubDriver(const char *arch) unsigned int j; if (arch == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("undefined hardware architecture")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("undefined hardware architecture")); return NULL; } @@ -90,8 +90,8 @@ cpuCompareXML(virCPUDefPtr host, goto cleanup; if (!cpu->model) { - virCPUReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("no CPU model specified")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("no CPU model specified")); goto cleanup; } @@ -118,9 +118,9 @@ cpuCompare(virCPUDefPtr host, return VIR_CPU_COMPARE_ERROR; if (driver->compare == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot compare CPUs of %s architecture"), - host->arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot compare CPUs of %s architecture"), + host->arch); return VIR_CPU_COMPARE_ERROR; } @@ -146,14 +146,14 @@ cpuDecode(virCPUDefPtr cpu, } if (models == NULL && nmodels != 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("nonzero nmodels doesn't match with NULL models")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("nonzero nmodels doesn't match with NULL models")); return -1; } if (cpu == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid CPU definition")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid CPU definition")); return -1; } @@ -161,9 +161,9 @@ cpuDecode(virCPUDefPtr cpu, return -1; if (driver->decode == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot decode CPU data for %s architecture"), - cpu->arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot decode CPU data for %s architecture"), + cpu->arch); return -1; } @@ -192,9 +192,9 @@ cpuEncode(const char *arch, return -1; if (driver->encode == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot encode CPU data for %s architecture"), - arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot encode CPU data for %s architecture"), + arch); return -1; } @@ -218,9 +218,9 @@ cpuDataFree(const char *arch, return; if (driver->free == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot free CPU data for %s architecture"), - arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot free CPU data for %s architecture"), + arch); return; } @@ -239,9 +239,9 @@ cpuNodeData(const char *arch) return NULL; if (driver->nodeData == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot get node CPU data for %s architecture"), - arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot get node CPU data for %s architecture"), + arch); return NULL; } @@ -263,9 +263,9 @@ cpuGuestData(virCPUDefPtr host, return VIR_CPU_COMPARE_ERROR; if (driver->guestData == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot compute guest CPU data for %s architecture"), - host->arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot compute guest CPU data for %s architecture"), + host->arch); return VIR_CPU_COMPARE_ERROR; } @@ -297,13 +297,13 @@ cpuBaselineXML(const char **xmlCPUs, } if (xmlCPUs == NULL && ncpus != 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("nonzero ncpus doesn't match with NULL xmlCPUs")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("nonzero ncpus doesn't match with NULL xmlCPUs")); return NULL; } if (ncpus < 1) { - virCPUReportError(VIR_ERR_INVALID_ARG, "%s", _("No CPUs given")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("No CPUs given")); return NULL; } @@ -369,19 +369,19 @@ cpuBaseline(virCPUDefPtr *cpus, } if (cpus == NULL && ncpus != 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("nonzero ncpus doesn't match with NULL cpus")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("nonzero ncpus doesn't match with NULL cpus")); return NULL; } if (ncpus < 1) { - virCPUReportError(VIR_ERR_INVALID_ARG, "%s", _("No CPUs given")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("No CPUs given")); return NULL; } if (models == NULL && nmodels != 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("nonzero nmodels doesn't match with NULL models")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("nonzero nmodels doesn't match with NULL models")); return NULL; } @@ -389,9 +389,9 @@ cpuBaseline(virCPUDefPtr *cpus, return NULL; if (driver->baseline == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot compute baseline CPU of %s architecture"), - cpus[0]->arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot compute baseline CPU of %s architecture"), + cpus[0]->arch); return NULL; } @@ -411,9 +411,9 @@ cpuUpdate(virCPUDefPtr guest, return -1; if (driver->update == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot update guest CPU data for %s architecture"), - host->arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot update guest CPU data for %s architecture"), + host->arch); return -1; } @@ -434,9 +434,9 @@ cpuHasFeature(const char *arch, return -1; if (driver->hasFeature == NULL) { - virCPUReportError(VIR_ERR_NO_SUPPORT, - _("cannot check guest CPU data for %s architecture"), - arch); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot check guest CPU data for %s architecture"), + arch); return -1; } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index d7bc54e..8d6db44 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -30,11 +30,6 @@ # include "cpu_x86_data.h" -# define virCPUReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - - union cpuData { struct cpuX86Data x86; /* generic driver needs no data */ diff --git a/src/cpu/cpu_generic.c b/src/cpu/cpu_generic.c index 2a31b49..cba6cfa 100644 --- a/src/cpu/cpu_generic.c +++ b/src/cpu/cpu_generic.c @@ -131,9 +131,9 @@ genericBaseline(virCPUDefPtr *cpus, } } if (!found) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU model '%s' is not support by hypervisor"), - cpus[0]->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU model '%s' is not support by hypervisor"), + cpus[0]->model); goto error; } } @@ -154,16 +154,16 @@ genericBaseline(virCPUDefPtr *cpus, virHashTablePtr hash; if (STRNEQ(cpu->arch, cpus[i]->arch)) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPUs have incompatible architectures: '%s' != '%s'"), - cpu->arch, cpus[i]->arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPUs have incompatible architectures: '%s' != '%s'"), + cpu->arch, cpus[i]->arch); goto error; } if (STRNEQ(cpu->model, cpus[i]->model)) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU models don't match: '%s' != '%s'"), - cpu->model, cpus[i]->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU models don't match: '%s' != '%s'"), + cpu->model, cpus[i]->model); goto error; } diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index b8a6374..9749423 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -86,21 +86,21 @@ int cpuMapLoad(const char *arch, const char *mapfile = (cpumap ? cpumap : CPUMAPFILE); if (arch == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("undefined hardware architecture")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("undefined hardware architecture")); return -1; } if (cb == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no callback provided")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no callback provided")); return -1; } if ((xml = xmlParseFile(mapfile)) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse CPU map file: %s"), - mapfile); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse CPU map file: %s"), + mapfile); goto cleanup; } @@ -116,15 +116,15 @@ int cpuMapLoad(const char *arch, ctxt->node = xmlDocGetRootElement(xml); if ((ctxt->node = virXPathNode(xpath, ctxt)) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find CPU map for %s architecture"), arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find CPU map for %s architecture"), arch); goto cleanup; } for (element = 0; element < CPU_MAP_ELEMENT_LAST; element++) { if (load(ctxt, element, cb, data) < 0) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse CPU map for %s architecture"), arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse CPU map for %s architecture"), arch); goto cleanup; } } diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 73e9d7e..dce0a09 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -524,26 +524,26 @@ x86VendorLoad(xmlXPathContextPtr ctxt, vendor->name = virXPathString("string(@name)", ctxt); if (!vendor->name) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU vendor name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU vendor name")); goto ignore; } if (x86VendorFind(map, vendor->name)) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU vendor %s already defined"), vendor->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU vendor %s already defined"), vendor->name); goto ignore; } string = virXPathString("string(@string)", ctxt); if (!string) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Missing vendor string for CPU vendor %s"), vendor->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing vendor string for CPU vendor %s"), vendor->name); goto ignore; } if (strlen(string) != VENDOR_STRING_LENGTH) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid CPU vendor string '%s'"), string); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid CPU vendor string '%s'"), string); goto ignore; } @@ -673,14 +673,14 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, feature->name = virXPathString("string(@name)", ctxt); if (feature->name == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU feature name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU feature name")); goto ignore; } if (x86FeatureFind(map, feature->name)) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU feature %s already defined"), feature->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU feature %s already defined"), feature->name); goto ignore; } @@ -703,8 +703,8 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, if (ret_fun < 0 || ret_eax == -2 || ret_ebx == -2 || ret_ecx == -2 || ret_edx == -2) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid cpuid[%d] in %s feature"), i, feature->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid cpuid[%d] in %s feature"), i, feature->name); goto ignore; } @@ -816,8 +816,8 @@ x86ModelFromCPU(const virCPUDefPtr cpu, if (policy == VIR_CPU_FEATURE_REQUIRE) { if ((model = x86ModelFind(map, cpu->model)) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown CPU model %s"), cpu->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown CPU model %s"), cpu->model); goto error; } @@ -837,8 +837,8 @@ x86ModelFromCPU(const virCPUDefPtr cpu, continue; if ((feature = x86FeatureFind(map, cpu->features[i].name)) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown CPU feature %s"), cpu->features[i].name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown CPU feature %s"), cpu->features[i].name); goto error; } @@ -866,9 +866,9 @@ x86ModelSubtractCPU(struct x86_model *model, unsigned int i; if (!(cpu_model = x86ModelFind(map, cpu->model))) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown CPU model %s"), - cpu->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown CPU model %s"), + cpu->model); return -1; } @@ -878,9 +878,9 @@ x86ModelSubtractCPU(struct x86_model *model, const struct x86_feature *feature; if (!(feature = x86FeatureFind(map, cpu->features[i].name))) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown CPU feature %s"), - cpu->features[i].name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown CPU feature %s"), + cpu->features[i].name); return -1; } @@ -953,8 +953,8 @@ x86ModelLoad(xmlXPathContextPtr ctxt, model->name = virXPathString("string(@name)", ctxt); if (model->name == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU model name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing CPU model name")); goto ignore; } @@ -964,16 +964,16 @@ x86ModelLoad(xmlXPathContextPtr ctxt, name = virXPathString("string(./model/@name)", ctxt); if (name == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Missing ancestor's name in CPU model %s"), - model->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing ancestor's name in CPU model %s"), + model->name); goto ignore; } if ((ancestor = x86ModelFind(map, name)) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Ancestor model %s not found for CPU model %s"), - name, model->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Ancestor model %s not found for CPU model %s"), + name, model->name); VIR_FREE(name); goto ignore; } @@ -989,16 +989,16 @@ x86ModelLoad(xmlXPathContextPtr ctxt, if (virXPathBoolean("boolean(./vendor)", ctxt)) { vendor = virXPathString("string(./vendor/@name)", ctxt); if (!vendor) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid vendor element in CPU model %s"), - model->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid vendor element in CPU model %s"), + model->name); goto ignore; } if (!(model->vendor = x86VendorFind(map, vendor))) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown vendor %s referenced by CPU model %s"), - vendor, model->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown vendor %s referenced by CPU model %s"), + vendor, model->name); goto ignore; } } @@ -1012,15 +1012,15 @@ x86ModelLoad(xmlXPathContextPtr ctxt, char *name; if ((name = virXMLPropString(nodes[i], "name")) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Missing feature name for CPU model %s"), model->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing feature name for CPU model %s"), model->name); goto ignore; } if ((feature = x86FeatureFind(map, name)) == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Feature %s required by CPU model %s not found"), - name, model->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Feature %s required by CPU model %s not found"), + name, model->name); VIR_FREE(name); goto ignore; } @@ -1336,9 +1336,9 @@ x86Decode(virCPUDefPtr cpu, if (!allowed) { if (preferred && STREQ(candidate->name, preferred)) { if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) { - virCPUReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("CPU model %s is not supported by hypervisor"), - preferred); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU model %s is not supported by hypervisor"), + preferred); goto out; } else { VIR_WARN("Preferred CPU model %s not allowed by" @@ -1395,8 +1395,8 @@ x86Decode(virCPUDefPtr cpu, } if (cpuModel == NULL) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Cannot find suitable CPU model for given data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Cannot find suitable CPU model for given data")); goto out; } @@ -1490,8 +1490,8 @@ x86Encode(const virCPUDefPtr cpu, const struct x86_vendor *v = NULL; if (cpu->vendor && !(v = x86VendorFind(map, cpu->vendor))) { - virCPUReportError(VIR_ERR_OPERATION_FAILED, - _("CPU vendor %s not found"), cpu->vendor); + virReportError(VIR_ERR_OPERATION_FAILED, + _("CPU vendor %s not found"), cpu->vendor); goto error; } @@ -1646,8 +1646,8 @@ x86Baseline(virCPUDefPtr *cpus, if (!cpus[0]->vendor) outputVendor = false; else if (!(vendor = x86VendorFind(map, cpus[0]->vendor))) { - virCPUReportError(VIR_ERR_OPERATION_FAILED, - _("Unknown CPU vendor %s"), cpus[0]->vendor); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Unknown CPU vendor %s"), cpus[0]->vendor); goto error; } @@ -1659,9 +1659,9 @@ x86Baseline(virCPUDefPtr *cpus, if (cpus[i]->vendor && model->vendor && STRNEQ(cpus[i]->vendor, model->vendor->name)) { - virCPUReportError(VIR_ERR_OPERATION_FAILED, - _("CPU vendor %s of model %s differs from vendor %s"), - model->vendor->name, model->name, cpus[i]->vendor); + virReportError(VIR_ERR_OPERATION_FAILED, + _("CPU vendor %s of model %s differs from vendor %s"), + model->vendor->name, model->name, cpus[i]->vendor); goto error; } @@ -1676,13 +1676,13 @@ x86Baseline(virCPUDefPtr *cpus, if (vn) { if (!vendor) { if (!(vendor = x86VendorFind(map, vn))) { - virCPUReportError(VIR_ERR_OPERATION_FAILED, - _("Unknown CPU vendor %s"), vn); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Unknown CPU vendor %s"), vn); goto error; } } else if (STRNEQ(vendor->name, vn)) { - virCPUReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("CPU vendors do not match")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("CPU vendors do not match")); goto error; } } @@ -1693,8 +1693,8 @@ x86Baseline(virCPUDefPtr *cpus, } if (x86DataIsEmpty(base_model->data)) { - virCPUReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("CPUs are incompatible")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("CPUs are incompatible")); goto error; } @@ -1742,9 +1742,9 @@ x86UpdateCustom(virCPUDefPtr guest, if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) { const struct x86_feature *feature; if (!(feature = x86FeatureFind(map, guest->features[i].name))) { - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown CPU feature %s"), - guest->features[i].name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown CPU feature %s"), + guest->features[i].name); goto cleanup; } @@ -1792,8 +1792,8 @@ x86Update(virCPUDefPtr guest, break; } - virCPUReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU mode: %d"), guest->mode); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU mode: %d"), guest->mode); return -1; } -- 1.7.10.4

On Wed, Jul 18, 2012 at 19:40:41 +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the CPU helper APIs to use virReportError instead of the virCPUReportError custom macor
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/cpu/cpu.c | 86 ++++++++++++++++---------------- src/cpu/cpu.h | 5 -- src/cpu/cpu_generic.c | 18 +++---- src/cpu/cpu_map.c | 22 ++++----- src/cpu/cpu_x86.c | 132 ++++++++++++++++++++++++------------------------- 6 files changed, 129 insertions(+), 135 deletions(-)
Some of the error messages are not ideal, but that's not your fault... ACK Jirka

From: "Daniel P. Berrange" <berrange@redhat.com> Update the OpenVZ driver to use virReportError instead of the openvzError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/openvz/openvz_conf.c | 132 ++++++++++----------- src/openvz/openvz_conf.h | 4 - src/openvz/openvz_driver.c | 282 ++++++++++++++++++++++---------------------- src/openvz/openvz_util.c | 5 +- 5 files changed, 211 insertions(+), 213 deletions(-) diff --git a/cfg.mk b/cfg.mk index 9dfb618..cde9583 100644 --- a/cfg.mk +++ b/cfg.mk @@ -516,7 +516,6 @@ msg_gen_function += XENXS_ERROR msg_gen_function += lxcError msg_gen_function += libxlError msg_gen_function += nodeReportError -msg_gen_function += openvzError msg_gen_function += qemuReportError msg_gen_function += regerror msg_gen_function += remoteError diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index bc54012..1ed1814 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -120,8 +120,8 @@ int openvzExtractVersion(struct openvz_driver *driver) return 0; if (openvzExtractVersionInfo(VZCTL, &driver->version) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not extract vzctl version")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not extract vzctl version")); return -1; } @@ -234,9 +234,9 @@ openvzReadNetworkConf(virDomainDefPtr def, */ ret = openvzReadVPSConfigParam(veid, "IP_ADDRESS", &temp); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read 'IP_ADDRESS' from config for container %d"), - veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read 'IP_ADDRESS' from config for container %d"), + veid); goto error; } else if (ret > 0) { token = strtok_r(temp, " ", &saveptr); @@ -266,9 +266,9 @@ openvzReadNetworkConf(virDomainDefPtr def, */ ret = openvzReadVPSConfigParam(veid, "NETIF", &temp); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read 'NETIF' from config for container %d"), - veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read 'NETIF' from config for container %d"), + veid); goto error; } else if (ret > 0) { token = strtok_r(temp, ";", &saveptr); @@ -292,8 +292,8 @@ openvzReadNetworkConf(virDomainDefPtr def, p += 12; len = next - p; if (len > 16) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Too long network device name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Too long network device name")); goto error; } @@ -301,16 +301,16 @@ openvzReadNetworkConf(virDomainDefPtr def, goto no_memory; if (virStrncpy(net->ifname, p, len, len+1) == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Network ifname %s too long for destination"), p); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Network ifname %s too long for destination"), p); goto error; } } else if (STRPREFIX(p, "bridge=")) { p += 7; len = next - p; if (len > 16) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Too long bridge device name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Too long bridge device name")); goto error; } @@ -318,26 +318,26 @@ openvzReadNetworkConf(virDomainDefPtr def, goto no_memory; if (virStrncpy(net->data.bridge.brname, p, len, len+1) == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Bridge name %s too long for destination"), p); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bridge name %s too long for destination"), p); goto error; } } else if (STRPREFIX(p, "mac=")) { p += 4; len = next - p; if (len != 17) { /* should be 17 */ - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Wrong length MAC address")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Wrong length MAC address")); goto error; } if (virStrncpy(cpy_temp, p, len, sizeof(cpy_temp)) == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("MAC address %s too long for destination"), p); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("MAC address %s too long for destination"), p); goto error; } if (virMacAddrParse(cpy_temp, &net->mac) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Wrong MAC address")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Wrong MAC address")); goto error; } } @@ -411,9 +411,9 @@ openvzReadFSConf(virDomainDefPtr def, ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", &temp); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read 'OSTEMPLATE' from config for container %d"), - veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read 'OSTEMPLATE' from config for container %d"), + veid); goto error; } else if (ret > 0) { if (VIR_ALLOC(fs) < 0) @@ -425,9 +425,9 @@ openvzReadFSConf(virDomainDefPtr def, /* OSTEMPLATE was not found, VE was booted from a private dir directly */ ret = openvzReadVPSConfigParam(veid, "VE_PRIVATE", &temp); if (ret <= 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read 'VE_PRIVATE' from config for container %d"), - veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read 'VE_PRIVATE' from config for container %d"), + veid); goto error; } @@ -449,9 +449,9 @@ openvzReadFSConf(virDomainDefPtr def, ret = openvzReadVPSConfigParam(veid, param, &temp); if (ret > 0) { if (openvzParseBarrierLimit(temp, &barrier, &limit)) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read '%s' from config for container %d"), - param, veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read '%s' from config for container %d"), + param, veid); goto error; } else { /* Ensure that we can multiply by 1024 without overflowing. */ @@ -503,16 +503,16 @@ openvzReadMemConf(virDomainDefPtr def, int veid) param = "VMGUARPAGES"; ret = openvzReadVPSConfigParam(veid, param, &temp); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read '%s' from config for container %d"), - param, veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read '%s' from config for container %d"), + param, veid); goto error; } else if (ret > 0) { ret = openvzParseBarrierLimit(temp, &barrier, NULL); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not parse barrier of '%s' " - "from config for container %d"), param, veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse barrier of '%s' " + "from config for container %d"), param, veid); goto error; } if (barrier == LONG_MAX) @@ -525,16 +525,16 @@ openvzReadMemConf(virDomainDefPtr def, int veid) param = "PRIVVMPAGES"; ret = openvzReadVPSConfigParam(veid, param, &temp); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read '%s' from config for container %d"), - param, veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read '%s' from config for container %d"), + param, veid); goto error; } else if (ret > 0) { ret = openvzParseBarrierLimit(temp, &barrier, &limit); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not parse barrier and limit of '%s' " - "from config for container %d"), param, veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse barrier and limit of '%s' " + "from config for container %d"), param, veid); goto error; } if (barrier == LONG_MAX) @@ -592,8 +592,8 @@ int openvzLoadDomains(struct openvz_driver *driver) { if (virStrToLong_i(line, &status, 10, &veid) < 0 || *status++ != ' ' || (line = strchr(status, '\n')) == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to parse vzlist output")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to parse vzlist output")); goto cleanup; } *line++ = '\0'; @@ -602,8 +602,8 @@ int openvzLoadDomains(struct openvz_driver *driver) { goto no_memory; if (virMutexInit(&dom->lock) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot initialize mutex")); VIR_FREE(dom); goto cleanup; } @@ -639,8 +639,8 @@ int openvzLoadDomains(struct openvz_driver *driver) { ret = virUUIDParse(uuidstr, dom->def->uuid); if (ret == -1) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("UUID in config file malformed")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("UUID in config file malformed")); goto cleanup; } @@ -651,9 +651,9 @@ int openvzLoadDomains(struct openvz_driver *driver) { ret = openvzReadVPSConfigParam(veid, "CPUS", &temp); if (ret < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not read config for container %d"), - veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not read config for container %d"), + veid); goto cleanup; } else if (ret > 0) { dom->def->maxvcpus = strtoI(temp); @@ -671,15 +671,15 @@ int openvzLoadDomains(struct openvz_driver *driver) { virUUIDFormat(dom->def->uuid, uuidstr); if (virHashLookup(driver->domains.objs, uuidstr)) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Duplicate container UUID %s detected for %d"), - uuidstr, - veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Duplicate container UUID %s detected for %d"), + uuidstr, + veid); goto cleanup; } if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not add UUID for container %d"), veid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not add UUID for container %d"), veid); goto cleanup; } @@ -1048,8 +1048,8 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len) if (iden != NULL && uuidbuf != NULL && STREQ(iden, "#UUID:")) { if (virStrcpy(uuidstr, uuidbuf, len) == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("invalid uuid %s"), uuidbuf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid uuid %s"), uuidbuf); goto cleanup; } break; @@ -1110,8 +1110,8 @@ openvzSetUUID(int vpsid){ unsigned char uuid[VIR_UUID_BUFLEN]; if (virUUIDGenerate(uuid)) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to generate UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to generate UUID")); return -1; } @@ -1155,8 +1155,8 @@ static int openvzAssignUUIDs(void) errno = 0; } if (errno) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to scan configuration directory")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to scan configuration directory")); ret = -1; } @@ -1193,7 +1193,7 @@ int openvzGetVEID(const char *name) { if (ok && veid >= 0) return veid; - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to parse vzlist output")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to parse vzlist output")); return -1; } diff --git a/src/openvz/openvz_conf.h b/src/openvz/openvz_conf.h index 9f2245f..3c783b7 100644 --- a/src/openvz/openvz_conf.h +++ b/src/openvz/openvz_conf.h @@ -33,10 +33,6 @@ # include "domain_conf.h" # include "threads.h" -# define openvzError(code, ...) \ - virReportErrorHelper(VIR_FROM_OPENVZ, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - /* OpenVZ commands - Replace with wrapper scripts later? */ # define VZLIST "/usr/sbin/vzlist" diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 8ecd83b..8f923dc 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -113,8 +113,8 @@ openvzDomainDefineCmd(virDomainDefPtr vmdef) NULL); if (vmdef == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Container is not defined")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Container is not defined")); virCommandFree(cmd); return NULL; } @@ -138,8 +138,8 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef) virCommandPtr cmd = NULL; if (vmdef->nfss > 1) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("only one filesystem supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("only one filesystem supported")); goto cleanup; } @@ -147,8 +147,8 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef) vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE && vmdef->fss[0]->type != VIR_DOMAIN_FS_TYPE_MOUNT) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("filesystem is not of type 'template' or 'mount'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("filesystem is not of type 'template' or 'mount'")); goto cleanup; } @@ -158,20 +158,20 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef) { if (virStrToLong_i(vmdef->name, NULL, 10, &vpsid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not convert domain name to VEID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not convert domain name to VEID")); goto cleanup; } if (openvzCopyDefaultConfig(vpsid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not copy default config")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not copy default config")); goto cleanup; } if (openvzWriteVPSConfigParam(vpsid, "VE_PRIVATE", vmdef->fss[0]->src) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set the source dir for the filesystem")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set the source dir for the filesystem")); goto cleanup; } } else { @@ -217,8 +217,8 @@ openvzSetDiskQuota(virDomainDefPtr vmdef, virCommandAddArgFormat(cmd, "%lld", hl); } } else if (fss->space_soft_limit) { - openvzError(VIR_ERR_INVALID_ARG, "%s", - _("Can't set soft limit without hard limit")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Can't set soft limit without hard limit")); goto cleanup; } @@ -245,7 +245,7 @@ static virDomainPtr openvzDomainLookupByID(virConnectPtr conn, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -278,7 +278,7 @@ static char *openvzGetOSType(virDomainPtr dom) openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -303,7 +303,7 @@ static virDomainPtr openvzDomainLookupByUUID(virConnectPtr conn, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -328,7 +328,7 @@ static virDomainPtr openvzDomainLookupByName(virConnectPtr conn, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -354,8 +354,8 @@ static int openvzDomainGetInfo(virDomainPtr dom, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -367,8 +367,8 @@ static int openvzDomainGetInfo(virDomainPtr dom, info->cpuTime = 0; } else { if (openvzGetProcessInfo(&(info->cpuTime), dom->id) < 0) { - openvzError(VIR_ERR_OPERATION_FAILED, - _("cannot read cputime for domain %d"), dom->id); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot read cputime for domain %d"), dom->id); goto cleanup; } } @@ -402,8 +402,8 @@ openvzDomainGetState(virDomainPtr dom, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -426,7 +426,7 @@ static int openvzDomainIsActive(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); openvzDriverUnlock(driver); if (!obj) { - openvzError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = virDomainObjIsActive(obj); @@ -448,7 +448,7 @@ static int openvzDomainIsPersistent(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); openvzDriverUnlock(driver); if (!obj) { - openvzError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = obj->persistent; @@ -476,8 +476,8 @@ static char *openvzDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -520,14 +520,14 @@ static int openvzDomainSuspend(virDomainPtr dom) { openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - openvzError(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not running")); goto cleanup; } @@ -558,14 +558,14 @@ static int openvzDomainResume(virDomainPtr dom) { openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - openvzError(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not running")); goto cleanup; } @@ -601,8 +601,8 @@ openvzDomainShutdownFlags(virDomainPtr dom, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -611,8 +611,8 @@ openvzDomainShutdownFlags(virDomainPtr dom, openvzSetProgramSentinal(prog, vm->def->name); if (status != VIR_DOMAIN_RUNNING) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain is not in running state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain is not in running state")); goto cleanup; } @@ -652,8 +652,8 @@ static int openvzDomainReboot(virDomainPtr dom, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -662,8 +662,8 @@ static int openvzDomainReboot(virDomainPtr dom, openvzSetProgramSentinal(prog, vm->def->name); if (status != VIR_DOMAIN_RUNNING) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain is not in running state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain is not in running state")); goto cleanup; } @@ -752,8 +752,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid, if (net == NULL) return 0; if (vpsid == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Container ID is not specified")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Container ID is not specified")); return -1; } @@ -788,8 +788,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid, if (net->data.ethernet.dev == NULL) { net->data.ethernet.dev = openvzGenerateContainerVethName(veid); if (net->data.ethernet.dev == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not generate eth name for container")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not generate eth name for container")); rc = -1; goto exit; } @@ -800,8 +800,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid, if (net->ifname == NULL) { net->ifname = openvzGenerateVethName(veid, net->data.ethernet.dev); if (net->ifname == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not generate veth name")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not generate veth name")); rc = -1; goto exit; } @@ -852,8 +852,8 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid, no_memory: VIR_FREE(opt); - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not put argument to %s"), VZCTL); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not put argument to %s"), VZCTL); cmdExecFree(prog); return -1; @@ -881,8 +881,8 @@ openvzDomainSetNetworkConfig(virConnectPtr conn, } if (openvzDomainSetNetwork(conn, def->name, def->nets[i], &buf) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not configure network")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not configure network")); goto exit; } } @@ -892,8 +892,8 @@ openvzDomainSetNetworkConfig(virConnectPtr conn, if (param) { if (openvzWriteVPSConfigParam(strtoI(def->name), "NETIF", param) < 0) { VIR_FREE(param); - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot replace NETIF config")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot replace NETIF config")); return -1; } VIR_FREE(param); @@ -924,9 +924,9 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml) vm = virDomainFindByName(&driver->domains, vmdef->name); if (vm) { - openvzError(VIR_ERR_OPERATION_FAILED, - _("Already an OPENVZ VM active with the id '%s'"), - vmdef->name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Already an OPENVZ VM active with the id '%s'"), + vmdef->name); goto cleanup; } if (!(vm = virDomainAssignDef(driver->caps, @@ -942,15 +942,15 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml) if (vm->def->nfss == 1) { if (openvzSetDiskQuota(vm->def, vm->def->fss[0], true) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set disk quota")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set disk quota")); goto cleanup; } } if (openvzSetDefinedUUID(strtoI(vm->def->name), vm->def->uuid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set UUID")); goto cleanup; } @@ -958,22 +958,22 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml) goto cleanup; if (vm->def->vcpus != vm->def->maxvcpus) { - openvzError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("current vcpu count must equal maximum")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("current vcpu count must equal maximum")); goto cleanup; } if (vm->def->maxvcpus > 0) { if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set number of virtual cpu")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set number of virtual cpu")); goto cleanup; } } if (vm->def->mem.cur_balloon > 0) { if (openvzDomainSetMemoryInternal(vm, vm->def->mem.cur_balloon) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set memory size")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set memory size")); goto cleanup; } } @@ -1010,9 +1010,9 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml, vm = virDomainFindByName(&driver->domains, vmdef->name); if (vm) { - openvzError(VIR_ERR_OPERATION_FAILED, - _("Already an OPENVZ VM defined with the id '%s'"), - vmdef->name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Already an OPENVZ VM defined with the id '%s'"), + vmdef->name); goto cleanup; } if (!(vm = virDomainAssignDef(driver->caps, @@ -1030,15 +1030,15 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml, if (vm->def->nfss == 1) { if (openvzSetDiskQuota(vm->def, vm->def->fss[0], true) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set disk quota")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set disk quota")); goto cleanup; } } if (openvzSetDefinedUUID(strtoI(vm->def->name), vm->def->uuid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set UUID")); goto cleanup; } @@ -1057,8 +1057,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml, if (vm->def->maxvcpus > 0) { if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not set number of virtual cpu")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not set number of virtual cpu")); goto cleanup; } } @@ -1091,8 +1091,8 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching id")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching id")); goto cleanup; } @@ -1100,8 +1100,8 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) goto cleanup; if (status != VIR_DOMAIN_SHUTOFF) { - openvzError(VIR_ERR_OPERATION_DENIED, "%s", - _("domain is not in shutoff state")); + virReportError(VIR_ERR_OPERATION_DENIED, "%s", + _("domain is not in shutoff state")); goto cleanup; } @@ -1143,8 +1143,8 @@ openvzDomainUndefineFlags(virDomainPtr dom, openvzDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -1192,8 +1192,8 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart) openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -1222,14 +1222,14 @@ openvzDomainGetAutostart(virDomainPtr dom, int *autostart) openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } if (openvzReadVPSConfigParam(strtoI(vm->def->name), "ONBOOT", &value) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not read container config")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not read container config")); goto cleanup; } @@ -1252,8 +1252,8 @@ static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED, if (type == NULL || STRCASEEQ(type, "openvz")) return 1028; /* OpenVZ has no limitation */ - openvzError(VIR_ERR_INVALID_ARG, - _("unknown type '%s'"), type); + virReportError(VIR_ERR_INVALID_ARG, + _("unknown type '%s'"), type); return -1; } @@ -1262,7 +1262,8 @@ openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED, unsigned int flags) { if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { - openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported flags (0x%x)"), flags); return -1; } @@ -1306,7 +1307,8 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, int ret = -1; if (flags != VIR_DOMAIN_AFFECT_LIVE) { - openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported flags (0x%x)"), flags); return -1; } @@ -1315,14 +1317,14 @@ static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, openvzDriverUnlock(driver); if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } if (nvcpus <= 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("VCPUs should be >= 1")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("VCPUs should be >= 1")); goto cleanup; } @@ -1371,21 +1373,21 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn, /* If path isn't /system, then they typoed, so tell them correct path */ if (conn->uri->path == NULL || STRNEQ (conn->uri->path, "/system")) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("unexpected OpenVZ URI path '%s', try openvz:///system"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected OpenVZ URI path '%s', try openvz:///system"), conn->uri->path); return VIR_DRV_OPEN_ERROR; } if (!virFileExists("/proc/vz")) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("OpenVZ control file /proc/vz does not exist")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("OpenVZ control file /proc/vz does not exist")); return VIR_DRV_OPEN_ERROR; } if (access("/proc/vz", W_OK) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("OpenVZ control file /proc/vz is not accessible")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("OpenVZ control file /proc/vz is not accessible")); return VIR_DRV_OPEN_ERROR; } } @@ -1479,8 +1481,8 @@ static int openvzListDomains(virConnectPtr conn ATTRIBUTE_UNUSED, if (!ret) break; if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not parse VPS ID %s"), buf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse VPS ID %s"), buf); continue; } ids[got] = veid; @@ -1534,8 +1536,8 @@ static int openvzListDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED, if (!ret) break; if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Could not parse VPS ID %s"), buf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse VPS ID %s"), buf); continue; } snprintf(vpsname, sizeof(vpsname), "%d", veid); @@ -1666,24 +1668,24 @@ openvzDomainGetBarrierLimit(virDomainPtr domain, virCommandAddArgFormat(cmd, "-o%s.b,%s.l", param, param); virCommandAddArg(cmd, domain->name); if (virCommandRun(cmd, &status)) { - openvzError(VIR_ERR_OPERATION_FAILED, - _("Failed to get %s for %s: %d"), param, domain->name, - status); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to get %s for %s: %d"), param, domain->name, + status); goto cleanup; } tmp = output; virSkipSpaces(&tmp); if (virStrToLong_ull(tmp, &endp, 10, barrier) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Can't parse limit from "VZLIST" output '%s'"), output); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Can't parse limit from "VZLIST" output '%s'"), output); goto cleanup; } tmp = endp; virSkipSpaces(&tmp); if (virStrToLong_ull(tmp, &endp, 10, limit) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Can't parse barrier from "VZLIST" output '%s'"), output); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Can't parse barrier from "VZLIST" output '%s'"), output); goto cleanup; } @@ -1706,9 +1708,9 @@ openvzDomainSetBarrierLimit(virDomainPtr domain, /* LONG_MAX indicates unlimited so reject larger values */ if (barrier > LONG_MAX || limit > LONG_MAX) { - openvzError(VIR_ERR_OPERATION_FAILED, - _("Failed to set %s for %s: value too large"), param, - domain->name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to set %s for %s: value too large"), param, + domain->name); goto cleanup; } @@ -1717,9 +1719,9 @@ openvzDomainSetBarrierLimit(virDomainPtr domain, virCommandAddArgFormat(cmd, "%llu:%llu", barrier, limit); virCommandAddArg(cmd, "--save"); if (virCommandRun(cmd, &status)) { - openvzError(VIR_ERR_OPERATION_FAILED, - _("Failed to set %s for %s: %d"), param, domain->name, - status); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to set %s for %s: %d"), param, domain->name, + status); goto cleanup; } @@ -1872,8 +1874,8 @@ openvzGetVEStatus(virDomainObjPtr vm, int *status, int *reason) goto cleanup; if ((line = strchr(outbuf, '\n')) == NULL) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to parse vzlist output")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to parse vzlist output")); goto cleanup; } *line++ = '\0'; @@ -1916,14 +1918,14 @@ openvzDomainInterfaceStats (virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - openvzError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - openvzError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -1939,8 +1941,8 @@ openvzDomainInterfaceStats (virDomainPtr dom, if (ret == 0) ret = linuxDomainInterfaceStats(path, stats); else - openvzError(VIR_ERR_INVALID_ARG, - _("invalid path, '%s' is not a known interface"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path, '%s' is not a known interface"), path); cleanup: if (vm) @@ -1962,8 +1964,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef, pos = virDomainFSIndexByName(vmdef, fs->dst); if (pos < 0) { - openvzError(VIR_ERR_INVALID_ARG, - _("target %s doesn't exist."), fs->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("target %s doesn't exist."), fs->dst); return -1; } cur = vmdef->fss[pos]; @@ -1974,8 +1976,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef, || cur->accessmode != fs->accessmode || cur->wrpolicy != fs->wrpolicy || cur->readonly != fs->readonly) { - openvzError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Can only modify disk quota")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Can only modify disk quota")); return -1; } @@ -1985,9 +1987,9 @@ openvzUpdateDevice(virDomainDefPtr vmdef, cur->space_hard_limit = fs->space_hard_limit; cur->space_soft_limit = fs->space_soft_limit; } else { - openvzError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Can't modify device type '%s'"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Can't modify device type '%s'"), + virDomainDeviceTypeToString(dev->type)); return -1; } @@ -2015,14 +2017,14 @@ openvzDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, vmdef = vm->def; if (!vm) { - openvzError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } if (virStrToLong_i(vmdef->name, NULL, 10, &veid) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not convert domain name to VEID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not convert domain name to VEID")); goto cleanup; } diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c index 61b55de..1989ec5 100644 --- a/src/openvz/openvz_util.c +++ b/src/openvz/openvz_util.c @@ -30,6 +30,7 @@ #include "openvz_conf.h" #include "openvz_util.h" +#define VIR_FROM_THIS VIR_FROM_OPENVZ long openvzKBPerPages(void) @@ -41,8 +42,8 @@ openvzKBPerPages(void) if (kb_per_pages > 0) { kb_per_pages /= 1024; } else { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("Can't determine page size")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Can't determine page size")); kb_per_pages = 0; return -1; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the OpenVZ driver to use virReportError instead of the openvzError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/openvz/openvz_conf.c | 132 ++++++++++----------- src/openvz/openvz_conf.h | 4 - src/openvz/openvz_driver.c | 282 ++++++++++++++++++++++---------------------- src/openvz/openvz_util.c | 5 +- 5 files changed, 211 insertions(+), 213 deletions(-)
...
/* OpenVZ commands - Replace with wrapper scripts later? */ # define VZLIST "/usr/sbin/vzlist" diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 8ecd83b..8f923dc 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c
...
@@ -1371,21 +1373,21 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn, /* If path isn't /system, then they typoed, so tell them correct path */ if (conn->uri->path == NULL || STRNEQ (conn->uri->path, "/system")) { - openvzError(VIR_ERR_INTERNAL_ERROR, - _("unexpected OpenVZ URI path '%s', try openvz:///system"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected OpenVZ URI path '%s', try openvz:///system"), conn->uri->path);
Bad indent on the last parameter.
return VIR_DRV_OPEN_ERROR; }
if (!virFileExists("/proc/vz")) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("OpenVZ control file /proc/vz does not exist")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("OpenVZ control file /proc/vz does not exist")); return VIR_DRV_OPEN_ERROR; }
if (access("/proc/vz", W_OK) < 0) { - openvzError(VIR_ERR_INTERNAL_ERROR, "%s", - _("OpenVZ control file /proc/vz is not accessible")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("OpenVZ control file /proc/vz is not accessible")); return VIR_DRV_OPEN_ERROR; } }
ACK with the one nit fixed. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the XenXS shared code to use virReportError instead of the XENXS_ERROR custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/xenxs/xen_sxpr.c | 256 ++++++++++++++++++++++----------------------- src/xenxs/xen_xm.c | 220 +++++++++++++++++++------------------- src/xenxs/xenxs_private.h | 4 - 4 files changed, 238 insertions(+), 243 deletions(-) diff --git a/cfg.mk b/cfg.mk index cde9583..fda36cc 100644 --- a/cfg.mk +++ b/cfg.mk @@ -512,7 +512,6 @@ msg_gen_function += HYPERV_ERROR msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR msg_gen_function += VMX_ERROR -msg_gen_function += XENXS_ERROR msg_gen_function += lxcError msg_gen_function += libxlError msg_gen_function += nodeReportError diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 2a240fc..42533ce 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -56,8 +56,8 @@ int xenGetDomIdFromSxpr(const struct sexpr *root, int xendConfigVersion) int id = -1; const char * tmp = sexpr_node(root, "domain/domid"); if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */ - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing id")); } else { id = tmp ? sexpr_int(root, "domain/domid") : -1; } @@ -93,8 +93,8 @@ xenParseSxprOS(const struct sexpr *node, goto no_memory; if (def->os.loader == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing HVM loader")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing HVM loader")); return -1; } } else { @@ -153,8 +153,8 @@ xenParseSxprOS(const struct sexpr *node, if (!hvm && !def->os.kernel && !def->os.bootloader) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing kernel & bootloader")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing kernel & bootloader")); return -1; } @@ -204,8 +204,8 @@ xenParseSxprChar(const char *value, def->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET; } else { if ((def->source.type = virDomainChrTypeFromString(prefix)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown chr device type '%s'"), prefix); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown chr device type '%s'"), prefix); goto error; } } @@ -230,8 +230,8 @@ xenParseSxprChar(const char *value, const char *offset2; if (offset == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed char device string")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed char device string")); goto error; } @@ -260,8 +260,8 @@ xenParseSxprChar(const char *value, const char *offset2, *offset3; if (offset == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed char device string")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed char device string")); goto error; } @@ -278,8 +278,8 @@ xenParseSxprChar(const char *value, offset3 = strchr(offset2, ':'); if (offset3 == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed char device string")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed char device string")); goto error; } @@ -382,8 +382,8 @@ xenParseSxprDisks(virDomainDefPtr def, goto no_memory; if (dst == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, vbd has no dev")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, vbd has no dev")); goto error; } @@ -393,8 +393,8 @@ xenParseSxprDisks(virDomainDefPtr def, if (!offset || !hvm || STRNEQ(offset, ":cdrom")) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, vbd has no src")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, vbd has no src")); goto error; } } @@ -402,8 +402,8 @@ xenParseSxprDisks(virDomainDefPtr def, if (src != NULL) { offset = strchr(src, ':'); if (!offset) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot parse vbd filename, missing driver name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot parse vbd filename, missing driver name")); goto error; } @@ -416,9 +416,9 @@ xenParseSxprDisks(virDomainDefPtr def, goto no_memory; if (virStrncpy(disk->driverName, src, offset-src, (offset-src)+1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver name %s too big for destination"), - src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver name %s too big for destination"), + src); goto error; } } @@ -429,8 +429,8 @@ xenParseSxprDisks(virDomainDefPtr def, STREQ (disk->driverName, "tap2")) { offset = strchr(src, ':'); if (!offset) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot parse vbd filename, missing driver type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot parse vbd filename, missing driver type")); goto error; } @@ -438,9 +438,9 @@ xenParseSxprDisks(virDomainDefPtr def, goto no_memory; if (virStrncpy(disk->driverType, src, offset-src, (offset-src)+1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver type %s too big for destination"), - src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver type %s too big for destination"), + src); goto error; } @@ -601,8 +601,8 @@ xenParseSxprNets(virDomainDefPtr def, tmp = sexpr_node(node, "device/vif/mac"); if (tmp) { if (virMacAddrParse(tmp, &net->mac) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("malformed mac address '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed mac address '%s'"), tmp); goto cleanup; } } @@ -688,9 +688,9 @@ xenParseSxprSound(virDomainDefPtr def, else len = strlen(offset); if (virStrncpy(model, offset, len, sizeof(model)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Sound model %s too big for destination"), - offset); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Sound model %s too big for destination"), + offset); goto error; } @@ -910,8 +910,8 @@ xenParseSxprGraphicsNew(virDomainDefPtr def, goto no_memory; if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown graphics type '%s'"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown graphics type '%s'"), tmp); goto error; } @@ -1035,44 +1035,44 @@ xenParseSxprPCI(virDomainDefPtr def, continue; if (!(domain = sexpr_node(node, "dev/domain"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI domain")); goto error; } if (!(bus = sexpr_node(node, "dev/bus"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI bus")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI bus")); goto error; } if (!(slot = sexpr_node(node, "dev/slot"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI slot")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI slot")); goto error; } if (!(func = sexpr_node(node, "dev/func"))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing PCI func")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing PCI func")); goto error; } if (virStrToLong_i(domain, NULL, 0, &domainID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI domain '%s'"), domain); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI domain '%s'"), domain); goto error; } if (virStrToLong_i(bus, NULL, 0, &busID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI bus '%s'"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI bus '%s'"), bus); goto error; } if (virStrToLong_i(slot, NULL, 0, &slotID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI slot '%s'"), slot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI slot '%s'"), slot); goto error; } if (virStrToLong_i(func, NULL, 0, &funcID) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("cannot parse PCI func '%s'"), func); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse PCI func '%s'"), func); goto error; } @@ -1134,8 +1134,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/domid"); if (tmp == NULL && xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { /* domid was mandatory */ - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing id")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing id")); goto error; } def->virtType = VIR_DOMAIN_VIRT_XEN; @@ -1147,15 +1147,15 @@ xenParseSxpr(const struct sexpr *root, if (sexpr_node_copy(root, "domain/name", &def->name) < 0) goto no_memory; if (def->name == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing name")); goto error; } tmp = sexpr_node(root, "domain/uuid"); if (tmp == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing name")); goto error; } if (virUUIDParse(tmp, def->uuid) < 0) @@ -1205,8 +1205,8 @@ xenParseSxpr(const struct sexpr *root, if (virDomainCpuSetParse(cpus, 0, def->cpumask, def->cpumasklen) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("invalid CPU mask %s"), cpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid CPU mask %s"), cpus); goto error; } } @@ -1219,8 +1219,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_poweroff"); if (tmp != NULL) { if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle type %s"), tmp); goto error; } } else @@ -1229,8 +1229,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_reboot"); if (tmp != NULL) { if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle type %s"), tmp); goto error; } } else @@ -1239,8 +1239,8 @@ xenParseSxpr(const struct sexpr *root, tmp = sexpr_node(root, "domain/on_crash"); if (tmp != NULL) { if ((def->onCrash = virDomainLifecycleCrashTypeFromString(tmp)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown lifecycle type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown lifecycle type %s"), tmp); goto error; } } else @@ -1265,8 +1265,8 @@ xenParseSxpr(const struct sexpr *root, const char *value = sexpr_node(root, "domain/image/hvm/localtime"); if (value) { if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown localtime offset %s"), value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown localtime offset %s"), value); goto error; } } @@ -1307,8 +1307,8 @@ xenParseSxpr(const struct sexpr *root, const char *value = sexpr_node(root, "domain/image/linux/localtime"); if (value) { if (virStrToLong_i(value, NULL, 0, &vmlocaltime) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unknown localtime offset %s"), value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown localtime offset %s"), value); goto error; } } @@ -1575,9 +1575,9 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected graphics type %d"), - def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected graphics type %d"), + def->type); return -1; } @@ -1634,9 +1634,9 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected graphics type %d"), - def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected graphics type %d"), + def->type); return -1; } @@ -1688,8 +1688,8 @@ xenFormatSxprChr(virDomainChrDefPtr def, const char *type = virDomainChrTypeToString(def->source.type); if (!type) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected chr device type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected chr device type")); return -1; } @@ -1744,8 +1744,8 @@ xenFormatSxprChr(virDomainChrDefPtr def, break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported chr device type '%s'"), type); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported chr device type '%s'"), type); return -1; } @@ -1783,8 +1783,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, if (hvm && def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (isAttach) { - XENXS_ERROR(VIR_ERR_INVALID_ARG, - _("Cannot directly attach floppy %s"), def->src); + virReportError(VIR_ERR_INVALID_ARG, + _("Cannot directly attach floppy %s"), def->src); return -1; } return 0; @@ -1795,8 +1795,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, def->device == VIR_DOMAIN_DISK_DEVICE_CDROM && xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) { if (isAttach) { - XENXS_ERROR(VIR_ERR_INVALID_ARG, - _("Cannot directly attach CDROM %s"), def->src); + virReportError(VIR_ERR_INVALID_ARG, + _("Cannot directly attach CDROM %s"), def->src); return -1; } return 0; @@ -1855,9 +1855,9 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, virBufferEscapeSexpr(buf, "(uname 'phy:/dev/%s')", def->src); } else { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported disk type %s"), - virDomainDiskTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported disk type %s"), + virDomainDiskTypeToString(def->type)); return -1; } } @@ -1870,8 +1870,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def, else virBufferAddLit(buf, "(mode 'w')"); if (def->transient) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("transient disks not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("transient disks not supported yet")); return -1; } @@ -1912,16 +1912,16 @@ xenFormatSxprNet(virConnectPtr conn, if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE && def->type != VIR_DOMAIN_NET_TYPE_NETWORK && def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unsupported network type %d"), def->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported network type %d"), def->type); return -1; } if (def->script && def->type != VIR_DOMAIN_NET_TYPE_BRIDGE && def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("scripts are not supported on interfaces of type %s"), - virDomainNetTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("scripts are not supported on interfaces of type %s"), + virDomainNetTypeToString(def->type)); return -1; } @@ -1953,17 +1953,17 @@ xenFormatSxprNet(virConnectPtr conn, char *bridge; if (!network) { - XENXS_ERROR(VIR_ERR_NO_NETWORK, "%s", - def->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, "%s", + def->data.network.name); return -1; } bridge = virNetworkGetBridgeName(network); virNetworkFree(network); if (!bridge) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("network %s is not active"), - def->data.network.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network %s is not active"), + def->data.network.name); return -1; } virBufferEscapeSexpr(buf, "(bridge '%s')", bridge); @@ -2063,8 +2063,8 @@ xenFormatSxprOnePCI(virDomainHostdevDefPtr def, int detach) { if (def->managed) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("managed PCI devices not supported with XenD")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("managed PCI devices not supported with XenD")); return -1; } @@ -2123,8 +2123,8 @@ xenFormatSxprAllPCI(virDomainDefPtr def, if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && def->hostdevs[i]->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { if (def->hostdevs[i]->managed) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("managed PCI devices not supported with XenD")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("managed PCI devices not supported with XenD")); return -1; } @@ -2155,9 +2155,9 @@ xenFormatSxprSound(virDomainDefPtr def, for (i = 0 ; i < def->nsounds ; i++) { if (!(str = virDomainSoundModelTypeToString(def->sounds[i]->model))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected sound model %d"), - def->sounds[i]->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected sound model %d"), + def->sounds[i]->model); return -1; } if (i) @@ -2192,8 +2192,8 @@ xenFormatSxprInput(virDomainInputDefPtr input, if (input->type != VIR_DOMAIN_INPUT_TYPE_MOUSE && input->type != VIR_DOMAIN_INPUT_TYPE_TABLET) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected input type %d"), input->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected input type %d"), input->type); return -1; } @@ -2270,22 +2270,22 @@ xenFormatSxpr(virConnectPtr conn, } if (!(tmp = virDomainLifecycleTypeToString(def->onPoweroff))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle value %d"), def->onPoweroff); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle value %d"), def->onPoweroff); goto error; } virBufferAsprintf(&buf, "(on_poweroff '%s')", tmp); if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle value %d"), def->onReboot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle value %d"), def->onReboot); goto error; } virBufferAsprintf(&buf, "(on_reboot '%s')", tmp); if (!(tmp = virDomainLifecycleCrashTypeToString(def->onCrash))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle value %d"), def->onCrash); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle value %d"), def->onCrash); goto error; } virBufferAsprintf(&buf, "(on_crash '%s')", tmp); @@ -2302,8 +2302,8 @@ xenFormatSxpr(virConnectPtr conn, if (hvm && def->os.loader == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s",_("no HVM domain loader")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s",_("no HVM domain loader")); goto error; } @@ -2492,9 +2492,9 @@ xenFormatSxpr(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } } else { @@ -2515,8 +2515,8 @@ xenFormatSxpr(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_UTC: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto error; } vmlocaltime = 0; @@ -2524,17 +2524,17 @@ xenFormatSxpr(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto error; } vmlocaltime = 1; rtc_timeoffset = 0; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } virBufferAsprintf(&buf, "(rtc_timeoffset %d)", rtc_timeoffset); @@ -2548,9 +2548,9 @@ xenFormatSxpr(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } } /* !hvm */ diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 07cb9bd..99e736e 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -56,8 +56,8 @@ static int xenXMConfigGetBool(virConfPtr conf, } else if (val->type == VIR_CONF_STRING) { *value = STREQ(val->str, "1") ? 1 : 0; } else { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } return 0; @@ -83,13 +83,13 @@ static int xenXMConfigGetULong(virConfPtr conf, char *ret; *value = strtol(val->str, &ret, 10); if (ret == val->str) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } } else { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } return 0; @@ -115,13 +115,13 @@ static int xenXMConfigGetULongLong(virConfPtr conf, char *ret; *value = strtoll(val->str, &ret, 10); if (ret == val->str) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } } else { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } return 0; @@ -142,8 +142,8 @@ static int xenXMConfigGetString(virConfPtr conf, } if (val->type != VIR_CONF_STRING) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was malformed"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was malformed"), name); return -1; } if (!val->str) @@ -163,21 +163,21 @@ static int xenXMConfigCopyStringInternal(virConfPtr conf, if (!(val = virConfGetValue(conf, name))) { if (allowMissing) return 0; - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was missing"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was missing"), name); return -1; } if (val->type != VIR_CONF_STRING) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was not a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was not a string"), name); return -1; } if (!val->str) { if (allowMissing) return 0; - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("config value %s was missing"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("config value %s was missing"), name); return -1; } @@ -208,32 +208,32 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char * virConfValuePtr val; if (!uuid || !name || !conf) { - XENXS_ERROR(VIR_ERR_INVALID_ARG, - _("Arguments must be non null")); + virReportError(VIR_ERR_INVALID_ARG, + _("Arguments must be non null")); return -1; } if (!(val = virConfGetValue(conf, name))) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("config value %s was missing"), name); + virReportError(VIR_ERR_CONF_SYNTAX, + _("config value %s was missing"), name); return -1; } if (val->type != VIR_CONF_STRING) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("config value %s not a string"), name); + virReportError(VIR_ERR_CONF_SYNTAX, + _("config value %s not a string"), name); return -1; } if (!val->str) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("%s can't be empty"), name); + virReportError(VIR_ERR_CONF_SYNTAX, + _("%s can't be empty"), name); return -1; } if (virUUIDParse(val->str, uuid) < 0) { - XENXS_ERROR(VIR_ERR_CONF_SYNTAX, - _("%s not parseable"), val->str); + virReportError(VIR_ERR_CONF_SYNTAX, + _("%s not parseable"), val->str); return -1; } @@ -287,9 +287,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, defaultArch = virCapabilitiesDefaultGuestArch(caps, def->os.type, virDomainVirtTypeToString(def->virtType)); if (defaultArch == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("no supported architecture for os type '%s'"), - def->os.type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no supported architecture for os type '%s'"), + def->os.type); goto cleanup; } if (!(def->os.arch = strdup(defaultArch))) @@ -379,24 +379,24 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (xenXMConfigGetString(conf, "on_poweroff", &str, "destroy") < 0) goto cleanup; if ((def->onPoweroff = virDomainLifecycleTypeFromString(str)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_poweroff"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected value %s for on_poweroff"), str); goto cleanup; } if (xenXMConfigGetString(conf, "on_reboot", &str, "restart") < 0) goto cleanup; if ((def->onReboot = virDomainLifecycleTypeFromString(str)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_reboot"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected value %s for on_reboot"), str); goto cleanup; } if (xenXMConfigGetString(conf, "on_crash", &str, "restart") < 0) goto cleanup; if ((def->onCrash = virDomainLifecycleCrashTypeFromString(str)) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected value %s for on_crash"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected value %s for on_crash"), str); goto cleanup; } @@ -509,9 +509,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto no_memory; if (virStrncpy(disk->src, head, offset - head, (offset - head) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Source file %s too big for destination"), - head); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Source file %s too big for destination"), + head); goto cleanup; } } @@ -528,8 +528,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto no_memory; if (virStrncpy(disk->dst, head, offset - head, (offset - head) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Dest file %s too big for destination"), head); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Dest file %s too big for destination"), head); goto cleanup; } head = offset + 1; @@ -544,9 +544,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (virStrncpy(disk->driverName, disk->src, (tmp - disk->src), (tmp - disk->src) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver name %s too big for destination"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver name %s too big for destination"), + disk->src); goto cleanup; } @@ -565,9 +565,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (virStrncpy(disk->driverType, disk->src, (tmp - disk->src), (tmp - disk->src) + 1) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Driver type %s too big for destination"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Driver type %s too big for destination"), + disk->src); goto cleanup; } @@ -681,17 +681,17 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (STRPREFIX(key, "mac=")) { int len = nextkey ? (nextkey - data) : sizeof(mac) - 1; if (virStrncpy(mac, data, len, sizeof(mac)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("MAC address %s too big for destination"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("MAC address %s too big for destination"), + data); goto skipnic; } } else if (STRPREFIX(key, "bridge=")) { int len = nextkey ? (nextkey - data) : sizeof(bridge) - 1; if (virStrncpy(bridge, data, len, sizeof(bridge)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Bridge %s too big for destination"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bridge %s too big for destination"), + data); goto skipnic; } } else if (STRPREFIX(key, "script=")) { @@ -703,30 +703,30 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, } else if (STRPREFIX(key, "model=")) { int len = nextkey ? (nextkey - data) : sizeof(model) - 1; if (virStrncpy(model, data, len, sizeof(model)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Model %s too big for destination"), data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Model %s too big for destination"), data); goto skipnic; } } else if (STRPREFIX(key, "type=")) { int len = nextkey ? (nextkey - data) : sizeof(type) - 1; if (virStrncpy(type, data, len, sizeof(type)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Type %s too big for destination"), data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Type %s too big for destination"), data); goto skipnic; } } else if (STRPREFIX(key, "vifname=")) { int len = nextkey ? (nextkey - data) : sizeof(vifname) - 1; if (virStrncpy(vifname, data, len, sizeof(vifname)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Vifname %s too big for destination"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Vifname %s too big for destination"), + data); goto skipnic; } } else if (STRPREFIX(key, "ip=")) { int len = nextkey ? (nextkey - data) : sizeof(ip) - 1; if (virStrncpy(ip, data, len, sizeof(ip)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IP %s too big for destination"), data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IP %s too big for destination"), data); goto skipnic; } } @@ -743,8 +743,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (mac[0]) { if (virMacAddrParse(mac, &net->mac) < 0) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("malformed mac address '%s'"), mac); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed mac address '%s'"), mac); goto cleanup; } } @@ -823,8 +823,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Domain %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Domain %s too big for destination"), key); goto skippci; } @@ -833,8 +833,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Bus %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bus %s too big for destination"), key); goto skippci; } @@ -843,8 +843,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Slot %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Slot %s too big for destination"), key); goto skippci; } @@ -853,8 +853,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, goto skippci; if (virStrncpy(func, key, 1, sizeof(func)) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Function %s too big for destination"), key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Function %s too big for destination"), key); goto skippci; } @@ -979,9 +979,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, char *key = vfb; if (virStrcpyStatic(vfb, list->list->str) == NULL) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VFB %s too big for destination"), - list->list->str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VFB %s too big for destination"), + list->list->str); goto cleanup; } @@ -1159,8 +1159,8 @@ int xenXMConfigSetInt(virConfPtr conf, const char *setting, long long l) { virConfValuePtr value = NULL; if ((long) l != l) { - XENXS_ERROR(VIR_ERR_OVERFLOW, _("failed to store %lld to %s"), - l, setting); + virReportError(VIR_ERR_OVERFLOW, _("failed to store %lld to %s"), + l, setting); return -1; } if (VIR_ALLOC(value) < 0) { @@ -1219,9 +1219,9 @@ static int xenFormatXMDisk(virConfValuePtr list, virBufferAddLit(&buf, "phy:"); break; default: - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type %s"), - virDomainDiskTypeToString(disk->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk type %s"), + virDomainDiskTypeToString(disk->type)); goto cleanup; } } @@ -1242,8 +1242,8 @@ static int xenFormatXMDisk(virConfValuePtr list, else virBufferAddLit(&buf, ",w"); if (disk->transient) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("transient disks not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("transient disks not supported yet")); return -1; } @@ -1350,16 +1350,16 @@ static int xenFormatXMNet(virConnectPtr conn, virNetworkPtr network = virNetworkLookupByName(conn, net->data.network.name); char *bridge; if (!network) { - XENXS_ERROR(VIR_ERR_NO_NETWORK, "%s", - net->data.network.name); + virReportError(VIR_ERR_NO_NETWORK, "%s", + net->data.network.name); return -1; } bridge = virNetworkGetBridgeName(network); virNetworkFree(network); if (!bridge) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("network %s is not active"), - net->data.network.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("network %s is not active"), + net->data.network.name); return -1; } @@ -1369,9 +1369,9 @@ static int xenFormatXMNet(virConnectPtr conn, break; default: - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unsupported network type %d"), - net->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported network type %d"), + net->type); goto cleanup; } @@ -1670,9 +1670,9 @@ virConfPtr xenFormatXM(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto cleanup; } } else { @@ -1686,8 +1686,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_UTC: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto cleanup; } vmlocaltime = 0; @@ -1695,17 +1695,17 @@ virConfPtr xenFormatXM(virConnectPtr conn, break; case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: if (def->clock.data.utc_reset) { - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock adjustment='reset'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock adjustment='reset'")); goto cleanup; } vmlocaltime = 1; rtc_timeoffset = 0; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto cleanup; } if (xenXMConfigSetInt(conf, "rtc_timeoffset", rtc_timeoffset) < 0) @@ -1720,9 +1720,9 @@ virConfPtr xenFormatXM(virConnectPtr conn, vmlocaltime = 1; break; default: - XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset='%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset='%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto cleanup; } } /* !hvm */ @@ -1732,8 +1732,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (!(lifecycle = virDomainLifecycleTypeToString(def->onPoweroff))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle action %d"), def->onPoweroff); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle action %d"), def->onPoweroff); goto cleanup; } if (xenXMConfigSetString(conf, "on_poweroff", lifecycle) < 0) @@ -1741,8 +1741,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (!(lifecycle = virDomainLifecycleTypeToString(def->onReboot))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle action %d"), def->onReboot); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle action %d"), def->onReboot); goto cleanup; } if (xenXMConfigSetString(conf, "on_reboot", lifecycle) < 0) @@ -1750,8 +1750,8 @@ virConfPtr xenFormatXM(virConnectPtr conn, if (!(lifecycle = virDomainLifecycleCrashTypeToString(def->onCrash))) { - XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, - _("unexpected lifecycle action %d"), def->onCrash); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected lifecycle action %d"), def->onCrash); goto cleanup; } if (xenXMConfigSetString(conf, "on_crash", lifecycle) < 0) diff --git a/src/xenxs/xenxs_private.h b/src/xenxs/xenxs_private.h index bc903f5..4fc9461 100644 --- a/src/xenxs/xenxs_private.h +++ b/src/xenxs/xenxs_private.h @@ -57,8 +57,4 @@ # define VIR_FROM_THIS VIR_FROM_NONE -# define XENXS_ERROR(code, ...) \ - virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - #endif /* __VIR_XENXS_PRIVATE_H__ */ -- 1.7.10.4

On Wed, Jul 18, 2012 at 19:40:43 +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the XenXS shared code to use virReportError instead of the XENXS_ERROR custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/xenxs/xen_sxpr.c | 256 ++++++++++++++++++++++----------------------- src/xenxs/xen_xm.c | 220 +++++++++++++++++++------------------- src/xenxs/xenxs_private.h | 4 - 4 files changed, 238 insertions(+), 243 deletions(-)
ACK Jirka

From: "Daniel P. Berrange" <berrange@redhat.com> Update the VMWare driver to use virReportError instead of the vmwareError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/vmware/vmware_conf.c | 56 +++++++++++----------- src/vmware/vmware_conf.h | 4 -- src/vmware/vmware_driver.c | 110 ++++++++++++++++++++++---------------------- 4 files changed, 83 insertions(+), 88 deletions(-) diff --git a/cfg.mk b/cfg.mk index fda36cc..ffc9312 100644 --- a/cfg.mk +++ b/cfg.mk @@ -542,7 +542,6 @@ msg_gen_function += virSecurityReportError msg_gen_function += virXenInotifyError msg_gen_function += virXenStoreError msg_gen_function += virXendError -msg_gen_function += vmwareError msg_gen_function += xenapiSessionErrorHandler msg_gen_function += xenUnifiedError msg_gen_function += xenXMError diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 847d146..e7a9dfa 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -252,14 +252,14 @@ vmwareExtractVersion(struct vmware_driver *driver) goto cleanup; if ((tmp = STRSKIP(outbuf, pattern)) == NULL) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("failed to parse %s version"), bin); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse %s version"), bin); goto cleanup; } if (virParseVersionString(tmp, &version, false) < 0) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("version parsing error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("version parsing error")); goto cleanup; } @@ -303,8 +303,8 @@ vmwareParsePath(char *path, char **directory, char **filename) *separator++ = '\0'; if (*separator == '\0') { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("path '%s' doesn't reference a file"), path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("path '%s' doesn't reference a file"), path); return -1; } @@ -361,9 +361,9 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) * isn't perfect but should work in the majority of cases. */ if (vmdef->ndisks < 1) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Domain XML doesn't contain any disks, " - "cannot deduce datastore and path for VMX file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Domain XML doesn't contain any disks, " + "cannot deduce datastore and path for VMX file")); goto cleanup; } @@ -376,16 +376,16 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) } if (disk == NULL) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Domain XML doesn't contain any file-based harddisks, " - "cannot deduce datastore and path for VMX file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Domain XML doesn't contain any file-based harddisks, " + "cannot deduce datastore and path for VMX file")); goto cleanup; } if (disk->src == NULL) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("First file-based harddisk has no source, cannot " - "deduce datastore and path for VMX file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("First file-based harddisk has no source, cannot " + "deduce datastore and path for VMX file")); goto cleanup; } @@ -394,9 +394,9 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath) } if (!virFileHasSuffix(fileName, ".vmdk")) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("Expecting source '%s' of first file-based harddisk " - "to be a VMDK image"), disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting source '%s' of first file-based harddisk " + "to be a VMDK image"), disk->src); goto cleanup; } @@ -420,8 +420,8 @@ vmwareMoveFile(char *srcFile, char *dstFile) { "mv", PROGRAM_SENTINAL, PROGRAM_SENTINAL, NULL }; if (!virFileExists(srcFile)) { - vmwareError(VIR_ERR_INTERNAL_ERROR, _("file %s does not exist"), - srcFile); + virReportError(VIR_ERR_INTERNAL_ERROR, _("file %s does not exist"), + srcFile); return -1; } @@ -431,8 +431,8 @@ vmwareMoveFile(char *srcFile, char *dstFile) vmwareSetSentinal(cmdmv, srcFile); vmwareSetSentinal(cmdmv, dstFile); if (virRun(cmdmv, NULL) < 0) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("failed to move file to %s "), dstFile); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to move file to %s "), dstFile); return -1; } @@ -472,14 +472,14 @@ vmwareExtractPid(const char * vmxPath) goto cleanup; if (!fgets(line, sizeof(line), logFile)) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to read vmware log file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to read vmware log file")); goto cleanup; } if ((tmp = strstr(line, " pid=")) == NULL) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot find pid in vmware log file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot find pid in vmware log file")); goto cleanup; } @@ -488,8 +488,8 @@ vmwareExtractPid(const char * vmxPath) /* Although 64-bit windows allows 64-bit pid_t, a domain id has to be * 32 bits. For now, we just reject pid values that overflow int. */ if (virStrToLong_i(tmp, &tmp, 10, &pid_value) < 0 || *tmp != ' ') { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot parse pid in vmware log file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot parse pid in vmware log file")); goto cleanup; } diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h index b6d9d60..9053eba 100644 --- a/src/vmware/vmware_conf.h +++ b/src/vmware/vmware_conf.h @@ -30,10 +30,6 @@ # define VIR_FROM_THIS VIR_FROM_VMWARE # define PROGRAM_SENTINAL ((char *)0x1) -# define vmwareError(code, ...) \ - virReportErrorHelper(VIR_FROM_VMWARE, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - # define TYPE_PLAYER 0 # define TYPE_WORKSTATION 1 diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 2b9a275..9af5078 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -98,9 +98,9 @@ vmwareOpen(virConnectPtr conn, /* If path isn't /session, then they typoed, so tell them correct path */ if (conn->uri->path == NULL || STRNEQ(conn->uri->path, "/session")) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("unexpected VMware URI path '%s', try vmwareplayer:///session or vmwarews:///session"), - NULLSTR(conn->uri->path)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected VMware URI path '%s', try vmwareplayer:///session or vmwarews:///session"), + NULLSTR(conn->uri->path)); return VIR_DRV_OPEN_ERROR; } } @@ -111,8 +111,8 @@ vmwareOpen(virConnectPtr conn, vmrun = virFindFileInPath(VMRUN); if (vmrun == NULL) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("%s utility is missing"), VMRUN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s utility is missing"), VMRUN); return VIR_DRV_OPEN_ERROR; } else { VIR_FREE(vmrun); @@ -273,8 +273,8 @@ vmwareStartVM(struct vmware_driver *driver, virDomainObjPtr vm) const char *vmxPath = ((vmwareDomainPtr) vm->privateData)->vmxPath; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_SHUTOFF) { - vmwareError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not in shutoff state")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not in shutoff state")); return -1; } @@ -334,8 +334,8 @@ vmwareDomainDefineXML(virConnectPtr conn, const char *xml) /* create vmx file */ if (virFileWriteStr(vmxPath, vmx, S_IRUSR|S_IWUSR) < 0) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("Failed to write vmx file '%s'"), vmxPath); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to write vmx file '%s'"), vmxPath); goto cleanup; } @@ -386,8 +386,8 @@ vmwareDomainShutdownFlags(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -395,8 +395,8 @@ vmwareDomainShutdownFlags(virDomainPtr dom, goto cleanup; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain is not in running state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain is not in running state")); goto cleanup; } @@ -435,9 +435,9 @@ vmwareDomainSuspend(virDomainPtr dom) int ret = -1; if (driver->type == TYPE_PLAYER) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("vmplayer does not support libvirt suspend/resume" - " (vmware pause/unpause) operation ")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("vmplayer does not support libvirt suspend/resume" + " (vmware pause/unpause) operation ")); return ret; } @@ -446,16 +446,16 @@ vmwareDomainSuspend(virDomainPtr dom) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } vmwareSetSentinal(cmd, vmw_types[driver->type]); vmwareSetSentinal(cmd, ((vmwareDomainPtr) vm->privateData)->vmxPath); if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain is not in running state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain is not in running state")); goto cleanup; } @@ -484,9 +484,9 @@ vmwareDomainResume(virDomainPtr dom) int ret = -1; if (driver->type == TYPE_PLAYER) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("vmplayer does not support libvirt suspend/resume" - "(vmware pause/unpause) operation ")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("vmplayer does not support libvirt suspend/resume" + "(vmware pause/unpause) operation ")); return ret; } @@ -495,16 +495,16 @@ vmwareDomainResume(virDomainPtr dom) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } vmwareSetSentinal(cmd, vmw_types[driver->type]); vmwareSetSentinal(cmd, ((vmwareDomainPtr) vm->privateData)->vmxPath); if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain is not in suspend state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain is not in suspend state")); goto cleanup; } @@ -539,8 +539,8 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -552,8 +552,8 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags) goto cleanup; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { - vmwareError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain is not in running state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain is not in running state")); goto cleanup; } @@ -605,8 +605,8 @@ vmwareDomainCreateXML(virConnectPtr conn, const char *xml, /* create vmx file */ if (virFileWriteStr(vmxPath, vmx, S_IRUSR|S_IWUSR) < 0) { - vmwareError(VIR_ERR_INTERNAL_ERROR, - _("Failed to write vmx file '%s'"), vmxPath); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to write vmx file '%s'"), vmxPath); goto cleanup; } @@ -656,8 +656,8 @@ vmwareDomainCreateWithFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - vmwareError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -665,8 +665,8 @@ vmwareDomainCreateWithFlags(virDomainPtr dom, goto cleanup; if (virDomainObjIsActive(vm)) { - vmwareError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is already running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is already running")); goto cleanup; } @@ -702,14 +702,14 @@ vmwareDomainUndefineFlags(virDomainPtr dom, char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - vmwareError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!vm->persistent) { - vmwareError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot undefine transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot undefine transient domain")); goto cleanup; } @@ -750,7 +750,7 @@ vmwareDomainLookupByID(virConnectPtr conn, int id) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -776,7 +776,7 @@ vmwareGetOSType(virDomainPtr dom) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -802,7 +802,7 @@ vmwareDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -828,7 +828,7 @@ vmwareDomainLookupByName(virConnectPtr conn, const char *name) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -853,7 +853,7 @@ vmwareDomainIsActive(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); vmwareDriverUnlock(driver); if (!obj) { - vmwareError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = virDomainObjIsActive(obj); @@ -876,7 +876,7 @@ vmwareDomainIsPersistent(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); vmwareDriverUnlock(driver); if (!obj) { - vmwareError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = obj->persistent; @@ -902,8 +902,8 @@ vmwareDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -928,8 +928,8 @@ vmwareDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat, virCheckFlags(0, NULL); if (STRNEQ(nativeFormat, "vmware-vmx")) { - vmwareError(VIR_ERR_INVALID_ARG, - _("Unsupported config format '%s'"), nativeFormat); + virReportError(VIR_ERR_INVALID_ARG, + _("Unsupported config format '%s'"), nativeFormat); return NULL; } @@ -1029,8 +1029,8 @@ vmwareDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -1067,8 +1067,8 @@ vmwareDomainGetState(virDomainPtr dom, vmwareDriverUnlock(driver); if (!vm) { - vmwareError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the VMWare driver to use virReportError instead of the vmwareError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/vmware/vmware_conf.c | 56 +++++++++++----------- src/vmware/vmware_conf.h | 4 -- src/vmware/vmware_driver.c | 110 ++++++++++++++++++++++---------------------- 4 files changed, 83 insertions(+), 88 deletions(-)
ACK. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the libxl driver to use virReportError instead of the libxlError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/libxl/libxl_conf.c | 42 ++-- src/libxl/libxl_conf.h | 4 - src/libxl/libxl_driver.c | 614 +++++++++++++++++++++++----------------------- 4 files changed, 328 insertions(+), 333 deletions(-) diff --git a/cfg.mk b/cfg.mk index ffc9312..72321eb 100644 --- a/cfg.mk +++ b/cfg.mk @@ -513,7 +513,6 @@ msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR msg_gen_function += VMX_ERROR msg_gen_function += lxcError -msg_gen_function += libxlError msg_gen_function += nodeReportError msg_gen_function += qemuReportError msg_gen_function += regerror diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 201df75..d3ce733 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -372,8 +372,8 @@ libxlMakeDomCreateInfo(virDomainDefPtr def, libxl_domain_create_info *c_info) virUUIDFormat(def->uuid, uuidstr); if (libxl_uuid_from_string(&c_info->uuid, uuidstr) ) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to parse UUID '%s'"), uuidstr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to parse UUID '%s'"), uuidstr); goto error; } @@ -397,9 +397,9 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config) * only 32 can be represented. */ if (def->maxvcpus > 32 || def->vcpus > 32) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("This version of libxenlight only supports 32 " - "vcpus per domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("This version of libxenlight only supports 32 " + "vcpus per domain")); return -1; } @@ -532,9 +532,9 @@ libxlMakeDisk(virDomainDefPtr def, virDomainDiskDefPtr l_disk, x_disk->format = DISK_FORMAT_RAW; x_disk->backend = DISK_BACKEND_PHY; } else { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight does not support disk driver %s"), - l_disk->driverName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight does not support disk driver %s"), + l_disk->driverName); return -1; } } else { @@ -548,8 +548,8 @@ libxlMakeDisk(virDomainDefPtr def, virDomainDiskDefPtr l_disk, x_disk->readwrite = !l_disk->readonly; x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0; if (l_disk->transient) { - libxlError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libxenlight does not support transient disks")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libxenlight does not support transient disks")); return -1; } @@ -626,9 +626,9 @@ libxlMakeNic(virDomainDefPtr def, virDomainNetDefPtr l_nic, } } else { if (l_nic->script) { - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("scripts are not supported on interfaces of type %s"), - virDomainNetTypeToString(l_nic->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("scripts are not supported on interfaces of type %s"), + virDomainNetTypeToString(l_nic->type)); return -1; } } @@ -697,8 +697,8 @@ libxlMakeVfb(libxlDriverPrivatePtr driver, virDomainDefPtr def, if (l_vfb->data.vnc.autoport) { port = libxlNextFreeVncPort(driver, LIBXL_VNC_PORT_MIN); if (port < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to find an unused VNC port")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to find an unused VNC port")); return -1; } l_vfb->data.vnc.port = port; @@ -779,8 +779,8 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf) const char *type = virDomainChrTypeToString(def->source.type); if (!type) { - libxlError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected chr device type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected chr device type")); return -1; } @@ -917,14 +917,14 @@ libxlMakeCapabilities(libxl_ctx *ctx) regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED); if (libxl_get_physinfo(ctx, &phy_info) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get node physical info from libxenlight")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get node physical info from libxenlight")); return NULL; } if ((ver_info = libxl_get_version_info(ctx)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get version info from libxenlight")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get version info from libxenlight")); return NULL; } diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 2820afb..3067c52 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -96,10 +96,6 @@ struct _libxlSavefileHeader { uint32_t unused[10]; }; -# define libxlError(code, ...) \ - virReportErrorHelper(VIR_FROM_LIBXL, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - virCapsPtr libxlMakeCapabilities(libxl_ctx *ctx); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 4d1db3a..0e39484 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -168,14 +168,14 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info) struct utsname utsname; if (libxl_get_physinfo(&driver->ctx, &phy_info)) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxl_get_physinfo_info failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxl_get_physinfo_info failed")); return -1; } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxl_get_version_info failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxl_get_version_info failed")); return -1; } @@ -184,9 +184,9 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info) utsname.machine, strlen(utsname.machine), sizeof(info->model)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("machine type %s too big for destination"), - utsname.machine); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("machine type %s too big for destination"), + utsname.machine); return -1; } @@ -224,32 +224,32 @@ libxlSaveImageOpen(libxlDriverPrivatePtr driver, const char *from, char *xml = NULL; if ((fd = virFileOpenAs(from, O_RDONLY, 0, -1, -1, 0)) < 0) { - libxlError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot read domain image")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot read domain image")); goto error; } if (saferead(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) { - libxlError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to read libxl header")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to read libxl header")); goto error; } if (memcmp(hdr.magic, LIBXL_SAVE_MAGIC, sizeof(hdr.magic))) { - libxlError(VIR_ERR_INVALID_ARG, "%s", _("image magic is incorrect")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("image magic is incorrect")); goto error; } if (hdr.version > LIBXL_SAVE_VERSION) { - libxlError(VIR_ERR_OPERATION_FAILED, - _("image version is not supported (%d > %d)"), - hdr.version, LIBXL_SAVE_VERSION); + virReportError(VIR_ERR_OPERATION_FAILED, + _("image version is not supported (%d > %d)"), + hdr.version, LIBXL_SAVE_VERSION); goto error; } if (hdr.xmlLen <= 0) { - libxlError(VIR_ERR_OPERATION_FAILED, - _("invalid XML length: %d"), hdr.xmlLen); + virReportError(VIR_ERR_OPERATION_FAILED, + _("invalid XML length: %d"), hdr.xmlLen); goto error; } @@ -259,7 +259,7 @@ libxlSaveImageOpen(libxlDriverPrivatePtr driver, const char *from, } if (saferead(fd, xml, hdr.xmlLen) != hdr.xmlLen) { - libxlError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML")); goto error; } @@ -362,8 +362,8 @@ libxlVmReap(libxlDriverPrivatePtr driver, libxlDomainObjPrivatePtr priv = vm->privateData; if (libxl_domain_destroy(&priv->ctx, vm->def->id, force) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Unable to cleanup domain %d"), vm->def->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to cleanup domain %d"), vm->def->id); return -1; } @@ -541,8 +541,8 @@ libxlDomainSetVcpuAffinites(libxlDriverPrivatePtr driver, virDomainObjPtr vm) map.map = cpumap; if (libxl_set_vcpuaffinity(&priv->ctx, def->id, vcpu, &map) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to pin vcpu '%d' with libxenlight"), vcpu); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to pin vcpu '%d' with libxenlight"), vcpu); goto cleanup; } @@ -639,10 +639,10 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, char def_uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(vm->def->uuid, vm_uuidstr); virUUIDFormat(def->uuid, def_uuidstr); - libxlError(VIR_ERR_OPERATION_FAILED, - _("cannot restore domain '%s' uuid %s from a file" - " which belongs to domain '%s' uuid %s"), - vm->def->name, vm_uuidstr, def->name, def_uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot restore domain '%s' uuid %s from a file" + " which belongs to domain '%s' uuid %s"), + vm->def->name, vm_uuidstr, def->name, def_uuidstr); goto error; } @@ -664,9 +664,9 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, return -1; if (libxlFreeMem(priv, &d_config) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to get free memory for domain '%s'"), - d_config.c_info.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to get free memory for domain '%s'"), + d_config.c_info.name); goto error; } @@ -680,13 +680,13 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, if (ret) { if (restore_fd < 0) - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to create new domain '%s'"), - d_config.c_info.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to create new domain '%s'"), + d_config.c_info.name); else - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to restore domain '%s'"), - d_config.c_info.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to restore domain '%s'"), + d_config.c_info.name); goto error; } @@ -696,8 +696,8 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml", (uint8_t *)dom_xml, strlen(dom_xml) + 1)) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to store userdata")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to store userdata")); goto error; } @@ -1064,8 +1064,8 @@ libxlOpen(virConnectPtr conn, /* Error if xen or libxl scheme specified but driver not started. */ if (libxl_driver == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libxenlight state driver is not active")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libxenlight state driver is not active")); return VIR_DRV_OPEN_ERROR; } @@ -1074,9 +1074,9 @@ libxlOpen(virConnectPtr conn, STRNEQ(conn->uri->path, "") && STRNEQ(conn->uri->path, "/") && STRNEQ(conn->uri->path, "/system")) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("unexpected Xen URI path '%s', try xen:///"), - NULLSTR(conn->uri->path)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected Xen URI path '%s', try xen:///"), + NULLSTR(conn->uri->path)); return VIR_DRV_OPEN_ERROR; } } @@ -1227,7 +1227,7 @@ libxlDomainLookupByID(virConnectPtr conn, int id) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1253,7 +1253,7 @@ libxlDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1279,7 +1279,7 @@ libxlDomainLookupByName(virConnectPtr conn, const char *name) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } @@ -1309,12 +1309,12 @@ libxlDomainSuspend(virDomainPtr dom) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } @@ -1322,9 +1322,9 @@ libxlDomainSuspend(virDomainPtr dom) if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) { if (libxl_domain_pause(&priv->ctx, dom->id) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to suspend domain '%d' with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to suspend domain '%d' with libxenlight"), + dom->id); goto cleanup; } @@ -1367,13 +1367,13 @@ libxlDomainResume(virDomainPtr dom) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } @@ -1381,9 +1381,9 @@ libxlDomainResume(virDomainPtr dom) if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { if (libxl_domain_unpause(&priv->ctx, dom->id) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to resume domain '%d' with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to resume domain '%d' with libxenlight"), + dom->id); goto cleanup; } @@ -1425,22 +1425,22 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not running")); goto cleanup; } priv = vm->privateData; if (libxl_domain_shutdown(&priv->ctx, dom->id, LIBXL_DOM_REQ_POWEROFF) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to shutdown domain '%d' with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to shutdown domain '%d' with libxenlight"), + dom->id); goto cleanup; } @@ -1478,22 +1478,22 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not running")); goto cleanup; } priv = vm->privateData; if (libxl_domain_shutdown(&priv->ctx, dom->id, LIBXL_DOM_REQ_REBOOT) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to reboot domain '%d' with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to reboot domain '%d' with libxenlight"), + dom->id); goto cleanup; } ret = 0; @@ -1521,14 +1521,14 @@ libxlDomainDestroyFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not running")); goto cleanup; } @@ -1536,8 +1536,8 @@ libxlDomainDestroyFlags(virDomainPtr dom, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_DESTROYED) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to destroy domain '%d'"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to destroy domain '%d'"), dom->id); goto cleanup; } @@ -1576,8 +1576,8 @@ libxlDomainGetOSType(virDomainPtr dom) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1602,7 +1602,7 @@ libxlDomainGetMaxMemory(virDomainPtr dom) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } ret = vm->def->mem.max_balloon; @@ -1633,7 +1633,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -1653,15 +1653,15 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, } if (!isActive && (flags & VIR_DOMAIN_MEM_LIVE)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot set memory on an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot set memory on an inactive domain")); goto cleanup; } if (flags & VIR_DOMAIN_MEM_CONFIG) { if (!vm->persistent) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot change persistent config of a transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot change persistent config of a transient domain")); goto cleanup; } if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm))) @@ -1674,9 +1674,9 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (flags & VIR_DOMAIN_MEM_LIVE) { priv = vm->privateData; if (libxl_domain_setmaxmem(&priv->ctx, dom->id, newmem) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set maximum memory for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to set maximum memory for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } } @@ -1695,8 +1695,8 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, /* resize the current memory */ if (newmem > vm->def->mem.max_balloon) { - libxlError(VIR_ERR_INVALID_ARG, "%s", - _("cannot set memory higher than max memory")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("cannot set memory higher than max memory")); goto cleanup; } @@ -1704,9 +1704,9 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, priv = vm->privateData; if (libxl_set_memory_target(&priv->ctx, dom->id, newmem, 0, /* force */ 1) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set memory for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to set memory for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } } @@ -1752,8 +1752,8 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -1763,8 +1763,8 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) info->maxMem = vm->def->mem.max_balloon; } else { if (libxl_domain_info(&driver->ctx, &d_info, dom->id) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxl_domain_info failed for domain '%d'"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxl_domain_info failed for domain '%d'"), dom->id); goto cleanup; } info->cpuTime = d_info.cpu_time; @@ -1799,8 +1799,8 @@ libxlDomainGetState(virDomainPtr dom, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -1828,9 +1828,9 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, int ret = -1; if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { - libxlError(VIR_ERR_OPERATION_INVALID, - _("Domain '%d' has to be running because libxenlight will" - " suspend it"), vm->def->id); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain '%d' has to be running because libxenlight will" + " suspend it"), vm->def->id); goto cleanup; } @@ -1851,21 +1851,21 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, hdr.xmlLen = xml_len; if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) { - libxlError(VIR_ERR_OPERATION_FAILED, - _("Failed to write save file header")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to write save file header")); goto cleanup; } if (safewrite(fd, xml, xml_len) != xml_len) { - libxlError(VIR_ERR_OPERATION_FAILED, - _("Failed to write xml description")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to write xml description")); goto cleanup; } if (libxl_domain_suspend(&priv->ctx, NULL, vm->def->id, fd) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to save domain '%d' with libxenlight"), - vm->def->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to save domain '%d' with libxenlight"), + vm->def->id); goto cleanup; } @@ -1873,8 +1873,8 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, VIR_DOMAIN_EVENT_STOPPED_SAVED); if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_SAVED) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to destroy domain '%d'"), vm->def->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to destroy domain '%d'"), vm->def->id); goto cleanup; } @@ -1906,8 +1906,8 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml, virCheckFlags(0, -1); if (dxml) { - libxlError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("xml modification unsupported")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("xml modification unsupported")); return -1; } @@ -1917,13 +1917,13 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } @@ -1955,8 +1955,8 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from, virCheckFlags(0, -1); if (dxml) { - libxlError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("xml modification unsupported")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("xml modification unsupported")); return -1; } @@ -2015,13 +2015,13 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } @@ -2030,10 +2030,10 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags) if (!(flags & VIR_DUMP_LIVE) && virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { if (libxl_domain_pause(&priv->ctx, dom->id) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Before dumping core, failed to suspend domain '%d'" - " with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Before dumping core, failed to suspend domain '%d'" + " with libxenlight"), + dom->id); goto cleanup; } virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_DUMP); @@ -2041,17 +2041,17 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags) } if (libxl_domain_core_dump(&priv->ctx, dom->id, to) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to dump core of domain '%d' with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to dump core of domain '%d' with libxenlight"), + dom->id); goto cleanup_unpause; } libxlDriverLock(driver); if (flags & VIR_DUMP_CRASH) { if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_CRASHED) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to destroy domain '%d'"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to destroy domain '%d'"), dom->id); goto cleanup_unlock; } @@ -2071,9 +2071,9 @@ cleanup_unlock: cleanup_unpause: if (virDomainObjIsActive(vm) && paused) { if (libxl_domain_unpause(&priv->ctx, dom->id) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("After dumping core, failed to resume domain '%d' with" - " libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("After dumping core, failed to resume domain '%d' with" + " libxenlight"), dom->id); } else { virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED); @@ -2105,18 +2105,18 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } if (!vm->persistent) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot do managed save for transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do managed save for transient domain")); goto cleanup; } @@ -2171,8 +2171,8 @@ libxlDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2200,8 +2200,8 @@ libxlDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2244,13 +2244,13 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 || (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) == (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) { - libxlError(VIR_ERR_INVALID_ARG, - _("invalid flag combination: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid flag combination: (0x%x)"), flags); return -1; } if (!nvcpus) { - libxlError(VIR_ERR_INVALID_ARG, _("nvcpus is zero")); + virReportError(VIR_ERR_INVALID_ARG, _("nvcpus is zero")); return -1; } @@ -2259,25 +2259,25 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot set vcpus on an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot set vcpus on an inactive domain")); goto cleanup; } if (!vm->persistent && (flags & VIR_DOMAIN_VCPU_CONFIG)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot change persistent config of a transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot change persistent config of a transient domain")); goto cleanup; } if ((max = libxlGetMaxVcpus(dom->conn, NULL)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not determine max vcpus for the domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not determine max vcpus for the domain")); goto cleanup; } @@ -2286,9 +2286,9 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } if (nvcpus > max) { - libxlError(VIR_ERR_INVALID_ARG, - _("requested vcpus is greater than max allowable" - " vcpus for the domain: %d > %d"), nvcpus, max); + virReportError(VIR_ERR_INVALID_ARG, + _("requested vcpus is greater than max allowable" + " vcpus for the domain: %d > %d"), nvcpus, max); goto cleanup; } @@ -2324,18 +2324,18 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, case VIR_DOMAIN_VCPU_LIVE: if (libxl_set_vcpuonline(&priv->ctx, dom->id, &map) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set vcpus for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to set vcpus for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } break; case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG: if (libxl_set_vcpuonline(&priv->ctx, dom->id, &map) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set vcpus for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to set vcpus for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } def->vcpus = nvcpus; @@ -2378,7 +2378,7 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -2391,22 +2391,22 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) flags |= VIR_DOMAIN_VCPU_CONFIG; } if ((flags & VIR_DOMAIN_VCPU_LIVE) && (flags & VIR_DOMAIN_VCPU_CONFIG)) { - libxlError(VIR_ERR_INVALID_ARG, - _("invalid flag combination: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid flag combination: (0x%x)"), flags); return -1; } if (flags & VIR_DOMAIN_VCPU_LIVE) { if (!active) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not running")); goto cleanup; } def = vm->def; } else { if (!vm->persistent) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is transient")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is transient")); goto cleanup; } def = vm->newDef ? vm->newDef : vm->def; @@ -2435,13 +2435,13 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot pin vcpus on an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot pin vcpus on an inactive domain")); goto cleanup; } @@ -2450,14 +2450,14 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap, map.size = maplen; map.map = cpumap; if (libxl_set_vcpuaffinity(&priv->ctx, dom->id, vcpu, &map) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to pin vcpu '%d' with libxenlight"), vcpu); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to pin vcpu '%d' with libxenlight"), vcpu); goto cleanup; } if (virDomainVcpuPinAdd(vm->def, cpumap, maplen, vcpu) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to update or add vcpupin xml")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to update or add vcpupin xml")); goto cleanup; } @@ -2491,21 +2491,21 @@ libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int maxinfo, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } priv = vm->privateData; if ((vcpuinfo = libxl_list_vcpu(&priv->ctx, dom->id, &maxcpu, &hostcpus)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to list vcpus for domain '%d' with libxenlight"), - dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to list vcpus for domain '%d' with libxenlight"), + dom->id); goto cleanup; } @@ -2554,8 +2554,8 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); goto cleanup; } @@ -2581,8 +2581,8 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat, virCheckFlags(0, NULL); if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) { - libxlError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), nativeFormat); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported config type %s"), nativeFormat); goto cleanup; } @@ -2595,7 +2595,7 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat, goto cleanup; if (!(def = xenParseXM(conf, ver_info->xen_version_major, driver->caps))) { - libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed")); goto cleanup; } @@ -2624,8 +2624,8 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat, virCheckFlags(0, NULL); if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) { - libxlError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), nativeFormat); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported config type %s"), nativeFormat); goto cleanup; } @@ -2699,14 +2699,14 @@ libxlDomainCreateWithFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is already running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is already running")); goto cleanup; } @@ -2795,14 +2795,14 @@ libxlDomainUndefineFlags(virDomainPtr dom, char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!vm->persistent) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot undefine transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot undefine transient domain")); goto cleanup; } @@ -2813,14 +2813,14 @@ libxlDomainUndefineFlags(virDomainPtr dom, if (virFileExists(name)) { if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) { if (unlink(name) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to remove domain managed save image")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to remove domain managed save image")); goto cleanup; } } else { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", - _("Refusing to undefine while domain managed " - "save image exists")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Refusing to undefine while domain managed " + "save image exists")); goto cleanup; } } @@ -2876,16 +2876,16 @@ libxlDomainChangeEjectableMedia(libxlDomainObjPrivatePtr priv, } if (!origdisk) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("No device with bus '%s' and target '%s'"), - virDomainDiskBusTypeToString(disk->bus), disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No device with bus '%s' and target '%s'"), + virDomainDiskBusTypeToString(disk->bus), disk->dst); goto cleanup; } if (origdisk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Removable media not supported for %s device"), - virDomainDiskDeviceTypeToString(disk->device)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Removable media not supported for %s device"), + virDomainDiskDeviceTypeToString(disk->device)); return -1; } @@ -2893,9 +2893,9 @@ libxlDomainChangeEjectableMedia(libxlDomainObjPrivatePtr priv, goto cleanup; if ((ret = libxl_cdrom_insert(&priv->ctx, vm->def->id, &x_disk)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to change media for disk '%s'"), - disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to change media for disk '%s'"), + disk->dst); goto cleanup; } @@ -2928,14 +2928,14 @@ libxlDomainAttachDeviceDiskLive(libxlDomainObjPrivatePtr priv, case VIR_DOMAIN_DISK_DEVICE_DISK: if (l_disk->bus == VIR_DOMAIN_DISK_BUS_XEN) { if (virDomainDiskIndexByName(vm->def, l_disk->dst, true) >= 0) { - libxlError(VIR_ERR_OPERATION_FAILED, - _("target %s already exists"), l_disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("target %s already exists"), l_disk->dst); goto cleanup; } if (!l_disk->src) { - libxlError(VIR_ERR_INTERNAL_ERROR, - "%s", _("disk source path is missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("disk source path is missing")); goto cleanup; } @@ -2949,24 +2949,24 @@ libxlDomainAttachDeviceDiskLive(libxlDomainObjPrivatePtr priv, if ((ret = libxl_device_disk_add(&priv->ctx, vm->def->id, &x_disk)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to attach disk '%s'"), - l_disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to attach disk '%s'"), + l_disk->dst); goto cleanup; } virDomainDiskInsertPreAlloced(vm->def, l_disk); } else { - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk bus '%s' cannot be hotplugged."), - virDomainDiskBusTypeToString(l_disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk bus '%s' cannot be hotplugged."), + virDomainDiskBusTypeToString(l_disk->bus)); } break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device type '%s' cannot be hotplugged"), - virDomainDiskDeviceTypeToString(l_disk->device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device type '%s' cannot be hotplugged"), + virDomainDiskDeviceTypeToString(l_disk->device)); break; } @@ -2991,8 +2991,8 @@ libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv, if ((i = virDomainDiskIndexByName(vm->def, dev->data.disk->dst, false)) < 0) { - libxlError(VIR_ERR_OPERATION_FAILED, - _("disk %s not found"), dev->data.disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("disk %s not found"), dev->data.disk->dst); goto cleanup; } @@ -3003,9 +3003,9 @@ libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv, if ((ret = libxl_device_disk_del(&priv->ctx, &x_disk, wait_secs)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("libxenlight failed to detach disk '%s'"), - l_disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxenlight failed to detach disk '%s'"), + l_disk->dst); goto cleanup; } @@ -3013,15 +3013,15 @@ libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv, virDomainDiskDefFree(l_disk); } else { - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk bus '%s' cannot be hot unplugged."), - virDomainDiskBusTypeToString(dev->data.disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk bus '%s' cannot be hot unplugged."), + virDomainDiskBusTypeToString(dev->data.disk->bus)); } break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot hot unplugged"), - virDomainDiskDeviceTypeToString(dev->data.disk->device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot hot unplugged"), + virDomainDiskDeviceTypeToString(dev->data.disk->device)); break; } @@ -3043,9 +3043,9 @@ libxlDomainAttachDeviceLive(libxlDomainObjPrivatePtr priv, virDomainObjPtr vm, break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot be attached"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot be attached"), + virDomainDeviceTypeToString(dev->type)); break; } @@ -3061,8 +3061,8 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if (virDomainDiskIndexByName(vmdef, disk->dst, true) >= 0) { - libxlError(VIR_ERR_INVALID_ARG, - _("target %s already exists."), disk->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("target %s already exists."), disk->dst); return -1; } if (virDomainDiskInsert(vmdef, disk)) { @@ -3074,8 +3074,8 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("persistent attach of device is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent attach of device is not supported")); return -1; } return 0; @@ -3093,9 +3093,9 @@ libxlDomainDetachDeviceLive(libxlDomainObjPrivatePtr priv, virDomainObjPtr vm, break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot be detached"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); break; } @@ -3112,16 +3112,16 @@ libxlDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if (!(detach = virDomainDiskRemoveByName(vmdef, disk->dst))) { - libxlError(VIR_ERR_INVALID_ARG, - _("no target device %s"), disk->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("no target device %s"), disk->dst); break; } virDomainDiskDefFree(detach); ret = 0; break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("persistent detach of device is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent detach of device is not supported")); break; } @@ -3145,16 +3145,16 @@ libxlDomainUpdateDeviceLive(libxlDomainObjPrivatePtr priv, dev->data.disk = NULL; break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk bus '%s' cannot be updated."), - virDomainDiskBusTypeToString(disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk bus '%s' cannot be updated."), + virDomainDiskBusTypeToString(disk->bus)); break; } break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot be updated"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot be updated"), + virDomainDeviceTypeToString(dev->type)); break; } @@ -3173,14 +3173,14 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if ((i = virDomainDiskIndexByName(vmdef, disk->dst, false)) < 0) { - libxlError(VIR_ERR_INVALID_ARG, - _("target %s doesn't exist."), disk->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("target %s doesn't exist."), disk->dst); goto cleanup; } orig = vmdef->disks[i]; if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) { - libxlError(VIR_ERR_INVALID_ARG, - _("this disk doesn't support update")); + virReportError(VIR_ERR_INVALID_ARG, + _("this disk doesn't support update")); goto cleanup; } @@ -3200,8 +3200,8 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) disk->src = NULL; break; default: - libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("persistent update of device is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent update of device is not supported")); goto cleanup; } @@ -3236,7 +3236,7 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } @@ -3248,15 +3248,15 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG; /* check consistency between flags and the vm state */ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain is not running")); goto cleanup; } } if ((flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) && !vm->persistent) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot modify device on transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot modify device on transient domain")); goto cleanup; } @@ -3281,8 +3281,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, case LIBXL_DEVICE_UPDATE: ret = libxlDomainUpdateDeviceConfig(vmdef, dev); default: - libxlError(VIR_ERR_INTERNAL_ERROR, - _("unknown domain modify action %d"), action); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown domain modify action %d"), action); break; } } else @@ -3305,8 +3305,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, case LIBXL_DEVICE_UPDATE: ret = libxlDomainUpdateDeviceLive(priv, vm, dev); default: - libxlError(VIR_ERR_INTERNAL_ERROR, - _("unknown domain modify action %d"), action); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown domain modify action %d"), action); break; } /* @@ -3378,12 +3378,12 @@ libxlNodeGetFreeMemory(virConnectPtr conn) libxlDriverPrivatePtr driver = conn->privateData; if (libxl_get_physinfo(&driver->ctx, &phy_info)) { - libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed")); return 0; } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed")); return 0; } @@ -3438,8 +3438,8 @@ libxlDomainGetAutostart(virDomainPtr dom, int *autostart) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3466,14 +3466,14 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - libxlError(VIR_ERR_NO_DOMAIN, - _("No domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("No domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!vm->persistent) { - libxlError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot set autostart for transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot set autostart for transient domain")); goto cleanup; } @@ -3535,20 +3535,20 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams) libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } priv = vm->privateData; if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler id for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get scheduler id for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } @@ -3602,34 +3602,34 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } priv = vm->privateData; if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler id for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get scheduler id for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } if (sched_id != XEN_SCHEDULER_CREDIT) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Only 'credit' scheduler is supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Only 'credit' scheduler is supported")); goto cleanup; } if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler parameters for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get scheduler parameters for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } @@ -3688,34 +3688,34 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom, libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); + virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid")); goto cleanup; } if (!virDomainObjIsActive(vm)) { - libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running")); goto cleanup; } priv = vm->privateData; if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler id for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get scheduler id for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } if (sched_id != XEN_SCHEDULER_CREDIT) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Only 'credit' scheduler is supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Only 'credit' scheduler is supported")); goto cleanup; } if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler parameters for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get scheduler parameters for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } @@ -3730,9 +3730,9 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom, } if (libxl_sched_credit_domain_set(&priv->ctx, dom->id, &sc_info) != 0) { - libxlError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set scheduler parameters for domain '%d'" - " with libxenlight"), dom->id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to set scheduler parameters for domain '%d'" + " with libxenlight"), dom->id); goto cleanup; } @@ -3762,7 +3762,7 @@ libxlDomainIsActive(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); libxlDriverUnlock(driver); if (!obj) { - libxlError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = virDomainObjIsActive(obj); @@ -3784,7 +3784,7 @@ libxlDomainIsPersistent(virDomainPtr dom) obj = virDomainFindByUUID(&driver->domains, dom->uuid); libxlDriverUnlock(driver); if (!obj) { - libxlError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = obj->persistent; @@ -3806,7 +3806,7 @@ libxlDomainIsUpdated(virDomainPtr dom) vm = virDomainFindByUUID(&driver->domains, dom->uuid); libxlDriverUnlock(driver); if (!vm) { - libxlError(VIR_ERR_NO_DOMAIN, NULL); + virReportError(VIR_ERR_NO_DOMAIN, NULL); goto cleanup; } ret = vm->updated; -- 1.7.10.4

On Wed, Jul 18, 2012 at 19:40:45 +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the libxl driver to use virReportError instead of the libxlError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/libxl/libxl_conf.c | 42 ++-- src/libxl/libxl_conf.h | 4 - src/libxl/libxl_driver.c | 614 +++++++++++++++++++++++----------------------- 4 files changed, 328 insertions(+), 333 deletions(-)
ACK The following patch is worth applying while we are changing all the error messages: diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index d3ce733..28966cd 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -397,7 +397,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config) * only 32 can be represented. */ if (def->maxvcpus > 32 || def->vcpus > 32) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("This version of libxenlight only supports 32 " "vcpus per domain")); return -1; @@ -917,13 +917,13 @@ libxlMakeCapabilities(libxl_ctx *ctx) regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED); if (libxl_get_physinfo(ctx, &phy_info) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to get node physical info from libxenlight")); return NULL; } if ((ver_info = libxl_get_version_info(ctx)) == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to get version info from libxenlight")); return NULL; } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0e39484..edf5c33 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -168,13 +168,13 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info) struct utsname utsname; if (libxl_get_physinfo(&driver->ctx, &phy_info)) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxl_get_physinfo_info failed")); return -1; } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxl_get_version_info failed")); return -1; } @@ -696,7 +696,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml", (uint8_t *)dom_xml, strlen(dom_xml) + 1)) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("libxenlight failed to store userdata")); goto error; } @@ -1851,13 +1851,13 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm, hdr.xmlLen = xml_len; if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) { - virReportError(VIR_ERR_OPERATION_FAILED, + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Failed to write save file header")); goto cleanup; } if (safewrite(fd, xml, xml_len) != xml_len) { - virReportError(VIR_ERR_OPERATION_FAILED, + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Failed to write xml description")); goto cleanup; } @@ -2250,7 +2250,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } if (!nvcpus) { - virReportError(VIR_ERR_INVALID_ARG, _("nvcpus is zero")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("nvcpus is zero")); return -1; } @@ -2813,7 +2813,7 @@ libxlDomainUndefineFlags(virDomainPtr dom, if (virFileExists(name)) { if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) { if (unlink(name) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to remove domain managed save image")); goto cleanup; } @@ -3179,7 +3179,7 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev) } orig = vmdef->disks[i]; if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) { - virReportError(VIR_ERR_INVALID_ARG, + virReportError(VIR_ERR_INVALID_ARG, "%s", _("this disk doesn't support update")); goto cleanup; } @@ -3378,12 +3378,14 @@ libxlNodeGetFreeMemory(virConnectPtr conn) libxlDriverPrivatePtr driver = conn->privateData; if (libxl_get_physinfo(&driver->ctx, &phy_info)) { - virReportError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libxl_get_physinfo_info failed")); return 0; } if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libxl_get_version_info failed")); return 0; } @@ -3621,7 +3623,7 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom, } if (sched_id != XEN_SCHEDULER_CREDIT) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Only 'credit' scheduler is supported")); goto cleanup; } @@ -3707,7 +3709,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom, } if (sched_id != XEN_SCHEDULER_CREDIT) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Only 'credit' scheduler is supported")); goto cleanup; } -- 1.7.11.1

From: "Daniel P. Berrange" <berrange@redhat.com> Update the remote driver to use virReportError instead of the remoteError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/remote/remote_driver.c | 310 ++++++++++++++++++++++---------------------- src/rpc/gendispatch.pl | 18 +-- 3 files changed, 162 insertions(+), 167 deletions(-) diff --git a/cfg.mk b/cfg.mk index 72321eb..3de6a66 100644 --- a/cfg.mk +++ b/cfg.mk @@ -516,7 +516,6 @@ msg_gen_function += lxcError msg_gen_function += nodeReportError msg_gen_function += qemuReportError msg_gen_function += regerror -msg_gen_function += remoteError msg_gen_function += statsError msg_gen_function += streamsReportError msg_gen_function += vah_error diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index acae5d0..d91ae87 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -54,8 +54,8 @@ # define HYPER_TO_TYPE(_type, _to, _from) \ do { \ if ((_from) != (_type)(_from)) { \ - remoteError(VIR_ERR_INTERNAL_ERROR, \ - _("conversion from hyper to %s overflowed"), #_type); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("conversion from hyper to %s overflowed"), #_type); \ goto done; \ } \ (_to) = (_from); \ @@ -125,10 +125,6 @@ static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, virConnectAuthPtr auth); #endif /* HAVE_POLKIT */ -#define remoteError(code, ...) \ - virReportErrorHelper(VIR_FROM_REMOTE, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain); static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network); static virNWFilterPtr get_nonnull_nwfilter (virConnectPtr conn, remote_nonnull_nwfilter nwfilter); @@ -384,10 +380,10 @@ doRemoteOpen (virConnectPtr conn, transport = trans_tls; else if (STRCASEEQ (transport_str, "unix")) { if (conn->uri->server) { - remoteError(VIR_ERR_INVALID_ARG, - _("using unix socket and remote " - "server '%s' is not supported."), - conn->uri->server); + virReportError(VIR_ERR_INVALID_ARG, + _("using unix socket and remote " + "server '%s' is not supported."), + conn->uri->server); return VIR_DRV_OPEN_ERROR; } else { transport = trans_unix; @@ -399,9 +395,9 @@ doRemoteOpen (virConnectPtr conn, else if (STRCASEEQ (transport_str, "tcp")) transport = trans_tcp; else { - remoteError(VIR_ERR_INVALID_ARG, "%s", - _("remote_open: transport in URL not recognised " - "(should be tls|unix|ssh|ext|tcp)")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("remote_open: transport in URL not recognised " + "(should be tls|unix|ssh|ext|tcp)")); return VIR_DRV_OPEN_ERROR; } } @@ -551,8 +547,8 @@ doRemoteOpen (virConnectPtr conn, /* For ext transport, command is required. */ if (transport == trans_ext && !command) { - remoteError(VIR_ERR_INVALID_ARG, "%s", - _("remote_open: for 'ext' transport, command is required")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("remote_open: for 'ext' transport, command is required")); goto failed; } @@ -608,8 +604,8 @@ doRemoteOpen (virConnectPtr conn, } if (!(daemonPath = remoteFindDaemonPath())) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to locate libvirtd daemon in $PATH")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to locate libvirtd daemon in $PATH")); goto failed; } if (!(priv->client = virNetClientNewUNIX(sockname, @@ -663,9 +659,9 @@ doRemoteOpen (virConnectPtr conn, case trans_unix: case trans_ssh: case trans_ext: - remoteError(VIR_ERR_INVALID_ARG, "%s", - _("transport methods unix, ssh and ext are not supported " - "under Windows")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("transport methods unix, ssh and ext are not supported " + "under Windows")); goto failed; #endif /* WIN32 */ @@ -785,8 +781,8 @@ remoteAllocPrivateData(void) } if (virMutexInit(&priv->lock) < 0) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot initialize mutex")); VIR_FREE(priv); return NULL; } @@ -1085,9 +1081,9 @@ remoteNodeGetCPUStats (virConnectPtr conn, /* Check the length of the returned list carefully. */ if (ret.params.params_len > REMOTE_NODE_CPU_STATS_MAX || ret.params.params_len > *nparams) { - remoteError(VIR_ERR_RPC, "%s", - _("remoteNodeGetCPUStats: " - "returned number of stats exceeds limit")); + virReportError(VIR_ERR_RPC, "%s", + _("remoteNodeGetCPUStats: " + "returned number of stats exceeds limit")); goto cleanup; } /* Handle the case when the caller does not know the number of stats @@ -1104,9 +1100,9 @@ remoteNodeGetCPUStats (virConnectPtr conn, /* Deserialise the result. */ for (i = 0; i < *nparams; ++i) { if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) == NULL) { - remoteError(VIR_ERR_INTERNAL_ERROR, - _("Stats %s too big for destination"), - ret.params.params_val[i].field); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Stats %s too big for destination"), + ret.params.params_val[i].field); goto cleanup; } params[i].value = ret.params.params_val[i].value; @@ -1149,9 +1145,9 @@ remoteNodeGetMemoryStats (virConnectPtr conn, /* Check the length of the returned list carefully. */ if (ret.params.params_len > REMOTE_NODE_MEMORY_STATS_MAX || ret.params.params_len > *nparams) { - remoteError(VIR_ERR_RPC, "%s", - _("remoteNodeGetMemoryStats: " - "returned number of stats exceeds limit")); + virReportError(VIR_ERR_RPC, "%s", + _("remoteNodeGetMemoryStats: " + "returned number of stats exceeds limit")); goto cleanup; } /* Handle the case when the caller does not know the number of stats @@ -1168,9 +1164,9 @@ remoteNodeGetMemoryStats (virConnectPtr conn, /* Deserialise the result. */ for (i = 0; i < *nparams; ++i) { if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) == NULL) { - remoteError(VIR_ERR_INTERNAL_ERROR, - _("Stats %s too big for destination"), - ret.params.params_val[i].field); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Stats %s too big for destination"), + ret.params.params_val[i].field); goto cleanup; } params[i].value = ret.params.params_val[i].value; @@ -1201,9 +1197,9 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn, remoteDriverLock(priv); if (maxCells > REMOTE_NODE_MAX_CELLS) { - remoteError(VIR_ERR_RPC, - _("too many NUMA cells: %d > %d"), - maxCells, REMOTE_NODE_MAX_CELLS); + virReportError(VIR_ERR_RPC, + _("too many NUMA cells: %d > %d"), + maxCells, REMOTE_NODE_MAX_CELLS); goto done; } @@ -1240,9 +1236,9 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids) remoteDriverLock(priv); if (maxids > REMOTE_DOMAIN_ID_LIST_MAX) { - remoteError(VIR_ERR_RPC, - _("too many remote domain IDs: %d > %d"), - maxids, REMOTE_DOMAIN_ID_LIST_MAX); + virReportError(VIR_ERR_RPC, + _("too many remote domain IDs: %d > %d"), + maxids, REMOTE_DOMAIN_ID_LIST_MAX); goto done; } args.maxids = maxids; @@ -1254,9 +1250,9 @@ remoteListDomains (virConnectPtr conn, int *ids, int maxids) goto done; if (ret.ids.ids_len > maxids) { - remoteError(VIR_ERR_RPC, - _("too many remote domain IDs: %d > %d"), - ret.ids.ids_len, maxids); + virReportError(VIR_ERR_RPC, + _("too many remote domain IDs: %d > %d"), + ret.ids.ids_len, maxids); goto cleanup; } @@ -1407,8 +1403,8 @@ remoteSerializeTypedParameters(virTypedParameterPtr params, } break; default: - remoteError(VIR_ERR_RPC, _("unknown parameter type: %d"), - params[i].type); + virReportError(VIR_ERR_RPC, _("unknown parameter type: %d"), + params[i].type); goto cleanup; } } @@ -1435,8 +1431,8 @@ remoteDeserializeTypedParameters(remote_typed_param *ret_params_val, /* Check the length of the returned list carefully. */ if (ret_params_len > limit || ret_params_len > *nparams) { - remoteError(VIR_ERR_RPC, "%s", - _("returned number of parameters exceeds limit")); + virReportError(VIR_ERR_RPC, "%s", + _("returned number of parameters exceeds limit")); goto cleanup; } @@ -1446,9 +1442,9 @@ remoteDeserializeTypedParameters(remote_typed_param *ret_params_val, for (i = 0; i < ret_params_len; ++i) { if (virStrcpyStatic(params[i].field, ret_params_val[i].field) == NULL) { - remoteError(VIR_ERR_INTERNAL_ERROR, - _("Parameter %s too big for destination"), - ret_params_val[i].field); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parameter %s too big for destination"), + ret_params_val[i].field); goto cleanup; } params[i].type = ret_params_val[i].value.type; @@ -1486,8 +1482,8 @@ remoteDeserializeTypedParameters(remote_typed_param *ret_params_val, } break; default: - remoteError(VIR_ERR_RPC, _("unknown parameter type: %d"), - params[i].type); + virReportError(VIR_ERR_RPC, _("unknown parameter type: %d"), + params[i].type); goto cleanup; } } @@ -1511,8 +1507,8 @@ remoteDeserializeDomainDiskErrors(remote_domain_disk_error *ret_errors_val, int j; if (ret_errors_len > limit || ret_errors_len > maxerrors) { - remoteError(VIR_ERR_RPC, "%s", - _("returned number of disk errors exceeds limit")); + virReportError(VIR_ERR_RPC, "%s", + _("returned number of disk errors exceeds limit")); goto error; } @@ -1561,9 +1557,9 @@ remoteDomainBlockStatsFlags(virDomainPtr domain, /* Check the length of the returned list carefully. */ if (ret.params.params_len > REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX || ret.params.params_len > *nparams) { - remoteError(VIR_ERR_RPC, "%s", - _("remoteDomainBlockStatsFlags: " - "returned number of stats exceeds limit")); + virReportError(VIR_ERR_RPC, "%s", + _("remoteDomainBlockStatsFlags: " + "returned number of stats exceeds limit")); goto cleanup; } @@ -1756,17 +1752,17 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain, remoteDriverLock(priv); if (ncpumaps > REMOTE_VCPUINFO_MAX) { - remoteError(VIR_ERR_RPC, - _("vCPU count exceeds maximum: %d > %d"), - ncpumaps, REMOTE_VCPUINFO_MAX); + virReportError(VIR_ERR_RPC, + _("vCPU count exceeds maximum: %d > %d"), + ncpumaps, REMOTE_VCPUINFO_MAX); goto done; } if (INT_MULTIPLY_OVERFLOW(ncpumaps, maplen) || ncpumaps * maplen > REMOTE_CPUMAPS_MAX) { - remoteError(VIR_ERR_RPC, - _("vCPU map buffer length exceeds maximum: %d > %d"), - ncpumaps * maplen, REMOTE_CPUMAPS_MAX); + virReportError(VIR_ERR_RPC, + _("vCPU map buffer length exceeds maximum: %d > %d"), + ncpumaps * maplen, REMOTE_CPUMAPS_MAX); goto done; } @@ -1785,16 +1781,16 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain, goto done; if (ret.num > ncpumaps) { - remoteError(VIR_ERR_RPC, - _("host reports too many vCPUs: %d > %d"), - ret.num, ncpumaps); + virReportError(VIR_ERR_RPC, + _("host reports too many vCPUs: %d > %d"), + ret.num, ncpumaps); goto cleanup; } if (ret.cpumaps.cpumaps_len > ncpumaps * maplen) { - remoteError(VIR_ERR_RPC, - _("host reports map buffer length exceeds maximum: %d > %d"), - ret.cpumaps.cpumaps_len, ncpumaps * maplen); + virReportError(VIR_ERR_RPC, + _("host reports map buffer length exceeds maximum: %d > %d"), + ret.cpumaps.cpumaps_len, ncpumaps * maplen); goto cleanup; } @@ -1829,16 +1825,16 @@ remoteDomainGetVcpus (virDomainPtr domain, remoteDriverLock(priv); if (maxinfo > REMOTE_VCPUINFO_MAX) { - remoteError(VIR_ERR_RPC, - _("vCPU count exceeds maximum: %d > %d"), - maxinfo, REMOTE_VCPUINFO_MAX); + virReportError(VIR_ERR_RPC, + _("vCPU count exceeds maximum: %d > %d"), + maxinfo, REMOTE_VCPUINFO_MAX); goto done; } if (INT_MULTIPLY_OVERFLOW(maxinfo, maplen) || maxinfo * maplen > REMOTE_CPUMAPS_MAX) { - remoteError(VIR_ERR_RPC, - _("vCPU map buffer length exceeds maximum: %d > %d"), - maxinfo * maplen, REMOTE_CPUMAPS_MAX); + virReportError(VIR_ERR_RPC, + _("vCPU map buffer length exceeds maximum: %d > %d"), + maxinfo * maplen, REMOTE_CPUMAPS_MAX); goto done; } @@ -1853,15 +1849,15 @@ remoteDomainGetVcpus (virDomainPtr domain, goto done; if (ret.info.info_len > maxinfo) { - remoteError(VIR_ERR_RPC, - _("host reports too many vCPUs: %d > %d"), - ret.info.info_len, maxinfo); + virReportError(VIR_ERR_RPC, + _("host reports too many vCPUs: %d > %d"), + ret.info.info_len, maxinfo); goto cleanup; } if (ret.cpumaps.cpumaps_len > maxinfo * maplen) { - remoteError(VIR_ERR_RPC, - _("host reports map buffer length exceeds maximum: %d > %d"), - ret.cpumaps.cpumaps_len, maxinfo * maplen); + virReportError(VIR_ERR_RPC, + _("host reports map buffer length exceeds maximum: %d > %d"), + ret.cpumaps.cpumaps_len, maxinfo * maplen); goto cleanup; } @@ -1910,8 +1906,8 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel) if (ret.label.label_val != NULL) { if (strlen (ret.label.label_val) >= sizeof(seclabel->label)) { - remoteError(VIR_ERR_RPC, _("security label exceeds maximum: %zu"), - sizeof(seclabel->label) - 1); + virReportError(VIR_ERR_RPC, _("security label exceeds maximum: %zu"), + sizeof(seclabel->label) - 1); goto cleanup; } strcpy (seclabel->label, ret.label.label_val); @@ -1981,8 +1977,8 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel) if (ret.model.model_val != NULL) { if (strlen (ret.model.model_val) >= sizeof(secmodel->model)) { - remoteError(VIR_ERR_RPC, _("security model exceeds maximum: %zu"), - sizeof(secmodel->model) - 1); + virReportError(VIR_ERR_RPC, _("security model exceeds maximum: %zu"), + sizeof(secmodel->model) - 1); goto cleanup; } strcpy (secmodel->model, ret.model.model_val); @@ -1990,8 +1986,8 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel) if (ret.doi.doi_val != NULL) { if (strlen (ret.doi.doi_val) >= sizeof(secmodel->doi)) { - remoteError(VIR_ERR_RPC, _("security doi exceeds maximum: %zu"), - sizeof(secmodel->doi) - 1); + virReportError(VIR_ERR_RPC, _("security doi exceeds maximum: %zu"), + sizeof(secmodel->doi) - 1); goto cleanup; } strcpy (secmodel->doi, ret.doi.doi_val); @@ -2076,8 +2072,8 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn, if (ret.cookie.cookie_len > 0) { if (!cookie || !cookielen) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores cookie or cookielen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores cookie or cookielen")); goto error; } *cookie = ret.cookie.cookie_val; /* Caller frees. */ @@ -2085,8 +2081,8 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn, } if (ret.uri_out) { if (!uri_out) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores uri_out")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores uri_out")); goto error; } *uri_out = *ret.uri_out; /* Caller frees. */ @@ -2189,9 +2185,9 @@ remoteDomainMemoryStats (virDomainPtr domain, make_nonnull_domain (&args.dom, domain); if (nr_stats > REMOTE_DOMAIN_MEMORY_STATS_MAX) { - remoteError(VIR_ERR_RPC, - _("too many memory stats requested: %d > %d"), nr_stats, - REMOTE_DOMAIN_MEMORY_STATS_MAX); + virReportError(VIR_ERR_RPC, + _("too many memory stats requested: %d > %d"), nr_stats, + REMOTE_DOMAIN_MEMORY_STATS_MAX); goto done; } args.maxStats = nr_stats; @@ -2233,9 +2229,9 @@ remoteDomainBlockPeek (virDomainPtr domain, remoteDriverLock(priv); if (size > REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) { - remoteError(VIR_ERR_RPC, - _("block peek request too large for remote protocol, %zi > %d"), - size, REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX); + virReportError(VIR_ERR_RPC, + _("block peek request too large for remote protocol, %zi > %d"), + size, REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX); goto done; } @@ -2254,8 +2250,8 @@ remoteDomainBlockPeek (virDomainPtr domain, goto done; if (ret.buffer.buffer_len != size) { - remoteError(VIR_ERR_RPC, "%s", - _("returned buffer is not same size as requested")); + virReportError(VIR_ERR_RPC, "%s", + _("returned buffer is not same size as requested")); goto cleanup; } @@ -2285,9 +2281,9 @@ remoteDomainMemoryPeek (virDomainPtr domain, remoteDriverLock(priv); if (size > REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX) { - remoteError(VIR_ERR_RPC, - _("memory peek request too large for remote protocol, %zi > %d"), - size, REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX); + virReportError(VIR_ERR_RPC, + _("memory peek request too large for remote protocol, %zi > %d"), + size, REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX); goto done; } @@ -2305,8 +2301,8 @@ remoteDomainMemoryPeek (virDomainPtr domain, goto done; if (ret.buffer.buffer_len != size) { - remoteError(VIR_ERR_RPC, "%s", - _("returned buffer is not same size as requested")); + virReportError(VIR_ERR_RPC, "%s", + _("returned buffer is not same size as requested")); goto cleanup; } @@ -2430,15 +2426,15 @@ static int remoteDomainGetCPUStats(virDomainPtr domain, remoteDriverLock(priv); if (nparams > REMOTE_NODE_CPU_STATS_MAX) { - remoteError(VIR_ERR_RPC, - _("nparams count exceeds maximum: %u > %u"), - nparams, REMOTE_NODE_CPU_STATS_MAX); + virReportError(VIR_ERR_RPC, + _("nparams count exceeds maximum: %u > %u"), + nparams, REMOTE_NODE_CPU_STATS_MAX); goto done; } if (ncpus > REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX) { - remoteError(VIR_ERR_RPC, - _("ncpus count exceeds maximum: %u > %u"), - ncpus, REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX); + virReportError(VIR_ERR_RPC, + _("ncpus count exceeds maximum: %u > %u"), + ncpus, REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX); goto done; } @@ -2461,9 +2457,9 @@ static int remoteDomainGetCPUStats(virDomainPtr domain, if (ret.params.params_len > nparams * ncpus || (ret.params.params_len && ((ret.params.params_len % ret.nparams) || ret.nparams > nparams))) { - remoteError(VIR_ERR_RPC, "%s", - _("remoteDomainGetCPUStats: " - "returned number of stats exceeds limit")); + virReportError(VIR_ERR_RPC, "%s", + _("remoteDomainGetCPUStats: " + "returned number of stats exceeds limit")); memset(params, 0, sizeof(*params) * nparams * ncpus); goto cleanup; } @@ -2797,8 +2793,8 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, } else if (STRCASEEQ(authtype, "polkit")) { want = REMOTE_AUTH_POLKIT; } else { - remoteError(VIR_ERR_AUTH_FAILED, - _("unknown authentication type %s"), authtype); + virReportError(VIR_ERR_AUTH_FAILED, + _("unknown authentication type %s"), authtype); return -1; } for (i = 0 ; i < ret.types.types_len ; i++) { @@ -2806,9 +2802,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, type = want; } if (type == REMOTE_AUTH_NONE) { - remoteError(VIR_ERR_AUTH_FAILED, - _("requested authentication type %s rejected"), - authtype); + virReportError(VIR_ERR_AUTH_FAILED, + _("requested authentication type %s rejected"), + authtype); return -1; } } else { @@ -2845,9 +2841,9 @@ remoteAuthenticate (virConnectPtr conn, struct private_data *priv, break; default: - remoteError(VIR_ERR_AUTH_FAILED, - _("unsupported authentication type %d"), - ret.types.types_val[0]); + virReportError(VIR_ERR_AUTH_FAILED, + _("unsupported authentication type %d"), + ret.types.types_val[0]); VIR_FREE(ret.types.types_val); return -1; } @@ -3129,21 +3125,21 @@ static int remoteAuthInteract(virConnectPtr conn, goto cleanup; if (remoteAuthMakeCredentials(state->interact, &state->cred, &state->ncred) < 0) { - remoteError(VIR_ERR_AUTH_FAILED, "%s", - _("Failed to make auth credentials")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Failed to make auth credentials")); goto cleanup; } /* Run the authentication callback */ if (!auth || !auth->cb) { - remoteError(VIR_ERR_AUTH_FAILED, "%s", - _("No authentication callback available")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("No authentication callback available")); goto cleanup; } if ((*(auth->cb))(state->cred, state->ncred, auth->cbdata) < 0) { - remoteError(VIR_ERR_AUTH_FAILED, "%s", - _("Failed to collect auth credentials")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Failed to collect auth credentials")); goto cleanup; } @@ -3241,9 +3237,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, mechlist = iret.mechlist; if (wantmech) { if (strstr(mechlist, wantmech) == NULL) { - remoteError(VIR_ERR_AUTH_FAILED, - _("SASL mechanism %s not supported by server"), - wantmech); + virReportError(VIR_ERR_AUTH_FAILED, + _("SASL mechanism %s not supported by server"), + wantmech); VIR_FREE(iret.mechlist); goto cleanup; } @@ -3271,9 +3267,9 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, VIR_FREE(iret.mechlist); if (clientoutlen > REMOTE_AUTH_SASL_DATA_MAX) { - remoteError(VIR_ERR_AUTH_FAILED, - _("SASL negotiation data too long: %zu bytes"), - clientoutlen); + virReportError(VIR_ERR_AUTH_FAILED, + _("SASL negotiation data too long: %zu bytes"), + clientoutlen); goto cleanup; } /* NB, distinction of NULL vs "" is *critical* in SASL */ @@ -3366,8 +3362,8 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, VIR_DEBUG("SASL SSF value %d", ssf); if (ssf < 56) { /* 56 == DES level, good for Kerberos */ - remoteError(VIR_ERR_AUTH_FAILED, - _("negotiation SSF %d was not strong enough"), ssf); + virReportError(VIR_ERR_AUTH_FAILED, + _("negotiation SSF %d was not strong enough"), ssf); goto cleanup; } priv->is_secure = 1; @@ -3447,8 +3443,8 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, VIR_DEBUG("Client run callback for PolicyKit authentication"); /* Run the authentication callback */ if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) { - remoteError(VIR_ERR_AUTH_FAILED, "%s", - _("Failed to collect auth credentials")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Failed to collect auth credentials")); return -1; } } else { @@ -3488,7 +3484,7 @@ static int remoteDomainEventRegister(virConnectPtr conn, if ((count = virDomainEventStateRegister(conn, priv->domainEventState, callback, opaque, freecb)) < 0) { - remoteError(VIR_ERR_RPC, "%s", _("adding cb to list")); + virReportError(VIR_ERR_RPC, "%s", _("adding cb to list")); goto done; } @@ -3946,7 +3942,7 @@ remoteSecretGetValue (virSecretPtr secret, size_t *value_size, /* internalFlags intentionally do not go over the wire */ if (internalFlags) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", _("no internalFlags support")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no internalFlags support")); goto done; } @@ -4231,7 +4227,7 @@ static int remoteDomainEventRegisterAny(virConnectPtr conn, dom, eventID, callback, opaque, freecb, &callbackID)) < 0) { - remoteError(VIR_ERR_RPC, "%s", _("adding cb to list")); + virReportError(VIR_ERR_RPC, "%s", _("adding cb to list")); goto done; } @@ -4272,14 +4268,14 @@ static int remoteDomainEventDeregisterAny(virConnectPtr conn, if ((eventID = virDomainEventStateEventID(conn, priv->domainEventState, callbackID)) < 0) { - remoteError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); + virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); goto done; } if ((count = virDomainEventStateDeregisterID(conn, priv->domainEventState, callbackID)) < 0) { - remoteError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); + virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); goto done; } @@ -4374,8 +4370,8 @@ remoteDomainMigrateBegin3(virDomainPtr domain, if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores cookieout or cookieoutlen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ @@ -4433,8 +4429,8 @@ remoteDomainMigratePrepare3(virConnectPtr dconn, if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores cookieout or cookieoutlen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ @@ -4442,8 +4438,8 @@ remoteDomainMigratePrepare3(virConnectPtr dconn, } if (ret.uri_out) { if (!uri_out) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores uri_out")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores uri_out")); goto error; } *uri_out = *ret.uri_out; /* Caller frees. */ @@ -4516,8 +4512,8 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn, if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores cookieout or cookieoutlen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ @@ -4577,8 +4573,8 @@ remoteDomainMigratePerform3(virDomainPtr dom, if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores cookieout or cookieoutlen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ @@ -4636,8 +4632,8 @@ remoteDomainMigrateFinish3(virConnectPtr dconn, if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("caller ignores cookieout or cookieoutlen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("caller ignores cookieout or cookieoutlen")); goto error; } *cookieout = ret.cookie_out.cookie_out_val; /* Caller frees. */ @@ -4730,9 +4726,9 @@ remoteSetKeepAlive(virConnectPtr conn, int interval, unsigned int count) remoteDriverLock(priv); if (!virNetClientKeepAliveIsSupported(priv->client)) { - remoteError(VIR_ERR_INTERNAL_ERROR, "%s", - _("the caller doesn't support keepalive protocol;" - " perhaps it's missing event loop implementation")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("the caller doesn't support keepalive protocol;" + " perhaps it's missing event loop implementation")); goto cleanup; } diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index f161ee0..36248fd 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1424,9 +1424,9 @@ elsif ($opt_k) { foreach my $args_check (@args_check_list) { print "\n"; print " if ($args_check->{arg} > $args_check->{limit}) {\n"; - print " remoteError(VIR_ERR_RPC,\n"; - print " _(\"%s length greater than maximum: %d > %d\"),\n"; - print " $args_check->{name}, (int)$args_check->{arg}, $args_check->{limit});\n"; + print " virReportError(VIR_ERR_RPC,\n"; + print " _(\"%s length greater than maximum: %d > %d\"),\n"; + print " $args_check->{name}, (int)$args_check->{arg}, $args_check->{limit});\n"; print " goto done;\n"; print " }\n"; } @@ -1434,9 +1434,9 @@ elsif ($opt_k) { if ($single_ret_as_list) { print "\n"; print " if ($single_ret_list_max_var > $single_ret_list_max_define) {\n"; - print " remoteError(VIR_ERR_RPC,\n"; - print " _(\"too many remote ${single_ret_list_error_msg_type}s: %d > %d\"),\n"; - print " $single_ret_list_max_var, $single_ret_list_max_define);\n"; + print " virReportError(VIR_ERR_RPC,\n"; + print " _(\"too many remote ${single_ret_list_error_msg_type}s: %d > %d\"),\n"; + print " $single_ret_list_max_var, $single_ret_list_max_define);\n"; print " goto done;\n"; print " }\n"; } @@ -1491,9 +1491,9 @@ elsif ($opt_k) { if ($single_ret_as_list) { print " if (ret.$single_ret_list_name.${single_ret_list_name}_len > $single_ret_list_max_var) {\n"; - print " remoteError(VIR_ERR_RPC,\n"; - print " _(\"too many remote ${single_ret_list_error_msg_type}s: %d > %d\"),\n"; - print " ret.$single_ret_list_name.${single_ret_list_name}_len, $single_ret_list_max_var);\n"; + print " virReportError(VIR_ERR_RPC,\n"; + print " _(\"too many remote ${single_ret_list_error_msg_type}s: %d > %d\"),\n"; + print " ret.$single_ret_list_name.${single_ret_list_name}_len, $single_ret_list_max_var);\n"; print " goto cleanup;\n"; print " }\n"; print "\n"; -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the remote driver to use virReportError instead of the remoteError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/remote/remote_driver.c | 310 ++++++++++++++++++++++---------------------- src/rpc/gendispatch.pl | 18 +-- 3 files changed, 162 insertions(+), 167 deletions(-)
ACK. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the lock manager drivers to use virReportError instead of the virLockError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/locking/lock_driver_sanlock.c | 157 ++++++++++++++++++------------------- src/locking/lock_manager.c | 30 +++---- 2 files changed, 89 insertions(+), 98 deletions(-) diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 40cd518..67b70ca 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -48,11 +48,6 @@ #define VIR_FROM_THIS VIR_FROM_LOCKING -#define virLockError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - - #define VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE "__LIBVIRT__DISKS__" /* @@ -111,9 +106,9 @@ static int virLockManagerSanlockLoadConfig(const char *configFile) return -1; #define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \ - virLockError(VIR_ERR_INTERNAL_ERROR, \ - "%s: %s: expected type " #typ, \ - configFile, (name)); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "%s: %s: expected type " #typ, \ + configFile, (name)); \ virConfFree(conf); \ return -1; \ } @@ -167,9 +162,9 @@ static int virLockManagerSanlockSetupLockspace(void) ls.host_id = 0; /* Doesn't matter for initialization */ ls.flags = 0; if (!virStrcpy(ls.host_id_disk.path, path, SANLK_PATH_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Lockspace path '%s' exceeded %d characters"), - path, SANLK_PATH_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Lockspace path '%s' exceeded %d characters"), + path, SANLK_PATH_LEN); goto error; } ls.host_id_disk.offset = 0; @@ -190,9 +185,9 @@ static int virLockManagerSanlockSetupLockspace(void) } else { if ((rv = sanlock_align(&ls.host_id_disk)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to query sector size %s: error %d"), - path, rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to query sector size %s: error %d"), + path, rv); else virReportSystemError(-rv, _("Unable to query sector size %s"), @@ -219,9 +214,9 @@ static int virLockManagerSanlockSetupLockspace(void) if ((rv = sanlock_init(&ls, NULL, 0, 0)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to initialize lockspace %s: error %d"), - path, rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to initialize lockspace %s: error %d"), + path, rv); else virReportSystemError(-rv, _("Unable to initialize lockspace %s"), @@ -240,9 +235,9 @@ static int virLockManagerSanlockSetupLockspace(void) if ((rv = sanlock_add_lockspace(&ls, 0)) < 0) { if (-rv != EEXIST) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to add lockspace %s: error %d"), - path, rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to add lockspace %s: error %d"), + path, rv); else virReportSystemError(-rv, _("Unable to add lockspace %s"), @@ -296,8 +291,8 @@ static int virLockManagerSanlockInit(unsigned int version, goto error; if (driver->autoDiskLease && !driver->hostID) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Automatic disk lease mode enabled, but no host ID is set")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Automatic disk lease mode enabled, but no host ID is set")); goto error; } @@ -338,14 +333,14 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock, virCheckFlags(0, -1); if (!driver) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Sanlock plugin is not initialized")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Sanlock plugin is not initialized")); return -1; } if (type != VIR_LOCK_MANAGER_OBJECT_TYPE_DOMAIN) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unsupported object type %d"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unsupported object type %d"), type); return -1; } @@ -363,9 +358,9 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock, memcpy(priv->vm_uuid, param->value.uuid, 16); } else if (STREQ(param->key, "name")) { if (!virStrcpy(priv->vm_name, param->value.str, SANLK_NAME_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Domain name '%s' exceeded %d characters"), - param->value.str, SANLK_NAME_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Domain name '%s' exceeded %d characters"), + param->value.str, SANLK_NAME_LEN); goto error; } } else if (STREQ(param->key, "pid")) { @@ -409,14 +404,14 @@ static int virLockManagerSanlockDiskLeaseName(const char *path, int i; if (strbuflen < ((MD5_DIGEST_SIZE * 2) + 1)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("String length too small to store md5 checksum")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("String length too small to store md5 checksum")); return -1; } if (!(md5_buffer(path, strlen(path), buf))) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to compute md5 checksum")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to compute md5 checksum")); return -1; } @@ -447,27 +442,27 @@ static int virLockManagerSanlockAddLease(virLockManagerPtr lock, res->flags = shared ? SANLK_RES_SHARED : 0; res->num_disks = 1; if (!virStrcpy(res->name, name, SANLK_NAME_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Resource name '%s' exceeds %d characters"), - name, SANLK_NAME_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Resource name '%s' exceeds %d characters"), + name, SANLK_NAME_LEN); goto cleanup; } for (i = 0; i < nparams; i++) { if (STREQ(params[i].key, "path")) { if (!virStrcpy(res->disks[0].path, params[i].value.str, SANLK_PATH_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Lease path '%s' exceeds %d characters"), - params[i].value.str, SANLK_PATH_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Lease path '%s' exceeds %d characters"), + params[i].value.str, SANLK_PATH_LEN); goto cleanup; } } else if (STREQ(params[i].key, "offset")) { res->disks[0].offset = params[i].value.ul; } else if (STREQ(params[i].key, "lockspace")) { if (!virStrcpy(res->lockspace_name, params[i].value.str, SANLK_NAME_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Resource lockspace '%s' exceeds %d characters"), - params[i].value.str, SANLK_NAME_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Resource lockspace '%s' exceeds %d characters"), + params[i].value.str, SANLK_NAME_LEN); goto cleanup; } } @@ -499,8 +494,8 @@ static int virLockManagerSanlockAddDisk(virLockManagerPtr lock, char *path = NULL; if (nparams) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected lock parameters for disk resource")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected lock parameters for disk resource")); return -1; } @@ -520,18 +515,18 @@ static int virLockManagerSanlockAddDisk(virLockManagerPtr lock, goto cleanup; } if (!virStrcpy(res->disks[0].path, path, SANLK_PATH_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Lease path '%s' exceeds %d characters"), - path, SANLK_PATH_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Lease path '%s' exceeds %d characters"), + path, SANLK_PATH_LEN); goto cleanup; } if (!virStrcpy(res->lockspace_name, VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Resource lockspace '%s' exceeds %d characters"), - VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Resource lockspace '%s' exceeds %d characters"), + VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN); goto cleanup; } @@ -567,9 +562,9 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource *res) } else { if ((rv = sanlock_align(&res->disks[0])) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to query sector size %s: error %d"), - res->disks[0].path, rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to query sector size %s: error %d"), + res->disks[0].path, rv); else virReportSystemError(-rv, _("Unable to query sector size %s"), @@ -596,9 +591,9 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource *res) if ((rv = sanlock_init(NULL, res, 0, 0)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to initialize lease %s: error %d"), - res->disks[0].path, rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to initialize lease %s: error %d"), + res->disks[0].path, rv); else virReportSystemError(-rv, _("Unable to initialize lease %s"), @@ -631,9 +626,9 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock, VIR_LOCK_MANAGER_RESOURCE_SHARED, -1); if (priv->res_count == SANLK_MAX_RESOURCES) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Too many resources %d for object"), - SANLK_MAX_RESOURCES); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Too many resources %d for object"), + SANLK_MAX_RESOURCES); return -1; } @@ -692,8 +687,8 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, if (priv->res_count == 0 && priv->hasRWDisks && driver->requireLeaseForDisks) { - virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Read/write, exclusive access, disks were present, but no leases specified")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Read/write, exclusive access, disks were present, but no leases specified")); return -1; } @@ -703,9 +698,9 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, } if (!virStrcpy(opt->owner_name, priv->vm_name, SANLK_NAME_LEN)) { - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Domain name '%s' exceeded %d characters"), - priv->vm_name, SANLK_NAME_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Domain name '%s' exceeded %d characters"), + priv->vm_name, SANLK_NAME_LEN); goto error; } @@ -714,9 +709,9 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, &res_count, &res_args)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse lock state %s: error %d"), - state, rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to parse lock state %s: error %d"), + state, rv); else virReportSystemError(-rv, _("Unable to parse lock state %s"), @@ -739,9 +734,9 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, if (priv->vm_pid == getpid() && (sock = sanlock_register()) < 0) { if (sock <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Failed to open socket to sanlock daemon: error %d"), - sock); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open socket to sanlock daemon: error %d"), + sock); else virReportSystemError(-sock, "%s", _("Failed to open socket to sanlock daemon")); @@ -754,8 +749,8 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, priv->res_count, priv->res_args, opt)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Failed to acquire lock: error %d"), rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to acquire lock: error %d"), rv); else virReportSystemError(-rv, "%s", _("Failed to acquire lock")); @@ -778,8 +773,8 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, if (flags & VIR_LOCK_MANAGER_ACQUIRE_RESTRICT) { if ((rv = sanlock_restrict(sock, SANLK_RESTRICT_ALL)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Failed to restrict process: error %d"), rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to restrict process: error %d"), rv); else virReportSystemError(-rv, "%s", _("Failed to restrict process")); @@ -827,8 +822,8 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, if (state) { if ((rv = sanlock_inquire(-1, priv->vm_pid, 0, &res_count, state)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Failed to inquire lock: error %d"), rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to inquire lock: error %d"), rv); else virReportSystemError(-rv, "%s", _("Failed to inquire lock")); @@ -841,8 +836,8 @@ static int virLockManagerSanlockRelease(virLockManagerPtr lock, if ((rv = sanlock_release(-1, priv->vm_pid, SANLK_REL_ALL, 0, NULL)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Failed to release lock: error %d"), rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to release lock: error %d"), rv); else virReportSystemError(-rv, "%s", _("Failed to release lock")); @@ -862,7 +857,7 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock, virCheckFlags(0, -1); if (!state) { - virLockError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -870,8 +865,8 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock, if ((rv = sanlock_inquire(-1, priv->vm_pid, 0, &res_count, state)) < 0) { if (rv <= -200) - virLockError(VIR_ERR_INTERNAL_ERROR, - _("Failed to inquire lock: error %d"), rv); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to inquire lock: error %d"), rv); else virReportSystemError(-rv, "%s", _("Failed to inquire lock")); diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c index f07f9d7..d7929e3 100644 --- a/src/locking/lock_manager.c +++ b/src/locking/lock_manager.c @@ -39,23 +39,19 @@ #define VIR_FROM_THIS VIR_FROM_LOCKING -#define virLockError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - #define CHECK_PLUGIN(field, errret) \ if (!plugin->driver->field) { \ - virLockError(VIR_ERR_INTERNAL_ERROR, \ - _("Missing '%s' field in lock manager driver"), \ - #field); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Missing '%s' field in lock manager driver"), \ + #field); \ return errret; \ } #define CHECK_MANAGER(field, errret) \ if (!lock->driver->field) { \ - virLockError(VIR_ERR_INTERNAL_ERROR, \ - _("Missing '%s' field in lock manager driver"), \ - #field); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Missing '%s' field in lock manager driver"), \ + #field); \ return errret; \ } @@ -150,15 +146,15 @@ virLockManagerPluginPtr virLockManagerPluginNew(const char *name, handle = dlopen(modfile, RTLD_NOW | RTLD_LOCAL); if (!handle) { - virLockError(VIR_ERR_SYSTEM_ERROR, - _("Failed to load plugin %s: %s"), - modfile, dlerror()); + virReportError(VIR_ERR_SYSTEM_ERROR, + _("Failed to load plugin %s: %s"), + modfile, dlerror()); goto cleanup; } if (!(driver = dlsym(handle, "virLockDriverImpl"))) { - virLockError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing plugin initialization symbol 'virLockDriverImpl'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing plugin initialization symbol 'virLockDriverImpl'")); goto cleanup; } } @@ -195,8 +191,8 @@ virLockManagerPluginNew(const char *name ATTRIBUTE_UNUSED, const char *configFile ATTRIBUTE_UNUSED, unsigned int flags_unused ATTRIBUTE_UNUSED) { - virLockError(VIR_ERR_INTERNAL_ERROR, "%s", - _("this platform is missing dlopen")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("this platform is missing dlopen")); return NULL; } #endif /* !HAVE_DLFCN_H */ -- 1.7.10.4

On Wed, Jul 18, 2012 at 19:40:47 +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the lock manager drivers to use virReportError instead of the virLockError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/locking/lock_driver_sanlock.c | 157 ++++++++++++++++++------------------- src/locking/lock_manager.c | 30 +++---- 2 files changed, 89 insertions(+), 98 deletions(-)
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 40cd518..67b70ca 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c ... @@ -862,7 +857,7 @@ static int virLockManagerSanlockInquire(virLockManagerPtr lock, virCheckFlags(0, -1);
if (!state) { - virLockError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; }
You'll see a merge conflict with this hunk since __FUNCTION__ was replaced with "state". ... ACK And again, few missing "%s": diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index 67b70ca..2352968 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -291,7 +291,7 @@ static int virLockManagerSanlockInit(unsigned int version, goto error; if (driver->autoDiskLease && !driver->hostID) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Automatic disk lease mode enabled, but no host ID is set")); goto error; } @@ -333,7 +333,7 @@ static int virLockManagerSanlockNew(virLockManagerPtr lock, virCheckFlags(0, -1); if (!driver) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Sanlock plugin is not initialized")); return -1; } @@ -404,13 +404,13 @@ static int virLockManagerSanlockDiskLeaseName(const char *path, int i; if (strbuflen < ((MD5_DIGEST_SIZE * 2) + 1)) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("String length too small to store md5 checksum")); return -1; } if (!(md5_buffer(path, strlen(path), buf))) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to compute md5 checksum")); return -1; } @@ -494,7 +494,7 @@ static int virLockManagerSanlockAddDisk(virLockManagerPtr lock, char *path = NULL; if (nparams) { - virReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unexpected lock parameters for disk resource")); return -1; } -- 1.7.11.1

From: "Daniel P. Berrange" <berrange@redhat.com> Update the legacy Xen drivers to use virReportError instead of the statsError, virXenInotifyError, virXenStoreError, virXendError, xenUnifiedError, xenXMError custom macros Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 6 - src/xen/block_stats.c | 54 +++--- src/xen/xen_driver.c | 114 ++++++------ src/xen/xen_hypervisor.c | 211 +++++++++++---------- src/xen/xen_inotify.c | 48 +++-- src/xen/xend_internal.c | 461 +++++++++++++++++++++++----------------------- src/xen/xm_internal.c | 134 +++++++------- src/xen/xs_internal.c | 40 ++-- 8 files changed, 514 insertions(+), 554 deletions(-) diff --git a/cfg.mk b/cfg.mk index 3de6a66..d813f34 100644 --- a/cfg.mk +++ b/cfg.mk @@ -516,7 +516,6 @@ msg_gen_function += lxcError msg_gen_function += nodeReportError msg_gen_function += qemuReportError msg_gen_function += regerror -msg_gen_function += statsError msg_gen_function += streamsReportError msg_gen_function += vah_error msg_gen_function += vah_warning @@ -537,12 +536,7 @@ msg_gen_function += virReportError msg_gen_function += virReportErrorHelper msg_gen_function += virReportSystemError msg_gen_function += virSecurityReportError -msg_gen_function += virXenInotifyError -msg_gen_function += virXenStoreError -msg_gen_function += virXendError msg_gen_function += xenapiSessionErrorHandler -msg_gen_function += xenUnifiedError -msg_gen_function += xenXMError # Uncomment the following and run "make syntax-check" to see diagnostics # that are not yet marked for translation, but that need to be rewritten diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c index 50ace86..3d77720 100644 --- a/src/xen/block_stats.c +++ b/src/xen/block_stats.c @@ -32,12 +32,6 @@ # define VIR_FROM_THIS VIR_FROM_STATS_LINUX - -# define statsError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - - /*-------------------- Xen: block stats --------------------*/ # include <linux/major.h> @@ -172,9 +166,9 @@ read_bd_stats(xenUnifiedPrivatePtr priv, if (stats->rd_req == -1 && stats->rd_bytes == -1 && stats->wr_req == -1 && stats->wr_bytes == -1 && stats->errs == -1) { - statsError(VIR_ERR_INTERNAL_ERROR, - _("Failed to read any block statistics for domain %d"), - domid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to read any block statistics for domain %d"), + domid); return -1; } @@ -186,9 +180,9 @@ read_bd_stats(xenUnifiedPrivatePtr priv, stats->wr_req == 0 && stats->wr_bytes == 0 && stats->errs == 0 && !check_bd_connected (priv, device, domid)) { - statsError(VIR_ERR_INTERNAL_ERROR, - _("Frontend block device not connected for domain %d"), - domid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Frontend block device not connected for domain %d"), + domid); return -1; } @@ -197,18 +191,18 @@ read_bd_stats(xenUnifiedPrivatePtr priv, */ if (stats->rd_bytes > 0) { if (stats->rd_bytes >= ((unsigned long long)1)<<(63-9)) { - statsError(VIR_ERR_INTERNAL_ERROR, - _("stats->rd_bytes would overflow 64 bit counter for domain %d"), - domid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("stats->rd_bytes would overflow 64 bit counter for domain %d"), + domid); return -1; } stats->rd_bytes *= 512; } if (stats->wr_bytes > 0) { if (stats->wr_bytes >= ((unsigned long long)1)<<(63-9)) { - statsError(VIR_ERR_INTERNAL_ERROR, - _("stats->wr_bytes would overflow 64 bit counter for domain %d"), - domid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("stats->wr_bytes would overflow 64 bit counter for domain %d"), + domid); return -1; } stats->wr_bytes *= 512; @@ -326,21 +320,21 @@ xenLinuxDomainDeviceID(int domid, const char *path) * beginning of the strings for better error messages */ else if (strlen(mod_path) >= 7 && STRPREFIX(mod_path, "/dev/sd")) - statsError(VIR_ERR_INVALID_ARG, - _("invalid path, device names must be in the range " - "sda[1-15] - sdiv[1-15] for domain %d"), domid); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path, device names must be in the range " + "sda[1-15] - sdiv[1-15] for domain %d"), domid); else if (strlen(mod_path) >= 7 && STRPREFIX(mod_path, "/dev/hd")) - statsError(VIR_ERR_INVALID_ARG, - _("invalid path, device names must be in the range " - "hda[1-63] - hdt[1-63] for domain %d"), domid); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path, device names must be in the range " + "hda[1-63] - hdt[1-63] for domain %d"), domid); else if (strlen(mod_path) >= 8 && STRPREFIX(mod_path, "/dev/xvd")) - statsError(VIR_ERR_INVALID_ARG, - _("invalid path, device names must be in the range " - "xvda[1-15] - xvdiz[1-15] for domain %d"), domid); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path, device names must be in the range " + "xvda[1-15] - xvdiz[1-15] for domain %d"), domid); else - statsError(VIR_ERR_INVALID_ARG, - _("unsupported path, use xvdN, hdN, or sdN for domain %d"), - domid); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported path, use xvdN, hdN, or sdN for domain %d"), + domid); VIR_FREE(mod_path); diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 9ff3d29..cbde673 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -80,10 +80,6 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = { static int inside_daemon; #endif -#define xenUnifiedError(code, ...) \ - virReportErrorHelper(VIR_FROM_XEN, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - /** * xenNumaInit: * @conn: pointer to the hypervisor connection @@ -284,9 +280,9 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) if (conn->uri->path && STRNEQ(conn->uri->path, "") && STRNEQ(conn->uri->path, "/")) { - xenUnifiedError(VIR_ERR_INTERNAL_ERROR, - _("unexpected Xen URI path '%s', try xen:///"), - conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected Xen URI path '%s', try xen:///"), + conn->uri->path); return VIR_DRV_OPEN_ERROR; } @@ -316,8 +312,8 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) return VIR_DRV_OPEN_ERROR; } if (virMutexInit(&priv->lock) < 0) { - xenUnifiedError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot initialize mutex")); VIR_FREE(priv); return VIR_DRV_OPEN_ERROR; } @@ -515,14 +511,14 @@ xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type) GET_PRIVATE(conn); if (type && STRCASENEQ (type, "Xen")) { - xenUnifiedError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) return xenHypervisorGetMaxVcpus (conn, type); else { - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } } @@ -646,7 +642,7 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id) } /* Not found. */ - xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__); + virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__); return NULL; } @@ -684,7 +680,7 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn, } /* Not found. */ - xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__); + virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__); return NULL; } @@ -722,7 +718,7 @@ xenUnifiedDomainLookupByName (virConnectPtr conn, } /* Not found. */ - xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__); + virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__); return NULL; } @@ -1051,8 +1047,8 @@ xenUnifiedDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml, virCheckFlags(0, -1); if (dxml) { - xenUnifiedError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("xml modification unsupported")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("xml modification unsupported")); return -1; } @@ -1075,8 +1071,8 @@ xenUnifiedDomainRestoreFlags(virConnectPtr conn, const char *from, virCheckFlags(0, -1); if (dxml) { - xenUnifiedError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("xml modification unsupported")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("xml modification unsupported")); return -1; } @@ -1117,13 +1113,13 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus, if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 || (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) == (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) { - xenUnifiedError(VIR_ERR_INVALID_ARG, - _("invalid flag combination: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid flag combination: (0x%x)"), flags); return -1; } if (!nvcpus || (unsigned short) nvcpus != nvcpus) { - xenUnifiedError(VIR_ERR_INVALID_ARG, - _("argument out of range: %d"), nvcpus); + virReportError(VIR_ERR_INVALID_ARG, + _("argument out of range: %d"), nvcpus); return -1; } @@ -1143,7 +1139,7 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus, if (flags == VIR_DOMAIN_VCPU_LIVE) return xenHypervisorSetVcpus(dom, nvcpus); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1220,7 +1216,7 @@ xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags) if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM)) return xenHypervisorGetVcpuMax(dom); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1251,7 +1247,7 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) } } - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return NULL; } @@ -1274,8 +1270,8 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn, if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) && STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) { - xenUnifiedError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), format); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported config type %s"), format); return NULL; } @@ -1323,8 +1319,8 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn, if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) && STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) { - xenUnifiedError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), format); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported config type %s"), format); goto cleanup; } @@ -1378,7 +1374,7 @@ xenUnifiedDomainMigratePrepare (virConnectPtr dconn, uri_in, uri_out, flags, dname, resource); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1399,7 +1395,7 @@ xenUnifiedDomainMigratePerform (virDomainPtr dom, return xenDaemonDomainMigratePerform (dom, cookie, cookielen, uri, flags, dname, resource); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1425,15 +1421,15 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn, if (flags & VIR_MIGRATE_PERSIST_DEST) { domain_xml = xenDaemonDomainGetXMLDesc(dom, 0, NULL); if (! domain_xml) { - xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED, - "%s", _("failed to get XML representation of migrated domain")); + virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED, + "%s", _("failed to get XML representation of migrated domain")); goto failure; } dom_new = xenDaemonDomainDefineXML (dconn, domain_xml); if (! dom_new) { - xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED, - "%s", _("failed to define domain on destination host")); + virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED, + "%s", _("failed to define domain on destination host")); goto failure; } @@ -1647,7 +1643,7 @@ xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart) return xenDaemonDomainGetAutostart(dom, autostart); } - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1664,7 +1660,7 @@ xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart) return xenDaemonDomainSetAutostart(dom, autostart); } - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1756,7 +1752,7 @@ xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path, if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) return xenHypervisorDomainBlockStats (dom, path, stats); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1769,7 +1765,7 @@ xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path, if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) return xenHypervisorDomainInterfaceStats (dom, path, stats); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1794,7 +1790,7 @@ xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path, return 0; } - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1808,7 +1804,7 @@ xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMe return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems, startCell, maxCells); - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -1827,7 +1823,7 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn) return freeMem; } - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return 0; } @@ -1844,7 +1840,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn, xenUnifiedLock(priv); if (priv->xsWatch == -1) { - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedUnlock(priv); return -1; } @@ -1866,7 +1862,7 @@ xenUnifiedDomainEventDeregister(virConnectPtr conn, xenUnifiedLock(priv); if (priv->xsWatch == -1) { - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedUnlock(priv); return -1; } @@ -1894,7 +1890,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn, xenUnifiedLock(priv); if (priv->xsWatch == -1) { - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedUnlock(priv); return -1; } @@ -1917,7 +1913,7 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn, xenUnifiedLock(priv); if (priv->xsWatch == -1) { - xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); xenUnifiedUnlock(priv); return -1; } @@ -1965,8 +1961,8 @@ xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev, } if (!cap) { - xenUnifiedError(VIR_ERR_INVALID_ARG, - _("device %s is not a PCI device"), dev->name); + virReportError(VIR_ERR_INVALID_ARG, + _("device %s is not a PCI device"), dev->name); goto out; } @@ -2075,9 +2071,9 @@ xenUnifiedNodeDeviceReAttach (virNodeDevicePtr dev) /* Check if device is assigned to an active guest */ if ((domid = xenUnifiedNodeDeviceAssignedDomainId(dev)) >= 0) { - xenUnifiedError(VIR_ERR_INTERNAL_ERROR, - _("Device %s has been assigned to guest %d"), - dev->name, domid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Device %s has been assigned to guest %d"), + dev->name, domid); goto out; } @@ -2127,15 +2123,15 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom, virCheckFlags(0, -1); if (dom->id == -1) { - xenUnifiedError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } if (dev_name) { /* XXX support device aliases in future */ - xenUnifiedError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Named device aliases are not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Named device aliases are not supported")); goto cleanup; } @@ -2149,14 +2145,14 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom, chr = def->serials[0]; if (!chr) { - xenUnifiedError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot find default console device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot find default console device")); goto cleanup; } if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { - xenUnifiedError(VIR_ERR_INTERNAL_ERROR, - _("character device %s is not using a PTY"), dev_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("character device %s is not using a PTY"), dev_name); goto cleanup; } diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index b4ec579..21ea07d 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -874,11 +874,6 @@ struct xenUnifiedDriver xenHypervisorDriver = { .xenDomainSetSchedulerParameters = xenHypervisorSetSchedulerParameters, }; -#define virXenError(code, ...) \ - if (in_init == 0) \ - virReportErrorHelper(VIR_FROM_XEN, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - /** * xenHypervisorDoV0Op: * @handle: the handle to the Xen hypervisor @@ -901,18 +896,18 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op) hc.arg[0] = (unsigned long) op; if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " ioctl %d", + xen_ioctl_hypercall_cmd); } if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; } @@ -943,18 +938,18 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op) hc.arg[0] = (unsigned long) op; if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " ioctl %d", + xen_ioctl_hypercall_cmd); } if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; } @@ -986,18 +981,18 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op) hc.arg[0] = (unsigned long) op; if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " sys ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " sys ioctl %d", + xen_ioctl_hypercall_cmd); } if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; } @@ -1029,18 +1024,18 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op) hc.arg[0] = (unsigned long) op; if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " ioctl %d", + xen_ioctl_hypercall_cmd); } if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; } @@ -1069,7 +1064,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids, if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos), XEN_GETDOMAININFO_SIZE * maxids) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } if (hv_versions.hypervisor > 1) { @@ -1124,7 +1119,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids, } if (unlock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos), XEN_GETDOMAININFO_SIZE * maxids) < 0) { - virXenError(VIR_ERR_XEN_CALL, " release"); + virReportError(VIR_ERR_XEN_CALL, " release"); ret = -1; } return ret; @@ -1161,20 +1156,20 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams) xenUnifiedPrivatePtr priv; if (domain->conn == NULL) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain or conn is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain or conn is NULL")); return NULL; } priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return NULL; } if (domain->id < 0) { - virXenError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); return NULL; } @@ -1184,8 +1179,8 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams) * TODO: check on Xen 3.0.3 */ if (hv_versions.dom_interface < 5) { - virXenError(VIR_ERR_NO_XEN, "%s", - _("unsupported in dom interface < 5")); + virReportError(VIR_ERR_NO_XEN, "%s", + _("unsupported in dom interface < 5")); return NULL; } @@ -1242,20 +1237,20 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, xenUnifiedPrivatePtr priv; if (domain->conn == NULL) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain or conn is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain or conn is NULL")); return -1; } priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return -1; } if (domain->id < 0) { - virXenError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); return -1; } @@ -1265,8 +1260,8 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, * TODO: check on Xen 3.0.3 */ if (hv_versions.dom_interface < 5) { - virXenError(VIR_ERR_NO_XEN, "%s", - _("unsupported in dom interface < 5")); + virReportError(VIR_ERR_NO_XEN, "%s", + _("unsupported in dom interface < 5")); return -1; } @@ -1284,8 +1279,8 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, switch (op_sys.u.getschedulerid.sched_id){ case XEN_SCHEDULER_SEDF: if (*nparams < XEN_SCHED_SEDF_NPARAM) { - virXenError(VIR_ERR_INVALID_ARG, - "%s", _("Invalid parameter count")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("Invalid parameter count")); return -1; } @@ -1319,9 +1314,9 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, *nparams = XEN_SCHED_CRED_NPARAM; break; default: - virXenError(VIR_ERR_INVALID_ARG, - _("Unknown scheduler %d"), - op_sys.u.getschedulerid.sched_id); + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown scheduler %d"), + op_sys.u.getschedulerid.sched_id); return -1; } } @@ -1348,8 +1343,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, char buf[256]; if (domain->conn == NULL) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain or conn is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain or conn is NULL")); return -1; } @@ -1368,13 +1363,13 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return -1; } if (domain->id < 0) { - virXenError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); return -1; } @@ -1384,8 +1379,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, * TODO: check on Xen 3.0.3 */ if (hv_versions.dom_interface < 5) { - virXenError(VIR_ERR_NO_XEN, "%s", - _("unsupported in dom interface < 5")); + virReportError(VIR_ERR_NO_XEN, "%s", + _("unsupported in dom interface < 5")); return -1; } @@ -1423,18 +1418,18 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT)) { val = params[i].value.ui; if ((val < 1) || (val > USHRT_MAX)) { - virXenError(VIR_ERR_INVALID_ARG, - _("Credit scheduler weight parameter (%d) " - "is out of range (1-65535)"), val); + virReportError(VIR_ERR_INVALID_ARG, + _("Credit scheduler weight parameter (%d) " + "is out of range (1-65535)"), val); return -1; } op_dom.u.getschedinfo.u.credit.weight = val; } else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_CAP)) { val = params[i].value.ui; if (val >= USHRT_MAX) { - virXenError(VIR_ERR_INVALID_ARG, - _("Credit scheduler cap parameter (%d) is " - "out of range (0-65534)"), val); + virReportError(VIR_ERR_INVALID_ARG, + _("Credit scheduler cap parameter (%d) is " + "out of range (0-65534)"), val); return -1; } op_dom.u.getschedinfo.u.credit.cap = val; @@ -1447,9 +1442,9 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, break; } default: - virXenError(VIR_ERR_INVALID_ARG, - _("Unknown scheduler %d"), - op_sys.u.getschedulerid.sched_id); + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown scheduler %d"), + op_sys.u.getschedulerid.sched_id); return -1; } } @@ -1474,8 +1469,8 @@ xenHypervisorDomainBlockStats (virDomainPtr dom, xenUnifiedUnlock(priv); return ret; #else - virXenError(VIR_ERR_OPERATION_INVALID, "%s", - _("block statistics not supported on this platform")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("block statistics not supported on this platform")); return -1; #endif } @@ -1499,20 +1494,20 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom, * domain. */ if (sscanf(path, "vif%d.%d", &rqdomid, &device) != 2) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid path, should be vif<domid>.<n>.")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid path, should be vif<domid>.<n>.")); return -1; } if (rqdomid != dom->id) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid path, vif<domid> should match this domain ID")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid path, vif<domid> should match this domain ID")); return -1; } return linuxDomainInterfaceStats(path, stats); #else - virXenError(VIR_ERR_OPERATION_INVALID, "%s", - _("/proc/net/dev: Interface not found")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("/proc/net/dev: Interface not found")); return -1; #endif } @@ -1748,7 +1743,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu, xen_op_v2_dom op; if (lock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } memset(&op, 0, sizeof(op)); @@ -1783,7 +1778,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu, VIR_FREE(new); if (unlock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " release"); + virReportError(VIR_ERR_XEN_CALL, " release"); ret = -1; } } else { @@ -1880,7 +1875,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt, } if ((cpumap != NULL) && (maplen > 0)) { if (lock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } memset(cpumap, 0, maplen); @@ -1898,7 +1893,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt, } ret = xenHypervisorDoV2Dom(handle, &op); if (unlock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " release"); + virReportError(VIR_ERR_XEN_CALL, " release"); ret = -1; } } @@ -1998,7 +1993,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) char error[100]; regerror (errcode, &flags_hvm_rec, error, sizeof(error)); regfree (&flags_hvm_rec); - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error); in_init = 0; return -1; } @@ -2008,7 +2003,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) regerror (errcode, &flags_pae_rec, error, sizeof(error)); regfree (&flags_pae_rec); regfree (&flags_hvm_rec); - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error); in_init = 0; return -1; } @@ -2019,7 +2014,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) regfree (&xen_cap_rec); regfree (&flags_pae_rec); regfree (&flags_hvm_rec); - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error); in_init = 0; return -1; } @@ -2079,8 +2074,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) */ hv_versions.hypervisor = -1; - virXenError(VIR_ERR_XEN_CALL, " ioctl %lu", - (unsigned long) IOCTL_PRIVCMD_HYPERCALL); + virReportError(VIR_ERR_XEN_CALL, " ioctl %lu", + (unsigned long) IOCTL_PRIVCMD_HYPERCALL); VIR_FORCE_CLOSE(fd); in_init = 0; return -1; @@ -2184,8 +2179,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) VIR_DEBUG("Failed to find any Xen hypervisor method"); hv_versions.hypervisor = -1; - virXenError(VIR_ERR_XEN_CALL, " ioctl %lu", - (unsigned long)IOCTL_PRIVCMD_HYPERCALL); + virReportError(VIR_ERR_XEN_CALL, " ioctl %lu", + (unsigned long)IOCTL_PRIVCMD_HYPERCALL); VIR_FORCE_CLOSE(fd); in_init = 0; VIR_FREE(ipt); @@ -2226,7 +2221,7 @@ xenHypervisorOpen(virConnectPtr conn, ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR); if (ret < 0) { - virXenError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET); + virReportError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET); return -1; } @@ -2925,30 +2920,30 @@ xenHypervisorDomainGetOSType (virDomainPtr dom) priv = (xenUnifiedPrivatePtr) dom->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain shut off or invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain shut off or invalid")); return NULL; } /* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/ if (hv_versions.hypervisor < 2 || hv_versions.dom_interface < 4) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unsupported in dom interface < 4")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unsupported in dom interface < 4")); return NULL; } XEN_GETDOMAININFO_CLEAR(dominfo); if (virXen_getdomaininfo(priv->handle, dom->id, &dominfo) < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get domain details")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get domain details")); return NULL; } if (XEN_GETDOMAININFO_DOMAIN(dominfo) != dom->id) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get domain details")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get domain details")); return NULL; } @@ -3347,21 +3342,21 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free xenUnifiedPrivatePtr priv; if (conn == NULL) { - virXenError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument")); return -1; } priv = conn->privateData; if (priv->nbNodeCells < 0) { - virXenError(VIR_ERR_XEN_CALL, "%s", - _("cannot determine actual number of cells")); + virReportError(VIR_ERR_XEN_CALL, "%s", + _("cannot determine actual number of cells")); return -1; } if ((maxCells < 1) || (startCell >= priv->nbNodeCells)) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid argument")); return -1; } @@ -3369,14 +3364,14 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free * Support only hv_versions.sys_interface >=4 */ if (hv_versions.sys_interface < SYS_IFACE_MIN_VERS_NUMA) { - virXenError(VIR_ERR_XEN_CALL, "%s", - _("unsupported in sys interface < 4")); + virReportError(VIR_ERR_XEN_CALL, "%s", + _("unsupported in sys interface < 4")); return -1; } if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return -1; } @@ -3617,13 +3612,13 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, if (priv->handle < 0 || (domain->id < 0) || (info == NULL) || (maxinfo < 1) || (sizeof(cpumap_t) & 7)) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain shut off or invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain shut off or invalid")); return -1; } if ((cpumaps != NULL) && (maplen < 1)) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid argument")); return -1; } /* first get the number of virtual CPUs in this domain */ @@ -3632,8 +3627,8 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, &dominfo); if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get domain details")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get domain details")); return -1; } nbinfo = XEN_GETDOMAININFO_CPUCOUNT(dominfo) + 1; @@ -3649,16 +3644,16 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, (unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i), maplen); if (ret < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get VCPUs info")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get VCPUs info")); return -1; } } else { ret = virXen_getvcpusinfo(priv->handle, domain->id, i, ipt, NULL, 0); if (ret < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get VCPUs info")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get VCPUs info")); return -1; } } diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c index f7495b5..7185366 100644 --- a/src/xen/xen_inotify.c +++ b/src/xen/xen_inotify.c @@ -44,10 +44,6 @@ #define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY -#define virXenInotifyError(code, ...) \ - virReportErrorHelper(VIR_FROM_XEN_INOTIFY, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - struct xenUnifiedDriver xenInotifyDriver = { .xenClose = xenInotifyClose, }; @@ -91,8 +87,8 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename, uuid_str = filename + strlen(XEND_DOMAINS_DIR) + 1; if (virUUIDParse(uuid_str, rawuuid) < 0) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - _("parsing uuid %s"), uuid_str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("parsing uuid %s"), uuid_str); return -1; } /* call directly into xend here, as driver may not yet @@ -116,8 +112,8 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename, return 0; } } - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("finding dom on config list")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("finding dom on config list")); return -1; } @@ -168,8 +164,8 @@ xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn, int i; if (virUUIDParse(uuidstr, uuid) < 0) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - _("parsing uuid %s"), uuidstr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("parsing uuid %s"), uuidstr); return -1; } @@ -204,15 +200,15 @@ xenInotifyXendDomainsDirAddEntry(virConnectPtr conn, xenUnifiedPrivatePtr priv = conn->privateData; if (xenInotifyDomainLookup(conn, fname, &name, uuid) < 0) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error looking up domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Error looking up domain")); return -1; } if (xenUnifiedAddDomainInfo(priv->configInfoList, -1, name, uuid) < 0) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error adding file to config cache")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Error adding file to config cache")); VIR_FREE(name); return -1; } @@ -257,8 +253,8 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED, if( conn && conn->privateData ) { priv = conn->privateData; } else { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("conn, or private data is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("conn, or private data is NULL")); return; } @@ -300,19 +296,19 @@ reread: if (event) xenUnifiedDomainEventDispatch(conn->privateData, event); else - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("looking up dom")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("looking up dom")); if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0 ) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error adding file to config cache")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Error adding file to config cache")); goto cleanup; } } else if (e->mask & ( IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO) ) { virDomainEventPtr event; if (xenInotifyAddDomainConfigInfo(conn, fname) < 0 ) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error adding file to config cache")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Error adding file to config cache")); goto cleanup; } @@ -323,8 +319,8 @@ reread: if (event) xenUnifiedDomainEventDispatch(conn->privateData, event); else - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("looking up dom")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("looking up dom")); } @@ -386,8 +382,8 @@ xenInotifyOpen(virConnectPtr conn, } if (xenInotifyAddDomainConfigInfo(conn, path) < 0 ) { - virXenInotifyError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error adding file to config list")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Error adding file to config list")); closedir(dh); VIR_FREE(path); return -1; diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index f965129..191f1bf 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -65,13 +65,6 @@ virDomainXMLDevID(virDomainPtr domain, char *ref, int ref_len); -#define virXendError(code, ...) \ - virReportErrorHelper(VIR_FROM_XEND, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - -#define virXendErrorInt(code, ival) \ - virXendError(code, "%d", ival) - /** * do_connect: * @xend: pointer to the Xen Daemon structure @@ -89,8 +82,8 @@ do_connect(virConnectPtr xend) s = socket(priv->addrfamily, SOCK_STREAM, priv->addrprotocol); if (s == -1) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to create a socket")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to create a socket")); return -1; } @@ -109,8 +102,8 @@ do_connect(virConnectPtr xend) * error */ if (xenHavePrivilege()) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to connect to xend")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to connect to xend")); } } @@ -156,11 +149,11 @@ wr_sync(int fd, void *buffer, size_t size, int do_read) /* unrecoverable error */ if (len == -1) { if (do_read) - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to read from Xen Daemon")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to read from Xen Daemon")); else - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to write to Xen Daemon")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to write to Xen Daemon")); return -1; } @@ -303,11 +296,11 @@ xend_req(int fd, char **content) ssize_t ret; if (content_length > XEND_RCV_BUF_MAX_LEN) { - virXendError(VIR_ERR_INTERNAL_ERROR, - _("Xend returned HTTP Content-Length of %d, " - "which exceeds maximum of %d"), - content_length, - XEND_RCV_BUF_MAX_LEN); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Xend returned HTTP Content-Length of %d, " + "which exceeds maximum of %d"), + content_length, + XEND_RCV_BUF_MAX_LEN); return -1; } @@ -363,9 +356,9 @@ xend_get(virConnectPtr xend, const char *path, return ret; if ((ret >= 300) && ((ret != 404) || (!STRPREFIX(path, "/xend/domain/")))) { - virXendError(VIR_ERR_GET_FAILED, - _("%d status from xen daemon: %s:%s"), - ret, path, NULLSTR(*content)); + virReportError(VIR_ERR_GET_FAILED, + _("%d status from xen daemon: %s:%s"), + ret, path, NULLSTR(*content)); } return ret; @@ -411,11 +404,11 @@ xend_post(virConnectPtr xend, const char *path, const char *ops) VIR_FORCE_CLOSE(s); if ((ret < 0) || (ret >= 300)) { - virXendError(VIR_ERR_POST_FAILED, - _("xend_post: error from xen daemon: %s"), err_buf); + virReportError(VIR_ERR_POST_FAILED, + _("xend_post: error from xen daemon: %s"), err_buf); } else if ((ret == 202) && err_buf && (strstr(err_buf, "failed") != NULL)) { - virXendError(VIR_ERR_POST_FAILED, - _("xend_post: error from xen daemon: %s"), err_buf); + virReportError(VIR_ERR_POST_FAILED, + _("xend_post: error from xen daemon: %s"), err_buf); ret = -1; } else if (((ret >= 200) && (ret <= 202)) && err_buf && (strstr(err_buf, "xend.err") != NULL)) { @@ -423,8 +416,8 @@ xend_post(virConnectPtr xend, const char *path, const char *ops) * which returns a success code, but the word 'xend.err' * in body to indicate error :-( */ - virXendError(VIR_ERR_POST_FAILED, - _("xend_post: error from xen daemon: %s"), err_buf); + virReportError(VIR_ERR_POST_FAILED, + _("xend_post: error from xen daemon: %s"), err_buf); ret = -1; } @@ -458,7 +451,7 @@ http2unix(int ret) errno = EIO; break; default: - virXendErrorInt(VIR_ERR_HTTP_ERROR, ret); + virReportError(VIR_ERR_HTTP_ERROR, "%d", ret); errno = EINVAL; break; } @@ -677,9 +670,9 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port) ret = getaddrinfo (host, port, &hints, &res); if (ret != 0) { - virXendError(VIR_ERR_UNKNOWN_HOST, - _("unable to resolve hostname '%s': %s"), - host, gai_strerror (ret)); + virReportError(VIR_ERR_UNKNOWN_HOST, + _("unable to resolve hostname '%s': %s"), + host, gai_strerror (ret)); return -1; } @@ -851,19 +844,19 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname, value = sexpr_node(root, "domain/domid"); if (value == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing domid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing domid")); goto error; } ret = strtol(value, NULL, 0); if ((ret == 0) && (value[0] != '0')) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incorrect domid not numeric")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incorrect domid not numeric")); ret = -1; } else if (uuid != NULL) { if (sexpr_uuid(uuid, root, "domain/uuid") < 0) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing uuid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing uuid")); } } @@ -901,8 +894,8 @@ xenDaemonDomainLookupByID(virConnectPtr xend, name = sexpr_node(root, "domain/name"); if (name == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing name")); goto error; } if (domname) { @@ -914,8 +907,8 @@ xenDaemonDomainLookupByID(virConnectPtr xend, } if (sexpr_uuid(uuid, root, "domain/uuid") < 0) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing uuid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing uuid")); goto error; } @@ -937,7 +930,7 @@ xend_detect_config_version(virConnectPtr conn) { xenUnifiedPrivatePtr priv; if (!VIR_IS_CONNECT(conn)) { - virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return -1; } @@ -1178,7 +1171,7 @@ sexpr_to_xend_topology(const struct sexpr *root, return 0; parse_error: - virXendError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error")); + virReportError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error")); error: VIR_FREE(cpuNums); VIR_FREE(cpuset); @@ -1240,8 +1233,8 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root) return ret; error: - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to parse Xend domain information")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to parse Xend domain information")); if (ret != NULL) virUnrefDomain(ret); return NULL; @@ -1285,7 +1278,7 @@ xenDaemonOpen(virConnectPtr conn, if (conn->uri->scheme == NULL) { /* It should be a file access */ if (conn->uri->path == NULL) { - virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__); + virReportError(VIR_ERR_NO_CONNECT, __FUNCTION__); goto failed; } if (xenDaemonOpen_unix(conn, conn->uri->path) < 0 || @@ -1319,7 +1312,7 @@ xenDaemonOpen(virConnectPtr conn, xend_detect_config_version(conn) == -1) goto failed; } else { - virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__); + virReportError(VIR_ERR_NO_CONNECT, __FUNCTION__); goto failed; } @@ -1361,13 +1354,13 @@ int xenDaemonDomainSuspend(virDomainPtr domain) { if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1387,13 +1380,13 @@ int xenDaemonDomainResume(virDomainPtr domain) { if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1414,13 +1407,13 @@ int xenDaemonDomainShutdown(virDomainPtr domain) { if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1444,13 +1437,13 @@ xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags) virCheckFlags(0, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1481,13 +1474,13 @@ xenDaemonDomainDestroyFlags(virDomainPtr domain, virCheckFlags(0, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1511,7 +1504,7 @@ xenDaemonDomainGetOSType(virDomainPtr domain) xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } @@ -1557,13 +1550,13 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename) { if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || (filename == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1595,13 +1588,13 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename, if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || (filename == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("Domain %s isn't running."), domain->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Domain %s isn't running."), domain->name); return -1; } @@ -1628,7 +1621,7 @@ xenDaemonDomainRestore(virConnectPtr conn, const char *filename) { if ((conn == NULL) || (filename == NULL)) { /* this should be caught at the interface but ... */ - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } return xend_op(conn, "", "op", "restore", "file", filename, NULL); @@ -1651,7 +1644,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain) xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return 0; } @@ -1690,7 +1683,7 @@ xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1727,7 +1720,7 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory) xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1808,7 +1801,7 @@ xenDaemonDomainGetXMLDesc(virDomainPtr domain, unsigned int flags, /* Flags checked by virDomainDefFormat */ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } priv = (xenUnifiedPrivatePtr) domain->conn->privateData; @@ -1851,7 +1844,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || (info == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1926,7 +1919,7 @@ xenDaemonLookupByName(virConnectPtr conn, const char *domname) virDomainPtr ret = NULL; if ((conn == NULL) || (domname == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } @@ -1957,11 +1950,11 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) { struct sexpr *root; if (!VIR_IS_CONNECT(conn)) { - virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return -1; } if (info == NULL) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1990,12 +1983,12 @@ xenDaemonNodeGetTopology(virConnectPtr conn, struct sexpr *root; if (!VIR_IS_CONNECT(conn)) { - virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return -1; } if (caps == NULL) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2028,11 +2021,11 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer) unsigned long version; if (!VIR_IS_CONNECT(conn)) { - virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return -1; } if (hvVer == NULL) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } root = sexpr_get(conn, "/xend/node/"); @@ -2185,7 +2178,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus, if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || (vcpus < 1)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2200,23 +2193,23 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus, * running domains, or _CONFIG for inactive domains. */ if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { if (flags & VIR_DOMAIN_VCPU_CONFIG) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " + "persistent config")); return -1; } } else if (domain->id < 0) { if (flags & VIR_DOMAIN_VCPU_LIVE) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain not running")); return -1; } } else { if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend only supports modifying both live and " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend only supports modifying both live and " + "persistent config")); } } @@ -2224,14 +2217,14 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus, * the maximum. */ flags |= VIR_DOMAIN_VCPU_MAXIMUM; if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("could not determine max vcpus for the domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("could not determine max vcpus for the domain")); return -1; } if (vcpus > max) { - virXendError(VIR_ERR_INVALID_ARG, - _("requested vcpus is greater than max allowable" - " vcpus for the domain: %d > %d"), vcpus, max); + virReportError(VIR_ERR_INVALID_ARG, + _("requested vcpus is greater than max allowable" + " vcpus for the domain: %d > %d"), vcpus, max); return -1; } @@ -2267,7 +2260,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu, if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2303,8 +2296,8 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu, if (ret == 0) { if (virDomainVcpuPinAdd(def, cpumap, maplen, vcpu) < 0) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to add vcpupin xml entry")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to add vcpupin xml entry")); return -1; } } @@ -2339,7 +2332,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) VIR_DOMAIN_VCPU_MAXIMUM, -1); if (domain == NULL || domain->conn == NULL || domain->name == NULL) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2351,8 +2344,8 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) return -2; if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain not active")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain not active")); return -1; } @@ -2403,11 +2396,11 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) || (info == NULL) || (maxinfo < 1)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (cpumaps != NULL && maplen < 1) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2639,7 +2632,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2648,14 +2641,14 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, if (domain->id < 0) { /* Cannot modify live config if domain is inactive */ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Cannot modify live config if domain is inactive")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Cannot modify live config if domain is inactive")); return -1; } /* If xendConfigVersion < 3 only live config can be changed */ if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " "persistent config")); return -1; } @@ -2664,9 +2657,9 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4 && (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT && flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " + "persistent config")); return -1; } /* Xen only supports modifying both live and persistent config if @@ -2675,9 +2668,9 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4 && (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE | VIR_DOMAIN_DEVICE_MODIFY_CONFIG))) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend only supports modifying both live and " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend only supports modifying both live and " + "persistent config")); return -1; } } @@ -2743,15 +2736,15 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, goto cleanup; } } else { - virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unsupported device type")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported device type")); goto cleanup; } break; default: - virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unsupported device type")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported device type")); goto cleanup; } @@ -2763,8 +2756,8 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, "config", sexpr, NULL); } else { if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - virXendError(VIR_ERR_OPERATION_INVALID, - _("target '%s' already exists"), target); + virReportError(VIR_ERR_OPERATION_INVALID, + _("target '%s' already exists"), target); } else { /* device exists, attempt to modify it */ ret = xend_op(domain->conn, domain->name, "op", "device_configure", @@ -2807,7 +2800,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml, VIR_DOMAIN_DEVICE_MODIFY_CONFIG, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2816,14 +2809,14 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml, if (domain->id < 0) { /* Cannot modify live config if domain is inactive */ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Cannot modify live config if domain is inactive")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Cannot modify live config if domain is inactive")); return -1; } /* If xendConfigVersion < 3 only live config can be changed */ if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " "persistent config")); return -1; } @@ -2832,9 +2825,9 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml, if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4 && (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT && flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " + "persistent config")); return -1; } /* Xen only supports modifying both live and persistent config if @@ -2843,9 +2836,9 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml, if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4 && (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE | VIR_DOMAIN_DEVICE_MODIFY_CONFIG))) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend only supports modifying both live and " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend only supports modifying both live and " + "persistent config")); return -1; } } @@ -2871,16 +2864,16 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml, break; default: - virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unsupported device type")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported device type")); goto cleanup; } sexpr = virBufferContentAndReset(&buf); if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("requested device does not exist")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("requested device does not exist")); goto cleanup; } else { /* device exists, attempt to modify it */ @@ -2920,7 +2913,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -2929,15 +2922,15 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, if (domain->id < 0) { /* Cannot modify live config if domain is inactive */ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Cannot modify live config if domain is inactive")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Cannot modify live config if domain is inactive")); return -1; } /* If xendConfigVersion < 3 only live config can be changed */ if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " + "persistent config")); return -1; } } else { @@ -2945,9 +2938,9 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4 && (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT && flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend version does not support modifying " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend version does not support modifying " + "persistent config")); return -1; } /* Xen only supports modifying both live and persistent config if @@ -2956,9 +2949,9 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4 && (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE | VIR_DOMAIN_DEVICE_MODIFY_CONFIG))) { - virXendError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xend only supports modifying both live and " - "persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xend only supports modifying both live and " + "persistent config")); return -1; } } @@ -2982,8 +2975,8 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 1) < 0) goto cleanup; } else { - virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unsupported device type")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported device type")); goto cleanup; } xendev = virBufferContentAndReset(&buf); @@ -3013,7 +3006,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain, xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -3026,8 +3019,8 @@ xenDaemonDomainGetAutostart(virDomainPtr domain, root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name); if (root == NULL) { - virXendError(VIR_ERR_XEN_CALL, - "%s", _("xenDaemonGetAutostart failed to find this domain")); + virReportError(VIR_ERR_XEN_CALL, + "%s", _("xenDaemonGetAutostart failed to find this domain")); return -1; } @@ -3053,7 +3046,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain, xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__); + virReportError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__); return -1; } @@ -3066,8 +3059,8 @@ xenDaemonDomainSetAutostart(virDomainPtr domain, root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name); if (root == NULL) { - virXendError(VIR_ERR_XEN_CALL, - "%s", _("xenDaemonSetAutostart failed to find this domain")); + virReportError(VIR_ERR_XEN_CALL, + "%s", _("xenDaemonSetAutostart failed to find this domain")); return -1; } @@ -3076,8 +3069,8 @@ xenDaemonDomainSetAutostart(virDomainPtr domain, const char *val = (autonode->u.s.car->kind == SEXPR_VALUE ? autonode->u.s.car->u.value : NULL); if (!val || (!STREQ(val, "ignore") && !STREQ(val, "start"))) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unexpected value from on_xend_start")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unexpected value from on_xend_start")); goto error; } @@ -3091,8 +3084,8 @@ xenDaemonDomainSetAutostart(virDomainPtr domain, } if (sexpr2string(root, &buffer) < 0) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("sexpr2string failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("sexpr2string failed")); goto error; } @@ -3104,13 +3097,13 @@ xenDaemonDomainSetAutostart(virDomainPtr domain, content = virBufferContentAndReset(&buffer); if (xend_op(domain->conn, "", "op", "new", "config", content, NULL) != 0) { - virXendError(VIR_ERR_XEN_CALL, - "%s", _("Failed to redefine sexpr")); + virReportError(VIR_ERR_XEN_CALL, + "%s", _("Failed to redefine sexpr")); goto error; } } else { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("on_xend_start not present in sexpr")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("on_xend_start not present in sexpr")); goto error; } @@ -3172,9 +3165,9 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, /* Xen doesn't support renaming domains during migration. */ if (dname) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("xenDaemonDomainMigrate: Xen does not support" - " renaming domains during migration")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("xenDaemonDomainMigrate: Xen does not support" + " renaming domains during migration")); return -1; } @@ -3182,9 +3175,9 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, * ignores it. */ if (bandwidth) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("xenDaemonDomainMigrate: Xen does not support" - " bandwidth limits during migration")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("xenDaemonDomainMigrate: Xen does not support" + " bandwidth limits during migration")); return -1; } @@ -3210,16 +3203,16 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, * a nice error message. */ if (flags & VIR_MIGRATE_PAUSED) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("xenDaemonDomainMigrate: xend cannot migrate paused domains")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("xenDaemonDomainMigrate: xend cannot migrate paused domains")); return -1; } /* XXX we could easily do tunnelled & peer2peer migration too if we want to. support these... */ if (flags != 0) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("xenDaemonDomainMigrate: unsupported flag")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("xenDaemonDomainMigrate: unsupported flag")); return -1; } @@ -3234,16 +3227,16 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, return -1; if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) { - virXendError(VIR_ERR_INVALID_ARG, - "%s", _("xenDaemonDomainMigrate: only xenmigr://" - " migrations are supported by Xen")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("xenDaemonDomainMigrate: only xenmigr://" + " migrations are supported by Xen")); virURIFree (uriptr); return -1; } if (!uriptr->server) { - virXendError(VIR_ERR_INVALID_ARG, - "%s", _("xenDaemonDomainMigrate: a hostname must be" - " specified in the URI")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("xenDaemonDomainMigrate: a hostname must be" + " specified in the URI")); virURIFree (uriptr); return -1; } @@ -3261,8 +3254,8 @@ xenDaemonDomainMigratePerform (virDomainPtr domain, int port_nr, n; if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) { - virXendError(VIR_ERR_INVALID_ARG, - "%s", _("xenDaemonDomainMigrate: invalid port number")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("xenDaemonDomainMigrate: invalid port number")); return -1; } snprintf (port, sizeof(port), "%d", port_nr); @@ -3327,22 +3320,22 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) { if (!(def = virDomainDefParseString(priv->caps, xmlDesc, 1 << VIR_DOMAIN_VIRT_XEN, VIR_DOMAIN_XML_INACTIVE))) { - virXendError(VIR_ERR_XML_ERROR, - "%s", _("failed to parse domain description")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("failed to parse domain description")); return NULL; } if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) { - virXendError(VIR_ERR_XML_ERROR, - "%s", _("failed to build sexpr")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("failed to build sexpr")); goto error; } ret = xend_op(conn, "", "op", "new", "config", sexpr, NULL); VIR_FREE(sexpr); if (ret != 0) { - virXendError(VIR_ERR_XEN_CALL, - _("Failed to create inactive domain %s"), def->name); + virReportError(VIR_ERR_XEN_CALL, + _("Failed to create inactive domain %s"), def->name); goto error; } @@ -3364,7 +3357,7 @@ int xenDaemonDomainCreate(virDomainPtr domain) virDomainPtr tmp; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -3391,7 +3384,7 @@ int xenDaemonDomainUndefine(virDomainPtr domain) xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -3510,15 +3503,15 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams) char *schedulertype = NULL; if (domain->conn == NULL || domain->name == NULL) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } /* Support only xendConfigVersion >=4 */ priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("unsupported in xendConfigVersion < 4")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("unsupported in xendConfigVersion < 4")); return NULL; } @@ -3529,8 +3522,8 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams) /* get xen_scheduler from xend/node */ ret = sexpr_node(root, "node/xen_scheduler"); if (ret == NULL){ - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("node information incomplete, missing scheduler name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("node information incomplete, missing scheduler name")); goto error; } if (STREQ (ret, "credit")) { @@ -3550,7 +3543,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams) if (nparams) *nparams = XEN_SCHED_SEDF_NPARAM; } else { - virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler")); goto error; } @@ -3583,15 +3576,15 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, int ret = -1; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } /* Support only xendConfigVersion >=4 */ priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("unsupported in xendConfigVersion < 4")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("unsupported in xendConfigVersion < 4")); return -1; } @@ -3603,16 +3596,16 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, /* get the scheduler type */ sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam); if (sched_type == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to get a scheduler name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to get a scheduler name")); goto error; } switch (sched_nparam){ case XEN_SCHED_SEDF_NPARAM: if (*nparams < XEN_SCHED_SEDF_NPARAM) { - virXendError(VIR_ERR_INVALID_ARG, - "%s", _("Invalid parameter count")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("Invalid parameter count")); goto error; } @@ -3622,21 +3615,21 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, case XEN_SCHED_CRED_NPARAM: /* get cpu_weight/cpu_cap from xend/domain */ if (sexpr_node(root, "domain/cpu_weight") == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing cpu_weight")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing cpu_weight")); goto error; } if (sexpr_node(root, "domain/cpu_cap") == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing cpu_cap")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing cpu_cap")); goto error; } if (virStrcpyStatic(params[0].field, VIR_DOMAIN_SCHEDULER_WEIGHT) == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - _("Weight %s too big for destination"), - VIR_DOMAIN_SCHEDULER_WEIGHT); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Weight %s too big for destination"), + VIR_DOMAIN_SCHEDULER_WEIGHT); goto error; } params[0].type = VIR_TYPED_PARAM_UINT; @@ -3645,9 +3638,9 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, if (*nparams > 1) { if (virStrcpyStatic(params[1].field, VIR_DOMAIN_SCHEDULER_CAP) == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - _("Cap %s too big for destination"), - VIR_DOMAIN_SCHEDULER_CAP); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cap %s too big for destination"), + VIR_DOMAIN_SCHEDULER_CAP); goto error; } params[1].type = VIR_TYPED_PARAM_UINT; @@ -3659,7 +3652,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain, ret = 0; break; default: - virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler")); goto error; } @@ -3691,15 +3684,15 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, int ret = -1; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } /* Support only xendConfigVersion >=4 and active domains */ priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("unsupported in xendConfigVersion < 4")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("unsupported in xendConfigVersion < 4")); return -1; } @@ -3711,8 +3704,8 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, /* get the scheduler type */ sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam); if (sched_type == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to get a scheduler name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to get a scheduler name")); goto error; } @@ -3738,7 +3731,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, params[i].type == VIR_TYPED_PARAM_UINT) { snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui); } else { - virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); goto error; } } @@ -3747,8 +3740,8 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, if (strlen(buf_weight) == 0) { weight = sexpr_node(root, "domain/cpu_weight"); if (weight == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing cpu_weight")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing cpu_weight")); goto error; } snprintf(buf_weight, sizeof(buf_weight), "%s", weight); @@ -3756,8 +3749,8 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, if (strlen(buf_cap) == 0) { cap = sexpr_node(root, "domain/cpu_cap"); if (cap == NULL) { - virXendError(VIR_ERR_INTERNAL_ERROR, - "%s", _("domain information incomplete, missing cpu_cap")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("domain information incomplete, missing cpu_cap")); goto error; } snprintf(buf_cap, sizeof(buf_cap), "%s", cap); @@ -3769,7 +3762,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain, break; } default: - virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler")); goto error; } @@ -3817,13 +3810,13 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, domain->name); else { /* This call always fails for dom0. */ - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("domainBlockPeek is not supported for dom0")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domainBlockPeek is not supported for dom0")); return -1; } if (!root) { - virXendError(VIR_ERR_XEN_CALL, __FUNCTION__); + virReportError(VIR_ERR_XEN_CALL, __FUNCTION__); return -1; } @@ -3838,8 +3831,8 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, goto cleanup; if (!(actual = virDomainDiskPathByName(def, path))) { - virXendError(VIR_ERR_INVALID_ARG, - _("%s: invalid path"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("%s: invalid path"), path); goto cleanup; } path = actual; @@ -4000,8 +3993,8 @@ virDomainXMLDevID(virDomainPtr domain, if (tmp == NULL) return -1; } else { - virXendError(VIR_ERR_OPERATION_INVALID, - "%s", _("hotplug of device type not supported")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("hotplug of device type not supported")); return -1; } diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index cde0abb..c073f25 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -96,10 +96,6 @@ struct xenUnifiedDriver xenXMDriver = { .xenDomainDetachDeviceFlags = xenXMDomainDetachDeviceFlags, }; -#define xenXMError(code, ...) \ - virReportErrorHelper(VIR_FROM_XENXM, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - #ifndef WITH_XEN_INOTIFY static int xenInotifyActive(virConnectPtr conn ATTRIBUTE_UNUSED) { @@ -281,8 +277,8 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename) virDomainDefFree(entry->def); VIR_FREE(entry->filename); VIR_FREE(entry); - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("xenXMConfigCacheRefresh: virHashAddEntry")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("xenXMConfigCacheRefresh: virHashAddEntry")); return -1; } } @@ -486,7 +482,7 @@ int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) { const char *filename; xenXMConfCachePtr entry; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -532,7 +528,7 @@ char *xenXMDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) /* Flags checked by virDomainDefFormat */ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } if (domain->id != -1) @@ -565,7 +561,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) { int ret = -1; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->conn->flags & VIR_CONNECT_RO) @@ -610,7 +606,7 @@ int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) { int ret = -1; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->conn->flags & VIR_CONNECT_RO) @@ -653,7 +649,7 @@ unsigned long long xenXMDomainGetMaxMemory(virDomainPtr domain) { unsigned long long ret = 0; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return 0; } if (domain->id != -1) @@ -701,18 +697,18 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus, VIR_DOMAIN_VCPU_MAXIMUM, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->conn->flags & VIR_CONNECT_RO) { - xenXMError(VIR_ERR_OPERATION_DENIED, __FUNCTION__); + virReportError(VIR_ERR_OPERATION_DENIED, __FUNCTION__); return -1; } if (domain->id != -1) return -2; if (flags & VIR_DOMAIN_VCPU_LIVE) { - xenXMError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); return -1; } @@ -727,8 +723,8 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus, /* Hypervisor maximum. */ if ((max = xenUnifiedGetMaxVcpus(domain->conn, NULL)) < 0) { - xenXMError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not determine max vcpus for the domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not determine max vcpus for the domain")); goto cleanup; } /* Can't specify a current larger than stored maximum; but @@ -736,9 +732,9 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus, if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM)) max = entry->def->maxvcpus; if (vcpus > max) { - xenXMError(VIR_ERR_INVALID_ARG, - _("requested vcpus is greater than max allowable" - " vcpus for the domain: %d > %d"), vcpus, max); + virReportError(VIR_ERR_INVALID_ARG, + _("requested vcpus is greater than max allowable" + " vcpus for the domain: %d > %d"), vcpus, max); goto cleanup; } @@ -785,14 +781,14 @@ xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) VIR_DOMAIN_VCPU_MAXIMUM, -1); if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id != -1) return -2; if (flags & VIR_DOMAIN_VCPU_LIVE) { - xenXMError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active")); return -1; } @@ -840,17 +836,17 @@ int xenXMDomainPinVcpu(virDomainPtr domain, if (domain == NULL || domain->conn == NULL || domain->name == NULL || cpumap == NULL || maplen < 1 || maplen > (int)sizeof(cpumap_t)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->conn->flags & VIR_CONNECT_RO) { - xenXMError(VIR_ERR_INVALID_ARG, - "%s", _("read only connection")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("read only connection")); return -1; } if (domain->id != -1) { - xenXMError(VIR_ERR_INVALID_ARG, - "%s", _("not inactive domain")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("not inactive domain")); return -1; } @@ -858,12 +854,12 @@ int xenXMDomainPinVcpu(virDomainPtr domain, xenUnifiedLock(priv); if (!(filename = virHashLookup(priv->nameConfigMap, domain->name))) { - xenXMError(VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup")); goto cleanup; } if (!(entry = virHashLookup(priv->configCache, filename))) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("can't retrieve config file for domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("can't retrieve config file for domain")); goto cleanup; } @@ -923,11 +919,11 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) { virDomainPtr ret = NULL; if (!VIR_IS_CONNECT(conn)) { - xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return NULL; } if (domname == NULL) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } @@ -979,11 +975,11 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn, virDomainPtr ret = NULL; if (!VIR_IS_CONNECT(conn)) { - xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return NULL; } if (uuid == NULL) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } @@ -1078,11 +1074,11 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData; if (!VIR_IS_CONNECT(conn)) { - xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return NULL; } if (xml == NULL) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } if (conn->flags & VIR_CONNECT_RO) @@ -1116,9 +1112,9 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(entry->def->uuid, uuidstr); - xenXMError(VIR_ERR_OPERATION_FAILED, - _("domain '%s' is already defined with uuid %s"), - entry->def->name, uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("domain '%s' is already defined with uuid %s"), + entry->def->name, uuidstr); entry = NULL; goto error; } @@ -1129,28 +1125,28 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) /* domain exists, we will overwrite it */ if (!(oldfilename = (char *)virHashLookup(priv->nameConfigMap, def->name))) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("can't retrieve config filename for domain to overwrite")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("can't retrieve config filename for domain to overwrite")); goto error; } if (!(entry = virHashLookup(priv->configCache, oldfilename))) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("can't retrieve config entry for domain to overwrite")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("can't retrieve config entry for domain to overwrite")); goto error; } /* Remove the name -> filename mapping */ if (virHashRemoveEntry(priv->nameConfigMap, def->name) < 0) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to remove old domain from config map")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to remove old domain from config map")); goto error; } /* Remove the config record itself */ if (virHashRemoveEntry(priv->configCache, oldfilename) < 0) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to remove old domain from config map")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to remove old domain from config map")); goto error; } @@ -1169,8 +1165,8 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) } if ((entry->refreshedAt = time(NULL)) == ((time_t)-1)) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unable to get current time")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unable to get current time")); goto error; } @@ -1181,15 +1177,15 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) entry->def = def; if (virHashAddEntry(priv->configCache, filename, entry) < 0) { - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unable to store config file handle")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unable to store config file handle")); goto error; } if (virHashAddEntry(priv->nameConfigMap, def->name, entry->filename) < 0) { virHashSteal(priv->configCache, filename); - xenXMError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unable to store config file handle")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unable to store config file handle")); goto error; } @@ -1219,7 +1215,7 @@ int xenXMDomainUndefine(virDomainPtr domain) { int ret = -1; if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1295,7 +1291,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames int i, ret = -1; if (!VIR_IS_CONNECT(conn)) { - xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return -1; } @@ -1340,7 +1336,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) { int ret = -1; if (!VIR_IS_CONNECT(conn)) { - xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__); + virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__); return -1; } @@ -1385,7 +1381,7 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if ((!domain) || (!domain->conn) || (!domain->name) || (!xml)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1394,8 +1390,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml, if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) || (domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) { - xenXMError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xm driver only supports modifying persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xm driver only supports modifying persistent config")); return -1; } @@ -1436,8 +1432,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml, } default: - xenXMError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Xm driver only supports adding disk or network devices")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Xm driver only supports adding disk or network devices")); goto cleanup; } @@ -1482,7 +1478,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml, virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); if ((!domain) || (!domain->conn) || (!domain->name) || (!xml)) { - xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -1491,8 +1487,8 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml, if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) || (domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) { - xenXMError(VIR_ERR_OPERATION_INVALID, "%s", - _("Xm driver only supports modifying persistent config")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Xm driver only supports modifying persistent config")); return -1; } @@ -1547,9 +1543,9 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml, break; } default: - xenXMError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot be detached"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot be detached"), + virDomainDeviceTypeToString(dev->type)); goto cleanup; } @@ -1574,8 +1570,8 @@ xenXMDomainBlockPeek (virDomainPtr dom ATTRIBUTE_UNUSED, size_t size ATTRIBUTE_UNUSED, void *buffer ATTRIBUTE_UNUSED) { - xenXMError(VIR_ERR_OPERATION_INVALID, "%s", - _("block peeking not implemented")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("block peeking not implemented")); return -1; } diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index d1bcb27..8f52e8f 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -51,10 +51,6 @@ struct xenUnifiedDriver xenStoreDriver = { .xenDomainGetInfo = xenStoreGetDomainInfo, }; -#define virXenStoreError(code, ...) \ - virReportErrorHelper(VIR_FROM_XENSTORE, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - /************************************************************************ * * * Helper internal APIs * @@ -254,8 +250,8 @@ xenStoreOpen(virConnectPtr conn, * remote) mechanism. */ if (xenHavePrivilege()) { - virXenStoreError(VIR_ERR_NO_XEN, - "%s", _("failed to connect to Xen Store")); + virReportError(VIR_ERR_NO_XEN, + "%s", _("failed to connect to Xen Store")); } return -1; } @@ -278,8 +274,8 @@ xenStoreOpen(virConnectPtr conn, if ( xenStoreAddWatch(conn, "@releaseDomain", "releaseDomain", xenStoreDomainReleased, priv) < 0 ) { - virXenStoreError(VIR_ERR_INTERNAL_ERROR, - "%s", _("adding watch @releaseDomain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("adding watch @releaseDomain")); return -1; } @@ -287,8 +283,8 @@ xenStoreOpen(virConnectPtr conn, if( xenStoreAddWatch(conn, "@introduceDomain", "introduceDomain", xenStoreDomainIntroduced, priv) < 0 ) { - virXenStoreError(VIR_ERR_INTERNAL_ERROR, - "%s", _("adding watch @introduceDomain")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("adding watch @introduceDomain")); return -1; } @@ -317,7 +313,7 @@ xenStoreClose(virConnectPtr conn) xenUnifiedPrivatePtr priv; if (conn == NULL) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -371,7 +367,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) return -1; if ((domain == NULL) || (domain->conn == NULL) || (info == NULL)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -472,7 +468,7 @@ xenStoreDomainSetMemory(virDomainPtr domain, unsigned long memory) if ((domain == NULL) || (domain->conn == NULL) || (memory < 1024 * MIN_XEN_GUEST_SIZE)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id == -1) @@ -536,13 +532,13 @@ xenStoreNumOfDomains(virConnectPtr conn) xenUnifiedPrivatePtr priv; if (conn == NULL) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } priv = (xenUnifiedPrivatePtr) conn->privateData; if (priv->xshandle == NULL) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -624,7 +620,7 @@ xenStoreListDomains(virConnectPtr conn, int *ids, int maxids) int ret; if ((conn == NULL) || (ids == NULL)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } @@ -659,7 +655,7 @@ xenStoreLookupByName(virConnectPtr conn, const char *name) xenUnifiedPrivatePtr priv; if ((conn == NULL) || (name == NULL)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } @@ -723,7 +719,7 @@ xenStoreDomainShutdown(virDomainPtr domain) xenUnifiedPrivatePtr priv; if ((domain == NULL) || (domain->conn == NULL)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id == -1 || domain->id == 0) @@ -759,7 +755,7 @@ xenStoreDomainReboot(virDomainPtr domain, unsigned int flags) virCheckFlags(0, -1); if ((domain == NULL) || (domain->conn == NULL)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (domain->id == -1 || domain->id == 0) @@ -789,7 +785,7 @@ xenStoreDomainGetOSType(virDomainPtr domain) { char *vm, *str = NULL; if ((domain == NULL) || (domain->conn == NULL)) { - virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__); + virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return NULL; } @@ -1156,8 +1152,8 @@ int xenStoreAddWatch(virConnectPtr conn, for (n=0; n < list->count; n++) { if( STREQ(list->watches[n]->path, path) && STREQ(list->watches[n]->token, token)) { - virXenStoreError(VIR_ERR_INTERNAL_ERROR, - "%s", _("watch already tracked")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("watch already tracked")); return -1; } } -- 1.7.10.4

On Wed, Jul 18, 2012 at 07:40:48PM +0100, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the legacy Xen drivers to use virReportError instead of the statsError, virXenInotifyError, virXenStoreError, virXendError, xenUnifiedError, xenXMError custom macros
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
I realized this patch doesn't pass syntax-check. I've got a separate patch to be applied first to correct the problems: https://www.redhat.com/archives/libvir-list/2012-July/msg00922.html the related problematic hunks in this patch then just go away in the rebase. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the legacy Xen drivers to use virReportError instead of the statsError, virXenInotifyError, virXenStoreError, virXendError, xenUnifiedError, xenXMError custom macros
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 6 - src/xen/block_stats.c | 54 +++--- src/xen/xen_driver.c | 114 ++++++------ src/xen/xen_hypervisor.c | 211 +++++++++++---------- src/xen/xen_inotify.c | 48 +++-- src/xen/xend_internal.c | 461 +++++++++++++++++++++++----------------------- src/xen/xm_internal.c | 134 +++++++------- src/xen/xs_internal.c | 40 ++-- 8 files changed, 514 insertions(+), 554 deletions(-)
diff --git a/cfg.mk b/cfg.mk
ACK to changes in this file
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
ACK to changes in this file.
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index b4ec579..21ea07d 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -874,11 +874,6 @@ struct xenUnifiedDriver xenHypervisorDriver = { .xenDomainSetSchedulerParameters = xenHypervisorSetSchedulerParameters, };
-#define virXenError(code, ...) \ - if (in_init == 0) \ - virReportErrorHelper(VIR_FROM_XEN, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) -
This error reporting macro is different from the other ones you nuked in the previous patches. This one does not print the error if the global static variable "in_init" in xen_hypervisor.c is non-zero. Skimming through the code in xenHypervisorInit the program flow may leave the function without reseting in_init to 0 and thus suppressing error reporting from all parts of this file. Also in_init is compared only in that macro, so removing the use of that makes that variable pointless. I don't know if suppressing errors during init of xen driver is needed but either way, this part wil need tweaking. NACK to changes in this file until it gets cleared.
/** * xenHypervisorDoV0Op: * @handle: the handle to the Xen hypervisor @@ -901,18 +896,18 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op) hc.arg[0] = (unsigned long) op;
if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; }
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " ioctl %d", + xen_ioctl_hypercall_cmd); }
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; }
@@ -943,18 +938,18 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op) hc.arg[0] = (unsigned long) op;
if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; }
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " ioctl %d", + xen_ioctl_hypercall_cmd); }
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; }
@@ -986,18 +981,18 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op) hc.arg[0] = (unsigned long) op;
if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; }
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " sys ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " sys ioctl %d", + xen_ioctl_hypercall_cmd); }
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; }
@@ -1029,18 +1024,18 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op) hc.arg[0] = (unsigned long) op;
if (lock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; }
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc); if (ret < 0) { - virXenError(VIR_ERR_XEN_CALL, " ioctl %d", - xen_ioctl_hypercall_cmd); + virReportError(VIR_ERR_XEN_CALL, " ioctl %d", + xen_ioctl_hypercall_cmd); }
if (unlock_pages(op, sizeof(dom0_op_t)) < 0) { - virXenError(VIR_ERR_XEN_CALL, " releasing"); + virReportError(VIR_ERR_XEN_CALL, " releasing"); ret = -1; }
@@ -1069,7 +1064,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos), XEN_GETDOMAININFO_SIZE * maxids) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } if (hv_versions.hypervisor > 1) { @@ -1124,7 +1119,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids, } if (unlock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos), XEN_GETDOMAININFO_SIZE * maxids) < 0) { - virXenError(VIR_ERR_XEN_CALL, " release"); + virReportError(VIR_ERR_XEN_CALL, " release"); ret = -1; } return ret; @@ -1161,20 +1156,20 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams) xenUnifiedPrivatePtr priv;
if (domain->conn == NULL) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain or conn is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain or conn is NULL")); return NULL; }
priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return NULL; } if (domain->id < 0) { - virXenError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); return NULL; }
@@ -1184,8 +1179,8 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams) * TODO: check on Xen 3.0.3 */ if (hv_versions.dom_interface < 5) { - virXenError(VIR_ERR_NO_XEN, "%s", - _("unsupported in dom interface < 5")); + virReportError(VIR_ERR_NO_XEN, "%s", + _("unsupported in dom interface < 5")); return NULL; }
@@ -1242,20 +1237,20 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, xenUnifiedPrivatePtr priv;
if (domain->conn == NULL) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain or conn is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain or conn is NULL")); return -1; }
priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return -1; } if (domain->id < 0) { - virXenError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); return -1; }
@@ -1265,8 +1260,8 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, * TODO: check on Xen 3.0.3 */ if (hv_versions.dom_interface < 5) { - virXenError(VIR_ERR_NO_XEN, "%s", - _("unsupported in dom interface < 5")); + virReportError(VIR_ERR_NO_XEN, "%s", + _("unsupported in dom interface < 5")); return -1; }
@@ -1284,8 +1279,8 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, switch (op_sys.u.getschedulerid.sched_id){ case XEN_SCHEDULER_SEDF: if (*nparams < XEN_SCHED_SEDF_NPARAM) { - virXenError(VIR_ERR_INVALID_ARG, - "%s", _("Invalid parameter count")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("Invalid parameter count")); return -1; }
@@ -1319,9 +1314,9 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain, *nparams = XEN_SCHED_CRED_NPARAM; break; default: - virXenError(VIR_ERR_INVALID_ARG, - _("Unknown scheduler %d"), - op_sys.u.getschedulerid.sched_id); + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown scheduler %d"), + op_sys.u.getschedulerid.sched_id); return -1; } } @@ -1348,8 +1343,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, char buf[256];
if (domain->conn == NULL) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain or conn is NULL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain or conn is NULL")); return -1; }
@@ -1368,13 +1363,13 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
priv = (xenUnifiedPrivatePtr) domain->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return -1; } if (domain->id < 0) { - virXenError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); return -1; }
@@ -1384,8 +1379,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, * TODO: check on Xen 3.0.3 */ if (hv_versions.dom_interface < 5) { - virXenError(VIR_ERR_NO_XEN, "%s", - _("unsupported in dom interface < 5")); + virReportError(VIR_ERR_NO_XEN, "%s", + _("unsupported in dom interface < 5")); return -1; }
@@ -1423,18 +1418,18 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT)) { val = params[i].value.ui; if ((val < 1) || (val > USHRT_MAX)) { - virXenError(VIR_ERR_INVALID_ARG, - _("Credit scheduler weight parameter (%d) " - "is out of range (1-65535)"), val); + virReportError(VIR_ERR_INVALID_ARG, + _("Credit scheduler weight parameter (%d) " + "is out of range (1-65535)"), val); return -1; } op_dom.u.getschedinfo.u.credit.weight = val; } else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_CAP)) { val = params[i].value.ui; if (val >= USHRT_MAX) { - virXenError(VIR_ERR_INVALID_ARG, - _("Credit scheduler cap parameter (%d) is " - "out of range (0-65534)"), val); + virReportError(VIR_ERR_INVALID_ARG, + _("Credit scheduler cap parameter (%d) is " + "out of range (0-65534)"), val); return -1; } op_dom.u.getschedinfo.u.credit.cap = val; @@ -1447,9 +1442,9 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain, break; } default: - virXenError(VIR_ERR_INVALID_ARG, - _("Unknown scheduler %d"), - op_sys.u.getschedulerid.sched_id); + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown scheduler %d"), + op_sys.u.getschedulerid.sched_id); return -1; } } @@ -1474,8 +1469,8 @@ xenHypervisorDomainBlockStats (virDomainPtr dom, xenUnifiedUnlock(priv); return ret; #else - virXenError(VIR_ERR_OPERATION_INVALID, "%s", - _("block statistics not supported on this platform")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("block statistics not supported on this platform")); return -1; #endif } @@ -1499,20 +1494,20 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom, * domain. */ if (sscanf(path, "vif%d.%d", &rqdomid, &device) != 2) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid path, should be vif<domid>.<n>.")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid path, should be vif<domid>.<n>.")); return -1; } if (rqdomid != dom->id) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid path, vif<domid> should match this domain ID")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid path, vif<domid> should match this domain ID")); return -1; }
return linuxDomainInterfaceStats(path, stats); #else - virXenError(VIR_ERR_OPERATION_INVALID, "%s", - _("/proc/net/dev: Interface not found")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("/proc/net/dev: Interface not found")); return -1; #endif } @@ -1748,7 +1743,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu, xen_op_v2_dom op;
if (lock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } memset(&op, 0, sizeof(op)); @@ -1783,7 +1778,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu, VIR_FREE(new);
if (unlock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " release"); + virReportError(VIR_ERR_XEN_CALL, " release"); ret = -1; } } else { @@ -1880,7 +1875,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt, } if ((cpumap != NULL) && (maplen > 0)) { if (lock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " locking"); + virReportError(VIR_ERR_XEN_CALL, " locking"); return -1; } memset(cpumap, 0, maplen); @@ -1898,7 +1893,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt, } ret = xenHypervisorDoV2Dom(handle, &op); if (unlock_pages(cpumap, maplen) < 0) { - virXenError(VIR_ERR_XEN_CALL, " release"); + virReportError(VIR_ERR_XEN_CALL, " release"); ret = -1; } } @@ -1998,7 +1993,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) char error[100]; regerror (errcode, &flags_hvm_rec, error, sizeof(error)); regfree (&flags_hvm_rec); - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error); in_init = 0; return -1; } @@ -2008,7 +2003,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) regerror (errcode, &flags_pae_rec, error, sizeof(error)); regfree (&flags_pae_rec); regfree (&flags_hvm_rec); - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error); in_init = 0; return -1; } @@ -2019,7 +2014,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) regfree (&xen_cap_rec); regfree (&flags_pae_rec); regfree (&flags_hvm_rec); - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error); in_init = 0; return -1; } @@ -2079,8 +2074,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions) */
hv_versions.hypervisor = -1; - virXenError(VIR_ERR_XEN_CALL, " ioctl %lu", - (unsigned long) IOCTL_PRIVCMD_HYPERCALL); + virReportError(VIR_ERR_XEN_CALL, " ioctl %lu", + (unsigned long) IOCTL_PRIVCMD_HYPERCALL); VIR_FORCE_CLOSE(fd); in_init = 0; return -1; @@ -2184,8 +2179,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
VIR_DEBUG("Failed to find any Xen hypervisor method"); hv_versions.hypervisor = -1; - virXenError(VIR_ERR_XEN_CALL, " ioctl %lu", - (unsigned long)IOCTL_PRIVCMD_HYPERCALL); + virReportError(VIR_ERR_XEN_CALL, " ioctl %lu", + (unsigned long)IOCTL_PRIVCMD_HYPERCALL); VIR_FORCE_CLOSE(fd); in_init = 0; VIR_FREE(ipt); @@ -2226,7 +2221,7 @@ xenHypervisorOpen(virConnectPtr conn,
ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR); if (ret < 0) { - virXenError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET); + virReportError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET); return -1; }
@@ -2925,30 +2920,30 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
priv = (xenUnifiedPrivatePtr) dom->conn->privateData; if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain shut off or invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain shut off or invalid")); return NULL; }
/* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/ if (hv_versions.hypervisor < 2 || hv_versions.dom_interface < 4) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unsupported in dom interface < 4")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unsupported in dom interface < 4")); return NULL; }
XEN_GETDOMAININFO_CLEAR(dominfo);
if (virXen_getdomaininfo(priv->handle, dom->id, &dominfo) < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get domain details")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get domain details")); return NULL; }
if (XEN_GETDOMAININFO_DOMAIN(dominfo) != dom->id) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get domain details")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get domain details")); return NULL; }
@@ -3347,21 +3342,21 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free xenUnifiedPrivatePtr priv;
if (conn == NULL) { - virXenError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument")); return -1; }
priv = conn->privateData;
if (priv->nbNodeCells < 0) { - virXenError(VIR_ERR_XEN_CALL, "%s", - _("cannot determine actual number of cells")); + virReportError(VIR_ERR_XEN_CALL, "%s", + _("cannot determine actual number of cells")); return -1; }
if ((maxCells < 1) || (startCell >= priv->nbNodeCells)) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid argument")); return -1; }
@@ -3369,14 +3364,14 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free * Support only hv_versions.sys_interface >=4 */ if (hv_versions.sys_interface < SYS_IFACE_MIN_VERS_NUMA) { - virXenError(VIR_ERR_XEN_CALL, "%s", - _("unsupported in sys interface < 4")); + virReportError(VIR_ERR_XEN_CALL, "%s", + _("unsupported in sys interface < 4")); return -1; }
if (priv->handle < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("priv->handle invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("priv->handle invalid")); return -1; }
@@ -3617,13 +3612,13 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, if (priv->handle < 0 || (domain->id < 0) || (info == NULL) || (maxinfo < 1) || (sizeof(cpumap_t) & 7)) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("domain shut off or invalid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("domain shut off or invalid")); return -1; } if ((cpumaps != NULL) && (maplen < 1)) { - virXenError(VIR_ERR_INVALID_ARG, "%s", - _("invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("invalid argument")); return -1; } /* first get the number of virtual CPUs in this domain */ @@ -3632,8 +3627,8 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, &dominfo);
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get domain details")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get domain details")); return -1; } nbinfo = XEN_GETDOMAININFO_CPUCOUNT(dominfo) + 1; @@ -3649,16 +3644,16 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, (unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i), maplen); if (ret < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get VCPUs info")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get VCPUs info")); return -1; } } else { ret = virXen_getvcpusinfo(priv->handle, domain->id, i, ipt, NULL, 0); if (ret < 0) { - virXenError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get VCPUs info")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get VCPUs info")); return -1; } }
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
ACK to changes in this file.
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
ACK to changes in this file.
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
ACK to changes in this file.
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
ACK to changes in this file. Apart from the problematic macro in src/xen/xen_hypervisor.c and some pre-existing virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__) this patch looks fine, but I have to give: NACK until src/xen/xen_hypervisor.c gets clarified. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the ESX driver to use virReportError instead of the ESX_ERROR & ESX_VI_ERROR custom macros Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 2 - src/esx/esx_driver.c | 422 ++++++++++++++-------------- src/esx/esx_private.h | 4 - src/esx/esx_storage_driver.c | 100 +++---- src/esx/esx_util.c | 74 ++--- src/esx/esx_vi.c | 626 +++++++++++++++++++++--------------------- src/esx/esx_vi.h | 7 - src/esx/esx_vi_methods.c | 12 +- src/esx/esx_vi_types.c | 216 +++++++-------- 9 files changed, 725 insertions(+), 738 deletions(-) diff --git a/cfg.mk b/cfg.mk index d813f34..5e8958b 100644 --- a/cfg.mk +++ b/cfg.mk @@ -506,8 +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 += ESX_ERROR -msg_gen_function += ESX_VI_ERROR msg_gen_function += HYPERV_ERROR msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index db2144c..1aab6a7 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -213,9 +213,9 @@ esxParseVMXFileName(const char *fileName, void *opaque) if ((tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) == NULL || (datastoreName = strtok_r(tmp, "/", &saveptr)) == NULL || (directoryAndFileName = strtok_r(NULL, "", &saveptr)) == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("File name '%s' doesn't have expected format " - "'/vmfs/volumes/<datastore>/<path>'"), fileName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("File name '%s' doesn't have expected format " + "'/vmfs/volumes/<datastore>/<path>'"), fileName); goto cleanup; } @@ -228,9 +228,9 @@ esxParseVMXFileName(const char *fileName, void *opaque) } if (datastoreList == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("File name '%s' refers to non-existing datastore '%s'"), - fileName, datastoreName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("File name '%s' refers to non-existing datastore '%s'"), + fileName, datastoreName); goto cleanup; } @@ -250,8 +250,8 @@ esxParseVMXFileName(const char *fileName, void *opaque) } if (result == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not handle file name '%s'"), fileName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not handle file name '%s'"), fileName); goto cleanup; } } @@ -352,8 +352,8 @@ esxFormatVMXFileName(const char *fileName, void *opaque) goto cleanup; } } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not handle file name '%s'"), fileName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not handle file name '%s'"), fileName); goto cleanup; } @@ -407,8 +407,8 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model, vmDiskFileInfo = esxVI_VmDiskFileInfo_DynamicCast(fileInfo); if (vmDiskFileInfo == NULL || vmDiskFileInfo->controllerType == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not lookup controller model for '%s'"), def->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not lookup controller model for '%s'"), def->src); goto cleanup; } @@ -425,9 +425,9 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model, "ParaVirtualSCSIController")) { *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI; } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Found unexpected controller model '%s' for disk '%s'"), - vmDiskFileInfo->controllerType, def->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Found unexpected controller model '%s' for disk '%s'"), + vmDiskFileInfo->controllerType, def->src); goto cleanup; } @@ -468,8 +468,8 @@ esxSupportsLongMode(esxPrivate *priv) } if (hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the HostSystem object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the HostSystem object")); goto cleanup; } @@ -496,11 +496,11 @@ esxSupportsLongMode(esxPrivate *priv) } else if (edxLongModeBit == '0') { priv->supportsLongMode = esxVI_Boolean_False; } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Bit 29 (Long Mode) of HostSystem property " - "'hardware.cpuFeature[].edx' with value '%s' " - "has unexpected value '%c', expecting '0' " - "or '1'"), hostCpuIdInfo->edx, edxLongModeBit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Bit 29 (Long Mode) of HostSystem property " + "'hardware.cpuFeature[].edx' with value '%s' " + "has unexpected value '%c', expecting '0' " + "or '1'"), hostCpuIdInfo->edx, edxLongModeBit); goto cleanup; } @@ -548,8 +548,8 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid) } if (hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the HostSystem object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the HostSystem object")); goto cleanup; } @@ -686,7 +686,7 @@ esxConnectToHost(virConnectPtr conn, : esxVI_ProductVersion_GSX; if (vCenterIpAddress == NULL || *vCenterIpAddress != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -705,7 +705,7 @@ esxConnectToHost(virConnectPtr conn, username = virAuthGetUsername(conn, auth, "esx", "root", conn->uri->server); if (username == NULL) { - ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed")); goto cleanup; } } @@ -713,7 +713,7 @@ esxConnectToHost(virConnectPtr conn, unescapedPassword = virAuthGetPassword(conn, auth, "esx", username, conn->uri->server); if (unescapedPassword == NULL) { - ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed")); goto cleanup; } @@ -743,15 +743,15 @@ esxConnectToHost(virConnectPtr conn, priv->host->productVersion != esxVI_ProductVersion_ESX4x && priv->host->productVersion != esxVI_ProductVersion_ESX50 && priv->host->productVersion != esxVI_ProductVersion_ESX5x) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("%s is neither an ESX 3.5, 4.x nor 5.x host"), - conn->uri->server); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is neither an ESX 3.5, 4.x nor 5.x host"), + conn->uri->server); goto cleanup; } } else { /* GSX */ if (priv->host->productVersion != esxVI_ProductVersion_GSX20) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("%s isn't a GSX 2.0 host"), conn->uri->server); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s isn't a GSX 2.0 host"), conn->uri->server); goto cleanup; } } @@ -816,8 +816,8 @@ esxConnectToVCenter(virConnectPtr conn, if (hostSystemIpAddress == NULL && (priv->parsedUri->path == NULL || STREQ(priv->parsedUri->path, "/"))) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Path has to specify the datacenter and compute resource")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Path has to specify the datacenter and compute resource")); return -1; } @@ -836,7 +836,7 @@ esxConnectToVCenter(virConnectPtr conn, username = virAuthGetUsername(conn, auth, "esx", "administrator", hostname); if (username == NULL) { - ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Username request failed")); goto cleanup; } } @@ -844,7 +844,7 @@ esxConnectToVCenter(virConnectPtr conn, unescapedPassword = virAuthGetPassword(conn, auth, "esx", username, hostname); if (unescapedPassword == NULL) { - ESX_ERROR(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", _("Password request failed")); goto cleanup; } @@ -872,9 +872,9 @@ esxConnectToVCenter(virConnectPtr conn, priv->vCenter->productVersion != esxVI_ProductVersion_VPX4x && priv->vCenter->productVersion != esxVI_ProductVersion_VPX50 && priv->vCenter->productVersion != esxVI_ProductVersion_VPX5x) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("%s is neither a vCenter 2.5, 4.x nor 5.x server"), - hostname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is neither a vCenter 2.5, 4.x nor 5.x server"), + hostname); goto cleanup; } @@ -982,9 +982,9 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, return VIR_DRV_OPEN_DECLINED; } - ESX_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; } @@ -996,15 +996,15 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, /* Require server part */ if (conn->uri->server == NULL) { - ESX_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) { - ESX_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; } @@ -1060,16 +1060,16 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, if (priv->parsedUri->vCenter != NULL) { if (STREQ(priv->parsedUri->vCenter, "*")) { if (potentialVCenterIpAddress == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("This host is not managed by a vCenter")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("This host is not managed by a vCenter")); goto cleanup; } if (virStrcpyStatic(vCenterIpAddress, potentialVCenterIpAddress) == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("vCenter IP address %s too big for destination"), - potentialVCenterIpAddress); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("vCenter IP address %s too big for destination"), + potentialVCenterIpAddress); goto cleanup; } } else { @@ -1080,12 +1080,12 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, if (potentialVCenterIpAddress != NULL && STRNEQ(vCenterIpAddress, potentialVCenterIpAddress)) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("This host is managed by a vCenter with IP " - "address %s, but a mismachting vCenter '%s' " - "(%s) has been specified"), - potentialVCenterIpAddress, priv->parsedUri->vCenter, - vCenterIpAddress); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("This host is managed by a vCenter with IP " + "address %s, but a mismachting vCenter '%s' " + "(%s) has been specified"), + potentialVCenterIpAddress, priv->parsedUri->vCenter, + vCenterIpAddress); goto cleanup; } } @@ -1181,8 +1181,8 @@ esxSupportsVMotion(esxPrivate *priv) } if (hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the HostSystem object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the HostSystem object")); goto cleanup; } @@ -1245,9 +1245,9 @@ esxGetVersion(virConnectPtr conn, unsigned long *version) if (virParseVersionString(priv->primary->service->about->version, version, false) < 0) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse version number from '%s'"), - priv->primary->service->about->version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse version number from '%s'"), + priv->primary->service->about->version); return -1; } @@ -1282,8 +1282,8 @@ esxGetHostname(virConnectPtr conn) } if (hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the HostSystem object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the HostSystem object")); goto cleanup; } @@ -1311,8 +1311,8 @@ esxGetHostname(virConnectPtr conn) } if (hostName == NULL || strlen(hostName) < 1) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing or empty 'hostName' property")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing or empty 'hostName' property")); goto cleanup; } @@ -1380,8 +1380,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo) } if (hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the HostSystem object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the HostSystem object")); goto cleanup; } @@ -1461,9 +1461,9 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo) if (virStrncpy(nodeinfo->model, dynamicProperty->val->string, sizeof(nodeinfo->model) - 1, sizeof(nodeinfo->model)) == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("CPU Model %s too long for destination"), - dynamicProperty->val->string); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CPU Model %s too long for destination"), + dynamicProperty->val->string); goto cleanup; } } else { @@ -1550,9 +1550,9 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids) if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value, &ids[count]) < 0 || ids[count] <= 0) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse positive integer from '%s'"), - virtualMachine->obj->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to parse positive integer from '%s'"), + virtualMachine->obj->value); goto cleanup; } @@ -1652,7 +1652,7 @@ esxDomainLookupByID(virConnectPtr conn, int id) } if (domain == NULL) { - ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id); + virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id); } cleanup: @@ -1740,7 +1740,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name) } if (virtualMachine == NULL) { - ESX_ERROR(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"), name); + virReportError(VIR_ERR_NO_DOMAIN, _("No domain with name '%s'"), name); goto cleanup; } @@ -1797,8 +1797,8 @@ esxDomainSuspend(virDomainPtr domain) } if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not powered on")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not powered on")); goto cleanup; } @@ -1811,8 +1811,8 @@ esxDomainSuspend(virDomainPtr domain) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not suspend domain: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not suspend domain: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -1855,7 +1855,7 @@ esxDomainResume(virDomainPtr domain) } if (powerState != esxVI_VirtualMachinePowerState_Suspended) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not suspended")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not suspended")); goto cleanup; } @@ -1869,8 +1869,8 @@ esxDomainResume(virDomainPtr domain) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not resume domain: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not resume domain: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -1912,8 +1912,8 @@ esxDomainShutdownFlags(virDomainPtr domain, unsigned int flags) } if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not powered on")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not powered on")); goto cleanup; } @@ -1963,8 +1963,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags) } if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not powered on")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not powered on")); goto cleanup; } @@ -2019,8 +2019,8 @@ esxDomainDestroyFlags(virDomainPtr domain, } if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not powered on")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not powered on")); goto cleanup; } @@ -2033,8 +2033,8 @@ esxDomainDestroyFlags(virDomainPtr domain, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not destroy domain: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not destroy domain: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -2103,9 +2103,9 @@ esxDomainGetMaxMemory(virDomainPtr domain) } if (dynamicProperty->val->int32 < 0) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Got invalid memory size %d"), - dynamicProperty->val->int32); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Got invalid memory size %d"), + dynamicProperty->val->int32); } else { memoryMB = dynamicProperty->val->int32; } @@ -2152,8 +2152,8 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) } if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not powered off")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not powered off")); goto cleanup; } @@ -2176,9 +2176,9 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not set max-memory to %lu kilobytes: %s"), memory, - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not set max-memory to %lu kilobytes: %s"), memory, + taskInfoErrorMessage); goto cleanup; } @@ -2233,9 +2233,9 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not set memory to %lu kilobytes: %s"), memory, - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not set memory to %lu kilobytes: %s"), memory, + taskInfoErrorMessage); goto cleanup; } @@ -2469,9 +2469,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase); if (perfEntityMetric == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("QueryPerf returned object with unexpected type '%s'"), - esxVI_Type_ToString(perfEntityMetricBase->_type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("QueryPerf returned object with unexpected type '%s'"), + esxVI_Type_ToString(perfEntityMetricBase->_type)); goto cleanup; } @@ -2479,9 +2479,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value); if (perfMetricIntSeries == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("QueryPerf returned object with unexpected type '%s'"), - esxVI_Type_ToString(perfEntityMetric->value->_type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("QueryPerf returned object with unexpected type '%s'"), + esxVI_Type_ToString(perfEntityMetric->value->_type)); goto cleanup; } @@ -2597,13 +2597,13 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, char *taskInfoErrorMessage = NULL; if (flags != VIR_DOMAIN_AFFECT_LIVE) { - ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } if (nvcpus < 1) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Requested number of virtual CPUs must at least be 1")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Requested number of virtual CPUs must at least be 1")); return -1; } @@ -2618,10 +2618,10 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, } if (nvcpus > maxVcpus) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Requested number of virtual CPUs is greater than max " - "allowable number of virtual CPUs for the domain: %d > %d"), - nvcpus, maxVcpus); + virReportError(VIR_ERR_INVALID_ARG, + _("Requested number of virtual CPUs is greater than max " + "allowable number of virtual CPUs for the domain: %d > %d"), + nvcpus, maxVcpus); return -1; } @@ -2645,9 +2645,9 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not set number of virtual CPUs to %d: %s"), nvcpus, - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not set number of virtual CPUs to %d: %s"), nvcpus, + taskInfoErrorMessage); goto cleanup; } @@ -2681,7 +2681,7 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) esxVI_DynamicProperty *dynamicProperty = NULL; if (flags != (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { - ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); + virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags); return -1; } @@ -2703,8 +2703,8 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) } if (hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the HostSystem object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the HostSystem object")); goto cleanup; } @@ -2873,8 +2873,8 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat, memset(&data, 0, sizeof(data)); if (STRNEQ(nativeFormat, "vmware-vmx")) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Unsupported config format '%s'"), nativeFormat); + virReportError(VIR_ERR_INVALID_ARG, + _("Unsupported config format '%s'"), nativeFormat); return NULL; } @@ -2916,8 +2916,8 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat, memset(&data, 0, sizeof(data)); if (STRNEQ(nativeFormat, "vmware-vmx")) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Unsupported config format '%s'"), nativeFormat); + virReportError(VIR_ERR_INVALID_ARG, + _("Unsupported config format '%s'"), nativeFormat); return NULL; } @@ -3069,8 +3069,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) } if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not powered off")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not powered off")); goto cleanup; } @@ -3084,8 +3084,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not start domain: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not start domain: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -3167,9 +3167,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) if (virtualMachine != NULL) { /* FIXME */ - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Domain already exists, editing existing domains is not " - "supported yet")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Domain already exists, editing existing domains is not " + "supported yet")); goto cleanup; } @@ -3203,9 +3203,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) * datastore isn't perfect but should work in the majority of cases. */ if (def->ndisks < 1) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Domain XML doesn't contain any disks, cannot deduce " - "datastore and path for VMX file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Domain XML doesn't contain any disks, cannot deduce " + "datastore and path for VMX file")); goto cleanup; } @@ -3218,16 +3218,16 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) } if (disk == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Domain XML doesn't contain any file-based harddisks, " - "cannot deduce datastore and path for VMX file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Domain XML doesn't contain any file-based harddisks, " + "cannot deduce datastore and path for VMX file")); goto cleanup; } if (disk->src == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("First file-based harddisk has no source, cannot deduce " - "datastore and path for VMX file")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("First file-based harddisk has no source, cannot deduce " + "datastore and path for VMX file")); goto cleanup; } @@ -3237,9 +3237,9 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) } if (! virFileHasSuffix(disk->src, ".vmdk")) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting source '%s' of first file-based harddisk to " - "be a VMDK image"), disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting source '%s' of first file-based harddisk to " + "be a VMDK image"), disk->src); goto cleanup; } @@ -3308,8 +3308,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not define domain: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not define domain: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -3382,8 +3382,8 @@ esxDomainUndefineFlags(virDomainPtr domain, if (powerState != esxVI_VirtualMachinePowerState_Suspended && powerState != esxVI_VirtualMachinePowerState_PoweredOff) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Domain is not suspended or powered off")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Domain is not suspended or powered off")); goto cleanup; } @@ -3528,9 +3528,9 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart) for (powerInfo = powerInfoList; powerInfo != NULL; powerInfo = powerInfo->_next) { if (STRNEQ(powerInfo->key->value, virtualMachine->obj->value)) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Cannot enable general autostart option " - "without affecting other domains")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Cannot enable general autostart option " + "without affecting other domains")); goto cleanup; } } @@ -3735,9 +3735,9 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain, break; default: - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Shares level has unknown value %d"), - (int)sharesInfo->level); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Shares level has unknown value %d"), + (int)sharesInfo->level); goto cleanup; } @@ -3813,9 +3813,9 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain, } if (params[i].value.l < 0) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Could not set reservation to %lld MHz, expecting " - "positive value"), params[i].value.l); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not set reservation to %lld MHz, expecting " + "positive value"), params[i].value.l); goto cleanup; } @@ -3826,10 +3826,10 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain, } if (params[i].value.l < -1) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Could not set limit to %lld MHz, expecting " - "positive value or -1 (unlimited)"), - params[i].value.l); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not set limit to %lld MHz, expecting " + "positive value or -1 (unlimited)"), + params[i].value.l); goto cleanup; } @@ -3865,10 +3865,10 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain, break; default: - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Could not set shares to %d, expecting positive " - "value or -1 (low), -2 (normal) or -3 (high)"), - params[i].value.i); + virReportError(VIR_ERR_INVALID_ARG, + _("Could not set shares to %d, expecting positive " + "value or -1 (low), -2 (normal) or -3 (high)"), + params[i].value.i); goto cleanup; } } @@ -3885,9 +3885,9 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not change scheduler parameters: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not change scheduler parameters: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -3971,14 +3971,14 @@ esxDomainMigratePerform(virDomainPtr domain, virCheckFlags(ESX_MIGRATION_FLAGS, -1); if (priv->vCenter == NULL) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Migration not possible without a vCenter")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Migration not possible without a vCenter")); return -1; } if (dname != NULL) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Renaming domains on migration not supported")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Renaming domains on migration not supported")); return -1; } @@ -3991,15 +3991,15 @@ esxDomainMigratePerform(virDomainPtr domain, return -1; if (parsedUri->scheme == NULL || STRCASENEQ(parsedUri->scheme, "vpxmigr")) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Only vpxmigr:// migration URIs are supported")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Only vpxmigr:// migration URIs are supported")); goto cleanup; } if (STRCASENEQ(priv->vCenter->ipAddress, parsedUri->server)) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Migration source and destination have to refer to " - "the same vCenter")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Migration source and destination have to refer to " + "the same vCenter")); goto cleanup; } @@ -4007,8 +4007,8 @@ esxDomainMigratePerform(virDomainPtr domain, path_hostSystem = strtok_r(NULL, "", &saveptr); if (path_resourcePool == NULL || path_hostSystem == NULL) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Migration URI has to specify resource pool and host system")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Migration URI has to specify resource pool and host system")); goto cleanup; } @@ -4042,13 +4042,13 @@ esxDomainMigratePerform(virDomainPtr domain, * to the first event for now. */ if (eventList->fullFormattedMessage != NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not migrate domain, validation reported a " - "problem: %s"), eventList->fullFormattedMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not migrate domain, validation reported a " + "problem: %s"), eventList->fullFormattedMessage); } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not migrate domain, validation reported a " - "problem")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not migrate domain, validation reported a " + "problem")); } goto cleanup; @@ -4068,10 +4068,10 @@ esxDomainMigratePerform(virDomainPtr domain, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not migrate domain, migration task finished with " - "an error: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not migrate domain, migration task finished with " + "an error: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -4143,8 +4143,8 @@ esxNodeGetFreeMemory(virConnectPtr conn) } if (resourcePoolResourceUsage == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve memory usage of resource pool")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve memory usage of resource pool")); goto cleanup; } @@ -4324,8 +4324,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc, } if (def->ndisks) { - ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk snapshots not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk snapshots not supported yet")); return NULL; } @@ -4341,8 +4341,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc, } if (snapshotTree != NULL) { - ESX_ERROR(VIR_ERR_OPERATION_INVALID, - _("Snapshot '%s' already exists"), def->name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Snapshot '%s' already exists"), def->name); goto cleanup; } @@ -4358,8 +4358,8 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char *xmlDesc, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not create snapshot: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not create snapshot: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -4486,7 +4486,7 @@ esxDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen, leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0; if (names == NULL || nameslen < 0) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument")); return -1; } @@ -4579,7 +4579,7 @@ esxDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot, leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0; if (names == NULL || nameslen < 0) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument")); return -1; } @@ -4701,9 +4701,9 @@ esxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, unsigned int flags) } if (!snapshotTreeParent) { - ESX_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("snapshot '%s' does not have a parent"), - snapshotTree->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("snapshot '%s' does not have a parent"), + snapshotTree->name); goto cleanup; } @@ -4849,9 +4849,9 @@ esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned int flags) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not revert to snapshot '%s': %s"), snapshot->name, - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not revert to snapshot '%s': %s"), snapshot->name, + taskInfoErrorMessage); goto cleanup; } @@ -4915,9 +4915,9 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned int flags) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not delete snapshot '%s': %s"), snapshot->name, - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not delete snapshot '%s': %s"), snapshot->name, + taskInfoErrorMessage); goto cleanup; } @@ -4986,9 +4986,9 @@ esxDomainSetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not change memory parameters: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not change memory parameters: %s"), + taskInfoErrorMessage); goto cleanup; } diff --git a/src/esx/esx_private.h b/src/esx/esx_private.h index 3fcc001..58d1233 100644 --- a/src/esx/esx_private.h +++ b/src/esx/esx_private.h @@ -28,10 +28,6 @@ # include "capabilities.h" # include "esx_vi.h" -# define ESX_ERROR(code, ...) \ - virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - typedef struct _esxPrivate { esxVI_Context *primary; /* points to host or vCenter */ esxVI_Context *host; diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c index 9b64891..b200e56 100644 --- a/src/esx/esx_storage_driver.c +++ b/src/esx/esx_storage_driver.c @@ -84,8 +84,8 @@ esxStoragePoolLookupType(esxVI_Context *ctx, const char *poolName, } else if (esxVI_VmfsDatastoreInfo_DynamicCast(datastoreInfo) != NULL) { *poolType = VIR_STORAGE_POOL_FS; } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("DatastoreInfo has unexpected type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("DatastoreInfo has unexpected type")); goto cleanup; } @@ -336,9 +336,9 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (datastore == NULL) { virUUIDFormat(uuid, uuid_string); - ESX_VI_ERROR(VIR_ERR_NO_STORAGE_POOL, - _("Could not find datastore with UUID '%s'"), - uuid_string); + virReportError(VIR_ERR_NO_STORAGE_POOL, + _("Could not find datastore with UUID '%s'"), + uuid_string); goto cleanup; } @@ -557,9 +557,9 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags) } else if (STRCASEEQ(nasInfo->nas->type, "CIFS")) { def.source.format = VIR_STORAGE_POOL_NETFS_CIFS; } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Datastore has unexpected type '%s'"), - nasInfo->nas->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Datastore has unexpected type '%s'"), + nasInfo->nas->type); goto cleanup; } } else if (esxVI_VmfsDatastoreInfo_DynamicCast(info) != NULL) { @@ -569,8 +569,8 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags) * VMFS based datastore in libvirt terms */ } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("DatastoreInfo has unexpected type")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("DatastoreInfo has unexpected type")); goto cleanup; } @@ -607,8 +607,8 @@ esxStoragePoolSetAutostart(virStoragePoolPtr pool ATTRIBUTE_UNUSED, autostart = (autostart != 0); if (! autostart) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot deactivate storage pool autostart")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot deactivate storage pool autostart")); return -1; } @@ -670,7 +670,7 @@ esxStoragePoolListStorageVolumes(virStoragePoolPtr pool, char **const names, int i; if (names == NULL || maxnames < 0) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument")); return -1; } @@ -837,9 +837,9 @@ esxStorageVolumeLookupByKey(virConnectPtr conn, const char *key) } if (!priv->primary->hasQueryVirtualDiskUuid) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("QueryVirtualDiskUuid not available, cannot lookup storage " - "volume by UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("QueryVirtualDiskUuid not available, cannot lookup storage " + "volume by UUID")); return NULL; } @@ -999,8 +999,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc, } if (def->type != VIR_STORAGE_VOL_FILE) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Creating non-file volumes is not supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Creating non-file volumes is not supported")); goto cleanup; } @@ -1008,16 +1008,16 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc, tmp = strrchr(def->name, '/'); if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Volume name '%s' doesn't have expected format " - "'<directory>/<file>'"), def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Volume name '%s' doesn't have expected format " + "'<directory>/<file>'"), def->name); goto cleanup; } if (! virFileHasSuffix(def->name, ".vmdk")) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Volume name '%s' has unsupported suffix, expecting '.vmdk'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Volume name '%s' has unsupported suffix, expecting '.vmdk'"), + def->name); goto cleanup; } @@ -1095,8 +1095,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc, */ virtualDiskSpec->diskType = (char *)"thin"; } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unsupported capacity-to-allocation relation")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unsupported capacity-to-allocation relation")); goto cleanup; } @@ -1122,8 +1122,8 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not create volume: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not create volume: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -1149,9 +1149,9 @@ esxStorageVolumeCreateXML(virStoragePoolPtr pool, const char *xmldesc, } } } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Creation of %s volumes is not supported"), - virStorageFileFormatTypeToString(def->target.format)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Creation of %s volumes is not supported"), + virStorageFileFormatTypeToString(def->target.format)); goto cleanup; } @@ -1233,8 +1233,8 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc, } if (def->type != VIR_STORAGE_VOL_FILE) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Creating non-file volumes is not supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Creating non-file volumes is not supported")); goto cleanup; } @@ -1242,16 +1242,16 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc, tmp = strrchr(def->name, '/'); if (tmp == NULL || *def->name == '/' || tmp[1] == '\0') { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Volume name '%s' doesn't have expected format " - "'<directory>/<file>'"), def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Volume name '%s' doesn't have expected format " + "'<directory>/<file>'"), def->name); goto cleanup; } if (! virFileHasSuffix(def->name, ".vmdk")) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Volume name '%s' has unsupported suffix, expecting '.vmdk'"), - def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Volume name '%s' has unsupported suffix, expecting '.vmdk'"), + def->name); goto cleanup; } @@ -1324,8 +1324,8 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not copy volume: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not copy volume: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -1351,9 +1351,9 @@ esxStorageVolumeCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc, } } } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Creation of %s volumes is not supported"), - virStorageFileFormatTypeToString(def->target.format)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Creation of %s volumes is not supported"), + virStorageFileFormatTypeToString(def->target.format)); goto cleanup; } @@ -1412,8 +1412,8 @@ esxStorageVolumeDelete(virStorageVolPtr volume, unsigned int flags) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not delete volume: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -1461,8 +1461,8 @@ esxStorageVolumeWipe(virStorageVolPtr volume, unsigned int flags) } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"), - taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not wipe volume: %s"), + taskInfoErrorMessage); goto cleanup; } @@ -1595,8 +1595,8 @@ esxStorageVolumeGetXMLDesc(virStorageVolPtr volume, unsigned int flags) def.target.format = VIR_STORAGE_FILE_RAW; } else { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("File '%s' has unknown type"), datastorePath); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("File '%s' has unknown type"), datastorePath); goto cleanup; } diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c index 478f60b..6ed3a3e 100644 --- a/src/esx/esx_util.c +++ b/src/esx/esx_util.c @@ -50,7 +50,7 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) char *tmp; if (parsedUri == NULL || *parsedUri != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -74,10 +74,10 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) if (STRNEQ((*parsedUri)->transport, "http") && STRNEQ((*parsedUri)->transport, "https")) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Query parameter 'transport' has unexpected value " - "'%s' (should be http|https)"), - (*parsedUri)->transport); + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'transport' has unexpected value " + "'%s' (should be http|https)"), + (*parsedUri)->transport); goto cleanup; } } else if (STRCASEEQ(queryParam->name, "vcenter")) { @@ -92,9 +92,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) } else if (STRCASEEQ(queryParam->name, "no_verify")) { if (virStrToLong_i(queryParam->value, NULL, 10, &noVerify) < 0 || (noVerify != 0 && noVerify != 1)) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Query parameter 'no_verify' has unexpected value " - "'%s' (should be 0 or 1)"), queryParam->value); + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'no_verify' has unexpected value " + "'%s' (should be 0 or 1)"), queryParam->value); goto cleanup; } @@ -102,9 +102,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) } else if (STRCASEEQ(queryParam->name, "auto_answer")) { if (virStrToLong_i(queryParam->value, NULL, 10, &autoAnswer) < 0 || (autoAnswer != 0 && autoAnswer != 1)) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Query parameter 'auto_answer' has unexpected " - "value '%s' (should be 0 or 1)"), queryParam->value); + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'auto_answer' has unexpected " + "value '%s' (should be 0 or 1)"), queryParam->value); goto cleanup; } @@ -128,10 +128,10 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) } else if ((tmp = strstr(queryParam->value, "://")) != NULL) { *tmp = '\0'; - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Query parameter 'proxy' contains unexpected " - "type '%s' (should be (http|socks(|4|4a|5))"), - queryParam->value); + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'proxy' contains unexpected " + "type '%s' (should be (http|socks(|4|4a|5))"), + queryParam->value); goto cleanup; } else { tmp = queryParam->value; @@ -146,9 +146,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) if ((tmp = strchr((*parsedUri)->proxy_hostname, ':')) != NULL) { if (tmp == (*parsedUri)->proxy_hostname) { - ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", - _("Query parameter 'proxy' doesn't contain a " - "hostname")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Query parameter 'proxy' doesn't contain a " + "hostname")); goto cleanup; } @@ -158,9 +158,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri) &(*parsedUri)->proxy_port) < 0 || (*parsedUri)->proxy_port < 1 || (*parsedUri)->proxy_port > 65535) { - ESX_ERROR(VIR_ERR_INVALID_ARG, - _("Query parameter 'proxy' has unexpected port" - "value '%s' (should be [1..65535])"), tmp); + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'proxy' has unexpected port" + "value '%s' (should be [1..65535])"), tmp); goto cleanup; } } @@ -255,7 +255,7 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName, if ((datastoreName != NULL && *datastoreName != NULL) || (directoryName != NULL && *directoryName != NULL) || (directoryAndFileName != NULL && *directoryAndFileName != NULL)) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -266,9 +266,9 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName, /* Expected format: '[<datastore>] <path>' where <path> is optional */ if ((tmp = STRSKIP(copyOfDatastorePath, "[")) == NULL || *tmp == ']' || (preliminaryDatastoreName = strtok_r(tmp, "]", &saveptr)) == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Datastore path '%s' doesn't have expected format " - "'[<datastore>] <path>'"), datastorePath); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Datastore path '%s' doesn't have expected format " + "'[<datastore>] <path>'"), datastorePath); goto cleanup; } @@ -349,16 +349,16 @@ esxUtil_ResolveHostname(const char *hostname, errcode = getaddrinfo(hostname, NULL, &hints, &result); if (errcode != 0) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IP address lookup for host '%s' failed: %s"), hostname, - gai_strerror(errcode)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IP address lookup for host '%s' failed: %s"), hostname, + gai_strerror(errcode)); return -1; } if (result == NULL) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("No IP address for host '%s' found: %s"), hostname, - gai_strerror(errcode)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No IP address for host '%s' found: %s"), hostname, + gai_strerror(errcode)); return -1; } @@ -366,9 +366,9 @@ esxUtil_ResolveHostname(const char *hostname, ipAddress_length, NULL, 0, NI_NUMERICHOST); if (errcode != 0) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Formatting IP address for host '%s' failed: %s"), hostname, - gai_strerror(errcode)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Formatting IP address for host '%s' failed: %s"), hostname, + gai_strerror(errcode)); freeaddrinfo(result); return -1; } @@ -386,9 +386,9 @@ esxUtil_ReformatUuid(const char *input, char *output) unsigned char uuid[VIR_UUID_BUFLEN]; if (virUUIDParse(input, uuid) < 0) { - ESX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse UUID from string '%s'"), - input); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse UUID from string '%s'"), + input); return -1; } diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 48718b6..914102d 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -231,9 +231,9 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url) errorCode = curl_easy_perform(curl->handle); if (errorCode != CURLE_OK) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("curl_easy_perform() returned an error: %s (%d) : %s"), - curl_easy_strerror(errorCode), errorCode, curl->error); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("curl_easy_perform() returned an error: %s (%d) : %s"), + curl_easy_strerror(errorCode), errorCode, curl->error); return -1; } @@ -241,17 +241,17 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url) &responseCode); if (errorCode != CURLE_OK) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an " - "error: %s (%d) : %s"), curl_easy_strerror(errorCode), - errorCode, curl->error); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an " + "error: %s (%d) : %s"), curl_easy_strerror(errorCode), + errorCode, curl->error); return -1; } if (responseCode < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a " - "negative response code")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a " + "negative response code")); return -1; } @@ -261,19 +261,19 @@ esxVI_CURL_Perform(esxVI_CURL *curl, const char *url) &redirectUrl); if (errorCode != CURLE_OK) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned " - "an error: %s (%d) : %s"), - curl_easy_strerror(errorCode), - errorCode, curl->error); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned " + "an error: %s (%d) : %s"), + curl_easy_strerror(errorCode), + errorCode, curl->error); } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("The server redirects from '%s' to '%s'"), url, - redirectUrl); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("The server redirects from '%s' to '%s'"), url, + redirectUrl); } #else - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("The server redirects from '%s'"), url); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("The server redirects from '%s'"), url); #endif return -1; @@ -286,15 +286,15 @@ int esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) { if (curl->handle != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); return -1; } curl->handle = curl_easy_init(); if (curl->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize CURL")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize CURL")); return -1; } @@ -312,8 +312,8 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) curl->headers = curl_slist_append(curl->headers, "Expect:"); if (curl->headers == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not build CURL header list")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not build CURL header list")); return -1; } @@ -346,8 +346,8 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) } if (virMutexInit(&curl->lock) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize CURL mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize CURL mutex")); return -1; } @@ -361,7 +361,7 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char **content) int responseCode = 0; if (content == NULL || *content != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -379,9 +379,9 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char **content) if (responseCode < 0) { goto cleanup; } else if (responseCode != 200) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HTTP response code %d for download from '%s'"), - responseCode, url); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HTTP response code %d for download from '%s'"), + responseCode, url); goto cleanup; } @@ -407,7 +407,7 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char *content) int responseCode = 0; if (content == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -425,9 +425,9 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char *content) if (responseCode < 0) { return -1; } else if (responseCode != 200 && responseCode != 201) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HTTP response code %d for upload to '%s'"), - responseCode, url); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HTTP response code %d for upload to '%s'"), + responseCode, url); return -1; } @@ -525,14 +525,14 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl) int i; if (curl->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot share uninitialized CURL handle")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot share uninitialized CURL handle")); return -1; } if (curl->shared != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot share CURL handle that is already shared")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot share CURL handle that is already shared")); return -1; } @@ -540,8 +540,8 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl) shared->handle = curl_share_init(); if (shared->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize CURL (share)")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize CURL (share)")); return -1; } @@ -557,8 +557,8 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl) for (i = 0; i < ARRAY_CARDINALITY(shared->locks); ++i) { if (virMutexInit(&shared->locks[i]) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize a CURL (share) mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize a CURL (share) mutex")); return -1; } } @@ -580,19 +580,19 @@ int esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxVI_CURL *curl) { if (curl->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot unshare uninitialized CURL handle")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot unshare uninitialized CURL handle")); return -1; } if (curl->shared == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot unshare CURL handle that is not shared")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot unshare CURL handle that is not shared")); return -1; } if (curl->shared != shared) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (share) mismatch")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (share) mismatch")); return -1; } @@ -635,14 +635,14 @@ int esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CURL *curl) { if (curl->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot add uninitialized CURL handle to a multi handle")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot add uninitialized CURL handle to a multi handle")); return -1; } if (curl->multi != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot add CURL handle to a multi handle twice")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot add CURL handle to a multi handle twice")); return -1; } @@ -650,8 +650,8 @@ esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CURL *curl) multi->handle = curl_multi_init(); if (multi->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize CURL (multi)")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize CURL (multi)")); return -1; } } @@ -672,21 +672,21 @@ int esxVI_MultiCURL_Remove(esxVI_MultiCURL *multi, esxVI_CURL *curl) { if (curl->handle == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot remove uninitialized CURL handle from a " - "multi handle")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot remove uninitialized CURL handle from a " + "multi handle")); return -1; } if (curl->multi == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot remove CURL handle from a multi handle when it " - "wasn't added before")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot remove CURL handle from a multi handle when it " + "wasn't added before")); return -1; } if (curl->multi != multi) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (multi) mismatch")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("CURL (multi) mismatch")); return -1; } @@ -748,7 +748,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL || password == NULL || ctx->url != NULL || ctx->service != NULL || ctx->curl != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -767,8 +767,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, } if (virMutexInit(ctx->sessionLock) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize session mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize session mutex")); return -1; } @@ -797,9 +797,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, VIR_WARN("Found untested VI API major/minor version '%s'", ctx->service->about->apiVersion); } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VI API major/minor version '2.5', '4.x' or " - "'5.x' but found '%s'"), ctx->service->about->apiVersion); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VI API major/minor version '2.5', '4.x' or " + "'5.x' but found '%s'"), ctx->service->about->apiVersion); return -1; } @@ -807,9 +807,9 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, if (STRPREFIX(ctx->service->about->version, "2.0")) { ctx->productVersion = esxVI_ProductVersion_GSX20; } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting GSX major/minor version '2.0' but " - "found '%s'"), ctx->service->about->version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting GSX major/minor version '2.0' but " + "found '%s'"), ctx->service->about->version); return -1; } } else if (STREQ(ctx->service->about->productLineId, "esx") || @@ -833,10 +833,10 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, VIR_WARN("Found untested ESX major/minor version '%s'", ctx->service->about->version); } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting ESX major/minor version '3.5', " - "'4.x' or '5.x' but found '%s'"), - ctx->service->about->version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting ESX major/minor version '3.5', " + "'4.x' or '5.x' but found '%s'"), + ctx->service->about->version); return -1; } } else if (STREQ(ctx->service->about->productLineId, "vpx")) { @@ -859,23 +859,23 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, VIR_WARN("Found untested VPX major/minor version '%s'", ctx->service->about->version); } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VPX major/minor version '2.5', '4.x' " - "or '5.x' but found '%s'"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VPX major/minor version '2.5', '4.x' " + "or '5.x' but found '%s'"), ctx->service->about->version); return -1; } } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting product 'gsx' or 'esx' or 'embeddedEsx' " - "or 'vpx' but found '%s'"), - ctx->service->about->productLineId); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting product 'gsx' or 'esx' or 'embeddedEsx' " + "or 'vpx' but found '%s'"), + ctx->service->about->productLineId); return -1; } } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VI API type 'HostAgent' or 'VirtualCenter' " - "but found '%s'"), ctx->service->about->apiType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VI API type 'HostAgent' or 'VirtualCenter' " + "but found '%s'"), ctx->service->about->apiType); return -1; } @@ -927,8 +927,8 @@ esxVI_Context_LookupManagedObjects(esxVI_Context *ctx) } if (ctx->computeResource->resourcePool == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve resource pool")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve resource pool")); return -1; } @@ -979,8 +979,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) item = strtok_r(tmp, "/", &saveptr); if (item == NULL) { - ESX_VI_ERROR(VIR_ERR_INVALID_ARG, - _("Path '%s' does not specify a datacenter"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("Path '%s' does not specify a datacenter"), path); goto cleanup; } @@ -1023,8 +1023,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) } if (ctx->datacenter == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not find datacenter specified in '%s'"), path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find datacenter specified in '%s'"), path); goto cleanup; } @@ -1037,8 +1037,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) /* Lookup (Cluster)ComputeResource */ if (item == NULL) { - ESX_VI_ERROR(VIR_ERR_INVALID_ARG, - _("Path '%s' does not specify a compute resource"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("Path '%s' does not specify a compute resource"), path); goto cleanup; } @@ -1086,15 +1086,15 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) } if (ctx->computeResource == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not find compute resource specified in '%s'"), - path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find compute resource specified in '%s'"), + path); goto cleanup; } if (ctx->computeResource->resourcePool == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve resource pool")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve resource pool")); goto cleanup; } @@ -1109,8 +1109,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) if (STREQ(ctx->computeResource->_reference->type, "ClusterComputeResource")) { if (item == NULL) { - ESX_VI_ERROR(VIR_ERR_INVALID_ARG, - _("Path '%s' does not specify a host system"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("Path '%s' does not specify a host system"), path); goto cleanup; } @@ -1120,8 +1120,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) } if (item != NULL) { - ESX_VI_ERROR(VIR_ERR_INVALID_ARG, - _("Path '%s' ends with an excess item"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("Path '%s' ends with an excess item"), path); goto cleanup; } @@ -1140,8 +1140,8 @@ esxVI_Context_LookupManagedObjectsByPath(esxVI_Context *ctx, const char *path) } if (ctx->hostSystem == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not find host system specified in '%s'"), path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find host system specified in '%s'"), path); goto cleanup; } @@ -1187,8 +1187,8 @@ esxVI_Context_LookupManagedObjectsByHostSystemIp(esxVI_Context *ctx, } if (ctx->computeResource->resourcePool == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve resource pool")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve resource pool")); goto cleanup; } @@ -1220,7 +1220,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, xmlNodePtr responseNode = NULL; if (request == NULL || response == NULL || *response != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1270,25 +1270,25 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, xpathContext); if ((*response)->node == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HTTP response code %d for call to '%s'. " - "Fault is unknown, XPath evaluation failed"), - (*response)->responseCode, methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HTTP response code %d for call to '%s'. " + "Fault is unknown, XPath evaluation failed"), + (*response)->responseCode, methodName); goto cleanup; } if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HTTP response code %d for call to '%s'. " - "Fault is unknown, deserialization failed"), - (*response)->responseCode, methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HTTP response code %d for call to '%s'. " + "Fault is unknown, deserialization failed"), + (*response)->responseCode, methodName); goto cleanup; } - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HTTP response code %d for call to '%s'. " - "Fault: %s - %s"), (*response)->responseCode, - methodName, fault->faultcode, fault->faultstring); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HTTP response code %d for call to '%s'. " + "Fault: %s - %s"), (*response)->responseCode, + methodName, fault->faultcode, fault->faultstring); /* FIXME: Dump raw response until detail part gets deserialized */ VIR_DEBUG("HTTP response code %d for call to '%s' [[[[%s]]]]", @@ -1307,9 +1307,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, responseNode = virXPathNode(xpathExpression, xpathContext); if (responseNode == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("XPath evaluation of response for call to '%s' " - "failed"), methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("XPath evaluation of response for call to '%s' " + "failed"), methodName); goto cleanup; } @@ -1319,14 +1319,14 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, switch (occurrence) { case esxVI_Occurrence_RequiredItem: if ((*response)->node == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Call to '%s' returned an empty result, " - "expecting a non-empty result"), methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Call to '%s' returned an empty result, " + "expecting a non-empty result"), methodName); goto cleanup; } else if ((*response)->node->next != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Call to '%s' returned a list, expecting " - "exactly one item"), methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Call to '%s' returned a list, expecting " + "exactly one item"), methodName); goto cleanup; } @@ -1334,9 +1334,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, case esxVI_Occurrence_RequiredList: if ((*response)->node == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Call to '%s' returned an empty result, " - "expecting a non-empty result"), methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Call to '%s' returned an empty result, " + "expecting a non-empty result"), methodName); goto cleanup; } @@ -1345,9 +1345,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, case esxVI_Occurrence_OptionalItem: if ((*response)->node != NULL && (*response)->node->next != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Call to '%s' returned a list, expecting " - "exactly one item"), methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Call to '%s' returned a list, expecting " + "exactly one item"), methodName); goto cleanup; } @@ -1359,24 +1359,24 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName, case esxVI_Occurrence_None: if ((*response)->node != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Call to '%s' returned something, expecting " - "an empty result"), methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Call to '%s' returned something, expecting " + "an empty result"), methodName); goto cleanup; } break; default: - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid argument (occurrence)")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid argument (occurrence)")); goto cleanup; } } } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HTTP response code %d for call to '%s'"), - (*response)->responseCode, methodName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HTTP response code %d for call to '%s'"), + (*response)->responseCode, methodName); goto cleanup; } @@ -1425,17 +1425,17 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration, int i; if (anyType == NULL || value == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } *value = 0; /* undefined */ if (anyType->type != enumeration->type) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting type '%s' but found '%s'"), - esxVI_Type_ToString(enumeration->type), - esxVI_Type_ToString(anyType->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting type '%s' but found '%s'"), + esxVI_Type_ToString(enumeration->type), + esxVI_Type_ToString(anyType->type)); return -1; } @@ -1446,9 +1446,9 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration, } } - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Unknown value '%s' for %s"), anyType->value, - esxVI_Type_ToString(enumeration->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown value '%s' for %s"), anyType->value, + esxVI_Type_ToString(enumeration->type)); return -1; } @@ -1461,7 +1461,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration, const char *name = NULL; if (element == NULL || output == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1477,7 +1477,7 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration, } if (name == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1500,7 +1500,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration, char *name = NULL; if (value == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1519,8 +1519,8 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration, } if (result < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, _("Unknown value '%s' for %s"), - name, esxVI_Type_ToString(enumeration->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown value '%s' for %s"), + name, esxVI_Type_ToString(enumeration->type)); } VIR_FREE(name); @@ -1540,7 +1540,7 @@ esxVI_List_Append(esxVI_List **list, esxVI_List *item) esxVI_List *next = NULL; if (list == NULL || item == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1569,7 +1569,7 @@ esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList, esxVI_List *src = NULL; if (destList == NULL || *destList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1603,7 +1603,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list, if (list == NULL || *list != NULL || castFromAnyTypeFunc == NULL || freeFunc == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1612,17 +1612,17 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list, } if (! STRPREFIX(anyType->other, "ArrayOf")) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting type to begin with 'ArrayOf' but found '%s'"), - anyType->other); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting type to begin with 'ArrayOf' but found '%s'"), + anyType->other); return -1; } for (childNode = anyType->node->children; childNode != NULL; childNode = childNode->next) { if (childNode->type != XML_ELEMENT_NODE) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Wrong XML element type %d"), childNode->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Wrong XML element type %d"), childNode->type); goto cleanup; } @@ -1658,7 +1658,7 @@ esxVI_List_Serialize(esxVI_List *list, const char *element, esxVI_List *item = NULL; if (element == NULL || output == NULL || serializeFunc == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1684,7 +1684,7 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list, if (list == NULL || *list != NULL || deserializeFunc == NULL || freeFunc == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1694,8 +1694,8 @@ esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list, for (; node != NULL; node = node->next) { if (node->type != XML_ELEMENT_NODE) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Wrong XML element type %d"), node->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Wrong XML element type %d"), node->type); goto failure; } @@ -1730,7 +1730,7 @@ int esxVI_Alloc(void **ptrptr, size_t size) { if (ptrptr == NULL || *ptrptr != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1758,7 +1758,7 @@ esxVI_BuildSelectSet(esxVI_SelectionSpec **selectSet, * Don't check for *selectSet != NULL here because selectSet is a list * and might contain items already. This function appends to selectSet. */ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1897,14 +1897,14 @@ esxVI_EnsureSession(esxVI_Context *ctx) esxVI_UserSession *currentSession = NULL; if (ctx->sessionLock == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no mutex")); return -1; } virMutexLock(ctx->sessionLock); if (ctx->session == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no session")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call, no session")); goto cleanup; } @@ -1962,9 +1962,9 @@ esxVI_EnsureSession(esxVI_Context *ctx) goto cleanup; } } else if (STRNEQ(ctx->session->key, currentSession->key)) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Key of the current session differs from the key at " - "last login")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Key of the current session differs from the key at " + "last login")); goto cleanup; } } @@ -1999,7 +1999,7 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, esxVI_PropertyFilterSpec *propertyFilterSpec = NULL; if (objectContentList == NULL || *objectContentList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2017,9 +2017,9 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, STREQ(type, "ClusterComputeResource")) { objectSpec->selectSet = ctx->selectSet_folderToChildEntity; } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid lookup of '%s' from '%s'"), - type, root->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid lookup of '%s' from '%s'"), + type, root->type); goto cleanup; } } else if (STREQ(root->type, "ComputeResource") || @@ -2029,9 +2029,9 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, } else if (STREQ(type, "Datacenter")) { objectSpec->selectSet = ctx->selectSet_computeResourceToParentToParent; } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid lookup of '%s' from '%s'"), - type, root->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid lookup of '%s' from '%s'"), + type, root->type); goto cleanup; } } else if (STREQ(root->type, "HostSystem")) { @@ -2043,14 +2043,14 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, } else if (STREQ(type, "Datastore")) { objectSpec->selectSet = ctx->selectSet_hostSystemToDatastore; } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid lookup of '%s' from '%s'"), - type, root->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid lookup of '%s' from '%s'"), + type, root->type); goto cleanup; } } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid lookup from '%s'"), root->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid lookup from '%s'"), root->type); goto cleanup; } } @@ -2090,20 +2090,20 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, break; case esxVI_Occurrence_RequiredItem: - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not lookup '%s' from '%s'"), - type, root->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not lookup '%s' from '%s'"), + type, root->type); break; case esxVI_Occurrence_RequiredList: - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not lookup '%s' list from '%s'"), - type, root->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not lookup '%s' list from '%s'"), + type, root->type); break; default: - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid occurrence value")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid occurrence value")); break; } @@ -2157,9 +2157,9 @@ esxVI_GetManagedEntityStatus(esxVI_ObjectContent *objectContent, } } - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing '%s' property while looking for " - "ManagedEntityStatus"), propertyName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing '%s' property while looking for " + "ManagedEntityStatus"), propertyName); return -1; } @@ -2180,8 +2180,8 @@ esxVI_GetVirtualMachinePowerState(esxVI_ObjectContent *virtualMachine, } } - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing 'runtime.powerState' property")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing 'runtime.powerState' property")); return -1; } @@ -2196,7 +2196,7 @@ esxVI_GetVirtualMachineQuestionInfo esxVI_DynamicProperty *dynamicProperty; if (questionInfo == NULL || *questionInfo != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2222,7 +2222,7 @@ esxVI_GetBoolean(esxVI_ObjectContent *objectContent, const char *propertyName, esxVI_DynamicProperty *dynamicProperty; if (value == NULL || *value != esxVI_Boolean_Undefined) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2241,8 +2241,8 @@ esxVI_GetBoolean(esxVI_ObjectContent *objectContent, const char *propertyName, if (*value == esxVI_Boolean_Undefined && occurrence == esxVI_Occurrence_RequiredItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing '%s' property"), propertyName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing '%s' property"), propertyName); return -1; } @@ -2258,7 +2258,7 @@ esxVI_GetLong(esxVI_ObjectContent *objectContent, const char *propertyName, esxVI_DynamicProperty *dynamicProperty; if (value == NULL || *value != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2274,8 +2274,8 @@ esxVI_GetLong(esxVI_ObjectContent *objectContent, const char *propertyName, } if (*value == NULL && occurrence == esxVI_Occurrence_RequiredItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing '%s' property"), propertyName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing '%s' property"), propertyName); return -1; } @@ -2292,7 +2292,7 @@ esxVI_GetStringValue(esxVI_ObjectContent *objectContent, esxVI_DynamicProperty *dynamicProperty; if (value == NULL || *value != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2310,8 +2310,8 @@ esxVI_GetStringValue(esxVI_ObjectContent *objectContent, } if (*value == NULL && occurrence == esxVI_Occurrence_RequiredItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing '%s' property"), propertyName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing '%s' property"), propertyName); return -1; } @@ -2329,7 +2329,7 @@ esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent, esxVI_DynamicProperty *dynamicProperty; if (value == NULL || *value != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2346,8 +2346,8 @@ esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent, } if (*value == NULL && occurrence == esxVI_Occurrence_RequiredItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing '%s' property"), propertyName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing '%s' property"), propertyName); return -1; } @@ -2417,24 +2417,24 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine, esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined; if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("ObjectContent does not reference a virtual machine")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("ObjectContent does not reference a virtual machine")); return -1; } if (id != NULL) { if (esxUtil_ParseVirtualMachineIDString (virtualMachine->obj->value, id) < 0 || *id <= 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse positive integer from '%s'"), - virtualMachine->obj->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse positive integer from '%s'"), + virtualMachine->obj->value); goto failure; } } if (name != NULL) { if (*name != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); goto failure; } @@ -2455,8 +2455,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine, } if (virVMXUnescapeHexPercent(*name) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Domain name contains invalid escape sequence")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Domain name contains invalid escape sequence")); goto failure; } @@ -2465,8 +2465,8 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine, } if (*name == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not get name of virtual machine")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get name of virtual machine")); goto failure; } } @@ -2493,15 +2493,15 @@ esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine, } if (uuid_string == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not get UUID of virtual machine")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get UUID of virtual machine")); goto failure; } if (virUUIDParse(uuid_string, uuid) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse UUID from string '%s'"), - uuid_string); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse UUID from string '%s'"), + uuid_string); goto failure; } } else { @@ -2611,7 +2611,7 @@ esxVI_GetSnapshotTreeByName if (snapshotTree == NULL || *snapshotTree != NULL || (snapshotTreeParent && *snapshotTreeParent != NULL)) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2638,8 +2638,8 @@ esxVI_GetSnapshotTreeByName if (occurrence == esxVI_Occurrence_OptionalItem) { return 0; } else { - ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("Could not find snapshot with name '%s'"), name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("Could not find snapshot with name '%s'"), name); return -1; } @@ -2656,7 +2656,7 @@ esxVI_GetSnapshotTreeBySnapshot esxVI_VirtualMachineSnapshotTree *candidate; if (snapshotTree == NULL || *snapshotTree != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2673,9 +2673,9 @@ esxVI_GetSnapshotTreeBySnapshot } } - ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("Could not find domain snapshot with internal name '%s'"), - snapshot->value); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("Could not find domain snapshot with internal name '%s'"), + snapshot->value); return -1; } @@ -2721,7 +2721,7 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid, char uuid_string[VIR_UUID_STRING_BUFLEN] = ""; if (virtualMachine == NULL || *virtualMachine != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2738,9 +2738,9 @@ esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid, goto cleanup; } else { - ESX_VI_ERROR(VIR_ERR_NO_DOMAIN, - _("Could not find domain with UUID '%s'"), - uuid_string); + virReportError(VIR_ERR_NO_DOMAIN, + _("Could not find domain with UUID '%s'"), + uuid_string); goto cleanup; } } @@ -2775,7 +2775,7 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name, char *name_candidate = NULL; if (virtualMachine == NULL || *virtualMachine != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2813,8 +2813,8 @@ esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name, goto cleanup; } else { - ESX_VI_ERROR(VIR_ERR_NO_DOMAIN, - _("Could not find domain with name '%s'"), name); + virReportError(VIR_ERR_NO_DOMAIN, + _("Could not find domain with name '%s'"), name); goto cleanup; } } @@ -2866,8 +2866,8 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask } if (pendingTaskInfoList != NULL) { - ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID, "%s", - _("Other tasks are pending for this domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Other tasks are pending for this domain")); goto cleanup; } @@ -2910,7 +2910,7 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name, char *name_candidate; if (datastore == NULL || *datastore != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2947,8 +2947,8 @@ esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name, } if (*datastore == NULL && occurrence != esxVI_Occurrence_OptionalItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not find datastore with name '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find datastore with name '%s'"), name); goto cleanup; } @@ -2978,7 +2978,7 @@ esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx, esxVI_DatastoreHostMount *datastoreHostMount = NULL; if (datastore == NULL || *datastore != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3034,9 +3034,9 @@ esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx, } if (*datastore == NULL && occurrence != esxVI_Occurrence_OptionalItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not find datastore containing absolute path '%s'"), - absolutePath); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find datastore containing absolute path '%s'"), + absolutePath); goto cleanup; } @@ -3065,7 +3065,7 @@ esxVI_LookupDatastoreHostMount(esxVI_Context *ctx, esxVI_DatastoreHostMount *candidate = NULL; if (hostMount == NULL || *hostMount != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3104,8 +3104,8 @@ esxVI_LookupDatastoreHostMount(esxVI_Context *ctx, } if (*hostMount == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not lookup datastore host mount")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not lookup datastore host mount")); goto cleanup; } @@ -3131,7 +3131,7 @@ esxVI_LookupTaskInfoByTask(esxVI_Context *ctx, esxVI_DynamicProperty *dynamicProperty = NULL; if (taskInfo == NULL || *taskInfo != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3180,7 +3180,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine esxVI_TaskInfo *taskInfo = NULL; if (pendingTaskInfoList == NULL || *pendingTaskInfoList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3288,7 +3288,7 @@ esxVI_LookupRootSnapshotTreeList esxVI_DynamicProperty *dynamicProperty = NULL; if (rootSnapshotTreeList == NULL || *rootSnapshotTreeList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3344,7 +3344,7 @@ esxVI_LookupCurrentSnapshotTree esxVI_VirtualMachineSnapshotTree *snapshotTree = NULL; if (currentSnapshotTree == NULL || *currentSnapshotTree != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3380,15 +3380,15 @@ esxVI_LookupCurrentSnapshotTree goto cleanup; } else { - ESX_VI_ERROR(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s", - _("Domain has no current snapshot")); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s", + _("Domain has no current snapshot")); goto cleanup; } } if (rootSnapshotTreeList == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not lookup root snapshot list")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not lookup root snapshot list")); goto cleanup; } @@ -3441,7 +3441,7 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx, esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL; if (fileInfo == NULL || *fileInfo != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3475,9 +3475,9 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx, if (directoryAndFileName[length] != '/' || directoryAndFileName[length + 1] == '\0') { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Datastore path '%s' doesn't reference a file"), - datastorePath); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Datastore path '%s' doesn't reference a file"), + datastorePath); goto cleanup; } @@ -3562,9 +3562,9 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx, } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not search in datastore '%s': %s"), - datastoreName, taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not search in datastore '%s': %s"), + datastoreName, taskInfoErrorMessage); goto cleanup; } @@ -3581,9 +3581,9 @@ esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx, goto cleanup; } else { - ESX_VI_ERROR(VIR_ERR_NO_STORAGE_VOL, - _("No storage volume with key or path '%s'"), - datastorePath); + virReportError(VIR_ERR_NO_STORAGE_VOL, + _("No storage volume with key or path '%s'"), + datastorePath); goto cleanup; } } @@ -3638,7 +3638,7 @@ esxVI_LookupDatastoreContentByDatastoreName esxVI_TaskInfo *taskInfo = NULL; if (searchResultsList == NULL || *searchResultsList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3707,9 +3707,9 @@ esxVI_LookupDatastoreContentByDatastoreName } if (taskInfoState != esxVI_TaskInfoState_Success) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not serach in datastore '%s': %s"), - datastoreName, taskInfoErrorMessage); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not serach in datastore '%s': %s"), + datastoreName, taskInfoErrorMessage); goto cleanup; } @@ -3746,7 +3746,7 @@ esxVI_LookupStorageVolumeKeyByDatastorePath(esxVI_Context *ctx, char *uuid_string = NULL; if (key == NULL || *key != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3804,7 +3804,7 @@ esxVI_LookupAutoStartDefaults(esxVI_Context *ctx, esxVI_DynamicProperty *dynamicProperty = NULL; if (defaults == NULL || *defaults != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3835,8 +3835,8 @@ esxVI_LookupAutoStartDefaults(esxVI_Context *ctx, } if (*defaults == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not retrieve the AutoStartDefaults object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not retrieve the AutoStartDefaults object")); goto cleanup; } @@ -3861,7 +3861,7 @@ esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx, esxVI_DynamicProperty *dynamicProperty = NULL; if (powerInfoList == NULL || *powerInfoList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3916,7 +3916,7 @@ esxVI_HandleVirtualMachineQuestion char *possibleAnswers = NULL; if (blocked == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3951,19 +3951,19 @@ esxVI_HandleVirtualMachineQuestion if (autoAnswer) { if (possibleAnswers == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Pending question blocks virtual machine execution, " - "question is '%s', no possible answers"), - questionInfo->text); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Pending question blocks virtual machine execution, " + "question is '%s', no possible answers"), + questionInfo->text); *blocked = true; goto cleanup; } else if (answerChoice == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Pending question blocks virtual machine execution, " - "question is '%s', possible answers are %s, but no " - "default answer is specified"), questionInfo->text, - possibleAnswers); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Pending question blocks virtual machine execution, " + "question is '%s', possible answers are %s, but no " + "default answer is specified"), questionInfo->text, + possibleAnswers); *blocked = true; goto cleanup; @@ -3980,15 +3980,15 @@ esxVI_HandleVirtualMachineQuestion } } else { if (possibleAnswers != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Pending question blocks virtual machine execution, " - "question is '%s', possible answers are %s"), - questionInfo->text, possibleAnswers); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Pending question blocks virtual machine execution, " + "question is '%s', possible answers are %s"), + questionInfo->text, possibleAnswers); } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Pending question blocks virtual machine execution, " - "question is '%s', no possible answers"), - questionInfo->text); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Pending question blocks virtual machine execution, " + "question is '%s', no possible answers"), + questionInfo->text); } *blocked = true; @@ -4035,7 +4035,7 @@ esxVI_WaitForTaskCompletion(esxVI_Context *ctx, esxVI_TaskInfo *taskInfo = NULL; if (errorMessage == NULL || *errorMessage != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -4249,9 +4249,9 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo, for (r = 0; r < 4; ++r) { if (strlen(input[r]) != expectedLength) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HostCpuIdInfo register '%s' has an unexpected length"), - name[r]); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HostCpuIdInfo register '%s' has an unexpected length"), + name[r]); return -1; } @@ -4263,9 +4263,9 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo, output[r][o - 3] = input[r][i + 3]; if (i + 4 < expectedLength && input[r][i + 4] != ':') { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("HostCpuIdInfo register '%s' has an unexpected format"), - name[r]); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("HostCpuIdInfo register '%s' has an unexpected format"), + name[r]); return -1; } } @@ -4314,8 +4314,8 @@ esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion productVersio return 8; default: - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unexpected product version")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unexpected product version")); return -1; } } @@ -4382,8 +4382,8 @@ esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion productVersio esxVI_DynamicProperty *dynamicProperty = NULL; \ \ if (ptrptr == NULL || *ptrptr != NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return -1; \ } \ \ @@ -4463,13 +4463,13 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx, if (objectContent == NULL || *objectContent != NULL || objectContentList == NULL || *objectContentList != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } if (!esxVI_String_ListContainsValue(propertyNameList, "name")) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing 'name' property in %s lookup"), type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing 'name' property in %s lookup"), type); goto cleanup; } @@ -4501,8 +4501,8 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx, if (candidate == NULL) { if (occurrence != esxVI_Occurrence_OptionalItem) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not find %s with name '%s'"), type, name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not find %s with name '%s'"), type, name); goto cleanup; } diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h index 9560bd2..44ba4d1 100644 --- a/src/esx/esx_vi.h +++ b/src/esx/esx_vi.h @@ -35,13 +35,6 @@ # include "esx_util.h" - -# define ESX_VI_ERROR(code, ...) \ - virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - - - # define ESX_VI__SOAP__REQUEST_HEADER \ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \ "<soapenv:Envelope\n" \ diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c index 1f1780f..77588c2 100644 --- a/src/esx/esx_vi_methods.c +++ b/src/esx/esx_vi_methods.c @@ -41,7 +41,7 @@ #define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \ if (output == NULL || *output != 0) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); \ return -1; \ } @@ -162,7 +162,7 @@ esxVI_##_type *_this = NULL; \ \ if (ctx->service == NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid call")); \ return -1; \ } \ \ @@ -183,9 +183,9 @@ */ #define ESX_VI__METHOD__PARAMETER__REQUIRE(_name) \ if (_name == 0) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - "Required parameter '%s' is missing for call to %s", \ - #_name, methodName); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "Required parameter '%s' is missing for call to %s", \ + #_name, methodName); \ return -1; \ } @@ -237,7 +237,7 @@ esxVI_RetrieveServiceContent(esxVI_Context *ctx, esxVI_Response *response = NULL; if (serviceContent == NULL || *serviceContent != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index bcc310f..850f10e 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -81,8 +81,8 @@ \ if (item->_type <= esxVI_Type_Undefined || \ item->_type >= esxVI_Type_Other) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("%s object has invalid dynamic type"), typeName); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("%s object has invalid dynamic type"), typeName);\ return -1; \ } \ \ @@ -98,8 +98,8 @@ esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \ { \ if (dest == NULL || *dest != NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return -1; \ } \ \ @@ -192,8 +192,8 @@ _dest_type *item ATTRIBUTE_UNUSED; \ \ if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return -1; \ } \ \ @@ -211,9 +211,9 @@ ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, esxVI_##_type, \ { \ if (anyType->type != esxVI_Type_##_type) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s'"), \ - __FUNCTION__, anyType->other); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s'"), \ + __FUNCTION__, anyType->other); \ return -1; \ } \ }, /* nothing */) @@ -224,9 +224,9 @@ ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE_EXTRA(_type, _value_type, \ { \ if (anyType->type != esxVI_Type_##_type) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s'"), \ - __FUNCTION__, anyType->other); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s'"), \ + __FUNCTION__, anyType->other); \ return -1; \ } \ }, Value) @@ -239,8 +239,8 @@ const char *element, virBufferPtr output) \ { \ if (element == NULL || output == NULL ) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return -1; \ } \ \ @@ -281,8 +281,8 @@ _extra1 \ \ if (ptrptr == NULL || *ptrptr != NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return -1; \ } \ \ @@ -295,8 +295,8 @@ for (childNode = node->children; childNode != NULL; \ childNode = childNode->next) { \ if (childNode->type != XML_ELEMENT_NODE) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Wrong XML element type %d"), childNode->type);\ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Wrong XML element type %d"), childNode->type); \ goto failure; \ } \ \ @@ -334,8 +334,8 @@ long long value; \ \ if (number == NULL || *number != NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return -1; \ } \ \ @@ -346,23 +346,23 @@ string = (char *)xmlNodeListGetString(node->doc, node->children, 1); \ \ if (string == NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("XML node doesn't contain text, expecting an %s " \ - "value"), _xsdType); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("XML node doesn't contain text, expecting an %s "\ + "value"), _xsdType); \ goto cleanup; \ } \ \ if (virStrToLong_ll(string, NULL, 10, &value) < 0) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Unknown value '%s' for %s"), string, _xsdType); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Unknown value '%s' for %s"), string, _xsdType); \ goto cleanup; \ } \ \ if (((_min) != INT64_MIN && value < (_min)) \ || ((_max) != INT64_MAX && value > (_max))) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Value '%s' is not representable as %s"), \ - string, _xsdType); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Value '%s' is not representable as %s"), \ + string, _xsdType); \ goto cleanup; \ } \ \ @@ -485,9 +485,9 @@ */ #define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name) \ if (item->_name == 0) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("%s object is missing the required '%s' property"), \ - typeName, #_name); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("%s object is missing the required '%s' property"), \ + typeName, #_name); \ return -1; \ } @@ -542,9 +542,9 @@ break; \ \ default: \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s'"), __FUNCTION__, \ - esxVI_Type_ToString(_actual_type)); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s'"), __FUNCTION__,\ + esxVI_Type_ToString(_actual_type)); \ return _error_return; \ } @@ -604,8 +604,8 @@ esxVI_##__type##_DynamicCast(void *item) \ { \ if (item == NULL) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", \ - _("Invalid argument")); \ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \ + _("Invalid argument")); \ return NULL; \ } \ \ @@ -648,9 +648,9 @@ break; \ \ default: \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Call to %s for unexpected type '%s'"), \ - __FUNCTION__, esxVI_Type_ToString(type)); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Call to %s for unexpected type '%s'"), \ + __FUNCTION__, esxVI_Type_ToString(type)); \ return -1; \ }, \ /* nothing */, \ @@ -666,7 +666,7 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType, char *type = NULL; if (actualType == NULL || *actualType != esxVI_Type_Undefined) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -675,18 +675,18 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType, BAD_CAST "http://www.w3.org/2001/XMLSchema-instance"); if (type == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("%s is missing 'type' property"), - esxVI_Type_ToString(baseType)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is missing 'type' property"), + esxVI_Type_ToString(baseType)); return -1; } *actualType = esxVI_Type_FromString(type); if (*actualType == esxVI_Type_Undefined) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Unknown value '%s' for %s 'type' property"), - type, esxVI_Type_ToString(baseType)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown value '%s' for %s 'type' property"), + type, esxVI_Type_ToString(baseType)); goto cleanup; } @@ -709,9 +709,9 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType, * unselected properties. */ \ if (item->_name == 0 && \ esxVI_String_ListContainsValue(selectedPropertyNameList, #_name)) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("%s object is missing the required '%s' property"), \ - typeName, #_name); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("%s object is missing the required '%s' property"), \ + typeName, #_name); \ return -1; \ } @@ -726,8 +726,8 @@ esxVI_GetActualObjectType(xmlNodePtr node, esxVI_Type baseType, \ if (item->_type <= esxVI_Type_Undefined || \ item->_type >= esxVI_Type_Other) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("%s object has invalid dynamic type"), typeName); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("%s object has invalid dynamic type"), typeName);\ return -1; \ } \ \ @@ -866,10 +866,10 @@ int esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type) { if (anyType->type != type) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting type '%s' but found '%s'"), - esxVI_Type_ToString(type), - anyType->type != esxVI_Type_Other + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting type '%s' but found '%s'"), + esxVI_Type_ToString(type), + anyType->type != esxVI_Type_Other ? esxVI_Type_ToString(anyType->type) : anyType->other); return -1; @@ -882,7 +882,7 @@ int esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src) { if (dest == NULL || *dest != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -898,8 +898,8 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src) (*dest)->node = xmlCopyNode(src->node, 1); if ((*dest)->node == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not copy an XML node")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not copy an XML node")); goto failure; } @@ -949,7 +949,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) long long int number; if (anyType == NULL || *anyType != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -960,8 +960,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) (*anyType)->node = xmlCopyNode(node, 1); if ((*anyType)->node == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not copy an XML node")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not copy an XML node")); goto failure; } @@ -971,17 +971,17 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) BAD_CAST "http://www.w3.org/2001/XMLSchema-instance"); if ((*anyType)->other == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("AnyType is missing 'type' property")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("AnyType is missing 'type' property")); goto failure; } (*anyType)->type = esxVI_Type_FromString((*anyType)->other); if ((*anyType)->type == esxVI_Type_Undefined) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Unknown value '%s' for AnyType 'type' property"), - (*anyType)->other); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown value '%s' for AnyType 'type' property"), + (*anyType)->other); goto failure; } @@ -1000,17 +1000,17 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) #define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max) \ do { \ if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Unknown value '%s' for %s"), \ - (*anyType)->value, _xsdType); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Unknown value '%s' for %s"), \ + (*anyType)->value, _xsdType); \ goto failure; \ } \ \ if (((_min) != INT64_MIN && number < (_min)) \ || ((_max) != INT64_MAX && number > (_max))) { \ - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \ - _("Value '%s' is out of %s range"), \ - (*anyType)->value, _xsdType); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("Value '%s' is out of %s range"), \ + (*anyType)->value, _xsdType); \ goto failure; \ } \ \ @@ -1024,9 +1024,9 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType) } else if (STREQ((*anyType)->value, "false")) { (*anyType)->boolean = esxVI_Boolean_False; } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Unknown value '%s' for xsd:boolean"), - (*anyType)->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown value '%s' for xsd:boolean"), + (*anyType)->value); goto failure; } @@ -1170,7 +1170,7 @@ int esxVI_String_DeepCopyValue(char **dest, const char *src) { if (dest == NULL || *dest != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1210,7 +1210,7 @@ esxVI_String_SerializeValue(const char *value, const char *element, virBufferPtr output) { if (element == NULL || output == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1240,7 +1240,7 @@ int esxVI_String_DeserializeValue(xmlNodePtr node, char **value) { if (value == NULL || *value != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1374,7 +1374,7 @@ int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime) { if (dateTime == NULL || *dateTime != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1386,9 +1386,9 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime) (char *)xmlNodeListGetString(node->doc, node->children, 1); if ((*dateTime)->value == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("XML node doesn't contain text, expecting an " - "xsd:dateTime value")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("XML node doesn't contain text, expecting an " + "xsd:dateTime value")); goto failure; } @@ -1414,14 +1414,14 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, int tz_offset = 0; if (dateTime == NULL || secondsSinceEpoch == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } if (virStrcpyStatic(value, dateTime->value) == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("xsd:dateTime value '%s' too long for destination"), - dateTime->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("xsd:dateTime value '%s' too long for destination"), + dateTime->value); return -1; } @@ -1441,9 +1441,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, tmp = strptime(value, "%Y-%m-%dT%H:%M:%S", &tm); if (tmp == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("xsd:dateTime value '%s' has unexpected format"), - dateTime->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("xsd:dateTime value '%s' has unexpected format"), + dateTime->value); return -1; } @@ -1451,9 +1451,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, /* skip .ssssss part if present */ if (*tmp == '.' && virStrToLong_i(tmp + 1, &tmp, 10, &milliseconds) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("xsd:dateTime value '%s' has unexpected format"), - dateTime->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("xsd:dateTime value '%s' has unexpected format"), + dateTime->value); return -1; } @@ -1464,9 +1464,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, if (virStrToLong_i(tmp + 1, &tmp, 10, &tz_hours) < 0 || *tmp != ':' || virStrToLong_i(tmp + 1, NULL, 10, &tz_minutes) < 0) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("xsd:dateTime value '%s' has unexpected format"), - dateTime->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("xsd:dateTime value '%s' has unexpected format"), + dateTime->value); return -1; } @@ -1478,9 +1478,9 @@ esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, } else if (STREQ(tmp, "Z")) { /* Z refers to UTC. tz_offset is already initialized to zero */ } else { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("xsd:dateTime value '%s' has unexpected format"), - dateTime->value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("xsd:dateTime value '%s' has unexpected format"), + dateTime->value); return -1; } } @@ -1548,7 +1548,7 @@ int esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault) { if (methodFault == NULL || *methodFault != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1561,8 +1561,8 @@ esxVI_MethodFault_Deserialize(xmlNodePtr node, esxVI_MethodFault **methodFault) BAD_CAST "http://www.w3.org/2001/XMLSchema-instance"); if ((*methodFault)->_actualType == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("MethodFault is missing 'type' property")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("MethodFault is missing 'type' property")); goto failure; } @@ -1614,7 +1614,7 @@ esxVI_ManagedObjectReference_Serialize const char *element, virBufferPtr output) { if (element == NULL || output == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1644,7 +1644,7 @@ esxVI_ManagedObjectReference_Deserialize (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference) { if (managedObjectReference == NULL || *managedObjectReference != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1656,8 +1656,8 @@ esxVI_ManagedObjectReference_Deserialize (char *)xmlGetNoNsProp(node, BAD_CAST "type"); if ((*managedObjectReference)->type == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("ManagedObjectReference is missing 'type' property")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("ManagedObjectReference is missing 'type' property")); goto failure; } @@ -1734,9 +1734,9 @@ ESX_VI__TEMPLATE__DESERIALIZE_EXTRA(Event, /* nothing */, BAD_CAST "http://www.w3.org/2001/XMLSchema-instance"); if ((*ptrptr)->_actualType == NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, - _("%s is missing 'type' property"), - esxVI_Type_ToString((*ptrptr)->_type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is missing 'type' property"), + esxVI_Type_ToString((*ptrptr)->_type)); goto failure; } }, -- 1.7.10.4

On 18.07.2012 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the ESX driver to use virReportError instead of the ESX_ERROR & ESX_VI_ERROR custom macros
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 2 - src/esx/esx_driver.c | 422 ++++++++++++++-------------- src/esx/esx_private.h | 4 - src/esx/esx_storage_driver.c | 100 +++---- src/esx/esx_util.c | 74 ++--- src/esx/esx_vi.c | 626 +++++++++++++++++++++--------------------- src/esx/esx_vi.h | 7 - src/esx/esx_vi_methods.c | 12 +- src/esx/esx_vi_types.c | 216 +++++++-------- 9 files changed, 725 insertions(+), 738 deletions(-)
ACK with this squashed in: diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 86b0c6d..b1b5d70 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -386,8 +386,8 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char **content, * small things such as VMX of VMDK metadata files. */ if (*length > INT32_MAX / 2) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Download length it too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Download length it too large")); return -1; } diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index 5a53b42..9e67eff 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -1231,7 +1231,7 @@ int esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string) { if (string == NULL || *string != NULL) { - ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } Michal

From: "Daniel P. Berrange" <berrange@redhat.com> Update the Hyper-V driver to use virReportError instead of the HYPERV_ERROR custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/hyperv/hyperv_driver.c | 142 +++++++++++++++++++++---------------------- src/hyperv/hyperv_private.h | 4 -- src/hyperv/hyperv_util.c | 10 +-- src/hyperv/hyperv_wmi.c | 114 +++++++++++++++++----------------- 5 files changed, 133 insertions(+), 138 deletions(-) diff --git a/cfg.mk b/cfg.mk index 5e8958b..d7691a3 100644 --- a/cfg.mk +++ b/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 += HYPERV_ERROR msg_gen_function += PHYP_ERROR msg_gen_function += VIR_ERROR msg_gen_function += VMX_ERROR diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 3b15292..17685ea 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -96,23 +96,23 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) 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; } @@ -150,7 +150,7 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) 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; } } @@ -158,7 +158,7 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) 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; } @@ -167,14 +167,14 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) 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; } @@ -194,8 +194,8 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) } 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; } @@ -254,9 +254,9 @@ hypervGetHostname(virConnectPtr conn) } 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; } @@ -296,9 +296,9 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) } 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; } @@ -315,9 +315,9 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) } 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; } @@ -342,9 +342,9 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) /* 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; } @@ -471,7 +471,7 @@ hypervDomainLookupByID(virConnectPtr conn, int id) } 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; } @@ -506,8 +506,8 @@ hypervDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) } 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; } @@ -539,8 +539,8 @@ hypervDomainLookupByName(virConnectPtr conn, const char *name) } 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; } @@ -567,8 +567,8 @@ hypervDomainSuspend(virDomainPtr domain) 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; } @@ -596,8 +596,8 @@ hypervDomainResume(virDomainPtr domain) 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; } @@ -628,8 +628,8 @@ hypervDomainDestroyFlags(virDomainPtr domain, unsigned int flags) 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; } @@ -703,10 +703,10 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) } 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; } @@ -724,10 +724,10 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) } 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; } @@ -746,10 +746,10 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) 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; } @@ -845,10 +845,10 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) } 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; } @@ -866,10 +866,10 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) } 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; } @@ -888,10 +888,10 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) 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; } @@ -905,9 +905,9 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) } 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; } @@ -1066,8 +1066,8 @@ hypervDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) } 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; } @@ -1189,8 +1189,8 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags) 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; } @@ -1244,8 +1244,8 @@ hypervDomainManagedSaveRemove(virDomainPtr domain, unsigned int flags) 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; } diff --git a/src/hyperv/hyperv_private.h b/src/hyperv/hyperv_private.h index ebddf5d..677c5bc 100644 --- a/src/hyperv/hyperv_private.h +++ b/src/hyperv/hyperv_private.h @@ -29,10 +29,6 @@ # include "hyperv_util.h" # include "openwsman.h" -# define HYPERV_ERROR(code, ...) \ - virReportErrorHelper(VIR_FROM_HYPERV, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - typedef struct _hypervPrivate hypervPrivate; struct _hypervPrivate { diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c index 81c087e..86d140f 100644 --- a/src/hyperv/hyperv_util.c +++ b/src/hyperv/hyperv_util.c @@ -42,7 +42,7 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri) int i; if (parsedUri == NULL || *parsedUri != NULL) { - HYPERV_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -66,10 +66,10 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri) if (STRNEQ((*parsedUri)->transport, "http") && STRNEQ((*parsedUri)->transport, "https")) { - HYPERV_ERROR(VIR_ERR_INVALID_ARG, - _("Query parameter 'transport' has unexpected value " - "'%s' (should be http|https)"), - (*parsedUri)->transport); + virReportError(VIR_ERR_INVALID_ARG, + _("Query parameter 'transport' has unexpected value " + "'%s' (should be http|https)"), + (*parsedUri)->transport); goto cleanup; } } else { diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 517c8ea..4a2dfff 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -56,25 +56,25 @@ hyperyVerifyResponse(WsManClient *client, WsXmlDocH response, 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; } @@ -88,11 +88,11 @@ hyperyVerifyResponse(WsManClient *client, WsXmlDocH response, 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; @@ -126,7 +126,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root, 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; } @@ -140,8 +140,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root, 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; } @@ -149,8 +149,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root, 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; } @@ -176,24 +176,24 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root, 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; } @@ -205,8 +205,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root, 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; } @@ -422,8 +422,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain, 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; } @@ -442,15 +442,15 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain, 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; } @@ -459,9 +459,9 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain, 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; } @@ -476,9 +476,9 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain, } 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; } @@ -501,23 +501,23 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain, 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; } @@ -624,14 +624,14 @@ hypervMsvmComputerSystemToDomain(virConnectPtr conn, 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; } @@ -659,7 +659,7 @@ hypervMsvmComputerSystemFromDomain(virDomainPtr domain, 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; } @@ -675,8 +675,8 @@ hypervMsvmComputerSystemFromDomain(virDomainPtr domain, } 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; } -- 1.7.10.4

On 18.07.2012 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the Hyper-V driver to use virReportError instead of the HYPERV_ERROR custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/hyperv/hyperv_driver.c | 142 +++++++++++++++++++++---------------------- src/hyperv/hyperv_private.h | 4 -- src/hyperv/hyperv_util.c | 10 +-- src/hyperv/hyperv_wmi.c | 114 +++++++++++++++++----------------- 5 files changed, 133 insertions(+), 138 deletions(-)
ACK. Michal

From: "Daniel P. Berrange" <berrange@redhat.com> Update the security drivers to use virReportError instead of the virSecurityReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/security/security_apparmor.c | 94 ++++++++++++++++----------------- src/security/security_driver.c | 8 +-- src/security/security_manager.c | 50 +++++++++--------- src/security/security_manager.h | 5 -- src/security/security_selinux.c | 106 +++++++++++++++++++------------------- 6 files changed, 130 insertions(+), 134 deletions(-) diff --git a/cfg.mk b/cfg.mk index d7691a3..434bbe1 100644 --- a/cfg.mk +++ b/cfg.mk @@ -532,7 +532,6 @@ msg_gen_function += virRaiseError msg_gen_function += virReportError msg_gen_function += virReportErrorHelper msg_gen_function += virReportSystemError -msg_gen_function += virSecurityReportError msg_gen_function += xenapiSessionErrorHandler # Uncomment the following and run "make syntax-check" to see diagnostics diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index 62af3c6..8c95f78 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -238,8 +238,8 @@ use_apparmor(void) char *libvirt_daemon = NULL; if (virFileResolveLink("/proc/self/exe", &libvirt_daemon) < 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not find libvirtd")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not find libvirtd")); return rc; } @@ -275,10 +275,10 @@ reload_profile(virSecurityManagerPtr mgr, /* Update the profile only if it is loaded */ if (profile_loaded(secdef->imagelabel) >= 0) { if (load_profile(mgr, secdef->imagelabel, def, fn, append) < 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot update AppArmor profile " - "\'%s\'"), - secdef->imagelabel); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot update AppArmor profile " + "\'%s\'"), + secdef->imagelabel); goto clean; } } @@ -299,10 +299,10 @@ AppArmorSetSecurityUSBLabel(usbDevice *dev ATTRIBUTE_UNUSED, if (reload_profile(ptr->mgr, def, file, true) < 0) { const virSecurityLabelDefPtr secdef = &def->seclabel; - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot update AppArmor profile " - "\'%s\'"), - secdef->imagelabel); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot update AppArmor profile " + "\'%s\'"), + secdef->imagelabel); return -1; } return 0; @@ -317,10 +317,10 @@ AppArmorSetSecurityPCILabel(pciDevice *dev ATTRIBUTE_UNUSED, if (reload_profile(ptr->mgr, def, file, true) < 0) { const virSecurityLabelDefPtr secdef = &def->seclabel; - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot update AppArmor profile " - "\'%s\'"), - secdef->imagelabel); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot update AppArmor profile " + "\'%s\'"), + secdef->imagelabel); return -1; } return 0; @@ -347,8 +347,8 @@ AppArmorSecurityManagerProbe(const char *virtDriver) } if (!virFileExists(template)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("template \'%s\' does not exist"), template); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("template \'%s\' does not exist"), template); goto clean; } rc = SECURITY_DRIVER_ENABLE; @@ -403,16 +403,16 @@ AppArmorGenSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, return 0; if (def->seclabel.baselabel) { - virSecurityReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("Cannot set a base label with AppArmour")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("Cannot set a base label with AppArmour")); return rc; } if ((def->seclabel.label) || (def->seclabel.model) || (def->seclabel.imagelabel)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("security label already defined for VM")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("security label already defined for VM")); return rc; } @@ -441,9 +441,9 @@ AppArmorGenSecurityLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, /* Now that we have a label, load the profile into the kernel. */ if (load_profile(mgr, def->seclabel.label, def, NULL, false) < 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot load AppArmor profile " - "\'%s\'"), def->seclabel.label); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot load AppArmor profile " + "\'%s\'"), def->seclabel.label); goto err; } @@ -493,14 +493,14 @@ AppArmorGetSecurityProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, if (virStrcpy(sec->label, profile_name, VIR_SECURITY_LABEL_BUFLEN) == NULL) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("error copying profile name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("error copying profile name")); goto clean; } if ((sec->enforcing = profile_status(profile_name, 1)) < 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("error calling profile_status()")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("error calling profile_status()")); goto clean; } rc = 0; @@ -538,9 +538,9 @@ AppArmorRestoreSecurityAllLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, if (secdef->type == VIR_DOMAIN_SECLABEL_DYNAMIC) { if ((rc = remove_profile(secdef->label)) != 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("could not remove profile for \'%s\'"), - secdef->label); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not remove profile for \'%s\'"), + secdef->label); } } return rc; @@ -560,18 +560,18 @@ AppArmorSetSecurityProcessLabel(virSecurityManagerPtr mgr, virDomainDefPtr def) return rc; if (STRNEQ(virSecurityManagerGetModel(mgr), secdef->model)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: " - "\'%s\' model configured for domain, but " - "hypervisor driver is \'%s\'."), - secdef->model, virSecurityManagerGetModel(mgr)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "\'%s\' model configured for domain, but " + "hypervisor driver is \'%s\'."), + secdef->model, virSecurityManagerGetModel(mgr)); if (use_apparmor() > 0) goto clean; } if (aa_change_profile(profile_name) < 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("error calling aa_change_profile()")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("error calling aa_change_profile()")); goto clean; } rc = 0; @@ -634,8 +634,8 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr, if (secdef->imagelabel) { /* if the device doesn't exist, error out */ if (!virFileExists(disk->src)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("\'%s\' does not exist"), disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("\'%s\' does not exist"), disk->src); return rc; } @@ -646,10 +646,10 @@ AppArmorSetSecurityImageLabel(virSecurityManagerPtr mgr, if (profile_loaded(secdef->imagelabel) >= 0) { if (load_profile(mgr, secdef->imagelabel, def, disk->src, false) < 0) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot update AppArmor profile " - "\'%s\'"), - secdef->imagelabel); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot update AppArmor profile " + "\'%s\'"), + secdef->imagelabel); goto clean; } } @@ -670,9 +670,9 @@ AppArmorSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC) { if (use_apparmor() < 0 || profile_status(secdef->label, 0) < 0) { - virSecurityReportError(VIR_ERR_XML_ERROR, - _("Invalid security label \'%s\'"), - secdef->label); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid security label \'%s\'"), + secdef->label); return -1; } } diff --git a/src/security/security_driver.c b/src/security/security_driver.c index 0f21d7a..5cc6178 100644 --- a/src/security/security_driver.c +++ b/src/security/security_driver.c @@ -28,6 +28,8 @@ #include "security_nop.h" +#define VIR_FROM_THIS VIR_FROM_SECURITY + static virSecurityDriverPtr security_drivers[] = { #ifdef WITH_SECDRIVER_SELINUX &virSecurityDriverSELinux, @@ -69,9 +71,9 @@ virSecurityDriverPtr virSecurityDriverLookup(const char *name, } if (!drv) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("Security driver %s not found"), - NULLSTR(name)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Security driver %s not found"), + NULLSTR(name)); return NULL; } diff --git a/src/security/security_manager.c b/src/security/security_manager.c index 8ec4d3e..e7d0360 100644 --- a/src/security/security_manager.c +++ b/src/security/security_manager.c @@ -125,8 +125,8 @@ virSecurityManagerPtr virSecurityManagerNew(const char *name, /* driver "none" needs some special handling of *Confined bools */ if (STREQ(drv->name, "none")) { if (requireConfined) { - virSecurityReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Security driver \"none\" cannot create confined guests")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Security driver \"none\" cannot create confined guests")); return NULL; } @@ -180,7 +180,7 @@ virSecurityManagerGetDOI(virSecurityManagerPtr mgr) if (mgr->drv->getDOI) return mgr->drv->getDOI(mgr); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return NULL; } @@ -190,7 +190,7 @@ virSecurityManagerGetModel(virSecurityManagerPtr mgr) if (mgr->drv->getModel) return mgr->drv->getModel(mgr); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return NULL; } @@ -216,7 +216,7 @@ int virSecurityManagerRestoreImageLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainRestoreSecurityImageLabel) return mgr->drv->domainRestoreSecurityImageLabel(mgr, vm, disk); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -226,7 +226,7 @@ int virSecurityManagerSetDaemonSocketLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecurityDaemonSocketLabel) return mgr->drv->domainSetSecurityDaemonSocketLabel(mgr, vm); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -236,7 +236,7 @@ int virSecurityManagerSetSocketLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecuritySocketLabel) return mgr->drv->domainSetSecuritySocketLabel(mgr, vm); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -246,7 +246,7 @@ int virSecurityManagerClearSocketLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainClearSecuritySocketLabel) return mgr->drv->domainClearSecuritySocketLabel(mgr, vm); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -257,7 +257,7 @@ int virSecurityManagerSetImageLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecurityImageLabel) return mgr->drv->domainSetSecurityImageLabel(mgr, vm, disk); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -268,7 +268,7 @@ int virSecurityManagerRestoreHostdevLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainRestoreSecurityHostdevLabel) return mgr->drv->domainRestoreSecurityHostdevLabel(mgr, vm, dev); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -279,7 +279,7 @@ int virSecurityManagerSetHostdevLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecurityHostdevLabel) return mgr->drv->domainSetSecurityHostdevLabel(mgr, vm, dev); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -290,7 +290,7 @@ int virSecurityManagerSetSavedStateLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSavedStateLabel) return mgr->drv->domainSetSavedStateLabel(mgr, vm, savefile); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -301,7 +301,7 @@ int virSecurityManagerRestoreSavedStateLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainRestoreSavedStateLabel) return mgr->drv->domainRestoreSavedStateLabel(mgr, vm, savefile); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -317,15 +317,15 @@ int virSecurityManagerGenLabel(virSecurityManagerPtr mgr, if ((vm->seclabel.type == VIR_DOMAIN_SECLABEL_NONE) && mgr->requireConfined) { - virSecurityReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Unconfined guests are not allowed on this host")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Unconfined guests are not allowed on this host")); return -1; } if (mgr->drv->domainGenSecurityLabel) return mgr->drv->domainGenSecurityLabel(mgr, vm); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -336,7 +336,7 @@ int virSecurityManagerReserveLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainReserveSecurityLabel) return mgr->drv->domainReserveSecurityLabel(mgr, vm, pid); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -346,7 +346,7 @@ int virSecurityManagerReleaseLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainReleaseSecurityLabel) return mgr->drv->domainReleaseSecurityLabel(mgr, vm); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -357,7 +357,7 @@ int virSecurityManagerSetAllLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecurityAllLabel) return mgr->drv->domainSetSecurityAllLabel(mgr, vm, stdin_path); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -368,7 +368,7 @@ int virSecurityManagerRestoreAllLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainRestoreSecurityAllLabel) return mgr->drv->domainRestoreSecurityAllLabel(mgr, vm, migrated); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -380,7 +380,7 @@ int virSecurityManagerGetProcessLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainGetSecurityProcessLabel) return mgr->drv->domainGetSecurityProcessLabel(mgr, vm, pid, sec); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -390,7 +390,7 @@ int virSecurityManagerSetProcessLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecurityProcessLabel) return mgr->drv->domainSetSecurityProcessLabel(mgr, vm); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -408,7 +408,7 @@ int virSecurityManagerVerify(virSecurityManagerPtr mgr, if (mgr->drv->domainSecurityVerify) return mgr->drv->domainSecurityVerify(mgr, def); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -419,7 +419,7 @@ int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr, if (mgr->drv->domainSetSecurityImageFDLabel) return mgr->drv->domainSetSecurityImageFDLabel(mgr, vm, fd); - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } @@ -431,7 +431,7 @@ char *virSecurityManagerGetMountOptions(virSecurityManagerPtr mgr, /* I don't think this is an error, these should be optional - virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); */ return NULL; } diff --git a/src/security/security_manager.h b/src/security/security_manager.h index f0bf60d..af16e75 100644 --- a/src/security/security_manager.h +++ b/src/security/security_manager.h @@ -23,11 +23,6 @@ #ifndef VIR_SECURITY_MANAGER_H__ # define VIR_SECURITY_MANAGER_H__ -# define virSecurityReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_SECURITY, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - - typedef struct _virSecurityManager virSecurityManager; typedef virSecurityManager *virSecurityManagerPtr; diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index ffa65fb..a9e704d 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -277,29 +277,29 @@ SELinuxGenSecurityLabel(virSecurityManagerPtr mgr, if ((def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC) && !def->seclabel.baselabel && def->seclabel.model) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("security model already defined for VM")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("security model already defined for VM")); return rc; } if (def->seclabel.type == VIR_DOMAIN_SECLABEL_DYNAMIC && def->seclabel.label) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("security label already defined for VM")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("security label already defined for VM")); return rc; } if (def->seclabel.imagelabel) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("security image label already defined for VM")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("security image label already defined for VM")); return rc; } if (def->seclabel.model && STRNEQ(def->seclabel.model, SECURITY_SELINUX_NAME)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label model %s is not supported with selinux"), - def->seclabel.model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label model %s is not supported with selinux"), + def->seclabel.model); return rc; } @@ -350,8 +350,8 @@ SELinuxGenSecurityLabel(virSecurityManagerPtr mgr, def->seclabel.baselabel : data->domain_context, mcs); if (! def->seclabel.label) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot generate selinux context for %s"), mcs); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot generate selinux context for %s"), mcs); goto cleanup; } break; @@ -361,17 +361,17 @@ SELinuxGenSecurityLabel(virSecurityManagerPtr mgr, break; default: - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected security label type '%s'"), - virDomainSeclabelTypeToString(def->seclabel.type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected security label type '%s'"), + virDomainSeclabelTypeToString(def->seclabel.type)); goto cleanup; } if (!def->seclabel.norelabel) { def->seclabel.imagelabel = SELinuxGenNewContext(data->file_context, mcs); if (!def->seclabel.imagelabel) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot generate selinux context for %s"), mcs); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot generate selinux context for %s"), mcs); goto cleanup; } } @@ -517,10 +517,10 @@ SELinuxGetSecurityProcessLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, } if (strlen((char *) ctx) >= VIR_SECURITY_LABEL_BUFLEN) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label exceeds " - "maximum length: %d"), - VIR_SECURITY_LABEL_BUFLEN - 1); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label exceeds " + "maximum length: %d"), + VIR_SECURITY_LABEL_BUFLEN - 1); freecon(ctx); return -1; } @@ -1106,9 +1106,9 @@ SELinuxRestoreSecuritySmartcardCallback(virDomainDefPtr def, return SELinuxRestoreSecurityChardevLabel(def, &dev->data.passthru); default: - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown smartcard type %d"), - dev->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown smartcard type %d"), + dev->type); return -1; } @@ -1225,18 +1225,18 @@ SELinuxSecurityVerify(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED, { const virSecurityLabelDefPtr secdef = &def->seclabel; if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: " - "'%s' model configured for domain, but " - "hypervisor driver is '%s'."), - secdef->model, virSecurityManagerGetModel(mgr)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "'%s' model configured for domain, but " + "hypervisor driver is '%s'."), + secdef->model, virSecurityManagerGetModel(mgr)); return -1; } if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC) { if (security_check_context(secdef->label) != 0) { - virSecurityReportError(VIR_ERR_XML_ERROR, - _("Invalid security label %s"), secdef->label); + virReportError(VIR_ERR_XML_ERROR, + _("Invalid security label %s"), secdef->label); return -1; } } @@ -1255,11 +1255,11 @@ SELinuxSetSecurityProcessLabel(virSecurityManagerPtr mgr, return 0; if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: " - "'%s' model configured for domain, but " - "hypervisor driver is '%s'."), - secdef->model, virSecurityManagerGetModel(mgr)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "'%s' model configured for domain, but " + "hypervisor driver is '%s'."), + secdef->model, virSecurityManagerGetModel(mgr)); if (security_getenforce() == 1) return -1; } @@ -1290,11 +1290,11 @@ SELinuxSetSecurityDaemonSocketLabel(virSecurityManagerPtr mgr, return 0; if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: " - "'%s' model configured for domain, but " - "hypervisor driver is '%s'."), - secdef->model, virSecurityManagerGetModel(mgr)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "'%s' model configured for domain, but " + "hypervisor driver is '%s'."), + secdef->model, virSecurityManagerGetModel(mgr)); goto done; } @@ -1357,11 +1357,11 @@ SELinuxSetSecuritySocketLabel(virSecurityManagerPtr mgr, return 0; if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: " - "'%s' model configured for domain, but " - "hypervisor driver is '%s'."), - secdef->model, virSecurityManagerGetModel(mgr)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "'%s' model configured for domain, but " + "hypervisor driver is '%s'."), + secdef->model, virSecurityManagerGetModel(mgr)); goto done; } @@ -1394,11 +1394,11 @@ SELinuxClearSecuritySocketLabel(virSecurityManagerPtr mgr, return 0; if (!STREQ(virSecurityManagerGetModel(mgr), secdef->model)) { - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("security label driver mismatch: " - "'%s' model configured for domain, but " - "hypervisor driver is '%s'."), - secdef->model, virSecurityManagerGetModel(mgr)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label driver mismatch: " + "'%s' model configured for domain, but " + "hypervisor driver is '%s'."), + secdef->model, virSecurityManagerGetModel(mgr)); if (security_getenforce() == 1) return -1; } @@ -1451,9 +1451,9 @@ SELinuxSetSecuritySmartcardCallback(virDomainDefPtr def, return SELinuxSetSecurityChardevLabel(def, &dev->data.passthru); default: - virSecurityReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown smartcard type %d"), - dev->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown smartcard type %d"), + dev->type); return -1; } -- 1.7.10.4

On 18.07.2012 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the security drivers to use virReportError instead of the virSecurityReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/security/security_apparmor.c | 94 ++++++++++++++++----------------- src/security/security_driver.c | 8 +-- src/security/security_manager.c | 50 +++++++++--------- src/security/security_manager.h | 5 -- src/security/security_selinux.c | 106 +++++++++++++++++++------------------- 6 files changed, 130 insertions(+), 134 deletions(-)
ACK Michal

From: "Daniel P. Berrange" <berrange@redhat.com> Update the Power-Hypervisor driver to use virReportError instead of the PHYP_ERROR custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/phyp/phyp_driver.c | 76 +++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/cfg.mk b/cfg.mk index 434bbe1..c6f921c 100644 --- a/cfg.mk +++ b/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 diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 5136fbc..25de1ab 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -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,16 +998,16 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth, } } else { if (auth == NULL || auth->cb == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, - "%s", _("No authentication callback provided.")); + virReportError(VIR_ERR_AUTH_FAILED, + "%s", _("No authentication callback provided.")); goto err; } username = virAuthGetUsername(conn, auth, "ssh", NULL, conn->uri->server); if (username == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", - _("Username request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Username request failed")); goto err; } } @@ -1023,8 +1019,8 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth, ret = getaddrinfo(hostname, "22", &hints, &ai); if (ret != 0) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Error while getting %s address info"), hostname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while getting %s address info"), hostname); goto err; } @@ -1040,8 +1036,8 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth, cur = cur->ai_next; } - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Failed to connect to %s"), hostname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to connect to %s"), hostname); freeaddrinfo(ai); goto err; @@ -1060,8 +1056,8 @@ connected: while ((rc = libssh2_session_startup(session, sock)) == LIBSSH2_ERROR_EAGAIN) ; if (rc) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failure establishing SSH session.")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failure establishing SSH session.")); goto disconnect; } @@ -1083,16 +1079,16 @@ keyboard_interactive: || rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED || rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) { if (auth == NULL || auth->cb == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, - "%s", _("No authentication callback provided.")); + virReportError(VIR_ERR_AUTH_FAILED, + "%s", _("No authentication callback provided.")); goto disconnect; } password = virAuthGetPassword(conn, auth, "ssh", username, conn->uri->server); if (password == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", - _("Password request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Password request failed")); goto disconnect; } @@ -1102,8 +1098,8 @@ keyboard_interactive: LIBSSH2_ERROR_EAGAIN) ; if (rc) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, - "%s", _("Authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, + "%s", _("Authentication failed")); goto disconnect; } else goto exit; @@ -1157,8 +1153,8 @@ phypOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; if (conn->uri->server == NULL) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing server name in phyp:// URI")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing server name in phyp:// URI")); return VIR_DRV_OPEN_ERROR; } @@ -1198,16 +1194,16 @@ phypOpen(virConnectPtr conn, *char_ptr = '\0'; if (contains_specialcharacters(conn->uri->path)) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", - _("Error parsing 'path'. Invalid characters.")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("Error parsing 'path'. Invalid characters.")); goto failure; } } if ((session = openSSHSession(conn, auth, &internal_socket)) == NULL) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error while opening SSH session.")); + 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,29 +3581,29 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) virBuffer buf = VIR_BUFFER_INITIALIZER; if (!def->mem.cur_balloon) { - PHYP_ERROR(VIR_ERR_XML_ERROR, "%s", - _("Field <memory> on the domain XML file is missing or has " - "invalid value.")); + 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", - _("Field <currentMemory> on the domain XML file is missing or " - "has invalid value.")); + 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", - _("Domain XML must contain at least one <disk> element.")); + 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", - _("Field <src> under <disk> on the domain XML file is " - "missing.")); + 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; } -- 1.7.10.4

On 07/18/2012 08:40 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the Power-Hypervisor driver to use virReportError instead of the PHYP_ERROR custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/phyp/phyp_driver.c | 76 +++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/cfg.mk b/cfg.mk index 434bbe1..c6f921c 100644 --- a/cfg.mk +++ b/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 diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 5136fbc..25de1ab 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -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,16 +998,16 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth, } } else { if (auth == NULL || auth->cb == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, - "%s", _("No authentication callback provided.")); + virReportError(VIR_ERR_AUTH_FAILED, + "%s", _("No authentication callback provided.")); goto err; }
username = virAuthGetUsername(conn, auth, "ssh", NULL, conn->uri->server);
if (username == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", - _("Username request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Username request failed")); goto err; } } @@ -1023,8 +1019,8 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
ret = getaddrinfo(hostname, "22", &hints, &ai); if (ret != 0) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Error while getting %s address info"), hostname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while getting %s address info"), hostname); goto err; }
@@ -1040,8 +1036,8 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth, cur = cur->ai_next; }
- PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Failed to connect to %s"), hostname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to connect to %s"), hostname); freeaddrinfo(ai); goto err;
@@ -1060,8 +1056,8 @@ connected: while ((rc = libssh2_session_startup(session, sock)) == LIBSSH2_ERROR_EAGAIN) ; if (rc) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failure establishing SSH session.")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failure establishing SSH session.")); goto disconnect; }
@@ -1083,16 +1079,16 @@ keyboard_interactive: || rc == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED || rc == LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) { if (auth == NULL || auth->cb == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, - "%s", _("No authentication callback provided.")); + virReportError(VIR_ERR_AUTH_FAILED, + "%s", _("No authentication callback provided.")); goto disconnect; }
password = virAuthGetPassword(conn, auth, "ssh", username, conn->uri->server);
if (password == NULL) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, "%s", - _("Password request failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("Password request failed")); goto disconnect; }
@@ -1102,8 +1098,8 @@ keyboard_interactive: LIBSSH2_ERROR_EAGAIN) ;
if (rc) { - PHYP_ERROR(VIR_ERR_AUTH_FAILED, - "%s", _("Authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, + "%s", _("Authentication failed")); goto disconnect; } else goto exit; @@ -1157,8 +1153,8 @@ phypOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED;
if (conn->uri->server == NULL) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing server name in phyp:// URI")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Missing server name in phyp:// URI")); return VIR_DRV_OPEN_ERROR; }
@@ -1198,16 +1194,16 @@ phypOpen(virConnectPtr conn, *char_ptr = '\0';
if (contains_specialcharacters(conn->uri->path)) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", - _("Error parsing 'path'. Invalid characters.")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", + _("Error parsing 'path'. Invalid characters.")); goto failure; } }
if ((session = openSSHSession(conn, auth, &internal_socket)) == NULL) { - PHYP_ERROR(VIR_ERR_INTERNAL_ERROR, - "%s", _("Error while opening SSH session.")); + 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,29 +3581,29 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) virBuffer buf = VIR_BUFFER_INITIALIZER;
if (!def->mem.cur_balloon) { - PHYP_ERROR(VIR_ERR_XML_ERROR, "%s", - _("Field <memory> on the domain XML file is missing or has " - "invalid value.")); + 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", - _("Field <currentMemory> on the domain XML file is missing or " - "has invalid value.")); + 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", - _("Domain XML must contain at least one <disk> element.")); + 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", - _("Field <src> under <disk> on the domain XML file is " - "missing.")); + 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; }
ACK. Martin

From: "Daniel P. Berrange" <berrange@redhat.com> Update the VMX shared code to use virReportError instead of the VMX_ERROR custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/vmx/vmx.c | 738 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 367 insertions(+), 372 deletions(-) diff --git a/cfg.mk b/cfg.mk index c6f921c..6be785a 100644 --- a/cfg.mk +++ b/cfg.mk @@ -507,7 +507,6 @@ sc_avoid_attribute_unused_in_header: msg_gen_function = msg_gen_function += VIR_ERROR -msg_gen_function += VMX_ERROR msg_gen_function += lxcError msg_gen_function += nodeReportError msg_gen_function += qemuReportError diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 7357030..f5baf87 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -471,10 +471,6 @@ def->parallels[0]... #define VIR_FROM_THIS VIR_FROM_NONE -#define VMX_ERROR(code, ...) \ - virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - #define VMX_BUILD_NAME_EXTRA(_suffix, _extra) \ snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."_extra, prefix); @@ -586,8 +582,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string) handler = xmlFindCharEncodingHandler(encoding); if (handler == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("libxml2 doesn't handle %s encoding"), encoding); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxml2 doesn't handle %s encoding"), encoding); return NULL; } @@ -595,8 +591,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string) utf8 = xmlBufferCreate(); if (xmlCharEncInFunc(handler, utf8, input) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not convert from %s to UTF-8 encoding"), encoding); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not convert from %s to UTF-8 encoding"), encoding); goto cleanup; } @@ -627,14 +623,14 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char **string, return 0; } - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } if (value->type != VIR_CONF_STRING) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; } @@ -643,8 +639,8 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char **string, return 0; } - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } @@ -672,15 +668,15 @@ virVMXGetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } if (value->type != VIR_CONF_STRING) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; } @@ -688,15 +684,15 @@ virVMXGetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } if (virUUIDParse(value->str, uuid) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse UUID from string '%s'"), value->str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse UUID from string '%s'"), value->str); return -1; } @@ -718,8 +714,8 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long *number, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -729,8 +725,8 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long *number, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -738,14 +734,14 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long *number, if (STRCASEEQ(value->str, "unlimited")) { *number = -1; } else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must represent an integer value"), - name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must represent an integer value"), + name); return -1; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; } @@ -767,8 +763,8 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -778,8 +774,8 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -789,14 +785,14 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_, } else if (STRCASEEQ(value->str, "false")) { *boolean_ = 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must represent a boolean value " - "(true|false)"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must represent a boolean value " + "(true|false)"), name); return -1; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; } @@ -811,24 +807,24 @@ virVMXSCSIDiskNameToControllerAndUnit(const char *name, int *controller, int *un int idx; if (! STRPREFIX(name, "sd")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expecting domain XML attribute 'dev' of entry " - "'devices/disk/target' to start with 'sd'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML attribute 'dev' of entry " + "'devices/disk/target' to start with 'sd'")); return -1; } idx = virDiskNameToIndex(name); if (idx < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse valid disk index from '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse valid disk index from '%s'"), name); return -1; } /* Each of the 4 SCSI controllers has 1 bus with 15 units each for devices */ if (idx >= (4 * 15)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI disk index (parsed from '%s') is too large"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI disk index (parsed from '%s') is too large"), name); return -1; } @@ -851,24 +847,24 @@ virVMXIDEDiskNameToBusAndUnit(const char *name, int *bus, int *unit) int idx; if (! STRPREFIX(name, "hd")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expecting domain XML attribute 'dev' of entry " - "'devices/disk/target' to start with 'hd'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML attribute 'dev' of entry " + "'devices/disk/target' to start with 'hd'")); return -1; } idx = virDiskNameToIndex(name); if (idx < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse valid disk index from '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse valid disk index from '%s'"), name); return -1; } /* The IDE controller has 2 buses with 2 units each for devices */ if (idx >= (2 * 2)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE disk index (parsed from '%s') is too large"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE disk index (parsed from '%s') is too large"), name); return -1; } @@ -886,24 +882,24 @@ virVMXFloppyDiskNameToUnit(const char *name, int *unit) int idx; if (! STRPREFIX(name, "fd")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expecting domain XML attribute 'dev' of entry " - "'devices/disk/target' to start with 'fd'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML attribute 'dev' of entry " + "'devices/disk/target' to start with 'fd'")); return -1; } idx = virDiskNameToIndex(name); if (idx < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse valid disk index from '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse valid disk index from '%s'"), name); return -1; } /* The FDC controller has 1 bus with 2 units for devices */ if (idx >= 2) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Floppy disk index (parsed from '%s') is too large"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Floppy disk index (parsed from '%s') is too large"), name); return -1; } @@ -923,9 +919,9 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk) memset(&def, 0, sizeof(def)); if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported disk address type '%s'"), - virDomainDeviceAddressTypeToString(disk->info.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported disk address type '%s'"), + virDomainDeviceAddressTypeToString(disk->info.type)); return -1; } @@ -935,88 +931,88 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk) def.bus = disk->bus; if (virDomainDiskDefAssignAddress(caps, &def) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not verify disk address")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not verify disk address")); return -1; } if (def.info.addr.drive.controller != drive->controller || def.info.addr.drive.bus != drive->bus || def.info.addr.drive.unit != drive->unit) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Disk address %d:%d:%d doesn't match target device '%s'"), - drive->controller, drive->bus, drive->unit, disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Disk address %d:%d:%d doesn't match target device '%s'"), + drive->controller, drive->bus, drive->unit, disk->dst); return -1; } /* drive->{controller|bus|unit} is unsigned, no >= 0 checks are necessary */ if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (drive->controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - drive->controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + drive->controller); return -1; } if (drive->bus != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI bus index %d out of [0] range"), - drive->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI bus index %d out of [0] range"), + drive->bus); return -1; } if (drive->unit > 15 || drive->unit == 7) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI unit index %d out of [0..6,8..15] range"), - drive->unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI unit index %d out of [0..6,8..15] range"), + drive->unit); return -1; } } else if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) { if (drive->controller != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE controller index %d out of [0] range"), - drive->controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE controller index %d out of [0] range"), + drive->controller); return -1; } if (drive->bus > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE bus index %d out of [0..1] range"), - drive->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE bus index %d out of [0..1] range"), + drive->bus); return -1; } if (drive->unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE unit index %d out of [0..1] range"), - drive->unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE unit index %d out of [0..1] range"), + drive->unit); return -1; } } else if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) { if (drive->controller != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC controller index %d out of [0] range"), - drive->controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC controller index %d out of [0] range"), + drive->controller); return -1; } if (drive->bus != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC bus index %d out of [0] range"), - drive->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC bus index %d out of [0] range"), + drive->bus); return -1; } if (drive->unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC unit index %d out of [0..1] range"), - drive->unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC unit index %d out of [0..1] range"), + drive->unit); return -1; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s'"), - virDomainDiskBusTypeToString(disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s'"), + virDomainDiskBusTypeToString(disk->bus)); return -1; } @@ -1046,8 +1042,8 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def, model = virDomainControllerModelSCSITypeFromString(disk->driverName); if (model < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Unknown driver name '%s'"), disk->driverName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown driver name '%s'"), disk->driverName); return -1; } @@ -1059,20 +1055,20 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def, } if (controller == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing SCSI controller for index %d"), - disk->info.addr.drive.controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing SCSI controller for index %d"), + disk->info.addr.drive.controller); return -1; } if (controller->model == -1) { controller->model = model; } else if (controller->model != model) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Inconsistent SCSI controller model ('%s' is not '%s') " - "for SCSI controller index %d"), disk->driverName, - virDomainControllerModelSCSITypeToString(controller->model), - controller->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Inconsistent SCSI controller model ('%s' is not '%s') " + "for SCSI controller index %d"), disk->driverName, + virDomainControllerModelSCSITypeToString(controller->model), + controller->idx); return -1; } @@ -1148,10 +1144,10 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def, * have inconsistent SCSI controller models */ for (k = 0; k < count; ++k) { if (autodetectedModels[k] != autodetectedModels[0]) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Disks on SCSI controller %d have inconsistent " - "controller models, cannot autodetect model"), - controller->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Disks on SCSI controller %d have inconsistent " + "controller models, cannot autodetect model"), + controller->idx); goto cleanup; } } @@ -1164,11 +1160,11 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def, controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC && controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 && controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML attribute 'model' of entry " - "'controller' to be 'buslogic' or 'lsilogic' or " - "'lsisas1068' or 'vmpvscsi' but found '%s'"), - virDomainControllerModelSCSITypeToString(controller->model)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML attribute 'model' of entry " + "'controller' to be 'buslogic' or 'lsilogic' or " + "'lsisas1068' or 'vmpvscsi' but found '%s'"), + virDomainControllerModelSCSITypeToString(controller->model)); goto cleanup; } @@ -1216,8 +1212,8 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) int unit; if (ctx->parseFileName == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("virVMXContext has no parseFileName function set")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("virVMXContext has no parseFileName function set")); return NULL; } @@ -1269,9 +1265,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) } if (config_version != 8) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'config.version' to be 8 but found " - "%lld"), config_version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'config.version' to be 8 but found " + "%lld"), config_version); goto cleanup; } @@ -1283,10 +1279,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) if (virtualHW_version != 4 && virtualHW_version != 7 && virtualHW_version != 8) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'virtualHW.version' to be 4, 7 or 8 " - "but found %lld"), - virtualHW_version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'virtualHW.version' to be 4, 7 or 8 " + "but found %lld"), + virtualHW_version); goto cleanup; } @@ -1304,8 +1300,8 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) if (def->name != NULL) { if (virVMXUnescapeHexPercent(def->name) < 0 || virVMXUnescapeHexPipe(def->name) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("VMX entry 'name' contains invalid escape sequence")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("VMX entry 'name' contains invalid escape sequence")); goto cleanup; } } @@ -1318,9 +1314,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) if (def->description != NULL) { if (virVMXUnescapeHexPipe(def->description) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("VMX entry 'annotation' contains invalid escape " - "sequence")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("VMX entry 'annotation' contains invalid escape " + "sequence")); goto cleanup; } } @@ -1331,9 +1327,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) } if (memsize <= 0 || memsize % 4 != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'memsize' to be an unsigned " - "integer (multiple of 4) but found %lld"), memsize); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'memsize' to be an unsigned " + "integer (multiple of 4) but found %lld"), memsize); goto cleanup; } @@ -1377,9 +1373,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) } if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'numvcpus' to be an unsigned " - "integer (1 or a multiple of 2) but found %lld"), numvcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'numvcpus' to be an unsigned " + "integer (1 or a multiple of 2) but found %lld"), numvcpus); goto cleanup; } @@ -1409,17 +1405,17 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) number = virParseNumber(¤t); if (number < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to be " - "a comma separated list of unsigned integers but " - "found '%s'"), sched_cpu_affinity); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to be " + "a comma separated list of unsigned integers but " + "found '%s'"), sched_cpu_affinity); goto cleanup; } if (number >= VIR_DOMAIN_CPUMASK_LEN) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VMX entry 'sched.cpu.affinity' contains a %d, " - "this value is too large"), number); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry 'sched.cpu.affinity' contains a %d, " + "this value is too large"), number); goto cleanup; } @@ -1437,10 +1433,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) } else if (*current == '\0') { break; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to be " - "a comma separated list of unsigned integers but " - "found '%s'"), sched_cpu_affinity); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to be " + "a comma separated list of unsigned integers but " + "found '%s'"), sched_cpu_affinity); goto cleanup; } @@ -1448,10 +1444,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) } if (count < numvcpus) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to contain " - "at least as many values as 'numvcpus' (%lld) but " - "found only %d value(s)"), numvcpus, count); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to contain " + "at least as many values as 'numvcpus' (%lld) but " + "found only %d value(s)"), numvcpus, count); goto cleanup; } } @@ -1472,10 +1468,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) def->cputune.shares = def->vcpus * 2000; } else if (virStrToLong_ul(sched_cpu_shares, NULL, 10, &def->cputune.shares) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.shares' to be an " - "unsigned integer or 'low', 'normal' or 'high' but " - "found '%s'"), sched_cpu_shares); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.shares' to be an " + "unsigned integer or 'low', 'normal' or 'high' but " + "found '%s'"), sched_cpu_shares); goto cleanup; } } @@ -1633,7 +1629,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) /* def:controllers */ if (virDomainDefAddImplicitControllers(def) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers")); goto cleanup; } @@ -1641,9 +1637,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) if (def->controllers[controller]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { if (def->controllers[controller]->idx < 0 || def->controllers[controller]->idx > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - def->controllers[controller]->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + def->controllers[controller]->idx); goto cleanup; } @@ -1762,7 +1758,7 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) char *listenAddr = NULL; if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1837,14 +1833,14 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present, char *tmp; if (virtualDev == NULL || *virtualDev != -1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } if (controller < 0 || controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + controller); return -1; } @@ -1880,10 +1876,10 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present, *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC && *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 && *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' " - "or 'lsisas1068' or 'pvscsi' but found '%s'"), - virtualDev_name, virtualDev_string); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' " + "or 'lsisas1068' or 'pvscsi' but found '%s'"), + virtualDev_name, virtualDev_string); goto cleanup; } } @@ -1945,7 +1941,7 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, bool writeThrough = false; if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -1962,16 +1958,16 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (busType == VIR_DOMAIN_DISK_BUS_SCSI) { if (controllerOrBus < 0 || controllerOrBus > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - controllerOrBus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + controllerOrBus); goto cleanup; } if (unit < 0 || unit > 15 || unit == 7) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI unit index %d out of [0..6,8..15] range"), - unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI unit index %d out of [0..6,8..15] range"), + unit); goto cleanup; } @@ -1989,15 +1985,15 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, } } else if (busType == VIR_DOMAIN_DISK_BUS_IDE) { if (controllerOrBus < 0 || controllerOrBus > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE bus index %d out of [0..1] range"), - controllerOrBus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE bus index %d out of [0..1] range"), + controllerOrBus); goto cleanup; } if (unit < 0 || unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE unit index %d out of [0..1] range"), unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE unit index %d out of [0..1] range"), unit); goto cleanup; } @@ -2012,25 +2008,25 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for device type '%s'"), - virDomainDiskBusTypeToString(busType), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for device type '%s'"), + virDomainDiskBusTypeToString(busType), + virDomainDiskDeviceTypeToString(device)); goto cleanup; } } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (busType == VIR_DOMAIN_DISK_BUS_FDC) { if (controllerOrBus != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC controller index %d out of [0] range"), - controllerOrBus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC controller index %d out of [0] range"), + controllerOrBus); goto cleanup; } if (unit < 0 || unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC unit index %d out of [0..1] range"), - unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC unit index %d out of [0..1] range"), + unit); goto cleanup; } @@ -2045,16 +2041,16 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for device type '%s'"), - virDomainDiskBusTypeToString(busType), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for device type '%s'"), + virDomainDiskBusTypeToString(busType), + virDomainDiskDeviceTypeToString(device)); goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported device type '%s'"), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported device type '%s'"), + virDomainDiskDeviceTypeToString(device)); goto cleanup; } @@ -2124,18 +2120,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, if (busType == VIR_DOMAIN_DISK_BUS_SCSI && STRCASENEQ(deviceType, "scsi-hardDisk") && STRCASENEQ(deviceType, "disk")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'scsi-hardDisk' " - "or 'disk' but found '%s'"), deviceType_name, - deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'scsi-hardDisk' " + "or 'disk' but found '%s'"), deviceType_name, + deviceType); goto cleanup; } else if (busType == VIR_DOMAIN_DISK_BUS_IDE && STRCASENEQ(deviceType, "ata-hardDisk") && STRCASENEQ(deviceType, "disk")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'ata-hardDisk' " - "or 'disk' but found '%s'"), deviceType_name, - deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'ata-hardDisk' " + "or 'disk' but found '%s'"), deviceType_name, + deviceType); goto cleanup; } } @@ -2158,18 +2154,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, */ goto ignore; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid or not yet handled value '%s' for VMX entry " - "'%s'"), fileName, fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid or not yet handled value '%s' for VMX entry " + "'%s'"), fileName, fileName_name); goto cleanup; } } else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (virFileHasSuffix(fileName, ".iso")) { if (deviceType != NULL) { if (STRCASENEQ(deviceType, "cdrom-image")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'cdrom-image' " - "but found '%s'"), deviceType_name, deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'cdrom-image' " + "but found '%s'"), deviceType_name, deviceType); goto cleanup; } } @@ -2194,18 +2190,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, fileName = NULL; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid or not yet handled value '%s' for VMX entry " - "'%s'"), fileName, fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid or not yet handled value '%s' for VMX entry " + "'%s'"), fileName, fileName_name); goto cleanup; } } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (virFileHasSuffix(fileName, ".flp")) { if (fileType != NULL) { if (STRCASENEQ(fileType, "file")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'file' but " - "found '%s'"), fileType_name, fileType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'file' but " + "found '%s'"), fileType_name, fileType); goto cleanup; } } @@ -2222,20 +2218,20 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, fileName = NULL; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid or not yet handled value '%s' for VMX entry " - "'%s'"), fileName, fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid or not yet handled value '%s' for VMX entry " + "'%s'"), fileName, fileName_name); goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported device type '%s'"), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported device type '%s'"), + virDomainDiskDeviceTypeToString(device)); goto cleanup; } if (virDomainDiskDefAssignAddress(caps, *def) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not assign address to disk '%s'"), (*def)->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not assign address to disk '%s'"), (*def)->src); goto cleanup; } @@ -2302,14 +2298,14 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) char *networkName = NULL; if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } if (controller < 0 || controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Ethernet controller index %d out of [0..3] range"), - controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Ethernet controller index %d out of [0..3] range"), + controller); return -1; } @@ -2366,26 +2362,26 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) STRCASEEQ(addressType, "vpx")) { if (generatedAddress != NULL) { if (virMacAddrParse(generatedAddress, &(*def)->mac) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be MAC address but " - "found '%s'"), generatedAddress_name, - generatedAddress); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be MAC address but " + "found '%s'"), generatedAddress_name, + generatedAddress); goto cleanup; } } } else if (STRCASEEQ(addressType, "static")) { if (address != NULL) { if (virMacAddrParse(address, &(*def)->mac) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be MAC address but " - "found '%s'"), address_name, address); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be MAC address but " + "found '%s'"), address_name, address); goto cleanup; } } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'generated' or 'static' or " - "'vpx' but found '%s'"), addressType_name, addressType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'generated' or 'static' or " + "'vpx' but found '%s'"), addressType_name, addressType); goto cleanup; } @@ -2400,10 +2396,10 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) STRCASENEQ(virtualDev, "vmxnet") && STRCASENEQ(virtualDev, "vmxnet3") && STRCASENEQ(virtualDev, "e1000")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " - "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name, - virtualDev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " + "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name, + virtualDev); goto cleanup; } @@ -2452,9 +2448,9 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) networkName = NULL; } else if (STRCASEEQ(connectionType, "hostonly")) { /* FIXME */ - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("No yet handled value '%s' for VMX entry '%s'"), - connectionType, connectionType_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No yet handled value '%s' for VMX entry '%s'"), + connectionType, connectionType_name); goto cleanup; } else if (STRCASEEQ(connectionType, "nat")) { (*def)->type = VIR_DOMAIN_NET_TYPE_USER; @@ -2471,9 +2467,9 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) networkName = NULL; vnet = NULL; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid value '%s' for VMX entry '%s'"), connectionType, - connectionType_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid value '%s' for VMX entry '%s'"), connectionType, + connectionType_name); goto cleanup; } @@ -2531,13 +2527,13 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, virURIPtr parsedUri = NULL; if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } if (port < 0 || port > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Serial port index %d out of [0..3] range"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Serial port index %d out of [0..3] range"), port); return -1; } @@ -2622,9 +2618,9 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, goto cleanup; if (parsedUri->port == 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VMX entry '%s' doesn't contain a port part"), - fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry '%s' doesn't contain a port part"), + fileName_name); goto cleanup; } @@ -2659,9 +2655,9 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, STRCASEEQ(parsedUri->scheme, "tcp6+ssl")) { (*def)->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VMX entry '%s' contains unsupported scheme '%s'"), - fileName_name, parsedUri->scheme); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry '%s' contains unsupported scheme '%s'"), + fileName_name, parsedUri->scheme); goto cleanup; } @@ -2670,15 +2666,15 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, } else if (STRCASEEQ(network_endPoint, "client")) { (*def)->source.data.tcp.listen = false; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'server' or 'client' " - "but found '%s'"), network_endPoint_name, network_endPoint); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'server' or 'client' " + "but found '%s'"), network_endPoint_name, network_endPoint); goto cleanup; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' " - "or 'network' but found '%s'"), fileType_name, fileType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' " + "or 'network' but found '%s'"), fileType_name, fileType); goto cleanup; } @@ -2728,13 +2724,13 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port, char *fileName = NULL; if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } if (port < 0 || port > 2) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Parallel port index %d out of [0..2] range"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parallel port index %d out of [0..2] range"), port); return -1; } @@ -2795,9 +2791,9 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port, goto cleanup; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'device' or 'file' but " - "found '%s'"), fileType_name, fileType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'device' or 'file' but " + "found '%s'"), fileType_name, fileType); goto cleanup; } @@ -2832,7 +2828,7 @@ virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def) long long svga_vramSize = 0; if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -2886,18 +2882,18 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, bool floppy_present[2] = { false, false }; if (ctx->formatFileName == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("virVMXContext has no formatFileName function set")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("virVMXContext has no formatFileName function set")); return NULL; } memset(zero, 0, VIR_UUID_BUFLEN); if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting virt type to be '%s' but found '%s'"), - virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE), - virDomainVirtTypeToString(def->virtType)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting virt type to be '%s' but found '%s'"), + virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE), + virDomainVirtTypeToString(def->virtType)); return NULL; } @@ -2917,9 +2913,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, } else if (STRCASEEQ(def->os.arch, "x86_64")) { virBufferAddLit(&buffer, "guestOS = \"other-64\"\n"); } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML attribute 'arch' of entry 'os/type' " - "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML attribute 'arch' of entry 'os/type' " + "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch); goto cleanup; } @@ -2930,9 +2926,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, } else if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) { virBufferAddLit(&buffer, "smbios.reflecthost = \"true\"\n"); } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported SMBIOS mode '%s'"), - virDomainSmbiosModeTypeToString(def->os.smbios_mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported SMBIOS mode '%s'"), + virDomainSmbiosModeTypeToString(def->os.smbios_mode)); goto cleanup; } @@ -2994,16 +2990,16 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, /* def:maxvcpus -> vmx:numvcpus */ if (def->vcpus != def->maxvcpus) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No support for domain XML entry 'vcpu' attribute " - "'current'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No support for domain XML entry 'vcpu' attribute " + "'current'")); goto cleanup; } if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 && def->maxvcpus != 1)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML entry 'vcpu' to be an unsigned " - "integer (1 or a multiple of 2) but found %d"), - def->maxvcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML entry 'vcpu' to be an unsigned " + "integer (1 or a multiple of 2) but found %d"), + def->maxvcpus); goto cleanup; } @@ -3022,10 +3018,10 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, } if (sched_cpu_affinity_length < def->maxvcpus) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML attribute 'cpuset' of entry " - "'vcpu' to contain at least %d CPU(s)"), - def->maxvcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML attribute 'cpuset' of entry " + "'vcpu' to contain at least %d CPU(s)"), + def->maxvcpus); goto cleanup; } @@ -3070,9 +3066,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, break; default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported graphics type '%s'"), - virDomainGraphicsTypeToString(def->graphics[i]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported graphics type '%s'"), + virDomainGraphicsTypeToString(def->graphics[i]->type)); goto cleanup; } } @@ -3127,9 +3123,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, break; default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported disk device type '%s'"), - virDomainDiskDeviceTypeToString(def->disks[i]->device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported disk device type '%s'"), + virDomainDiskDeviceTypeToString(def->disks[i]->device)); goto cleanup; } } @@ -3160,8 +3156,8 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, /* def:videos */ if (def->nvideos > 0) { if (def->nvideos > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("No support for multiple video devices")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No support for multiple video devices")); goto cleanup; } @@ -3215,7 +3211,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) const char *listenAddr; if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3265,7 +3261,7 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, char *fileName = NULL; if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3288,17 +3284,17 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for harddisk"), - virDomainDiskBusTypeToString(def->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for harddisk"), + virDomainDiskBusTypeToString(def->bus)); return -1; } if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), - busName, def->dst, virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), + busName, def->dst, virDomainDiskTypeToString(def->type), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); return -1; } @@ -3309,9 +3305,9 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".vmdk")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s harddisk '%s' has unsupported suffix, " - "expecting '.vmdk'"), busName, def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Image file for %s harddisk '%s' has unsupported suffix, " + "expecting '.vmdk'"), busName, def->dst); return -1; } @@ -3332,10 +3328,10 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferAsprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n", entryPrefix, controllerOrBus, unit); } else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported cache mode '%s'"), - busName, def->dst, - virDomainDiskCacheTypeToString(def->cachemode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s harddisk '%s' has unsupported cache mode '%s'"), + busName, def->dst, + virDomainDiskCacheTypeToString(def->cachemode)); return -1; } } @@ -3355,7 +3351,7 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, char *fileName = NULL; if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3376,9 +3372,9 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for cdrom"), - virDomainDiskBusTypeToString(def->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for cdrom"), + virDomainDiskBusTypeToString(def->bus)); return -1; } @@ -3391,9 +3387,9 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".iso")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s cdrom '%s' has unsupported " - "suffix, expecting '.iso'"), busName, def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Image file for %s cdrom '%s' has unsupported " + "suffix, expecting '.iso'"), busName, def->dst); return -1; } @@ -3417,12 +3413,12 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, entryPrefix, controllerOrBus, unit, def->src); } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s cdrom '%s' has unsupported type '%s', expecting '%s' " - "or '%s'"), busName, def->dst, - virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s cdrom '%s' has unsupported type '%s', expecting '%s' " + "or '%s'"), busName, def->dst, + virDomainDiskTypeToString(def->type), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); return -1; } @@ -3439,7 +3435,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, char *fileName = NULL; if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; } @@ -3456,9 +3452,9 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".flp")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Image file for floppy '%s' has unsupported " - "suffix, expecting '.flp'"), def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Image file for floppy '%s' has unsupported " + "suffix, expecting '.flp'"), def->dst); return -1; } @@ -3481,12 +3477,12 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, unit, def->src); } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Floppy '%s' has unsupported type '%s', expecting '%s' " - "or '%s'"), def->dst, - virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Floppy '%s' has unsupported type '%s', expecting '%s' " + "or '%s'"), def->dst, + virDomainDiskTypeToString(def->type), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); return -1; } @@ -3503,9 +3499,9 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, unsigned int prefix, suffix; if (controller < 0 || controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Ethernet controller index %d out of [0..3] range"), - controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Ethernet controller index %d out of [0..3] range"), + controller); return -1; } @@ -3518,10 +3514,10 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, STRCASENEQ(def->model, "vmxnet2") && STRCASENEQ(def->model, "vmxnet3") && STRCASENEQ(def->model, "e1000")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML entry 'devices/interface/model' " - "to be 'vlance' or 'vmxnet' or 'vmxnet2' or 'vmxnet3' " - "or 'e1000' but found '%s'"), def->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML entry 'devices/interface/model' " + "to be 'vlance' or 'vmxnet' or 'vmxnet2' or 'vmxnet3' " + "or 'e1000' but found '%s'"), def->model); return -1; } @@ -3561,8 +3557,8 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, break; default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"), - virDomainNetTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"), + virDomainNetTypeToString(def->type)); return -1; } @@ -3611,9 +3607,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, const char *protocol; if (def->target.port < 0 || def->target.port > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Serial port index %d out of [0..3] range"), - def->target.port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Serial port index %d out of [0..3] range"), + def->target.port); return -1; } @@ -3676,9 +3672,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, break; default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device TCP protocol '%s'"), - virDomainChrTcpProtocolTypeToString( + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device TCP protocol '%s'"), + virDomainChrTcpProtocolTypeToString( def->source.data.tcp.protocol)); return -1; } @@ -3694,9 +3690,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, break; default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device type '%s'"), - virDomainChrTypeToString(def->source.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device type '%s'"), + virDomainChrTypeToString(def->source.type)); return -1; } @@ -3717,9 +3713,9 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def, char *fileName = NULL; if (def->target.port < 0 || def->target.port > 2) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Parallel port index %d out of [0..2] range"), - def->target.port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parallel port index %d out of [0..2] range"), + def->target.port); return -1; } @@ -3752,9 +3748,9 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def, break; default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device type '%s'"), - virDomainChrTypeToString(def->source.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device type '%s'"), + virDomainChrTypeToString(def->source.type)); return -1; } @@ -3769,9 +3765,9 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer) unsigned long long vram; if (def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported video device type '%s'"), - virDomainVideoTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported video device type '%s'"), + virDomainVideoTypeToString(def->type)); return -1; } @@ -3782,8 +3778,8 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer) vram = VIR_DIV_UP(def->vram, 64) * 64; if (def->heads > 1) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Multi-head video devices are unsupported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Multi-head video devices are unsupported")); return -1; } -- 1.7.10.4

On 07/18/2012 08:40 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the VMX shared code to use virReportError instead of the VMX_ERROR custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/vmx/vmx.c | 738 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 367 insertions(+), 372 deletions(-)
diff --git a/cfg.mk b/cfg.mk index c6f921c..6be785a 100644 --- a/cfg.mk +++ b/cfg.mk @@ -507,7 +507,6 @@ sc_avoid_attribute_unused_in_header:
msg_gen_function = msg_gen_function += VIR_ERROR -msg_gen_function += VMX_ERROR msg_gen_function += lxcError msg_gen_function += nodeReportError msg_gen_function += qemuReportError diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 7357030..f5baf87 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -471,10 +471,6 @@ def->parallels[0]...
#define VIR_FROM_THIS VIR_FROM_NONE
-#define VMX_ERROR(code, ...) \ - virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, __FUNCTION__, \ - __LINE__, __VA_ARGS__) - #define VMX_BUILD_NAME_EXTRA(_suffix, _extra) \ snprintf(_suffix##_name, sizeof(_suffix##_name), "%s."_extra, prefix);
@@ -586,8 +582,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string) handler = xmlFindCharEncodingHandler(encoding);
if (handler == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("libxml2 doesn't handle %s encoding"), encoding); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("libxml2 doesn't handle %s encoding"), encoding); return NULL; }
@@ -595,8 +591,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string) utf8 = xmlBufferCreate();
if (xmlCharEncInFunc(handler, utf8, input) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not convert from %s to UTF-8 encoding"), encoding); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not convert from %s to UTF-8 encoding"), encoding); goto cleanup; }
@@ -627,14 +623,14 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char **string, return 0; }
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; }
if (value->type != VIR_CONF_STRING) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; }
@@ -643,8 +639,8 @@ virVMXGetConfigString(virConfPtr conf, const char *name, char **string, return 0; }
- VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; }
@@ -672,15 +668,15 @@ virVMXGetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } }
if (value->type != VIR_CONF_STRING) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; }
@@ -688,15 +684,15 @@ virVMXGetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } }
if (virUUIDParse(value->str, uuid) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse UUID from string '%s'"), value->str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse UUID from string '%s'"), value->str); return -1; }
@@ -718,8 +714,8 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long *number, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -729,8 +725,8 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long *number, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -738,14 +734,14 @@ virVMXGetConfigLong(virConfPtr conf, const char *name, long long *number, if (STRCASEEQ(value->str, "unlimited")) { *number = -1; } else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must represent an integer value"), - name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must represent an integer value"), + name); return -1; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; }
@@ -767,8 +763,8 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -778,8 +774,8 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_, if (optional) { return 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing essential config entry '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing essential config entry '%s'"), name); return -1; } } @@ -789,14 +785,14 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_, } else if (STRCASEEQ(value->str, "false")) { *boolean_ = 0; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must represent a boolean value " - "(true|false)"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must represent a boolean value " + "(true|false)"), name); return -1; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Config entry '%s' must be a string"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Config entry '%s' must be a string"), name); return -1; }
@@ -811,24 +807,24 @@ virVMXSCSIDiskNameToControllerAndUnit(const char *name, int *controller, int *un int idx;
if (! STRPREFIX(name, "sd")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expecting domain XML attribute 'dev' of entry " - "'devices/disk/target' to start with 'sd'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML attribute 'dev' of entry " + "'devices/disk/target' to start with 'sd'")); return -1; }
idx = virDiskNameToIndex(name);
if (idx < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse valid disk index from '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse valid disk index from '%s'"), name); return -1; }
/* Each of the 4 SCSI controllers has 1 bus with 15 units each for devices */ if (idx >= (4 * 15)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI disk index (parsed from '%s') is too large"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI disk index (parsed from '%s') is too large"), name); return -1; }
@@ -851,24 +847,24 @@ virVMXIDEDiskNameToBusAndUnit(const char *name, int *bus, int *unit) int idx;
if (! STRPREFIX(name, "hd")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expecting domain XML attribute 'dev' of entry " - "'devices/disk/target' to start with 'hd'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML attribute 'dev' of entry " + "'devices/disk/target' to start with 'hd'")); return -1; }
idx = virDiskNameToIndex(name);
if (idx < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse valid disk index from '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse valid disk index from '%s'"), name); return -1; }
/* The IDE controller has 2 buses with 2 units each for devices */ if (idx >= (2 * 2)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE disk index (parsed from '%s') is too large"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE disk index (parsed from '%s') is too large"), name); return -1; }
@@ -886,24 +882,24 @@ virVMXFloppyDiskNameToUnit(const char *name, int *unit) int idx;
if (! STRPREFIX(name, "fd")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expecting domain XML attribute 'dev' of entry " - "'devices/disk/target' to start with 'fd'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expecting domain XML attribute 'dev' of entry " + "'devices/disk/target' to start with 'fd'")); return -1; }
idx = virDiskNameToIndex(name);
if (idx < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not parse valid disk index from '%s'"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not parse valid disk index from '%s'"), name); return -1; }
/* The FDC controller has 1 bus with 2 units for devices */ if (idx >= 2) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Floppy disk index (parsed from '%s') is too large"), name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Floppy disk index (parsed from '%s') is too large"), name); return -1; }
@@ -923,9 +919,9 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk) memset(&def, 0, sizeof(def));
if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported disk address type '%s'"), - virDomainDeviceAddressTypeToString(disk->info.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported disk address type '%s'"), + virDomainDeviceAddressTypeToString(disk->info.type)); return -1; }
@@ -935,88 +931,88 @@ virVMXVerifyDiskAddress(virCapsPtr caps, virDomainDiskDefPtr disk) def.bus = disk->bus;
if (virDomainDiskDefAssignAddress(caps, &def) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not verify disk address")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not verify disk address")); return -1; }
if (def.info.addr.drive.controller != drive->controller || def.info.addr.drive.bus != drive->bus || def.info.addr.drive.unit != drive->unit) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Disk address %d:%d:%d doesn't match target device '%s'"), - drive->controller, drive->bus, drive->unit, disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Disk address %d:%d:%d doesn't match target device '%s'"), + drive->controller, drive->bus, drive->unit, disk->dst); return -1; }
/* drive->{controller|bus|unit} is unsigned, no >= 0 checks are necessary */ if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (drive->controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - drive->controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + drive->controller); return -1; }
if (drive->bus != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI bus index %d out of [0] range"), - drive->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI bus index %d out of [0] range"), + drive->bus); return -1; }
if (drive->unit > 15 || drive->unit == 7) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI unit index %d out of [0..6,8..15] range"), - drive->unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI unit index %d out of [0..6,8..15] range"), + drive->unit); return -1; } } else if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) { if (drive->controller != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE controller index %d out of [0] range"), - drive->controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE controller index %d out of [0] range"), + drive->controller); return -1; }
if (drive->bus > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE bus index %d out of [0..1] range"), - drive->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE bus index %d out of [0..1] range"), + drive->bus); return -1; }
if (drive->unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE unit index %d out of [0..1] range"), - drive->unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE unit index %d out of [0..1] range"), + drive->unit); return -1; } } else if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) { if (drive->controller != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC controller index %d out of [0] range"), - drive->controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC controller index %d out of [0] range"), + drive->controller); return -1; }
if (drive->bus != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC bus index %d out of [0] range"), - drive->bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC bus index %d out of [0] range"), + drive->bus); return -1; }
if (drive->unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC unit index %d out of [0..1] range"), - drive->unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC unit index %d out of [0..1] range"), + drive->unit); return -1; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s'"), - virDomainDiskBusTypeToString(disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s'"), + virDomainDiskBusTypeToString(disk->bus)); return -1; }
@@ -1046,8 +1042,8 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def, model = virDomainControllerModelSCSITypeFromString(disk->driverName);
if (model < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Unknown driver name '%s'"), disk->driverName); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown driver name '%s'"), disk->driverName); return -1; }
@@ -1059,20 +1055,20 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def, }
if (controller == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Missing SCSI controller for index %d"), - disk->info.addr.drive.controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing SCSI controller for index %d"), + disk->info.addr.drive.controller); return -1; }
if (controller->model == -1) { controller->model = model; } else if (controller->model != model) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Inconsistent SCSI controller model ('%s' is not '%s') " - "for SCSI controller index %d"), disk->driverName, - virDomainControllerModelSCSITypeToString(controller->model), - controller->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Inconsistent SCSI controller model ('%s' is not '%s') " + "for SCSI controller index %d"), disk->driverName, + virDomainControllerModelSCSITypeToString(controller->model), + controller->idx); return -1; }
@@ -1148,10 +1144,10 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def, * have inconsistent SCSI controller models */ for (k = 0; k < count; ++k) { if (autodetectedModels[k] != autodetectedModels[0]) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Disks on SCSI controller %d have inconsistent " - "controller models, cannot autodetect model"), - controller->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Disks on SCSI controller %d have inconsistent " + "controller models, cannot autodetect model"), + controller->idx); goto cleanup; } } @@ -1164,11 +1160,11 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def, controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC && controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 && controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML attribute 'model' of entry " - "'controller' to be 'buslogic' or 'lsilogic' or " - "'lsisas1068' or 'vmpvscsi' but found '%s'"), - virDomainControllerModelSCSITypeToString(controller->model)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML attribute 'model' of entry " + "'controller' to be 'buslogic' or 'lsilogic' or " + "'lsisas1068' or 'vmpvscsi' but found '%s'"), + virDomainControllerModelSCSITypeToString(controller->model)); goto cleanup; }
@@ -1216,8 +1212,8 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) int unit;
if (ctx->parseFileName == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("virVMXContext has no parseFileName function set")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("virVMXContext has no parseFileName function set")); return NULL; }
@@ -1269,9 +1265,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) }
if (config_version != 8) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'config.version' to be 8 but found " - "%lld"), config_version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'config.version' to be 8 but found " + "%lld"), config_version); goto cleanup; }
@@ -1283,10 +1279,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
if (virtualHW_version != 4 && virtualHW_version != 7 && virtualHW_version != 8) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'virtualHW.version' to be 4, 7 or 8 " - "but found %lld"), - virtualHW_version); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'virtualHW.version' to be 4, 7 or 8 " + "but found %lld"), + virtualHW_version); goto cleanup; }
@@ -1304,8 +1300,8 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) if (def->name != NULL) { if (virVMXUnescapeHexPercent(def->name) < 0 || virVMXUnescapeHexPipe(def->name) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("VMX entry 'name' contains invalid escape sequence")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("VMX entry 'name' contains invalid escape sequence")); goto cleanup; } } @@ -1318,9 +1314,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
if (def->description != NULL) { if (virVMXUnescapeHexPipe(def->description) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("VMX entry 'annotation' contains invalid escape " - "sequence")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("VMX entry 'annotation' contains invalid escape " + "sequence")); goto cleanup; } } @@ -1331,9 +1327,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) }
if (memsize <= 0 || memsize % 4 != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'memsize' to be an unsigned " - "integer (multiple of 4) but found %lld"), memsize); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'memsize' to be an unsigned " + "integer (multiple of 4) but found %lld"), memsize); goto cleanup; }
@@ -1377,9 +1373,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) }
if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'numvcpus' to be an unsigned " - "integer (1 or a multiple of 2) but found %lld"), numvcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'numvcpus' to be an unsigned " + "integer (1 or a multiple of 2) but found %lld"), numvcpus); goto cleanup; }
@@ -1409,17 +1405,17 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) number = virParseNumber(¤t);
if (number < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to be " - "a comma separated list of unsigned integers but " - "found '%s'"), sched_cpu_affinity); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to be " + "a comma separated list of unsigned integers but " + "found '%s'"), sched_cpu_affinity); goto cleanup; }
if (number >= VIR_DOMAIN_CPUMASK_LEN) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VMX entry 'sched.cpu.affinity' contains a %d, " - "this value is too large"), number); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry 'sched.cpu.affinity' contains a %d, " + "this value is too large"), number); goto cleanup; }
@@ -1437,10 +1433,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) } else if (*current == '\0') { break; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to be " - "a comma separated list of unsigned integers but " - "found '%s'"), sched_cpu_affinity); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to be " + "a comma separated list of unsigned integers but " + "found '%s'"), sched_cpu_affinity); goto cleanup; }
@@ -1448,10 +1444,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) }
if (count < numvcpus) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.affinity' to contain " - "at least as many values as 'numvcpus' (%lld) but " - "found only %d value(s)"), numvcpus, count); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.affinity' to contain " + "at least as many values as 'numvcpus' (%lld) but " + "found only %d value(s)"), numvcpus, count); goto cleanup; } } @@ -1472,10 +1468,10 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) def->cputune.shares = def->vcpus * 2000; } else if (virStrToLong_ul(sched_cpu_shares, NULL, 10, &def->cputune.shares) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry 'sched.cpu.shares' to be an " - "unsigned integer or 'low', 'normal' or 'high' but " - "found '%s'"), sched_cpu_shares); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry 'sched.cpu.shares' to be an " + "unsigned integer or 'low', 'normal' or 'high' but " + "found '%s'"), sched_cpu_shares); goto cleanup; } } @@ -1633,7 +1629,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
/* def:controllers */ if (virDomainDefAddImplicitControllers(def) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not add controllers")); goto cleanup; }
@@ -1641,9 +1637,9 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx) if (def->controllers[controller]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { if (def->controllers[controller]->idx < 0 || def->controllers[controller]->idx > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - def->controllers[controller]->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + def->controllers[controller]->idx); goto cleanup; }
@@ -1762,7 +1758,7 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def) char *listenAddr = NULL;
if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -1837,14 +1833,14 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present, char *tmp;
if (virtualDev == NULL || *virtualDev != -1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
if (controller < 0 || controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + controller); return -1; }
@@ -1880,10 +1876,10 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present, *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC && *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 && *virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' " - "or 'lsisas1068' or 'pvscsi' but found '%s'"), - virtualDev_name, virtualDev_string); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' " + "or 'lsisas1068' or 'pvscsi' but found '%s'"), + virtualDev_name, virtualDev_string); goto cleanup; } } @@ -1945,7 +1941,7 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, bool writeThrough = false;
if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -1962,16 +1958,16 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (busType == VIR_DOMAIN_DISK_BUS_SCSI) { if (controllerOrBus < 0 || controllerOrBus > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller index %d out of [0..3] range"), - controllerOrBus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller index %d out of [0..3] range"), + controllerOrBus); goto cleanup; }
if (unit < 0 || unit > 15 || unit == 7) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("SCSI unit index %d out of [0..6,8..15] range"), - unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI unit index %d out of [0..6,8..15] range"), + unit); goto cleanup; }
@@ -1989,15 +1985,15 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, } } else if (busType == VIR_DOMAIN_DISK_BUS_IDE) { if (controllerOrBus < 0 || controllerOrBus > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE bus index %d out of [0..1] range"), - controllerOrBus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE bus index %d out of [0..1] range"), + controllerOrBus); goto cleanup; }
if (unit < 0 || unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("IDE unit index %d out of [0..1] range"), unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("IDE unit index %d out of [0..1] range"), unit); goto cleanup; }
@@ -2012,25 +2008,25 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for device type '%s'"), - virDomainDiskBusTypeToString(busType), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for device type '%s'"), + virDomainDiskBusTypeToString(busType), + virDomainDiskDeviceTypeToString(device)); goto cleanup; } } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (busType == VIR_DOMAIN_DISK_BUS_FDC) { if (controllerOrBus != 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC controller index %d out of [0] range"), - controllerOrBus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC controller index %d out of [0] range"), + controllerOrBus); goto cleanup; }
if (unit < 0 || unit > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("FDC unit index %d out of [0..1] range"), - unit); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("FDC unit index %d out of [0..1] range"), + unit); goto cleanup; }
@@ -2045,16 +2041,16 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for device type '%s'"), - virDomainDiskBusTypeToString(busType), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for device type '%s'"), + virDomainDiskBusTypeToString(busType), + virDomainDiskDeviceTypeToString(device)); goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported device type '%s'"), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported device type '%s'"), + virDomainDiskDeviceTypeToString(device)); goto cleanup; }
@@ -2124,18 +2120,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, if (busType == VIR_DOMAIN_DISK_BUS_SCSI && STRCASENEQ(deviceType, "scsi-hardDisk") && STRCASENEQ(deviceType, "disk")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'scsi-hardDisk' " - "or 'disk' but found '%s'"), deviceType_name, - deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'scsi-hardDisk' " + "or 'disk' but found '%s'"), deviceType_name, + deviceType); goto cleanup; } else if (busType == VIR_DOMAIN_DISK_BUS_IDE && STRCASENEQ(deviceType, "ata-hardDisk") && STRCASENEQ(deviceType, "disk")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'ata-hardDisk' " - "or 'disk' but found '%s'"), deviceType_name, - deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'ata-hardDisk' " + "or 'disk' but found '%s'"), deviceType_name, + deviceType); goto cleanup; } } @@ -2158,18 +2154,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf, */ goto ignore; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid or not yet handled value '%s' for VMX entry " - "'%s'"), fileName, fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid or not yet handled value '%s' for VMX entry " + "'%s'"), fileName, fileName_name); goto cleanup; } } else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) { if (virFileHasSuffix(fileName, ".iso")) { if (deviceType != NULL) { if (STRCASENEQ(deviceType, "cdrom-image")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'cdrom-image' " - "but found '%s'"), deviceType_name, deviceType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'cdrom-image' " + "but found '%s'"), deviceType_name, deviceType); goto cleanup; } } @@ -2194,18 +2190,18 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf,
fileName = NULL; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid or not yet handled value '%s' for VMX entry " - "'%s'"), fileName, fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid or not yet handled value '%s' for VMX entry " + "'%s'"), fileName, fileName_name); goto cleanup; } } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) { if (virFileHasSuffix(fileName, ".flp")) { if (fileType != NULL) { if (STRCASENEQ(fileType, "file")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'file' but " - "found '%s'"), fileType_name, fileType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'file' but " + "found '%s'"), fileType_name, fileType); goto cleanup; } } @@ -2222,20 +2218,20 @@ virVMXParseDisk(virVMXContext *ctx, virCapsPtr caps, virConfPtr conf,
fileName = NULL; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid or not yet handled value '%s' for VMX entry " - "'%s'"), fileName, fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid or not yet handled value '%s' for VMX entry " + "'%s'"), fileName, fileName_name); goto cleanup; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported device type '%s'"), - virDomainDiskDeviceTypeToString(device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported device type '%s'"), + virDomainDiskDeviceTypeToString(device)); goto cleanup; }
if (virDomainDiskDefAssignAddress(caps, *def) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Could not assign address to disk '%s'"), (*def)->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not assign address to disk '%s'"), (*def)->src); goto cleanup; }
@@ -2302,14 +2298,14 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) char *networkName = NULL;
if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
if (controller < 0 || controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Ethernet controller index %d out of [0..3] range"), - controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Ethernet controller index %d out of [0..3] range"), + controller); return -1; }
@@ -2366,26 +2362,26 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) STRCASEEQ(addressType, "vpx")) { if (generatedAddress != NULL) { if (virMacAddrParse(generatedAddress, &(*def)->mac) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be MAC address but " - "found '%s'"), generatedAddress_name, - generatedAddress); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be MAC address but " + "found '%s'"), generatedAddress_name, + generatedAddress); goto cleanup; } } } else if (STRCASEEQ(addressType, "static")) { if (address != NULL) { if (virMacAddrParse(address, &(*def)->mac) < 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be MAC address but " - "found '%s'"), address_name, address); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be MAC address but " + "found '%s'"), address_name, address); goto cleanup; } } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'generated' or 'static' or " - "'vpx' but found '%s'"), addressType_name, addressType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'generated' or 'static' or " + "'vpx' but found '%s'"), addressType_name, addressType); goto cleanup; }
@@ -2400,10 +2396,10 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) STRCASENEQ(virtualDev, "vmxnet") && STRCASENEQ(virtualDev, "vmxnet3") && STRCASENEQ(virtualDev, "e1000")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " - "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name, - virtualDev); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or " + "'vmxnet3' or 'e1000' but found '%s'"), virtualDev_name, + virtualDev); goto cleanup; }
@@ -2452,9 +2448,9 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) networkName = NULL; } else if (STRCASEEQ(connectionType, "hostonly")) { /* FIXME */ - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("No yet handled value '%s' for VMX entry '%s'"), - connectionType, connectionType_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No yet handled value '%s' for VMX entry '%s'"), + connectionType, connectionType_name); goto cleanup; } else if (STRCASEEQ(connectionType, "nat")) { (*def)->type = VIR_DOMAIN_NET_TYPE_USER; @@ -2471,9 +2467,9 @@ virVMXParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def) networkName = NULL; vnet = NULL; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Invalid value '%s' for VMX entry '%s'"), connectionType, - connectionType_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid value '%s' for VMX entry '%s'"), connectionType, + connectionType_name); goto cleanup; }
@@ -2531,13 +2527,13 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, virURIPtr parsedUri = NULL;
if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
if (port < 0 || port > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Serial port index %d out of [0..3] range"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Serial port index %d out of [0..3] range"), port); return -1; }
@@ -2622,9 +2618,9 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, goto cleanup;
if (parsedUri->port == 0) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VMX entry '%s' doesn't contain a port part"), - fileName_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry '%s' doesn't contain a port part"), + fileName_name); goto cleanup; }
@@ -2659,9 +2655,9 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, STRCASEEQ(parsedUri->scheme, "tcp6+ssl")) { (*def)->source.data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("VMX entry '%s' contains unsupported scheme '%s'"), - fileName_name, parsedUri->scheme); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("VMX entry '%s' contains unsupported scheme '%s'"), + fileName_name, parsedUri->scheme); goto cleanup; }
@@ -2670,15 +2666,15 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, } else if (STRCASEEQ(network_endPoint, "client")) { (*def)->source.data.tcp.listen = false; } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'server' or 'client' " - "but found '%s'"), network_endPoint_name, network_endPoint); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'server' or 'client' " + "but found '%s'"), network_endPoint_name, network_endPoint); goto cleanup; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' " - "or 'network' but found '%s'"), fileType_name, fileType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' " + "or 'network' but found '%s'"), fileType_name, fileType); goto cleanup; }
@@ -2728,13 +2724,13 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port, char *fileName = NULL;
if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
if (port < 0 || port > 2) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Parallel port index %d out of [0..2] range"), port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parallel port index %d out of [0..2] range"), port); return -1; }
@@ -2795,9 +2791,9 @@ virVMXParseParallel(virVMXContext *ctx, virConfPtr conf, int port, goto cleanup; } } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'device' or 'file' but " - "found '%s'"), fileType_name, fileType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting VMX entry '%s' to be 'device' or 'file' but " + "found '%s'"), fileType_name, fileType); goto cleanup; }
@@ -2832,7 +2828,7 @@ virVMXParseSVGA(virConfPtr conf, virDomainVideoDefPtr *def) long long svga_vramSize = 0;
if (def == NULL || *def != NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -2886,18 +2882,18 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, bool floppy_present[2] = { false, false };
if (ctx->formatFileName == NULL) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("virVMXContext has no formatFileName function set")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("virVMXContext has no formatFileName function set")); return NULL; }
memset(zero, 0, VIR_UUID_BUFLEN);
if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting virt type to be '%s' but found '%s'"), - virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE), - virDomainVirtTypeToString(def->virtType)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting virt type to be '%s' but found '%s'"), + virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE), + virDomainVirtTypeToString(def->virtType)); return NULL; }
@@ -2917,9 +2913,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, } else if (STRCASEEQ(def->os.arch, "x86_64")) { virBufferAddLit(&buffer, "guestOS = \"other-64\"\n"); } else { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML attribute 'arch' of entry 'os/type' " - "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML attribute 'arch' of entry 'os/type' " + "to be 'i686' or 'x86_64' but found '%s'"), def->os.arch); goto cleanup; }
@@ -2930,9 +2926,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, } else if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) { virBufferAddLit(&buffer, "smbios.reflecthost = \"true\"\n"); } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported SMBIOS mode '%s'"), - virDomainSmbiosModeTypeToString(def->os.smbios_mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported SMBIOS mode '%s'"), + virDomainSmbiosModeTypeToString(def->os.smbios_mode)); goto cleanup; }
@@ -2994,16 +2990,16 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def,
/* def:maxvcpus -> vmx:numvcpus */ if (def->vcpus != def->maxvcpus) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("No support for domain XML entry 'vcpu' attribute " - "'current'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("No support for domain XML entry 'vcpu' attribute " + "'current'")); goto cleanup; } if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 && def->maxvcpus != 1)) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML entry 'vcpu' to be an unsigned " - "integer (1 or a multiple of 2) but found %d"), - def->maxvcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML entry 'vcpu' to be an unsigned " + "integer (1 or a multiple of 2) but found %d"), + def->maxvcpus); goto cleanup; }
@@ -3022,10 +3018,10 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, }
if (sched_cpu_affinity_length < def->maxvcpus) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML attribute 'cpuset' of entry " - "'vcpu' to contain at least %d CPU(s)"), - def->maxvcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML attribute 'cpuset' of entry " + "'vcpu' to contain at least %d CPU(s)"), + def->maxvcpus); goto cleanup; }
@@ -3070,9 +3066,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported graphics type '%s'"), - virDomainGraphicsTypeToString(def->graphics[i]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported graphics type '%s'"), + virDomainGraphicsTypeToString(def->graphics[i]->type)); goto cleanup; } } @@ -3127,9 +3123,9 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported disk device type '%s'"), - virDomainDiskDeviceTypeToString(def->disks[i]->device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported disk device type '%s'"), + virDomainDiskDeviceTypeToString(def->disks[i]->device)); goto cleanup; } } @@ -3160,8 +3156,8 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def, /* def:videos */ if (def->nvideos > 0) { if (def->nvideos > 1) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", - _("No support for multiple video devices")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No support for multiple video devices")); goto cleanup; }
@@ -3215,7 +3211,7 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) const char *listenAddr;
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -3265,7 +3261,7 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -3288,17 +3284,17 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for harddisk"), - virDomainDiskBusTypeToString(def->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for harddisk"), + virDomainDiskBusTypeToString(def->bus)); return -1; }
if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), - busName, def->dst, virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), + busName, def->dst, virDomainDiskTypeToString(def->type), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); return -1; }
@@ -3309,9 +3305,9 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".vmdk")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s harddisk '%s' has unsupported suffix, " - "expecting '.vmdk'"), busName, def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Image file for %s harddisk '%s' has unsupported suffix, " + "expecting '.vmdk'"), busName, def->dst); return -1; }
@@ -3332,10 +3328,10 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferAsprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n", entryPrefix, controllerOrBus, unit); } else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported cache mode '%s'"), - busName, def->dst, - virDomainDiskCacheTypeToString(def->cachemode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s harddisk '%s' has unsupported cache mode '%s'"), + busName, def->dst, + virDomainDiskCacheTypeToString(def->cachemode)); return -1; } } @@ -3355,7 +3351,7 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -3376,9 +3372,9 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, return -1; } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for cdrom"), - virDomainDiskBusTypeToString(def->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported bus type '%s' for cdrom"), + virDomainDiskBusTypeToString(def->bus)); return -1; }
@@ -3391,9 +3387,9 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".iso")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s cdrom '%s' has unsupported " - "suffix, expecting '.iso'"), busName, def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Image file for %s cdrom '%s' has unsupported " + "suffix, expecting '.iso'"), busName, def->dst); return -1; }
@@ -3417,12 +3413,12 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, entryPrefix, controllerOrBus, unit, def->src); } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s cdrom '%s' has unsupported type '%s', expecting '%s' " - "or '%s'"), busName, def->dst, - virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s cdrom '%s' has unsupported type '%s', expecting '%s' " + "or '%s'"), busName, def->dst, + virDomainDiskTypeToString(def->type), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); return -1; }
@@ -3439,7 +3435,7 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, char *fileName = NULL;
if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); return -1; }
@@ -3456,9 +3452,9 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def,
if (def->src != NULL) { if (! virFileHasSuffix(def->src, ".flp")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Image file for floppy '%s' has unsupported " - "suffix, expecting '.flp'"), def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Image file for floppy '%s' has unsupported " + "suffix, expecting '.flp'"), def->dst); return -1; }
@@ -3481,12 +3477,12 @@ virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, unit, def->src); } } else { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Floppy '%s' has unsupported type '%s', expecting '%s' " - "or '%s'"), def->dst, - virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Floppy '%s' has unsupported type '%s', expecting '%s' " + "or '%s'"), def->dst, + virDomainDiskTypeToString(def->type), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); return -1; }
@@ -3503,9 +3499,9 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, unsigned int prefix, suffix;
if (controller < 0 || controller > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Ethernet controller index %d out of [0..3] range"), - controller); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Ethernet controller index %d out of [0..3] range"), + controller); return -1; }
@@ -3518,10 +3514,10 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, STRCASENEQ(def->model, "vmxnet2") && STRCASENEQ(def->model, "vmxnet3") && STRCASENEQ(def->model, "e1000")) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Expecting domain XML entry 'devices/interface/model' " - "to be 'vlance' or 'vmxnet' or 'vmxnet2' or 'vmxnet3' " - "or 'e1000' but found '%s'"), def->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Expecting domain XML entry 'devices/interface/model' " + "to be 'vlance' or 'vmxnet' or 'vmxnet2' or 'vmxnet3' " + "or 'e1000' but found '%s'"), def->model); return -1; }
@@ -3561,8 +3557,8 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"), - virDomainNetTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"), + virDomainNetTypeToString(def->type)); return -1; }
@@ -3611,9 +3607,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, const char *protocol;
if (def->target.port < 0 || def->target.port > 3) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Serial port index %d out of [0..3] range"), - def->target.port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Serial port index %d out of [0..3] range"), + def->target.port); return -1; }
@@ -3676,9 +3672,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device TCP protocol '%s'"), - virDomainChrTcpProtocolTypeToString( + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device TCP protocol '%s'"), + virDomainChrTcpProtocolTypeToString( def->source.data.tcp.protocol));
I'd probably indent the "def->source..." line differently so it's more visible that it is one level deeper.
return -1; } @@ -3694,9 +3690,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device type '%s'"), - virDomainChrTypeToString(def->source.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device type '%s'"), + virDomainChrTypeToString(def->source.type)); return -1; }
@@ -3717,9 +3713,9 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def, char *fileName = NULL;
if (def->target.port < 0 || def->target.port > 2) { - VMX_ERROR(VIR_ERR_INTERNAL_ERROR, - _("Parallel port index %d out of [0..2] range"), - def->target.port); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parallel port index %d out of [0..2] range"), + def->target.port); return -1; }
@@ -3752,9 +3748,9 @@ virVMXFormatParallel(virVMXContext *ctx, virDomainChrDefPtr def, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device type '%s'"), - virDomainChrTypeToString(def->source.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device type '%s'"), + virDomainChrTypeToString(def->source.type)); return -1; }
@@ -3769,9 +3765,9 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer) unsigned long long vram;
if (def->type != VIR_DOMAIN_VIDEO_TYPE_VMVGA) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported video device type '%s'"), - virDomainVideoTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported video device type '%s'"), + virDomainVideoTypeToString(def->type)); return -1; }
@@ -3782,8 +3778,8 @@ virVMXFormatSVGA(virDomainVideoDefPtr def, virBufferPtr buffer) vram = VIR_DIV_UP(def->vram, 64) * 64;
if (def->heads > 1) { - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Multi-head video devices are unsupported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Multi-head video devices are unsupported")); return -1; }
One remark up there, but no biggie. I also noticed some lines are more than 80 characters long (both in here and the PHYP driver), so maybe arranging them differently might be better, however it's not fatal and in case this is whole series-wise it'd be better to post a different patch in order not to mix this together, so ACK. Martin Martin

On 07/20/2012 07:34 AM, Martin Kletzander wrote:
On 07/18/2012 08:40 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the VMX shared code to use virReportError instead of the VMX_ERROR custom macro
@@ -3676,9 +3672,9 @@ virVMXFormatSerial(virVMXContext *ctx, virDomainChrDefPtr def, break;
default: - VMX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported character device TCP protocol '%s'"), - virDomainChrTcpProtocolTypeToString( + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported character device TCP protocol '%s'"), + virDomainChrTcpProtocolTypeToString( def->source.data.tcp.protocol));
I'd probably indent the "def->source..." line differently so it's more visible that it is one level deeper.
One remark up there, but no biggie.
I had to hunt for that remark among 70k of verbatim patch. Not only is it okay to trim portions of the patch that you are happy with, but trimming actually helps focus on the problems. Just be sure you leave enough context to help the readers pinpoint where the problem was (as I did here, by including the @@ line at the start of the problematic hunk). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, Jul 20, 2012 at 09:46:42AM -0600, Eric Blake wrote:
One remark up there, but no biggie.
I had to hunt for that remark among 70k of verbatim patch. Not only is it okay to trim portions of the patch that you are happy with, but trimming actually helps focus on the problems. Just be sure you leave enough context to help the readers pinpoint where the problem was (as I did here, by including the @@ line at the start of the problematic hunk).
I completely agree with your point, but if you have a good mutt colour setup, it is fairly easy to scan through large mails and distinguish new text vs quoted text at a glance. I even have some magic settings to highlight patches in email http://berrange.fedorapeople.org/mutt-patch-colour.jpeg In my .muttrc: # General colour settings color attachment brightmagenta black #color body white black color bold green black color header brightyellow black ^(From|Subject): color hdrdefault yellow black #color index white black #color indicator brightyellow red color indicator brightyellow red color markers brightcyan black color message brightcyan black color normal white black color quoted brightblue black color search green black color signature red black color status yellow blue color tilde magenta black color tree magenta black color underline green black # Patch file highlighting color body green black "^diff \-.*" color body green black "^index [a-f0-9].*" color body green black "^\-\-\- .*" color body green black "^[\+]{3} .*" color body cyan black "^[\+][^\+]+.*" color body red black "^\-[^\-]+.*" color body brightblue black "^@@ .*" Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Fri, Jul 20, 2012 at 16:55:22 +0100, Daniel P. Berrange wrote:
On Fri, Jul 20, 2012 at 09:46:42AM -0600, Eric Blake wrote:
One remark up there, but no biggie.
I had to hunt for that remark among 70k of verbatim patch. Not only is it okay to trim portions of the patch that you are happy with, but trimming actually helps focus on the problems. Just be sure you leave enough context to help the readers pinpoint where the problem was (as I did here, by including the @@ line at the start of the problematic hunk).
I completely agree with your point, but if you have a good mutt colour setup, it is fairly easy to scan through large mails and distinguish new text vs quoted text at a glance. I even have some magic settings to highlight patches in email
Not that it helps our non-mutt colleagues :-) But thanks for the coloring idea. BTW, I just found mutt has something even better... you can use skip-quoted function (mapped to S by default) in mutt's pager to automagically skip to the next unquoted line in the email. Jirka

From: "Daniel P. Berrange" <berrange@redhat.com> Update the streams code to use virReportError instead of the streamsReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/fdstream.c | 69 +++++++++++++++++++++++++++----------------------------- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/cfg.mk b/cfg.mk index 6be785a..699aeac 100644 --- a/cfg.mk +++ b/cfg.mk @@ -511,7 +511,6 @@ msg_gen_function += lxcError msg_gen_function += nodeReportError msg_gen_function += qemuReportError msg_gen_function += regerror -msg_gen_function += streamsReportError msg_gen_function += vah_error msg_gen_function += vah_warning msg_gen_function += virConfError diff --git a/src/fdstream.c b/src/fdstream.c index a4b41c0..647db53 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -42,9 +42,6 @@ #include "configmake.h" #define VIR_FROM_THIS VIR_FROM_STREAMS -#define streamsReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) /* Tunnelled migration stream support */ struct virFDStreamData { @@ -82,15 +79,15 @@ static int virFDStreamRemoveCallback(virStreamPtr stream) int ret = -1; if (!fdst) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream is not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream is not open")); return -1; } virMutexLock(&fdst->lock); if (fdst->watch == 0) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream does not have a callback registered")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream does not have a callback registered")); goto cleanup; } @@ -119,15 +116,15 @@ static int virFDStreamUpdateCallback(virStreamPtr stream, int events) int ret = -1; if (!fdst) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream is not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream is not open")); return -1; } virMutexLock(&fdst->lock); if (fdst->watch == 0) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream does not have a callback registered")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream does not have a callback registered")); goto cleanup; } @@ -201,15 +198,15 @@ virFDStreamAddCallback(virStreamPtr st, int ret = -1; if (!fdst) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream is not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream is not open")); return -1; } virMutexLock(&fdst->lock); if (fdst->watch != 0) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream already has a callback registered")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream already has a callback registered")); goto cleanup; } @@ -218,8 +215,8 @@ virFDStreamAddCallback(virStreamPtr st, virFDStreamEvent, st, virFDStreamCallbackFree)) < 0) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot register file watch on stream")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot register file watch on stream")); goto cleanup; } @@ -297,16 +294,16 @@ virFDStreamCloseInt(virStreamPtr st, bool streamAbort) } else if (status != 0) { if (buf[0] == '\0') { if (WIFEXITED(status)) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - _("I/O helper exited with status %d"), - WEXITSTATUS(status)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("I/O helper exited with status %d"), + WEXITSTATUS(status)); } else { - streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("I/O helper exited abnormally")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("I/O helper exited abnormally")); } } else { - streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s", - buf); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + buf); } ret = -1; } @@ -363,8 +360,8 @@ static int virFDStreamWrite(virStreamPtr st, const char *bytes, size_t nbytes) } if (!fdst) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream is not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream is not open")); return -1; } @@ -415,8 +412,8 @@ static int virFDStreamRead(virStreamPtr st, char *bytes, size_t nbytes) } if (!fdst) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("stream is not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("stream is not open")); return -1; } @@ -489,8 +486,8 @@ static int virFDStreamOpenInternal(virStreamPtr st, fdst->length = length; if (virMutexInit(&fdst->lock) < 0) { VIR_FREE(fdst); - streamsReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to initialize mutex")); return -1; } @@ -622,9 +619,9 @@ virFDStreamOpenFileInternal(virStreamPtr st, int fds[2] = { -1, -1 }; if ((oflags & O_ACCMODE) == O_RDWR) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: Cannot request read and write flags together"), - path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: Cannot request read and write flags together"), + path); goto error; } @@ -680,9 +677,9 @@ int virFDStreamOpenFile(virStreamPtr st, int oflags) { if (oflags & O_CREAT) { - streamsReportError(VIR_ERR_INTERNAL_ERROR, - _("Attempt to create %s without specifying mode"), - path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Attempt to create %s without specifying mode"), + path); return -1; } return virFDStreamOpenFileInternal(st, path, -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the streams code to use virReportError instead of the streamsReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/fdstream.c | 69 +++++++++++++++++++++++++++----------------------------- 2 files changed, 33 insertions(+), 37 deletions(-)
ACK. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the QEMU driver to use virReportError instead of the qemuReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/qemu/qemu_agent.c | 142 ++-- src/qemu/qemu_capabilities.c | 16 +- src/qemu/qemu_cgroup.c | 26 +- src/qemu/qemu_command.c | 1066 ++++++++++++------------ src/qemu/qemu_conf.c | 26 +- src/qemu/qemu_conf.h | 4 - src/qemu/qemu_domain.c | 94 +-- src/qemu/qemu_driver.c | 1834 +++++++++++++++++++++--------------------- src/qemu/qemu_hostdev.c | 59 +- src/qemu/qemu_hotplug.c | 362 ++++----- src/qemu/qemu_migration.c | 284 +++---- src/qemu/qemu_monitor.c | 384 ++++----- src/qemu/qemu_monitor_json.c | 546 ++++++------- src/qemu/qemu_monitor_text.c | 532 ++++++------ src/qemu/qemu_process.c | 216 ++--- 16 files changed, 2795 insertions(+), 2797 deletions(-) diff --git a/cfg.mk b/cfg.mk index 699aeac..6e1f6af 100644 --- a/cfg.mk +++ b/cfg.mk @@ -509,7 +509,6 @@ msg_gen_function = msg_gen_function += VIR_ERROR msg_gen_function += lxcError msg_gen_function += nodeReportError -msg_gen_function += qemuReportError msg_gen_function += regerror msg_gen_function += vah_error msg_gen_function += vah_warning diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 7a0381c..12b9499 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -204,22 +204,22 @@ qemuAgentOpenUnix(const char *monitor, pid_t cpid, bool *inProgress) } if (virSetNonBlock(monfd) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to put monitor into non-blocking mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to put monitor into non-blocking mode")); goto error; } if (virSetCloseExec(monfd) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to set monitor close-on-exec flag")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to set monitor close-on-exec flag")); goto error; } memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; if (virStrcpyStatic(addr.sun_path, monitor) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Agent path %s too big for destination"), monitor); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Agent path %s too big for destination"), monitor); goto error; } @@ -269,14 +269,14 @@ qemuAgentOpenPty(const char *monitor) int monfd; if ((monfd = open(monitor, O_RDWR | O_NONBLOCK)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open monitor path %s"), monitor); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open monitor path %s"), monitor); return -1; } if (virSetCloseExec(monfd) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to set monitor close-on-exec flag")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to set monitor close-on-exec flag")); goto error; } @@ -331,8 +331,8 @@ qemuAgentIOProcessLine(qemuAgentPtr mon, goto cleanup; if (obj->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Parsed JSON reply '%s' isn't an object"), line); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parsed JSON reply '%s' isn't an object"), line); goto cleanup; } @@ -362,12 +362,12 @@ qemuAgentIOProcessLine(qemuAgentPtr mon, goto cleanup; } - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected JSON reply '%s'"), line); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected JSON reply '%s'"), line); } } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown JSON reply '%s'"), line); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown JSON reply '%s'"), line); } cleanup: @@ -609,9 +609,9 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) { if (mon->fd != fd || mon->watch != watch) { if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) eof = true; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("event from unexpected fd %d!=%d / watch %d!=%d"), - mon->fd, fd, mon->watch, watch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("event from unexpected fd %d!=%d / watch %d!=%d"), + mon->fd, fd, mon->watch, watch); error = true; } else if (mon->lastError.code != VIR_ERR_OK) { if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) @@ -649,23 +649,23 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) { if (!error && events & VIR_EVENT_HANDLE_HANGUP) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("End of file from monitor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("End of file from monitor")); eof = 1; events &= ~VIR_EVENT_HANDLE_HANGUP; } if (!error && !eof && events & VIR_EVENT_HANDLE_ERROR) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid file descriptor while waiting for monitor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid file descriptor while waiting for monitor")); eof = 1; events &= ~VIR_EVENT_HANDLE_ERROR; } if (!error && events) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unhandled event %d for monitor fd %d"), - events, mon->fd); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unhandled event %d for monitor fd %d"), + events, mon->fd); error = 1; } } @@ -677,8 +677,8 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) { } else { virErrorPtr err = virGetLastError(); if (!err) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Error while processing monitor IO")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while processing monitor IO")); virCopyLastError(&mon->lastError); virResetLastError(); } @@ -734,8 +734,8 @@ qemuAgentOpen(virDomainObjPtr vm, qemuAgentPtr mon; if (!cb || !cb->eofNotify) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("EOF notify callback must be supplied")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("EOF notify callback must be supplied")); return NULL; } @@ -745,14 +745,14 @@ qemuAgentOpen(virDomainObjPtr vm, } if (virMutexInit(&mon->lock) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize monitor mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot initialize monitor mutex")); VIR_FREE(mon); return NULL; } if (virCondInit(&mon->notify) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize monitor condition")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot initialize monitor condition")); virMutexDestroy(&mon->lock); VIR_FREE(mon); return NULL; @@ -774,9 +774,9 @@ qemuAgentOpen(virDomainObjPtr vm, break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to handle monitor type: %s"), - virDomainChrTypeToString(config->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to handle monitor type: %s"), + virDomainChrTypeToString(config->type)); goto cleanup; } @@ -792,8 +792,8 @@ qemuAgentOpen(virDomainObjPtr vm, 0), qemuAgentIO, mon, qemuAgentUnwatch)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to register monitor events")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to register monitor events")); goto cleanup; } qemuAgentRef(mon); @@ -886,12 +886,12 @@ static int qemuAgentSend(qemuAgentPtr mon, if ((timeout && virCondWaitUntil(&mon->notify, &mon->lock, then) < 0) || (!timeout && virCondWait(&mon->notify, &mon->lock) < 0)) { if (errno == ETIMEDOUT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Guest agent not available for now")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Guest agent not available for now")); ret = -2; } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to wait on monitor condition")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to wait on monitor condition")); } goto cleanup; } @@ -959,23 +959,23 @@ qemuAgentGuestSync(qemuAgentPtr mon) } if (!sync_msg.rxObject) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing monitor reply object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing monitor reply object")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(sync_msg.rxObject, "return", &id_ret) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Malformed return value")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Malformed return value")); goto cleanup; } VIR_DEBUG("Guest returned ID: %llu", id_ret); if (id_ret != id) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Guest agent returned ID: %llu instead of %llu"), - id_ret, id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Guest agent returned ID: %llu instead of %llu"), + id_ret, id); goto cleanup; } ret = 0; @@ -1029,8 +1029,8 @@ qemuAgentCommand(qemuAgentPtr mon, if (await_event) { VIR_DEBUG("Woken up by event %d", await_event); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing monitor reply object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing monitor reply object")); ret = -1; } } else { @@ -1128,14 +1128,14 @@ qemuAgentCheckError(virJSONValuePtr cmd, /* Only send the user the command name + friendly error */ if (!error) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute QEMU command '%s'"), - qemuAgentCommandName(cmd)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to execute QEMU command '%s'"), + qemuAgentCommandName(cmd)); else - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute QEMU command '%s': %s"), - qemuAgentCommandName(cmd), - qemuAgentStringifyError(error)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to execute QEMU command '%s': %s"), + qemuAgentCommandName(cmd), + qemuAgentStringifyError(error)); VIR_FREE(cmdstr); VIR_FREE(replystr); @@ -1146,9 +1146,9 @@ qemuAgentCheckError(virJSONValuePtr cmd, VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s", cmdstr, replystr); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute QEMU command '%s'"), - qemuAgentCommandName(cmd)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to execute QEMU command '%s'"), + qemuAgentCommandName(cmd)); VIR_FREE(cmdstr); VIR_FREE(replystr); return -1; @@ -1178,9 +1178,9 @@ qemuAgentMakeCommand(const char *cmdname, char type; if (strlen(key) < 3) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("argument key '%s' is too short, missing type prefix"), - key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("argument key '%s' is too short, missing type prefix"), + key); goto error; } @@ -1232,8 +1232,8 @@ qemuAgentMakeCommand(const char *cmdname, ret = virJSONValueObjectAppendNull(jargs, key); } break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported data type '%c' for arg '%s'"), type, key - 2); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported data type '%c' for arg '%s'"), type, key - 2); goto error; } if (ret < 0) @@ -1332,8 +1332,8 @@ int qemuAgentFSFreeze(qemuAgentPtr mon) goto cleanup; if (virJSONValueObjectGetNumberInt(reply, "return", &ret) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("malformed return value")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed return value")); } cleanup: @@ -1369,8 +1369,8 @@ int qemuAgentFSThaw(qemuAgentPtr mon) goto cleanup; if (virJSONValueObjectGetNumberInt(reply, "return", &ret) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("malformed return value")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed return value")); } cleanup: diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f93f2aa..7861bee 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1226,9 +1226,9 @@ qemuCapsComputeCmdFlags(const char *help, if (version >= 15000 || (version >= 12000 && strstr(help, "libvirt"))) { if (check_yajl) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this qemu binary requires libvirt to be " - "compiled with yajl")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this qemu binary requires libvirt to be " + "compiled with yajl")); return -1; } qemuCapsSet(flags, QEMU_CAPS_NETDEV); @@ -1363,9 +1363,9 @@ fail: if (!p) p = strchr(help, '\0'); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse %s version number in '%.*s'"), - qemu, (int) (p - help), help); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse %s version number in '%.*s'"), + qemu, (int) (p - help), help); cleanup: return -1; @@ -1589,8 +1589,8 @@ int qemuCapsExtractVersion(virCapsPtr caps, "hvm", ut.machine, "qemu")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find suitable emulator for %s"), ut.machine); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot find suitable emulator for %s"), ut.machine); return -1; } diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index e39f5e1..cedbc95 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -310,8 +310,8 @@ int qemuSetupCgroup(struct qemud_driver *driver, goto cleanup; } } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Block I/O tuning is not available on this host")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Block I/O tuning is not available on this host")); goto cleanup; } } @@ -333,8 +333,8 @@ int qemuSetupCgroup(struct qemud_driver *driver, } } } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Block I/O tuning is not available on this host")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Block I/O tuning is not available on this host")); goto cleanup; } } @@ -372,8 +372,8 @@ int qemuSetupCgroup(struct qemud_driver *driver, } } } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Memory cgroup is not available on this host")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Memory cgroup is not available on this host")); } } @@ -387,8 +387,8 @@ int qemuSetupCgroup(struct qemud_driver *driver, goto cleanup; } } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("CPU tuning is not available on this host")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU tuning is not available on this host")); } } @@ -405,8 +405,8 @@ int qemuSetupCgroup(struct qemud_driver *driver, mask = virDomainCpuSetFormat(vm->def->numatune.memory.nodemask, VIR_DOMAIN_CPUMASK_LEN); if (!mask) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to convert memory nodemask")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to convert memory nodemask")); goto cleanup; } @@ -585,9 +585,9 @@ int qemuRemoveCgroup(struct qemud_driver *driver, rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0); if (rc != 0) { if (!quiet) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); return rc; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 09215af..447e0e5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -202,9 +202,9 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, fail = 1; if (active == 0) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Network '%s' is not active."), - net->data.network.name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Network '%s' is not active."), + net->data.network.name); } if (!fail) { @@ -228,9 +228,9 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, return -1; } } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Network type %d is not supported"), - virDomainNetGetActualType(net)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Network type %d is not supported"), + virDomainNetGetActualType(net)); return -1; } @@ -273,9 +273,9 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, if (tapfd >= 0 && virNetDevBandwidthSet(net->ifname, virDomainNetGetActualBandwidth(net)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot set bandwidth limits on %s"), - net->ifname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot set bandwidth limits on %s"), + net->ifname); VIR_FORCE_CLOSE(tapfd); goto cleanup; } @@ -314,9 +314,9 @@ qemuOpenVhostNet(virDomainDefPtr def, qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) && qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) { if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("vhost-net is not supported with " - "this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("vhost-net is not supported with " + "this QEMU binary")); return -1; } return 0; @@ -325,9 +325,9 @@ qemuOpenVhostNet(virDomainDefPtr def, /* If the nic model isn't virtio, don't try to open. */ if (!(net->model && STREQ(net->model, "virtio"))) { if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("vhost-net is only supported for " - "virtio network interfaces")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("vhost-net is only supported for " + "virtio network interfaces")); return -1; } return 0; @@ -341,9 +341,9 @@ qemuOpenVhostNet(virDomainDefPtr def, */ if ((*vhostfd < 0) && (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("vhost-net was requested for an interface, " - "but is unavailable")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("vhost-net was requested for an interface, " + "but is unavailable")); return -1; } return 0; @@ -422,9 +422,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk) char *dev_name; if (virDiskNameToBusDeviceIndex(disk, &busid, &devid) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot convert disk '%s' to bus/device index"), - disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot convert disk '%s' to bus/device index"), + disk->dst); return -1; } @@ -451,9 +451,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk) ret = virAsprintf(&dev_name, "xenblk%d", devid); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported disk name mapping for bus '%s'"), - virDomainDiskBusTypeToString(disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported disk name mapping for bus '%s'"), + virDomainDiskBusTypeToString(disk->bus)); return -1; } @@ -555,8 +555,8 @@ qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx) continue; } if ((thisidx = qemuDomainDeviceAliasIndex(&def->nets[i]->info, "net")) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine device index for network device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to determine device index for network device")); return -1; } if (thisidx >= idx) @@ -582,8 +582,8 @@ qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev for (i = 0 ; i < def->nhostdevs ; i++) { int thisidx; if ((thisidx = qemuDomainDeviceAliasIndex(def->hostdevs[i]->info, "hostdev")) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine device index for hostdev device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to determine device index for hostdev device")); return -1; } if (thisidx >= idx) @@ -609,8 +609,8 @@ qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr redir for (i = 0 ; i < def->nredirdevs ; i++) { int thisidx; if ((thisidx = qemuDomainDeviceAliasIndex(&def->redirdevs[i]->info, "redir")) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine device index for redirected device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to determine device index for redirected device")); return -1; } if (thisidx >= idx) @@ -835,9 +835,9 @@ qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info, rc = virDomainDeviceInfoIterate(def, qemuSpaprVIOFindByReg, info); while (rc != 0) { if (user_reg) { - qemuReportError(VIR_ERR_XML_ERROR, - _("spapr-vio address %#llx already in use"), - info->addr.spaprvio.reg); + virReportError(VIR_ERR_XML_ERROR, + _("spapr-vio address %#llx already in use"), + info->addr.spaprvio.reg); return -EEXIST; } @@ -911,8 +911,8 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev) if (dev->addr.pci.domain != 0 || dev->addr.pci.bus != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only PCI domain 0 and bus 0 are available")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only PCI domain 0 and bus 0 are available")); return NULL; } @@ -953,13 +953,13 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, if (virHashLookup(addrs->used, addr)) { if (info->addr.pci.function != 0) { - qemuReportError(VIR_ERR_XML_ERROR, - _("Attempted double use of PCI Address '%s' " - "(may need \"multifunction='on'\" for device on function 0)"), - addr); + virReportError(VIR_ERR_XML_ERROR, + _("Attempted double use of PCI Address '%s' " + "(may need \"multifunction='on'\" for device on function 0)"), + addr); } else { - qemuReportError(VIR_ERR_XML_ERROR, - _("Attempted double use of PCI Address '%s'"), addr); + virReportError(VIR_ERR_XML_ERROR, + _("Attempted double use of PCI Address '%s'"), addr); } goto cleanup; } @@ -982,10 +982,10 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, goto cleanup; if (virHashLookup(addrs->used, addr)) { - qemuReportError(VIR_ERR_XML_ERROR, - _("Attempted double use of PCI Address '%s'" - "(need \"multifunction='off'\" for device on function 0)"), - addr); + virReportError(VIR_ERR_XML_ERROR, + _("Attempted double use of PCI Address '%s'" + "(need \"multifunction='off'\" for device on function 0)"), + addr); goto cleanup; } @@ -1138,8 +1138,8 @@ int qemuDomainPCIAddressReserveAddr(qemuDomainPCIAddressSetPtr addrs, VIR_DEBUG("Reserving PCI addr %s", addr); if (virHashLookup(addrs->used, addr)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to reserve PCI address %s"), addr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to reserve PCI address %s"), addr); VIR_FREE(addr); return -1; } @@ -1199,9 +1199,9 @@ int qemuDomainPCIAddressEnsureAddr(qemuDomainPCIAddressSetPtr addrs, * reserve the whole slot. The function of the PCI device must be 0. */ if (dev->addr.pci.function != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only PCI device addresses with function=0" - " are supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only PCI device addresses with function=0" + " are supported")); return -1; } @@ -1316,8 +1316,8 @@ static int qemuDomainPCIAddressGetNextSlot(qemuDomainPCIAddressSetPtr addrs) return i; } - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No more available PCI addresses")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("No more available PCI addresses")); return -1; } @@ -1407,8 +1407,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) def->controllers[i]->info.addr.pci.bus != 0 || def->controllers[i]->info.addr.pci.slot != 1 || def->controllers[i]->info.addr.pci.function != 1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Primary IDE controller must have PCI address 0:0:1.1")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Primary IDE controller must have PCI address 0:0:1.1")); goto error; } /* If TYPE==PCI, then qemuCollectPCIAddress() function @@ -1430,8 +1430,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) def->controllers[i]->info.addr.pci.bus != 0 || def->controllers[i]->info.addr.pci.slot != 1 || def->controllers[i]->info.addr.pci.function != 2) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("PIIX3 USB controller must have PCI address 0:0:1.2")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("PIIX3 USB controller must have PCI address 0:0:1.2")); goto error; } reservedUSB = true; @@ -1465,8 +1465,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) def->videos[0]->info.addr.pci.bus != 0 || def->videos[0]->info.addr.pci.slot != 2 || def->videos[0]->info.addr.pci.function != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Primary video card must have PCI address 0:0:2.0")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Primary video card must have PCI address 0:0:2.0")); goto error; } /* If TYPE==PCI, then qemuCollectPCIAddress() function @@ -1616,8 +1616,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) continue; if (def->disks[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("virtio only support device address type 'PCI'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virtio only support device address type 'PCI'")); goto error; } @@ -1698,33 +1698,33 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, { if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { if (info->addr.pci.domain != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only PCI device addresses with domain=0 are supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only PCI device addresses with domain=0 are supported")); return -1; } if (info->addr.pci.bus != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Only PCI device addresses with bus=0 are supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Only PCI device addresses with bus=0 are supported")); return -1; } if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION)) { if (info->addr.pci.function > 7) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("The function of PCI device addresses must " - "less than 8")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("The function of PCI device addresses must " + "less than 8")); return -1; } } else { if (info->addr.pci.function != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Only PCI device addresses with function=0 " - "are supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only PCI device addresses with function=0 " + "are supported with this QEMU binary")); return -1; } if (info->addr.pci.multi == VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_ON) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("'multifunction=on' is not supported with " - "this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'multifunction=on' is not supported with " + "this QEMU binary")); return -1; } } @@ -1765,13 +1765,13 @@ qemuBuildRomStr(virBufferPtr buf, { if (info->rombar || info->romfile) { if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("rombar and romfile are supported only for PCI devices")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("rombar and romfile are supported only for PCI devices")); return -1; } if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("rombar and romfile not supported in this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("rombar and romfile not supported in this QEMU binary")); return -1; } @@ -1809,9 +1809,9 @@ static int qemuSafeSerialParamValue(const char *value) { if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen (value)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("driver serial '%s' contains unsafe characters"), - value); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("driver serial '%s' contains unsafe characters"), + value); return -1; } @@ -1851,9 +1851,9 @@ qemuBuildRBDString(virConnectPtr conn, secret = (char *)conn->secretDriver->getValue(sec, &secret_size, 0, VIR_SECRET_GET_VALUE_INTERNAL_CALL); if (secret == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get the value of the secret for username %s"), - disk->auth.username); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get the value of the secret for username %s"), + disk->auth.username); goto error; } /* qemu/librbd wants it base64 encoded */ @@ -1867,9 +1867,9 @@ qemuBuildRBDString(virConnectPtr conn, base64); VIR_FREE(base64); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("rbd username '%s' specified but secret not found"), - disk->auth.username); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("rbd username '%s' specified but secret not found"), + disk->auth.username); goto error; } } else { @@ -2020,16 +2020,16 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, int busid = -1, unitid = -1; if (idx < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type '%s'"), disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk type '%s'"), disk->dst); goto error; } switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_SCSI: if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for scsi disk")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for scsi disk")); goto error; } @@ -2037,8 +2037,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, * to be created. Yes this is slightly odd. It is not possible * to have > 1 bus on a SCSI controller (yet). */ if (disk->info.addr.drive.bus != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("SCSI controller only supports 1 bus")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("SCSI controller only supports 1 bus")); goto error; } busid = disk->info.addr.drive.controller; @@ -2047,14 +2047,14 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, case VIR_DOMAIN_DISK_BUS_IDE: if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for ide disk")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for ide disk")); goto error; } /* We can only have 1 IDE controller (currently) */ if (disk->info.addr.drive.controller != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Only 1 %s controller is supported"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Only 1 %s controller is supported"), bus); goto error; } busid = disk->info.addr.drive.bus; @@ -2063,25 +2063,25 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, case VIR_DOMAIN_DISK_BUS_FDC: if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for fdc disk")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for fdc disk")); goto error; } /* We can only have 1 FDC controller (currently) */ if (disk->info.addr.drive.controller != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Only 1 %s controller is supported"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Only 1 %s controller is supported"), bus); goto error; } /* We can only have 1 FDC bus (currently) */ if (disk->info.addr.drive.bus != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Only 1 %s bus is supported"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Only 1 %s bus is supported"), bus); goto error; } if (disk->info.addr.drive.target != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("target must be 0 for controller fdc")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("target must be 0 for controller fdc")); goto error; } unitid = disk->info.addr.drive.unit; @@ -2092,8 +2092,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)) { /* Paranoia - leave in here for now */ - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected address type for s390-virtio disk")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for s390-virtio disk")); goto error; } idx = -1; @@ -2115,14 +2115,14 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, /* QEMU only supports magic FAT format for now */ if (disk->driverType && STRNEQ(disk->driverType, "fat")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk driver type for '%s'"), - disk->driverType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk driver type for '%s'"), + disk->driverType); goto error; } if (!disk->readonly) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot create virtual FAT disks in read-write mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot create virtual FAT disks in read-write mode")); goto error; } if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) @@ -2134,8 +2134,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, switch (disk->protocol) { case VIR_DOMAIN_DISK_PROTOCOL_NBD: if (disk->nhosts != 1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("NBD accepts only one host")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("NBD accepts only one host")); goto error; } virBufferAsprintf(&opt, "file=nbd:%s:%s,", @@ -2162,9 +2162,9 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, } else { if ((disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) && (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("tray status 'open' is invalid for " - "block type disk")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("tray status 'open' is invalid for " + "block type disk")); goto error; } virBufferEscape(&opt, ',', ",", "file=%s,", disk->src); @@ -2210,8 +2210,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) virBufferAddLit(&opt, ",readonly=on"); if (disk->transient) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("transient disks not supported yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("transient disks not supported yet")); goto error; } if (disk->driverType && *disk->driverType != '\0' && @@ -2233,15 +2233,15 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC && !qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk cache mode 'directsync' is not " - "supported by this QEMU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk cache mode 'directsync' is not " + "supported by this QEMU")); goto error; } else if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_UNSAFE && !qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk cache mode 'unsafe' is not " - "supported by this QEMU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk cache mode 'unsafe' is not " + "supported by this QEMU")); goto error; } } else { @@ -2258,8 +2258,8 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, virBufferAsprintf(&opt, ",copy-on-read=%s", virDomainDiskCopyOnReadTypeToString(disk->copy_on_read)); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("copy_on_read is not supported by this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("copy_on_read is not supported by this QEMU binary")); goto error; } } @@ -2294,9 +2294,9 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, virBufferAsprintf(&opt, ",aio=%s", virDomainDiskIoTypeToString(disk->iomode)); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk aio mode not supported with this " - "QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk aio mode not supported with this " + "QEMU binary")); goto error; } } @@ -2309,9 +2309,9 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED, disk->blkdeviotune.read_iops_sec || disk->blkdeviotune.write_iops_sec) && !qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("block I/O throttling not supported with this " - "QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("block I/O throttling not supported with this " + "QEMU binary")); goto error; } @@ -2369,8 +2369,8 @@ qemuBuildDriveDevStr(virDomainDefPtr def, int controllerModel; if (idx < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type '%s'"), disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk type '%s'"), disk->dst); goto error; } @@ -2380,20 +2380,20 @@ qemuBuildDriveDevStr(virDomainDefPtr def, */ if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO && disk->bus != VIR_DOMAIN_DISK_BUS_SCSI) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device='lun' is not supported for bus='%s'"), - bus); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device='lun' is not supported for bus='%s'"), + bus); goto error; } if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device='lun' is not supported for type='%s'"), - virDomainDiskTypeToString(disk->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device='lun' is not supported for type='%s'"), + virDomainDiskTypeToString(disk->type)); goto error; } if (!qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device='lun' is not supported by this QEMU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device='lun' is not supported by this QEMU")); goto error; } } @@ -2401,8 +2401,8 @@ qemuBuildDriveDevStr(virDomainDefPtr def, switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_IDE: if (disk->info.addr.drive.target != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("target must be 0 for ide controller")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("target must be 0 for ide controller")); goto error; } @@ -2422,9 +2422,9 @@ qemuBuildDriveDevStr(virDomainDefPtr def, case VIR_DOMAIN_DISK_BUS_SCSI: if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_BLOCK)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support scsi-block for " - "lun passthrough")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support scsi-block for " + "lun passthrough")); goto error; } } @@ -2438,9 +2438,9 @@ qemuBuildDriveDevStr(virDomainDefPtr def, if (controllerModel == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC) { if (disk->info.addr.drive.target != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("target must be 0 for controller " - "model 'lsilogic'")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("target must be 0 for controller " + "model 'lsilogic'")); goto error; } @@ -2464,17 +2464,17 @@ qemuBuildDriveDevStr(virDomainDefPtr def, } else { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_CHANNEL)) { if (disk->info.addr.drive.target > 7) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support target " - "greater than 7")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support target " + "greater than 7")); goto error; } if ((disk->info.addr.drive.bus != disk->info.addr.drive.unit) && (disk->info.addr.drive.bus != 0)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU only supports both bus and " - "unit equal to 0")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU only supports both bus and " + "unit equal to 0")); goto error; } } @@ -2501,13 +2501,13 @@ qemuBuildDriveDevStr(virDomainDefPtr def, break; case VIR_DOMAIN_DISK_BUS_SATA: if (disk->info.addr.drive.bus != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("bus must be 0 for ide controller")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("bus must be 0 for ide controller")); goto error; } if (disk->info.addr.drive.target != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("target must be 0 for ide controller")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("target must be 0 for ide controller")); goto error; } @@ -2552,8 +2552,8 @@ qemuBuildDriveDevStr(virDomainDefPtr def, virBufferAddLit(&opt, "usb-storage"); break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk bus '%s' with device setup"), bus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk bus '%s' with device setup"), bus); goto error; } virBufferAsprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias); @@ -2582,14 +2582,14 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, const char *wrpolicy = virDomainFSWrpolicyTypeToString(fs->wrpolicy); if (fs->type != VIR_DOMAIN_FS_TYPE_MOUNT) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("only supports mount filesystem type")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("only supports mount filesystem type")); goto error; } if (!driver) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Filesystem driver type not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Filesystem driver type not supported")); goto error; } virBufferAdd(&opt, driver, -1); @@ -2607,8 +2607,8 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, /* For other fs drivers, default(passthru) should always * be supported */ if (fs->accessmode != VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("only supports passthrough accessmode")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("only supports passthrough accessmode")); goto error; } } @@ -2617,7 +2617,7 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, if (qemuCapsGet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT)) { virBufferAsprintf(&opt, ",writeout=%s", wrpolicy); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("filesystem writeout not supported")); goto error; } @@ -2630,9 +2630,9 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs, if (qemuCapsGet(qemuCaps, QEMU_CAPS_FSDEV_READONLY)) { virBufferAddLit(&opt, ",readonly"); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("readonly filesystem is not supported by this " - "QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("readonly filesystem is not supported by this " + "QEMU binary")); goto error; } } @@ -2657,8 +2657,8 @@ qemuBuildFSDevStr(virDomainFSDefPtr fs, virBuffer opt = VIR_BUFFER_INITIALIZER; if (fs->type != VIR_DOMAIN_FS_TYPE_MOUNT) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("can only passthrough directories")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("can only passthrough directories")); goto error; } @@ -2732,8 +2732,8 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef, caps = qemuControllerModelUSBToCaps(model); if (caps == -1 || !qemuCapsGet(qemuCaps, caps)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s not supported in this QEMU binary"), smodel); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s not supported in this QEMU binary"), smodel); return -1; } @@ -2778,9 +2778,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, virBufferAddLit(&buf, "spapr-vscsi"); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported controller model: %s"), - virDomainControllerModelSCSITypeToString(def->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported controller model: %s"), + virDomainControllerModelSCSITypeToString(def->model)); } virBufferAsprintf(&buf, ",id=scsi%d", def->idx); break; @@ -2826,9 +2826,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef, /* We always get an IDE controller, whether we want it or not. */ case VIR_DOMAIN_CONTROLLER_TYPE_IDE: default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown controller type: %s"), - virDomainControllerTypeToString(def->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown controller type: %s"), + virDomainControllerTypeToString(def->type)); goto error; } @@ -2913,13 +2913,13 @@ qemuBuildNicDevStr(virDomainNetDefPtr net, /* this should never happen, if it does, we need * to add another case to this switch. */ - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unrecognized virtio-net-pci 'tx' option")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unrecognized virtio-net-pci 'tx' option")); goto error; } } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtio-net-pci 'tx' option not supported in this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio-net-pci 'tx' option not supported in this QEMU binary")); goto error; } } @@ -2972,9 +2972,9 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, enum virDomainNetType netType = virDomainNetGetActualType(net); if (net->script && netType != VIR_DOMAIN_NET_TYPE_ETHERNET) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("scripts are not supported on interfaces of type %s"), - virDomainNetTypeToString(netType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("scripts are not supported on interfaces of type %s"), + virDomainNetTypeToString(netType)); return NULL; } @@ -3066,8 +3066,8 @@ qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev, const char *model = virDomainWatchdogModelTypeToString(dev->model); if (!model) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing watchdog model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing watchdog model")); goto error; } @@ -3146,8 +3146,8 @@ qemuBuildSoundDevStr(virDomainSoundDefPtr sound, const char *model = virDomainSoundModelTypeToString(sound->model); if (!model) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid sound model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid sound model")); goto error; } @@ -3204,8 +3204,8 @@ qemuBuildSoundCodecStr(virDomainSoundDefPtr sound, caps = qemuSoundCodecTypeToCaps(type); if (caps == -1 || !qemuCapsGet(qemuCaps, caps)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s not supported in this QEMU binary"), stype); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s not supported in this QEMU binary"), stype); goto error; } @@ -3227,8 +3227,8 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video, const char *model = qemuVideoTypeToString(video->type); if (!model) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid video model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid video model")); goto error; } @@ -3236,9 +3236,9 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video, if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { if (video->vram > (UINT_MAX / 1024)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("value for 'vram' must be less than '%u'"), - UINT_MAX / 1024); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("value for 'vram' must be less than '%u'"), + UINT_MAX / 1024); goto error; } @@ -3343,16 +3343,16 @@ qemuBuildRedirdevDevStr(virDomainRedirdevDefPtr dev, virBuffer buf = VIR_BUFFER_INITIALIZER; if (dev->bus != VIR_DOMAIN_REDIRDEV_BUS_USB) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Redirection bus %s is not supported by QEMU"), - virDomainRedirdevBusTypeToString(dev->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Redirection bus %s is not supported by QEMU"), + virDomainRedirdevBusTypeToString(dev->bus)); goto error; } if (!qemuCapsGet(qemuCaps, QEMU_CAPS_USB_REDIR)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("USB redirection is not supported " - "by this version of QEMU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("USB redirection is not supported " + "by this version of QEMU")); goto error; } @@ -3383,8 +3383,8 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev, if (!dev->source.subsys.u.usb.bus && !dev->source.subsys.u.usb.device) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("USB host device is missing bus/device information")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("USB host device is missing bus/device information")); return NULL; } @@ -3416,15 +3416,15 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev, virBuffer buf = VIR_BUFFER_INITIALIZER; if (dev->type != VIR_DOMAIN_HUB_TYPE_USB) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hub type %s not supported"), - virDomainHubTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hub type %s not supported"), + virDomainHubTypeToString(dev->type)); goto error; } if (!qemuCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("usb-hub not supported by QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("usb-hub not supported by QEMU binary")); goto error; } @@ -3453,8 +3453,8 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev) if (!dev->source.subsys.u.usb.bus && !dev->source.subsys.u.usb.device) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("USB host device is missing bus/device information")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("USB host device is missing bus/device information")); return NULL; } @@ -3552,8 +3552,8 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, case VIR_DOMAIN_CHR_TYPE_SPICEVMC: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("spicevmc not supported in this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("spicevmc not supported in this QEMU binary")); goto error; } virBufferAsprintf(&buf, "spicevmc,id=char%s,name=%s", alias, @@ -3561,9 +3561,9 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported chardev '%s'"), - virDomainChrTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported chardev '%s'"), + virDomainChrTypeToString(dev->type)); goto error; } @@ -3689,8 +3689,8 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, } break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Cannot use virtio serial for parallel/serial devices")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Cannot use virtio serial for parallel/serial devices")); return NULL; } @@ -3700,8 +3700,8 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, if (dev->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("virtio serial device has invalid address type")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("virtio serial device has invalid address type")); goto error; } @@ -3717,9 +3717,9 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev, if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL && dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC && STRNEQ_NULLABLE(dev->target.name, "com.redhat.spice.0")) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported spicevmc target name '%s'"), - dev->target.name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported spicevmc target name '%s'"), + dev->target.name); goto error; } @@ -3849,9 +3849,9 @@ qemuBuildClockArgStr(virDomainClockDefPtr def) struct tm nowbits; if (def->data.variable.basis != VIR_DOMAIN_CLOCK_BASIS_UTC) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock basis '%s'"), - virDomainClockBasisTypeToString(def->data.variable.basis)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock basis '%s'"), + virDomainClockBasisTypeToString(def->data.variable.basis)); goto error; } now += def->data.variable.adjustment; @@ -3867,9 +3867,9 @@ qemuBuildClockArgStr(virDomainClockDefPtr def) } break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset '%s'"), - virDomainClockOffsetTypeToString(def->offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset '%s'"), + virDomainClockOffsetTypeToString(def->offset)); goto error; } @@ -3881,9 +3881,9 @@ qemuBuildClockArgStr(virDomainClockDefPtr def) case -1: /* unspecified - use hypervisor default */ break; case VIR_DOMAIN_TIMER_TRACK_BOOT: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported rtc timer track '%s'"), - virDomainTimerTrackTypeToString(def->timers[i]->track)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported rtc timer track '%s'"), + virDomainTimerTrackTypeToString(def->timers[i]->track)); goto error; case VIR_DOMAIN_TIMER_TRACK_GUEST: virBufferAddLit(&buf, ",clock=vm"); @@ -3905,9 +3905,9 @@ qemuBuildClockArgStr(virDomainClockDefPtr def) break; case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported rtc timer tickpolicy '%s'"), - virDomainTimerTickpolicyTypeToString(def->timers[i]->tickpolicy)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported rtc timer tickpolicy '%s'"), + virDomainTimerTickpolicyTypeToString(def->timers[i]->tickpolicy)); goto error; } break; /* no need to check other timers - there is only one rtc */ @@ -3969,8 +3969,8 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, goto cleanup; if (!ncpus || !host) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("CPU specification not supported by hypervisor")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("CPU specification not supported by hypervisor")); goto cleanup; } @@ -3986,12 +3986,12 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, switch (cmp) { case VIR_CPU_COMPARE_INCOMPATIBLE: if (compare_msg) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("guest and host CPU are not compatible: %s"), - compare_msg); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("guest and host CPU are not compatible: %s"), + compare_msg); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("guest CPU is not compatible with host CPU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("guest CPU is not compatible with host CPU")); } /* fall through */ case VIR_CPU_COMPARE_ERROR: @@ -4012,15 +4012,15 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) { const char *mode = virCPUModeTypeToString(cpu->mode); if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("CPU mode '%s' is not supported by QEMU" - " binary"), mode); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU mode '%s' is not supported by QEMU" + " binary"), mode); goto cleanup; } if (def->virtType != VIR_DOMAIN_VIRT_KVM) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("CPU mode '%s' is only supported with kvm"), - mode); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("CPU mode '%s' is only supported with kvm"), + mode); goto cleanup; } virBufferAddLit(&buf, "host"); @@ -4145,9 +4145,9 @@ qemuBuildSmpArgStr(const virDomainDefPtr def, } else if (def->vcpus != def->maxvcpus) { virBufferFreeAndReset(&buf); /* FIXME - consider hot-unplugging cpus after boot for older qemu */ - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("setting current vcpu count less than maximum is " - "not supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting current vcpu count less than maximum is " + "not supported with this QEMU binary")); return NULL; } @@ -4286,9 +4286,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (qemuCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU)) { enableKQEMU = 1; } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("the QEMU binary %s does not support kqemu"), - emulator); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the QEMU binary %s does not support kqemu"), + emulator); } break; @@ -4299,9 +4299,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (qemuCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM)) { enableKVM = 1; } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_KVM)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("the QEMU binary %s does not support kvm"), - emulator); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the QEMU binary %s does not support kvm"), + emulator); } break; @@ -4310,9 +4310,9 @@ qemuBuildCommandLine(virConnectPtr conn, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("the QEMU binary %s does not support %s"), - emulator, virDomainVirtTypeToString(def->virtType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the QEMU binary %s does not support %s"), + emulator, virDomainVirtTypeToString(def->virtType)); break; } @@ -4376,19 +4376,19 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgFormat(cmd, "%llu", def->mem.max_balloon / 1024); if (def->mem.hugepage_backed) { if (!driver->hugetlbfs_mount) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("hugetlbfs filesystem is not mounted")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("hugetlbfs filesystem is not mounted")); goto error; } if (!driver->hugepage_path) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("hugepages are disabled by administrator config")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("hugepages are disabled by administrator config")); goto error; } if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MEM_PATH)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("hugepage backing not supported by '%s'"), - def->emulator); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("hugepage backing not supported by '%s'"), + def->emulator); goto error; } virCommandAddArgList(cmd, "-mem-prealloc", "-mem-path", @@ -4418,9 +4418,9 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-xen-domid"); virCommandAddArgFormat(cmd, "%d", def->id); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("qemu emulator '%s' does not support xen"), - def->emulator); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("qemu emulator '%s' does not support xen"), + def->emulator); goto error; } } @@ -4431,17 +4431,17 @@ qemuBuildCommandLine(virConnectPtr conn, bool skip_uuid = false; if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("the QEMU binary %s does not support smbios settings"), - emulator); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the QEMU binary %s does not support smbios settings"), + emulator); goto error; } /* should we really error out or just warn in those cases ? */ if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) { if (driver->hostsysinfo == NULL) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Host SMBIOS information is not available")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Host SMBIOS information is not available")); goto error; } source = driver->hostsysinfo; @@ -4449,8 +4449,8 @@ qemuBuildCommandLine(virConnectPtr conn, skip_uuid = true; } else if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_SYSINFO) { if (def->sysinfo == NULL) { - qemuReportError(VIR_ERR_XML_ERROR, - _("Domain '%s' sysinfo are not available"), + virReportError(VIR_ERR_XML_ERROR, + _("Domain '%s' sysinfo are not available"), def->name); goto error; } @@ -4495,18 +4495,18 @@ qemuBuildCommandLine(virConnectPtr conn, /* Serial graphics adapter */ if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("qemu does not support -device")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("qemu does not support -device")); goto error; } if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SGA)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("qemu does not support SGA")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("qemu does not support SGA")); goto error; } if (!def->nserials) { - qemuReportError(VIR_ERR_XML_ERROR, "%s", - _("need at least one serial port to use SGA")); + virReportError(VIR_ERR_XML_ERROR, "%s", + _("need at least one serial port to use SGA")); goto error; } virCommandAddArgList(cmd, "-device", "sga", NULL); @@ -4560,9 +4560,9 @@ qemuBuildCommandLine(virConnectPtr conn, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset '%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset '%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); goto error; } } @@ -4576,9 +4576,9 @@ qemuBuildCommandLine(virConnectPtr conn, default: case VIR_DOMAIN_TIMER_NAME_PLATFORM: case VIR_DOMAIN_TIMER_NAME_TSC: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported timer type (name) '%s'"), - virDomainTimerNameTypeToString(def->clock.timers[i]->name)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported timer type (name) '%s'"), + virDomainTimerNameTypeToString(def->clock.timers[i]->name)); goto error; case VIR_DOMAIN_TIMER_NAME_KVMCLOCK: @@ -4600,9 +4600,9 @@ qemuBuildCommandLine(virConnectPtr conn, break; case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported rtc tickpolicy '%s'"), - virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported rtc tickpolicy '%s'"), + virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); goto error; } } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_RTC) @@ -4611,9 +4611,9 @@ qemuBuildCommandLine(virConnectPtr conn, && (def->clock.timers[i]->tickpolicy != -1)) { /* a non-default rtc policy was given, but there is no way to implement it in this version of qemu */ - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported rtc tickpolicy '%s'"), - virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported rtc tickpolicy '%s'"), + virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); goto error; } break; @@ -4635,18 +4635,18 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-tdf"); } else { /* can't catchup if we have neither pit mode */ - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported pit tickpolicy '%s'"), - virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported pit tickpolicy '%s'"), + virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); goto error; } break; case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD: /* no way to support these modes for pit in qemu */ - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported pit tickpolicy '%s'"), - virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported pit tickpolicy '%s'"), + virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy)); goto error; } break; @@ -4666,8 +4666,8 @@ qemuBuildCommandLine(virConnectPtr conn, /* no hpet timer available. The only possible action is to raise an error if present="yes" */ if (def->clock.timers[i]->present == 1) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("pit timer is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("pit timer is not supported")); } } break; @@ -4701,8 +4701,8 @@ qemuBuildCommandLine(virConnectPtr conn, * configuration is used */ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("hypervisor lacks deviceboot feature")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("hypervisor lacks deviceboot feature")); goto error; } emitBootindex = true; @@ -4767,9 +4767,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (disk->driverName != NULL && !STREQ(disk->driverName, "qemu")) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported driver name '%s' for disk '%s'"), - disk->driverName, disk->src); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported driver name '%s' for disk '%s'"), + disk->driverName, disk->src); goto error; } } @@ -4788,8 +4788,8 @@ qemuBuildCommandLine(virConnectPtr conn, /* Only recent QEMU implements a SATA (AHCI) controller */ if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("SATA is not supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("SATA is not supported with this QEMU binary")); goto error; } else { char *devstr; @@ -4805,8 +4805,8 @@ qemuBuildCommandLine(virConnectPtr conn, def->controllers[i]->model == -1 && !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) { if (usblegacy) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Multiple legacy USB controller not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Multiple legacy USB controller not supported")); goto error; } usblegacy = true; @@ -4861,9 +4861,9 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-usbdevice"); virCommandAddArgFormat(cmd, "disk:%s", disk->src); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported usb disk type for '%s'"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported usb disk type for '%s'"), + disk->src); goto error; } continue; @@ -4950,9 +4950,9 @@ qemuBuildCommandLine(virConnectPtr conn, if ((disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) && (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("tray status 'open' is invalid for " - "block type disk")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("tray status 'open' is invalid for " + "block type disk")); goto error; } @@ -4961,9 +4961,9 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-usbdevice"); virCommandAddArgFormat(cmd, "disk:%s", disk->src); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported usb disk type for '%s'"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported usb disk type for '%s'"), + disk->src); goto error; } continue; @@ -4981,8 +4981,8 @@ qemuBuildCommandLine(virConnectPtr conn, STRPREFIX(disk->dst, "fd")) { snprintf(dev, NAME_MAX, "-%s", disk->dst); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk type '%s'"), disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk type '%s'"), disk->dst); goto error; } } @@ -4991,14 +4991,14 @@ qemuBuildCommandLine(virConnectPtr conn, /* QEMU only supports magic FAT format for now */ if (disk->driverType && STRNEQ(disk->driverType, "fat")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported disk driver type for '%s'"), - disk->driverType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported disk driver type for '%s'"), + disk->driverType); goto error; } if (!disk->readonly) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot create virtual FAT disks in read-write mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot create virtual FAT disks in read-write mode")); goto error; } if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) @@ -5013,8 +5013,8 @@ qemuBuildCommandLine(virConnectPtr conn, switch (disk->protocol) { case VIR_DOMAIN_DISK_PROTOCOL_NBD: if (disk->nhosts != 1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("NBD accepts only one host")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("NBD accepts only one host")); goto error; } if (virAsprintf(&file, "nbd:%s:%s,", disk->hosts->name, @@ -5085,8 +5085,8 @@ qemuBuildCommandLine(virConnectPtr conn, } } else { if (def->nfss) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("filesystem passthrough not supported by this QEMU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("filesystem passthrough not supported by this QEMU")); goto error; } } @@ -5248,9 +5248,9 @@ qemuBuildCommandLine(virConnectPtr conn, smartcard->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID || smartcard->info.addr.ccid.controller != 0 || smartcard->info.addr.ccid.slot != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks multiple smartcard " - "support")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks multiple smartcard " + "support")); virBufferFreeAndReset(&opt); goto error; } @@ -5259,9 +5259,9 @@ qemuBuildCommandLine(virConnectPtr conn, case VIR_DOMAIN_SMARTCARD_TYPE_HOST: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || !qemuCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard host " - "mode support")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks smartcard host " + "mode support")); goto error; } @@ -5271,9 +5271,9 @@ qemuBuildCommandLine(virConnectPtr conn, case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || !qemuCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard host " - "mode support")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks smartcard host " + "mode support")); goto error; } @@ -5281,9 +5281,9 @@ qemuBuildCommandLine(virConnectPtr conn, for (j = 0; j < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; j++) { if (strchr(smartcard->data.cert.file[j], ',')) { virBufferFreeAndReset(&opt); - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid certificate name: %s"), - smartcard->data.cert.file[j]); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid certificate name: %s"), + smartcard->data.cert.file[j]); goto error; } virBufferAsprintf(&opt, ",cert%d=%s", j + 1, @@ -5292,9 +5292,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (smartcard->data.cert.database) { if (strchr(smartcard->data.cert.database, ',')) { virBufferFreeAndReset(&opt); - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid database name: %s"), - smartcard->data.cert.database); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid database name: %s"), + smartcard->data.cert.database); goto error; } database = smartcard->data.cert.database; @@ -5307,9 +5307,9 @@ qemuBuildCommandLine(virConnectPtr conn, case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || !qemuCapsGet(qemuCaps, QEMU_CAPS_CCID_PASSTHRU)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard " - "passthrough mode support")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks smartcard " + "passthrough mode support")); goto error; } @@ -5328,9 +5328,9 @@ qemuBuildCommandLine(virConnectPtr conn, break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected smartcard type %d"), - smartcard->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected smartcard type %d"), + smartcard->type); virBufferFreeAndReset(&opt); goto error; } @@ -5420,8 +5420,8 @@ qemuBuildCommandLine(virConnectPtr conn, case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) || !qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("guestfwd requires QEMU to support -chardev & -device")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("guestfwd requires QEMU to support -chardev & -device")); goto error; } @@ -5448,8 +5448,8 @@ qemuBuildCommandLine(virConnectPtr conn, case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtio channel requires QEMU to support -device")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio channel requires QEMU to support -device")); goto error; } @@ -5487,8 +5487,8 @@ qemuBuildCommandLine(virConnectPtr conn, switch(console->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("virtio channel requires QEMU to support -device")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("virtio channel requires QEMU to support -device")); goto error; } @@ -5512,9 +5512,9 @@ qemuBuildCommandLine(virConnectPtr conn, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported console target type %s"), - NULLSTR(virDomainChrConsoleTargetTypeToString(console->targetType))); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported console target type %s"), + NULLSTR(virDomainChrConsoleTargetTypeToString(console->targetType))); goto error; } } @@ -5553,8 +5553,8 @@ qemuBuildCommandLine(virConnectPtr conn, } if (def->ngraphics > 1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("only 1 graphics device is supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("only 1 graphics device is supported")); goto error; } @@ -5592,15 +5592,15 @@ qemuBuildCommandLine(virConnectPtr conn, break; ret = networkGetNetworkAddress(listenNetwork, &netAddr); if (ret <= -2) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("network-based listen not possible, " - "network driver not present")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("network-based listen not possible, " + "network driver not present")); goto error; } if (ret < 0) { - qemuReportError(VIR_ERR_XML_ERROR, - _("listen network '%s' had no usable address"), - listenNetwork); + virReportError(VIR_ERR_XML_ERROR, + _("listen network '%s' had no usable address"), + listenNetwork); goto error; } listenAddr = netAddr; @@ -5676,9 +5676,9 @@ qemuBuildCommandLine(virConnectPtr conn, def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { if (qemuCapsGet(qemuCaps, QEMU_CAPS_0_10) && !qemuCapsGet(qemuCaps, QEMU_CAPS_SDL)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("sdl not supported by '%s'"), - def->emulator); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("sdl not supported by '%s'"), + def->emulator); goto error; } @@ -5714,8 +5714,8 @@ qemuBuildCommandLine(virConnectPtr conn, int defaultMode = def->graphics[0]->data.spice.defaultMode; if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SPICE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("spice graphics are not supported with this QEMU")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("spice graphics are not supported with this QEMU")); goto error; } @@ -5723,9 +5723,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (def->graphics[0]->data.spice.tlsPort > 0) { if (!driver->spiceTLS) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("spice TLS port set in XML configuration," - " but TLS is disabled in qemu.conf")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("spice TLS port set in XML configuration," + " but TLS is disabled in qemu.conf")); goto error; } virBufferAsprintf(&opt, ",tls-port=%u", @@ -5743,15 +5743,15 @@ qemuBuildCommandLine(virConnectPtr conn, break; ret = networkGetNetworkAddress(listenNetwork, &netAddr); if (ret <= -2) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("network-based listen not possible, " - "network driver not present")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("network-based listen not possible, " + "network driver not present")); goto error; } if (ret < 0) { - qemuReportError(VIR_ERR_XML_ERROR, - _("listen network '%s' had no usable address"), - listenNetwork); + virReportError(VIR_ERR_XML_ERROR, + _("listen network '%s' had no usable address"), + listenNetwork); goto error; } listenAddr = netAddr; @@ -5812,8 +5812,8 @@ qemuBuildCommandLine(virConnectPtr conn, switch (mode) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: if (!driver->spiceTLS) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("spice secure channels set in XML configuration, but TLS is disabled in qemu.conf")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("spice secure channels set in XML configuration, but TLS is disabled in qemu.conf")); goto error; } virBufferAsprintf(&opt, ",tls-channel=%s", @@ -5854,9 +5854,9 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=spice"); } else if ((def->ngraphics == 1)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported graphics type '%s'"), - virDomainGraphicsTypeToString(def->graphics[0]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported graphics type '%s'"), + virDomainGraphicsTypeToString(def->graphics[0]->type)); goto error; } @@ -5867,16 +5867,16 @@ qemuBuildCommandLine(virConnectPtr conn, } else { if ((def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) && !qemuCapsGet(qemuCaps, QEMU_CAPS_VGA_QXL)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU does not support QXL graphics adapters")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU does not support QXL graphics adapters")); goto error; } const char *vgastr = qemuVideoTypeToString(def->videos[0]->type); if (!vgastr || STREQ(vgastr, "")) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("video type %s is not supported with QEMU"), - virDomainVideoTypeToString(def->videos[0]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type %s is not supported with QEMU"), + virDomainVideoTypeToString(def->videos[0]->type)); goto error; } @@ -5886,9 +5886,9 @@ qemuBuildCommandLine(virConnectPtr conn, if (def->videos[0]->vram && qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { if (def->videos[0]->vram > (UINT_MAX / 1024)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("value for 'vram' must be less than '%u'"), - UINT_MAX / 1024); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("value for 'vram' must be less than '%u'"), + UINT_MAX / 1024); goto error; } @@ -5920,9 +5920,9 @@ qemuBuildCommandLine(virConnectPtr conn, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("video type %s is not supported with this QEMU"), - virDomainVideoTypeToString(def->videos[0]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type %s is not supported with this QEMU"), + virDomainVideoTypeToString(def->videos[0]->type)); goto error; } } @@ -5932,9 +5932,9 @@ qemuBuildCommandLine(virConnectPtr conn, for (i = 1 ; i < def->nvideos ; i++) { char *str; if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("video type %s is only valid as primary video card"), - virDomainVideoTypeToString(def->videos[0]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type %s is only valid as primary video card"), + virDomainVideoTypeToString(def->videos[0]->type)); goto error; } @@ -5947,8 +5947,8 @@ qemuBuildCommandLine(virConnectPtr conn, VIR_FREE(str); } } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("only one video card is currently supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("only one video card is currently supported")); goto error; } } @@ -6022,15 +6022,15 @@ qemuBuildCommandLine(virConnectPtr conn, const char *model = virDomainSoundModelTypeToString(sound->model); if (!model) { VIR_FREE(modstr); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid sound model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid sound model")); goto error; } if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) { VIR_FREE(modstr); - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks hda support")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks hda support")); goto error; } @@ -6060,8 +6060,8 @@ qemuBuildCommandLine(virConnectPtr conn, const char *model = virDomainWatchdogModelTypeToString(watchdog->model); if (!model) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing watchdog model")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing watchdog model")); goto error; } @@ -6076,8 +6076,8 @@ qemuBuildCommandLine(virConnectPtr conn, act = VIR_DOMAIN_WATCHDOG_ACTION_PAUSE; const char *action = virDomainWatchdogActionTypeToString(act); if (!action) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid watchdog action")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("invalid watchdog action")); goto error; } virCommandAddArgList(cmd, "-watchdog-action", action, NULL); @@ -6117,14 +6117,14 @@ qemuBuildCommandLine(virConnectPtr conn, if (hostdev->info->bootIndex) { if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("booting from assigned devices is only" - " supported for PCI devices")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("booting from assigned devices is only" + " supported for PCI devices")); goto error; } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_BOOTINDEX)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("booting from assigned PCI devices is not" - " supported with this version of qemu")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("booting from assigned PCI devices is not" + " supported with this version of qemu")); goto error; } } @@ -6179,8 +6179,8 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, devstr); VIR_FREE(devstr); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("PCI device assignment is not supported by this version of qemu")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("PCI device assignment is not supported by this version of qemu")); goto error; } } @@ -6193,9 +6193,9 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-incoming"); if (STRPREFIX(migrateFrom, "tcp")) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("TCP migration is not supported with " - "this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("TCP migration is not supported with " + "this QEMU binary")); goto error; } virCommandAddArg(cmd, migrateFrom); @@ -6210,39 +6210,39 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, migrateFrom); virCommandSetInputFD(cmd, migrateFd); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("STDIO migration is not supported " - "with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("STDIO migration is not supported " + "with this QEMU binary")); goto error; } } else if (STRPREFIX(migrateFrom, "exec")) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("EXEC migration is not supported " - "with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("EXEC migration is not supported " + "with this QEMU binary")); goto error; } virCommandAddArg(cmd, migrateFrom); } else if (STRPREFIX(migrateFrom, "fd")) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("FD migration is not supported " - "with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("FD migration is not supported " + "with this QEMU binary")); goto error; } virCommandAddArg(cmd, migrateFrom); virCommandPreserveFD(cmd, migrateFd); } else if (STRPREFIX(migrateFrom, "unix")) { if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("UNIX migration is not supported " - "with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("UNIX migration is not supported " + "with this QEMU binary")); goto error; } virCommandAddArg(cmd, migrateFrom); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unknown migration protocol")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unknown migration protocol")); goto error; } } @@ -6256,9 +6256,9 @@ qemuBuildCommandLine(virConnectPtr conn, if ((def->memballoon) && (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) { if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Memory balloon device type '%s' is not supported by this version of qemu"), - virDomainMemballoonModelTypeToString(def->memballoon->model)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Memory balloon device type '%s' is not supported by this version of qemu"), + virDomainMemballoonModelTypeToString(def->memballoon->model)); goto error; } if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { @@ -6516,8 +6516,8 @@ qemuParseKeywords(const char *str, if (separator >= endmark) { if (!allowEmptyValue) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("malformed keyword arguments in '%s'"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed keyword arguments in '%s'"), str); goto error; } separator = endmark; @@ -6629,9 +6629,9 @@ qemuParseCommandLineDisk(virCapsPtr caps, host = def->src + strlen("nbd:"); port = strchr(host, ':'); if (!port) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse nbd filename '%s'"), - def->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse nbd filename '%s'"), + def->src); def = NULL; goto cleanup; } @@ -6688,8 +6688,8 @@ qemuParseCommandLineDisk(virCapsPtr caps, vdi = strchr(port, ':'); if (!vdi) { def = NULL; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sheepdog filename '%s'"), p); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse sheepdog filename '%s'"), p); goto cleanup; } *vdi++ = '\0'; @@ -6775,24 +6775,24 @@ qemuParseCommandLineDisk(virCapsPtr caps, if (virStrToLong_i(values[i], NULL, 10, &idx) < 0) { virDomainDiskDefFree(def); def = NULL; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse drive index '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse drive index '%s'"), val); goto cleanup; } } else if (STREQ(keywords[i], "bus")) { if (virStrToLong_i(values[i], NULL, 10, &busid) < 0) { virDomainDiskDefFree(def); def = NULL; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse drive bus '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse drive bus '%s'"), val); goto cleanup; } } else if (STREQ(keywords[i], "unit")) { if (virStrToLong_i(values[i], NULL, 10, &unitid) < 0) { virDomainDiskDefFree(def); def = NULL; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse drive unit '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse drive unit '%s'"), val); goto cleanup; } } else if (STREQ(keywords[i], "readonly")) { @@ -6800,8 +6800,8 @@ qemuParseCommandLineDisk(virCapsPtr caps, def->readonly = 1; } else if (STREQ(keywords[i], "aio")) { if ((def->iomode = virDomainDiskIoTypeFromString(values[i])) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse io mode '%s'"), values[i]); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse io mode '%s'"), values[i]); } } } @@ -6812,8 +6812,8 @@ qemuParseCommandLineDisk(virCapsPtr caps, if (!def->src && def->device == VIR_DOMAIN_DISK_DEVICE_DISK && def->type != VIR_DOMAIN_DISK_TYPE_NETWORK) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("missing file parameter in drive '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing file parameter in drive '%s'"), val); virDomainDiskDefFree(def); def = NULL; goto cleanup; @@ -6825,8 +6825,8 @@ qemuParseCommandLineDisk(virCapsPtr caps, if (idx == -1 && unitid == -1 && busid == -1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("missing index/unit/bus parameter in drive '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing index/unit/bus parameter in drive '%s'"), val); virDomainDiskDefFree(def); def = NULL; goto cleanup; @@ -6874,8 +6874,8 @@ qemuParseCommandLineDisk(virCapsPtr caps, def->dst[2] = 'a' + idx; if (virDomainDiskDefAssignAddress(caps, def) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid device name '%s'"), def->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid device name '%s'"), def->dst); virDomainDiskDefFree(def); def = NULL; /* fall through to "cleanup" */ @@ -6910,8 +6910,8 @@ qemuFindNICForVLAN(int nnics, tmp += strlen("vlan="); if (virStrToLong_i(tmp, &end, 10, &gotvlan) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse NIC vlan in '%s'"), nics[i]); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse NIC vlan in '%s'"), nics[i]); return NULL; } @@ -6922,8 +6922,8 @@ qemuFindNICForVLAN(int nnics, if (wantvlan == 0 && nnics > 0) return nics[0]; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find NIC definition for vlan %d"), wantvlan); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find NIC definition for vlan %d"), wantvlan); return NULL; } @@ -6979,8 +6979,8 @@ qemuParseCommandLineNet(virCapsPtr caps, for (i = 0 ; i < nkeywords ; i++) { if (STREQ(keywords[i], "vlan")) { if (virStrToLong_i(values[i], NULL, 10, &wantvlan) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vlan in '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse vlan in '%s'"), val); virDomainNetDefFree(def); def = NULL; goto cleanup; @@ -7009,8 +7009,8 @@ qemuParseCommandLineNet(virCapsPtr caps, } if (!STRPREFIX(nic, "nic")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse NIC definition '%s'"), nic); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse NIC definition '%s'"), nic); virDomainNetDefFree(def); def = NULL; goto cleanup; @@ -7039,9 +7039,9 @@ qemuParseCommandLineNet(virCapsPtr caps, if (STREQ(keywords[i], "macaddr")) { genmac = 0; if (virMacAddrParse(values[i], &def->mac) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to parse mac address '%s'"), - values[i]); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to parse mac address '%s'"), + values[i]); virDomainNetDefFree(def); def = NULL; goto cleanup; @@ -7057,8 +7057,8 @@ qemuParseCommandLineNet(virCapsPtr caps, } } else if (STREQ(keywords[i], "sndbuf") && values[i]) { if (virStrToLong_ul(values[i], NULL, 10, &def->tune.sndbuf) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sndbuf size in '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse sndbuf size in '%s'"), val); virDomainNetDefFree(def); def = NULL; goto cleanup; @@ -7096,27 +7096,27 @@ qemuParseCommandLinePCI(const char *val) goto error; if (!STRPREFIX(val, "host=")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown PCI device syntax '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown PCI device syntax '%s'"), val); goto error; } start = val + strlen("host="); if (virStrToLong_i(start, &end, 16, &bus) < 0 || *end != ':') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract PCI device bus '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract PCI device bus '%s'"), val); goto error; } start = end + 1; if (virStrToLong_i(start, &end, 16, &slot) < 0 || *end != '.') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract PCI device slot '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract PCI device slot '%s'"), val); goto error; } start = end + 1; if (virStrToLong_i(start, NULL, 16, &func) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract PCI device function '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract PCI device function '%s'"), val); goto error; } @@ -7149,34 +7149,34 @@ qemuParseCommandLineUSB(const char *val) goto error; if (!STRPREFIX(val, "host:")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown USB device syntax '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown USB device syntax '%s'"), val); goto error; } start = val + strlen("host:"); if (strchr(start, ':')) { if (virStrToLong_i(start, &end, 16, &first) < 0 || *end != ':') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device vendor '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract USB device vendor '%s'"), val); goto error; } start = end + 1; if (virStrToLong_i(start, NULL, 16, &second) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device product '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract USB device product '%s'"), val); goto error; } } else { if (virStrToLong_i(start, &end, 10, &first) < 0 || *end != '.') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device bus '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract USB device bus '%s'"), val); goto error; } start = end + 1; if (virStrToLong_i(start, NULL, 10, &second) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device address '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot extract USB device address '%s'"), val); goto error; } } @@ -7280,8 +7280,8 @@ qemuParseCommandLineChr(virDomainChrSourceDefPtr source, } svc = strchr(val, ':'); if (!svc) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find port number in character device %s"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find port number in character device %s"), val); goto error; } opt = strchr(svc, ','); @@ -7320,8 +7320,8 @@ qemuParseCommandLineChr(virDomainChrSourceDefPtr source, if (!source->data.file.path) goto no_memory; } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown character device syntax %s"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown character device syntax %s"), val); goto error; } @@ -7432,8 +7432,8 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, if (dom->clock.timers[i]->present != -1 && dom->clock.timers[i]->present != present) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("conflicting occurrences of kvmclock feature")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("conflicting occurrences of kvmclock feature")); goto error; } dom->clock.timers[i]->present = present; @@ -7482,8 +7482,8 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, return 0; syntax: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown CPU syntax '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown CPU syntax '%s'"), val); goto error; no_memory: @@ -7561,8 +7561,8 @@ cleanup: return ret; syntax: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse CPU topology '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse CPU topology '%s'"), val); error: ret = -1; goto cleanup; @@ -7602,8 +7602,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, *monJSON = false; if (!progargv[0]) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no emulator path found")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no emulator path found")); return NULL; } @@ -7615,8 +7615,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, goto no_memory; if (virUUIDGenerate(def->uuid) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to generate uuid")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to generate uuid")); goto error; } @@ -7668,8 +7668,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, #define WANT_VALUE() \ const char *val = progargv[++i]; \ if (!val) { \ - qemuReportError(VIR_ERR_INTERNAL_ERROR, \ - _("missing value for %s argument"), arg); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("missing value for %s argument"), arg); \ goto error; \ } @@ -7728,15 +7728,15 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, tmp = strstr(val, sep); if (!tmp) { virDomainGraphicsDefFree(vnc); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("missing VNC port number in '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing VNC port number in '%s'"), val); goto error; } if (virStrToLong_i(tmp+strlen(sep), &opts, 10, &vnc->data.vnc.port) < 0) { virDomainGraphicsDefFree(vnc); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse VNC port '%s'"), tmp+1); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse VNC port '%s'"), tmp+1); goto error; } if (val[0] == '[') @@ -7762,8 +7762,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, int mem; WANT_VALUE(); if (virStrToLong_i(val, NULL, 10, &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, \ - _("cannot parse memory level '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("cannot parse memory level '%s'"), val); goto error; } def->mem.cur_balloon = def->mem.max_balloon = mem * 1024; @@ -7774,8 +7774,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, } else if (STREQ(arg, "-uuid")) { WANT_VALUE(); if (virUUIDParse(val, def->uuid) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, \ - _("cannot parse UUID '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("cannot parse UUID '%s'"), val); goto error; } } else if (STRPREFIX(arg, "-hd") || @@ -7835,8 +7835,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, host = disk->src; port = strchr(host, ':'); if (!port) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse nbd filename '%s'"), disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse nbd filename '%s'"), disk->src); goto error; } *port++ = '\0'; @@ -7864,8 +7864,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, *port++ = '\0'; vdi = strchr(port, ':'); if (!vdi) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sheepdog filename '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse sheepdog filename '%s'"), val); goto error; } *vdi++ = '\0'; @@ -8144,8 +8144,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, if (STRNEQ(val, "none")) { video = qemuVideoTypeFromString(val); if (video < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown video adapter type '%s'"), val); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown video adapter type '%s'"), val); goto error; } } @@ -8217,15 +8217,15 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, } if (!first_rbd_disk) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("CEPH_ARGS was set without an rbd disk")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("CEPH_ARGS was set without an rbd disk")); goto error; } /* CEPH_ARGS should be: -m host1[:port1][,host2[:port2]]... */ if (!STRPREFIX(ceph_args, "-m ")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("could not parse CEPH_ARGS '%s'"), ceph_args); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not parse CEPH_ARGS '%s'"), ceph_args); goto error; } hosts = strdup(strchr(ceph_args, ' ') + 1); @@ -8259,8 +8259,8 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps, VIR_FREE(hosts); if (first_rbd_disk->nhosts == 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("found no rbd hosts in CEPH_ARGS '%s'"), ceph_args); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("found no rbd hosts in CEPH_ARGS '%s'"), ceph_args); goto error; } } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 88a04bc..7735ffe 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -140,9 +140,9 @@ int qemudLoadDriverConfig(struct qemud_driver *driver, #define CHECK_TYPE(name,typ) if (p && p->type != (typ)) { \ - qemuReportError(VIR_ERR_INTERNAL_ERROR, \ - "%s: %s: expected type " #typ, \ - filename, (name)); \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + "%s: %s: expected type " #typ, \ + filename, (name)); \ virConfFree(conf); \ return -1; \ } @@ -535,16 +535,16 @@ qemuDriverCloseCallbackSet(struct qemud_driver *driver, closeDef = virHashLookup(driver->closeCallbacks, uuidstr); if (closeDef) { if (closeDef->conn != conn) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Close callback for domain %s already registered" - " with another connection %p"), - vm->def->name, closeDef->conn); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Close callback for domain %s already registered" + " with another connection %p"), + vm->def->name, closeDef->conn); return -1; } if (closeDef->cb && closeDef->cb != cb) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Another close callback is already defined for" - " domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Another close callback is already defined for" + " domain %s"), vm->def->name); return -1; } @@ -582,9 +582,9 @@ qemuDriverCloseCallbackUnset(struct qemud_driver *driver, return -1; if (closeDef->cb && closeDef->cb != cb) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Trying to remove mismatching close callback for" - " domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Trying to remove mismatching close callback for" + " domain %s"), vm->def->name); return -1; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 482e6d3..4234807 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -167,10 +167,6 @@ struct _qemuDomainCmdlineDef { # define QEMUD_MIGRATION_FIRST_PORT 49152 # define QEMUD_MIGRATION_NUM_PORTS 64 -# define qemuReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_QEMU, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - void qemuDriverLock(struct qemud_driver *driver); void qemuDriverUnlock(struct qemud_driver *driver); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 201ec03..42875b4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -344,8 +344,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) if (!(monitorpath = virXPathString("string(./monitor[1]/@path)", ctxt))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no monitor path")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no monitor path")); goto error; } @@ -371,9 +371,9 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) break; default: VIR_FREE(monitorpath); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported monitor type '%s'"), - virDomainChrTypeToString(priv->monConfig->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported monitor type '%s'"), + virDomainChrTypeToString(priv->monConfig->type)); goto error; } @@ -402,8 +402,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) } if ((n = virXPathNodeSet("./qemuCaps/flag", ctxt, &nodes)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("failed to parse qemu capabilities flags")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("failed to parse qemu capabilities flags")); goto error; } if (n > 0) { @@ -415,8 +415,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) if (str) { int flag = qemuCapsTypeFromString(str); if (flag < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown qemu capabilities flag %s"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown qemu capabilities flag %s"), str); VIR_FREE(str); goto error; } @@ -435,8 +435,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) int type; if ((type = qemuDomainJobTypeFromString(tmp)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown job type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown job type %s"), tmp); VIR_FREE(tmp); goto error; } @@ -448,8 +448,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) int async; if ((async = qemuDomainAsyncJobTypeFromString(tmp)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown async job type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown async job type %s"), tmp); VIR_FREE(tmp); goto error; } @@ -459,8 +459,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data) if ((tmp = virXPathString("string(./job[1]/@phase)", ctxt))) { priv->job.phase = qemuDomainAsyncJobPhaseFromString(async, tmp); if (priv->job.phase < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown job phase %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown job phase %s"), tmp); VIR_FREE(tmp); goto error; } @@ -514,9 +514,9 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED, int n, i; if (xmlXPathRegisterNs(ctxt, BAD_CAST "qemu", BAD_CAST QEMU_NAMESPACE_HREF) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to register xml namespace '%s'"), - QEMU_NAMESPACE_HREF); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to register xml namespace '%s'"), + QEMU_NAMESPACE_HREF); return -1; } @@ -537,8 +537,8 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED, for (i = 0; i < n; i++) { cmd->args[cmd->num_args] = virXMLPropString(nodes[i], "value"); if (cmd->args[cmd->num_args] == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No qemu command-line argument specified")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("No qemu command-line argument specified")); goto error; } cmd->num_args++; @@ -563,23 +563,23 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED, tmp = virXMLPropString(nodes[i], "name"); if (tmp == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No qemu environment name specified")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("No qemu environment name specified")); goto error; } if (tmp[0] == '\0') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Empty qemu environment name specified")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Empty qemu environment name specified")); goto error; } if (!c_isalpha(tmp[0]) && tmp[0] != '_') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid environment name, it must begin with a letter or underscore")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid environment name, it must begin with a letter or underscore")); goto error; } if (strspn(tmp, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_") != strlen(tmp)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid environment name, it must contain only alphanumerics and underscore")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Invalid environment name, it must contain only alphanumerics and underscore")); goto error; } @@ -838,13 +838,13 @@ error: priv->job.owner, priv->job.asyncOwner); if (errno == ETIMEDOUT) - qemuReportError(VIR_ERR_OPERATION_TIMEOUT, - "%s", _("cannot acquire state change lock")); + virReportError(VIR_ERR_OPERATION_TIMEOUT, + "%s", _("cannot acquire state change lock")); else if (driver->max_queued && priv->jobs_queued > driver->max_queued) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot acquire state change lock " - "due to max_queued limit")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot acquire state change lock " + "due to max_queued limit")); else virReportSystemError(errno, "%s", _("cannot acquire job mutex")); @@ -899,8 +899,8 @@ int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver, enum qemuDomainJob job) { if (job <= QEMU_JOB_NONE || job >= QEMU_JOB_ASYNC) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Attempt to start invalid job")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Attempt to start invalid job")); return -1; } @@ -971,8 +971,8 @@ qemuDomainObjEnterMonitorInternal(struct qemud_driver *driver, if (asyncJob != QEMU_ASYNC_JOB_NONE) { if (asyncJob != priv->job.asyncJob) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected async job %d"), asyncJob); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected async job %d"), asyncJob); return -1; } if (priv->job.asyncOwner != virThreadSelfID()) @@ -983,8 +983,8 @@ qemuDomainObjEnterMonitorInternal(struct qemud_driver *driver, QEMU_ASYNC_JOB_NONE) < 0) return -1; if (!virDomainObjIsActive(obj)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("domain is no longer running")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("domain is no longer running")); /* Still referenced by the containing async job. */ ignore_value(qemuDomainObjEndJob(driver, obj)); return -1; @@ -1241,8 +1241,8 @@ qemuDomainDefFormatBuf(struct qemud_driver *driver, def_cpu && (def_cpu->mode != VIR_CPU_MODE_CUSTOM || def_cpu->model)) { if (!driver->caps || !driver->caps->host.cpu) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot get host CPU capabilities")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot get host CPU capabilities")); goto cleanup; } @@ -1575,8 +1575,8 @@ qemuFindQemuImgBinary(struct qemud_driver *driver) if (!driver->qemuImgBinary) driver->qemuImgBinary = virFindFileInPath("qemu-img"); if (!driver->qemuImgBinary) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("unable to find kvm-img or qemu-img")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("unable to find kvm-img or qemu-img")); } return driver->qemuImgBinary; @@ -1672,10 +1672,10 @@ qemuDomainSnapshotForEachQcow2Raw(struct qemud_driver *driver, qemuDomainSnapshotForEachQcow2Raw(driver, def, name, "-d", false, i); } - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Disk device '%s' does not support" - " snapshotting"), - def->disks[i]->dst); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Disk device '%s' does not support" + " snapshotting"), + def->disks[i]->dst); return -1; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d3988b8..e65f694 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -283,8 +283,8 @@ qemuCreateCapabilities(virCapsPtr oldcaps, qemuDomainSetNamespaceHooks(caps); if (virGetHostUUID(caps->host.host_uuid)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot get the host uuid")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot get the host uuid")); goto err_exit; } @@ -930,33 +930,33 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; if (qemu_driver == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("qemu state driver is not active")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("qemu state driver is not active")); return VIR_DRV_OPEN_ERROR; } if (conn->uri->path == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("no QEMU URI path given, try %s"), - qemu_driver->privileged - ? "qemu:///system" - : "qemu:///session"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no QEMU URI path given, try %s"), + qemu_driver->privileged + ? "qemu:///system" + : "qemu:///session"); return VIR_DRV_OPEN_ERROR; } if (qemu_driver->privileged) { if (STRNEQ (conn->uri->path, "/system") && STRNEQ (conn->uri->path, "/session")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected QEMU URI path '%s', try qemu:///system"), - conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected QEMU URI path '%s', try qemu:///system"), + conn->uri->path); return VIR_DRV_OPEN_ERROR; } } else { if (STRNEQ (conn->uri->path, "/session")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected QEMU URI path '%s', try qemu:///session"), - conn->uri->path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected QEMU URI path '%s', try qemu:///session"), + conn->uri->path); return VIR_DRV_OPEN_ERROR; } } @@ -1048,8 +1048,8 @@ qemuGetSysinfo(virConnectPtr conn, unsigned int flags) virCheckFlags(0, NULL); if (!driver->hostsysinfo) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Host SMBIOS information is not available")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Host SMBIOS information is not available")); return NULL; } @@ -1075,8 +1075,8 @@ static int qemudGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED, const char *typ if (STRCASEEQ(type, "kqemu")) return 1; - qemuReportError(VIR_ERR_INVALID_ARG, - _("unknown type '%s'"), type); + virReportError(VIR_ERR_INVALID_ARG, + _("unknown type '%s'"), type); return -1; } @@ -1194,8 +1194,8 @@ static virDomainPtr qemudDomainLookupByID(virConnectPtr conn, qemuDriverUnlock(driver); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), id); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), id); goto cleanup; } @@ -1221,8 +1221,8 @@ static virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1246,8 +1246,8 @@ static virDomainPtr qemudDomainLookupByName(virConnectPtr conn, qemuDriverUnlock(driver); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching name '%s'"), name); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching name '%s'"), name); goto cleanup; } @@ -1273,8 +1273,8 @@ static int qemuDomainIsActive(virDomainPtr dom) if (!obj) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } ret = virDomainObjIsActive(obj); @@ -1297,8 +1297,8 @@ static int qemuDomainIsPersistent(virDomainPtr dom) if (!obj) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } ret = obj->persistent; @@ -1321,8 +1321,8 @@ static int qemuDomainIsUpdated(virDomainPtr dom) if (!obj) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } ret = obj->updated; @@ -1478,13 +1478,13 @@ static int qemudDomainSuspend(virDomainPtr dom) { if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -1502,8 +1502,8 @@ static int qemudDomainSuspend(virDomainPtr dom) { goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) { @@ -1545,8 +1545,8 @@ static int qemudDomainResume(virDomainPtr dom) { if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1554,8 +1554,8 @@ static int qemudDomainResume(virDomainPtr dom) { goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { @@ -1563,8 +1563,8 @@ static int qemudDomainResume(virDomainPtr dom) { VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("resume operation failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("resume operation failed")); goto endjob; } event = virDomainEventNewFromObj(vm, @@ -1605,8 +1605,8 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) { if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1619,13 +1619,13 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) { if (useAgent) { if (priv->agentError) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("QEMU guest agent is not available due to an error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("QEMU guest agent is not available due to an error")); goto cleanup; } if (!priv->agent) { - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU guest agent is not configured")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU guest agent is not configured")); goto cleanup; } } @@ -1634,8 +1634,8 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags) { goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -1686,8 +1686,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1700,27 +1700,27 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) if (useAgent) { if (priv->agentError) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("QEMU guest agent is not available due to an error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("QEMU guest agent is not available due to an error")); goto cleanup; } if (!priv->agent) { - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU guest agent is not configured")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU guest agent is not configured")); goto cleanup; } } else { #if HAVE_YAJL if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) { if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Reboot is not supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Reboot is not supported with this QEMU binary")); goto cleanup; } } else { #endif - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("Reboot is not supported without the JSON monitor")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Reboot is not supported without the JSON monitor")); goto cleanup; #if HAVE_YAJL } @@ -1731,8 +1731,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags) goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -1777,8 +1777,8 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1786,8 +1786,8 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -1839,8 +1839,8 @@ qemuDomainDestroyFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1855,8 +1855,8 @@ qemuDomainDestroyFlags(virDomainPtr dom, */ if (flags & VIR_DOMAIN_DESTROY_GRACEFUL) { if (qemuProcessKill(driver, vm, 0) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("failed to kill qemu process with SIGTERM")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("failed to kill qemu process with SIGTERM")); goto cleanup; } } else { @@ -1874,8 +1874,8 @@ qemuDomainDestroyFlags(virDomainPtr dom, priv->beingDestroyed = false; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -1923,8 +1923,8 @@ static char *qemudDomainGetOSType(virDomainPtr dom) { if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1952,8 +1952,8 @@ qemuDomainGetMaxMemory(virDomainPtr dom) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1983,8 +1983,8 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -1999,9 +1999,9 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, /* resize the maximum memory */ if (flags & VIR_DOMAIN_AFFECT_LIVE) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot resize the maximum memory on an " - "active domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot resize the maximum memory on an " + "active domain")); goto endjob; } @@ -2019,8 +2019,8 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, /* resize the current memory */ if (newmem > vm->def->mem.max_balloon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("cannot set memory higher than max memory")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("cannot set memory higher than max memory")); goto endjob; } @@ -2036,9 +2036,9 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, /* Lack of balloon support is a fatal error */ if (r == 0) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("Unable to change memory of active domain without " - "the balloon device and guest OS balloon driver")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Unable to change memory of active domain without " + "the balloon device and guest OS balloon driver")); goto endjob; } } @@ -2086,14 +2086,14 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -2103,8 +2103,8 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -2148,10 +2148,10 @@ static int qemuDomainSendKey(virDomainPtr domain, keycode = virKeycodeValueTranslate(codeset, VIR_KEYCODE_SET_RFB, keycodes[i]); if (keycode < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot translate keycode %u of %s codeset to rfb keycode"), - keycodes[i], - virKeycodeSetTypeToString(codeset)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot translate keycode %u of %s codeset to rfb keycode"), + keycodes[i], + virKeycodeSetTypeToString(codeset)); return -1; } keycodes[i] = keycode; @@ -2163,8 +2163,8 @@ static int qemuDomainSendKey(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2174,8 +2174,8 @@ static int qemuDomainSendKey(virDomainPtr domain, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -2209,8 +2209,8 @@ static int qemudDomainGetInfo(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2220,8 +2220,8 @@ static int qemudDomainGetInfo(virDomainPtr dom, info->cpuTime = 0; } else { if (qemudGetProcessInfo(&(info->cpuTime), NULL, NULL, vm->pid, 0) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("cannot read cputime for domain")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("cannot read cputime for domain")); goto cleanup; } } @@ -2298,8 +2298,8 @@ qemuDomainGetState(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2331,14 +2331,14 @@ qemuDomainGetControlInfo(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -2431,16 +2431,16 @@ qemuDomainSaveHeader(int fd, const char *path, char *xml, if (safewrite(fd, header, sizeof(*header)) != sizeof(*header)) { ret = -errno; - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to write header to domain save file '%s'"), - path); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to write header to domain save file '%s'"), + path); goto endjob; } if (safewrite(fd, xml, header->xml_len) != header->xml_len) { ret = -errno; - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to write xml to '%s'"), path); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to write xml to '%s'"), path); goto endjob; } endjob: @@ -2599,8 +2599,8 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom, unsigned int wrapperFlags = VIR_FILE_WRAPPER_NON_BLOCKING; if (qemuProcessAutoDestroyActive(driver, vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is marked for auto destroy")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is marked for auto destroy")); goto cleanup; } @@ -2627,8 +2627,8 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom, goto endjob; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } } @@ -2659,8 +2659,8 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom, xml = qemuDomainDefFormatLive(driver, vm->def, true, true); } if (!xml) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to get domain xml")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to get domain xml")); goto endjob; } len = strlen(xml) + 1; @@ -2689,8 +2689,8 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom, wrapperFlags |= VIR_FILE_WRAPPER_BYPASS_CACHE; directFlag = virFileDirectFdFlag(); if (directFlag < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("bypass cache unsupported by this system")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("bypass cache unsupported by this system")); goto cleanup; } } @@ -2818,15 +2818,15 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml, else { compressed = qemudSaveCompressionTypeFromString(driver->saveImageFormat); if (compressed < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("Invalid save image format specified " - "in configuration file")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("Invalid save image format specified " + "in configuration file")); goto cleanup; } if (!qemudCompressProgramAvailable(compressed)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("Compression program for image format " - "in configuration file isn't available")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("Compression program for image format " + "in configuration file isn't available")); goto cleanup; } } @@ -2835,14 +2835,14 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -2894,19 +2894,19 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } if (!vm->persistent) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot do managed save for transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot do managed save for transient domain")); goto cleanup; } @@ -2967,8 +2967,8 @@ qemuDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -2996,8 +2996,8 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3023,8 +3023,8 @@ static int qemuDumpToFd(struct qemud_driver *driver, virDomainObjPtr vm, int ret = -1; if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY)) { - qemuReportError(VIR_ERR_NO_SUPPORT, "%s", - _("dump-guest-memory is not supported")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("dump-guest-memory is not supported")); return -1; } @@ -3061,8 +3061,8 @@ doCoreDump(struct qemud_driver *driver, flags |= VIR_FILE_WRAPPER_BYPASS_CACHE; directFlag = virFileDirectFdFlag(); if (directFlag < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("bypass cache unsupported by this system")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("bypass cache unsupported by this system")); goto cleanup; } } @@ -3157,8 +3157,8 @@ static int qemudDomainCoreDump(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3167,8 +3167,8 @@ static int qemudDomainCoreDump(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -3185,8 +3185,8 @@ static int qemudDomainCoreDump(virDomainPtr dom, paused = 1; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } } @@ -3222,8 +3222,8 @@ endjob: VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_DUMP) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("resuming after dump failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("resuming after dump failed")); } } @@ -3266,8 +3266,8 @@ qemuDomainScreenshot(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3277,17 +3277,17 @@ qemuDomainScreenshot(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } /* Well, even if qemu allows multiple graphic cards, heads, whatever, * screenshot command does not */ if (screen) { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("currently is supported only taking " - "screenshots of screen ID 0")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("currently is supported only taking " + "screenshots of screen ID 0")); goto endjob; } @@ -3317,8 +3317,8 @@ qemuDomainScreenshot(virDomainPtr dom, } if (virFDStreamOpenFile(st, tmp, 0, 0, O_RDONLY) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to open stream")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to open stream")); goto endjob; } @@ -3369,8 +3369,8 @@ static void processWatchdogEvent(void *data, void *opaque) } if (!virDomainObjIsActive(wdEvent->vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); VIR_FREE(dumpfile); goto endjob; } @@ -3379,16 +3379,16 @@ static void processWatchdogEvent(void *data, void *opaque) ret = doCoreDump(driver, wdEvent->vm, dumpfile, getCompressionType(driver), flags); if (ret < 0) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("Dump failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("Dump failed")); ret = qemuProcessStartCPUs(driver, wdEvent->vm, NULL, VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_DUMP); if (ret < 0) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("Resuming after dump failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("Resuming after dump failed")); VIR_FREE(dumpfile); } @@ -3466,10 +3466,10 @@ static int qemudDomainHotplugVcpus(struct qemud_driver *driver, } if (ncpupids != vcpus) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("got wrong number of vCPU pids from QEMU monitor. " - "got %d, wanted %d"), - ncpupids, vcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("got wrong number of vCPU pids from QEMU monitor. " + "got %d, wanted %d"), + ncpupids, vcpus); ret = -1; goto cleanup; } @@ -3487,8 +3487,8 @@ cleanup: return ret; unsupported: - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change vcpu count of this domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change vcpu count of this domain")); goto cleanup; } @@ -3510,8 +3510,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, VIR_DOMAIN_VCPU_MAXIMUM, -1); if (!nvcpus || (unsigned short) nvcpus != nvcpus) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("argument out of range: %d"), nvcpus); + virReportError(VIR_ERR_INVALID_ARG, + _("argument out of range: %d"), nvcpus); return -1; } @@ -3522,8 +3522,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3539,21 +3539,21 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, /* MAXIMUM cannot be mixed with LIVE. */ if (maximum && (flags & VIR_DOMAIN_AFFECT_LIVE)) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("cannot adjust maximum on running domain")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("cannot adjust maximum on running domain")); goto endjob; } if (!(type = virDomainVirtTypeToString(vm->def->virtType))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown virt type in domain definition '%d'"), - vm->def->virtType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown virt type in domain definition '%d'"), + vm->def->virtType); goto endjob; } if ((max = qemudGetMaxVCPUs(NULL, type)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not determine max vcpus for the domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not determine max vcpus for the domain")); goto endjob; } @@ -3562,9 +3562,9 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, } if (nvcpus > max) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("requested vcpus is greater than max allowable" - " vcpus for the domain: %d > %d"), nvcpus, max); + virReportError(VIR_ERR_INVALID_ARG, + _("requested vcpus is greater than max allowable" + " vcpus for the domain: %d > %d"), nvcpus, max); goto endjob; } @@ -3632,8 +3632,8 @@ qemudDomainPinVcpuFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3644,9 +3644,9 @@ qemudDomainPinVcpuFlags(virDomainPtr dom, priv = vm->privateData; if (vcpu > (priv->nvcpupids-1)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("vcpu number out of range %d > %d"), - vcpu, priv->nvcpupids); + virReportError(VIR_ERR_INVALID_ARG, + _("vcpu number out of range %d > %d"), + vcpu, priv->nvcpupids); goto cleanup; } @@ -3673,23 +3673,23 @@ qemudDomainPinVcpuFlags(virDomainPtr dom, cpumap, maplen, maxcpu) < 0) goto cleanup; } else { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cpu affinity is not supported")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cpu affinity is not supported")); goto cleanup; } if (canResetting) { if (virDomainVcpuPinDel(vm->def, vcpu) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to delete vcpupin xml of " - "a running domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to delete vcpupin xml of " + "a running domain")); goto cleanup; } } else { if (virDomainVcpuPinAdd(vm->def, cpumap, maplen, vcpu) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to update or add vcpupin xml of " - "a running domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to update or add vcpupin xml of " + "a running domain")); goto cleanup; } } @@ -3702,16 +3702,16 @@ qemudDomainPinVcpuFlags(virDomainPtr dom, if (canResetting) { if (virDomainVcpuPinDel(persistentDef, vcpu) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to delete vcpupin xml of " - "a persistent domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to delete vcpupin xml of " + "a persistent domain")); goto cleanup; } } else { if (virDomainVcpuPinAdd(persistentDef, cpumap, maplen, vcpu) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to update or add vcpupin xml of " - "a persistent domain")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to update or add vcpupin xml of " + "a persistent domain")); goto cleanup; } } @@ -3765,8 +3765,8 @@ qemudDomainGetVcpuPinInfo(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3844,15 +3844,15 @@ qemudDomainGetVcpus(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", - _("cannot list vcpu pinning for an inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", + _("cannot list vcpu pinning for an inactive domain")); goto cleanup; } @@ -3901,8 +3901,8 @@ qemudDomainGetVcpus(virDomainPtr dom, goto cleanup; } } else { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cpu affinity is not available")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cpu affinity is not available")); goto cleanup; } } @@ -3935,8 +3935,8 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -3976,15 +3976,15 @@ static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr sec if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainVirtTypeToString(vm->def->virtType)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown virt type in domain definition '%d'"), - vm->def->virtType); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown virt type in domain definition '%d'"), + vm->def->virtType); goto cleanup; } @@ -4005,8 +4005,8 @@ static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr sec if (virDomainObjIsActive(vm)) { if (virSecurityManagerGetProcessLabel(driver->securityManager, vm->def, vm->pid, seclabel) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to get security label")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to get security label")); goto cleanup; } } @@ -4037,9 +4037,9 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn, p = driver->caps->host.secModel.model; if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("security model string exceeds max %d bytes"), - VIR_SECURITY_MODEL_BUFLEN-1); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security model string exceeds max %d bytes"), + VIR_SECURITY_MODEL_BUFLEN-1); ret = -1; goto cleanup; } @@ -4047,9 +4047,9 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn, p = driver->caps->host.secModel.doi; if (strlen(p) >= VIR_SECURITY_DOI_BUFLEN-1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("security DOI string exceeds max %d bytes"), - VIR_SECURITY_DOI_BUFLEN-1); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security DOI string exceeds max %d bytes"), + VIR_SECURITY_DOI_BUFLEN-1); ret = -1; goto cleanup; } @@ -4083,8 +4083,8 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver, if (bypass_cache) { int directFlag = virFileDirectFdFlag(); if (directFlag < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("bypass cache unsupported by this system")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("bypass cache unsupported by this system")); goto error; } oflags |= directFlag; @@ -4107,8 +4107,8 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver, } return -3; } - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to read qemu header")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to read qemu header")); goto error; } @@ -4128,7 +4128,7 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver, return -3; } } - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", msg); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", msg); goto error; } @@ -4138,15 +4138,15 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver, } if (header.version > QEMUD_SAVE_VERSION) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("image version is not supported (%d > %d)"), - header.version, QEMUD_SAVE_VERSION); + virReportError(VIR_ERR_OPERATION_FAILED, + _("image version is not supported (%d > %d)"), + header.version, QEMUD_SAVE_VERSION); goto error; } if (header.xml_len <= 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("invalid XML length: %d"), header.xml_len); + virReportError(VIR_ERR_OPERATION_FAILED, + _("invalid XML length: %d"), header.xml_len); goto error; } @@ -4156,8 +4156,8 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver, } if (saferead(fd, xml, header.xml_len) != header.xml_len) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to read XML")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to read XML")); goto error; } @@ -4225,9 +4225,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, if (header->version == 2) { const char *prog = qemudSaveCompressionTypeToString(header->compressed); if (prog == NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Invalid compressed save format %d"), - header->compressed); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Invalid compressed save format %d"), + header->compressed); goto out; } @@ -4240,9 +4240,9 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, virCommandSetOutputFD(cmd, fd); if (virCommandRunAsync(cmd, NULL) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to start decompression binary %s"), - prog); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to start decompression binary %s"), + prog); *fd = intermediatefd; goto out; } @@ -4293,8 +4293,8 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, VIR_DOMAIN_RUNNING_RESTORED, QEMU_ASYNC_JOB_NONE) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to resume domain")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to resume domain")); goto out; } if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) { @@ -4469,8 +4469,8 @@ qemuDomainSaveImageDefineXML(virConnectPtr conn, const char *path, len = strlen(xml) + 1; if (len > header.xml_len) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("new xml too large to fit in file")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("new xml too large to fit in file")); goto cleanup; } if (VIR_EXPAND_N(xml, len, header.xml_len - len) < 0) { @@ -4530,11 +4530,11 @@ qemuDomainObjRestore(virConnectPtr conn, char def_uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(vm->def->uuid, vm_uuidstr); virUUIDFormat(def->uuid, def_uuidstr); - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot restore domain '%s' uuid %s from a file" - " which belongs to domain '%s' uuid %s"), - vm->def->name, vm_uuidstr, - def->name, def_uuidstr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot restore domain '%s' uuid %s from a file" + " which belongs to domain '%s' uuid %s"), + vm->def->name, vm_uuidstr, + def->name, def_uuidstr); goto cleanup; } @@ -4572,8 +4572,8 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -4591,8 +4591,8 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -4635,8 +4635,8 @@ static char *qemuDomainXMLFromNative(virConnectPtr conn, virCheckFlags(0, NULL); if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), format); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported config type %s"), format); goto cleanup; } @@ -4679,8 +4679,8 @@ static char *qemuDomainXMLToNative(virConnectPtr conn, qemuDriverLock(driver); if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), format); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported config type %s"), format); goto cleanup; } @@ -4910,8 +4910,8 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags) if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -4919,8 +4919,8 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags) goto cleanup; if (virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is already running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is already running")); goto endjob; } @@ -5135,24 +5135,24 @@ qemuDomainUndefineFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!vm->persistent) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot undefine transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot undefine transient domain")); goto cleanup; } if (!virDomainObjIsActive(vm) && (nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots, NULL, 0))) { if (!(flags & VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("cannot delete inactive domain with %d " - "snapshots"), - nsnapshots); + virReportError(VIR_ERR_OPERATION_INVALID, + _("cannot delete inactive domain with %d " + "snapshots"), + nsnapshots); goto cleanup; } if (qemuDomainSnapshotDiscardAllMetadata(driver, vm) < 0) @@ -5166,15 +5166,15 @@ qemuDomainUndefineFlags(virDomainPtr dom, if (virFileExists(name)) { if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) { if (unlink(name) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to remove domain managed " - "save image")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to remove domain managed " + "save image")); goto cleanup; } } else { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("Refusing to undefine while domain managed " - "save image exists")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Refusing to undefine while domain managed " + "save image exists")); goto cleanup; } } @@ -5228,17 +5228,17 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn, int ret = -1; if (disk->driverName != NULL && !STREQ(disk->driverName, "qemu")) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported driver name '%s' for disk '%s'"), - disk->driverName, disk->src); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported driver name '%s' for disk '%s'"), + disk->driverName, disk->src); goto end; } if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto end; } if (qemuSetupDiskCgroup(driver, vm, cgroup, disk) < 0) @@ -5253,8 +5253,8 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn, case VIR_DOMAIN_DISK_DEVICE_LUN: if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) { if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device='lun' is not supported for usb bus")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device='lun' is not supported for usb bus")); break; } ret = qemuDomainAttachUsbMassstorageDevice(conn, driver, vm, @@ -5264,15 +5264,15 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn, } else if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { ret = qemuDomainAttachSCSIDisk(conn, driver, vm, disk); } else { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk bus '%s' cannot be hotplugged."), - virDomainDiskBusTypeToString(disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk bus '%s' cannot be hotplugged."), + virDomainDiskBusTypeToString(disk->bus)); } break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device type '%s' cannot be hotplugged"), - virDomainDiskDeviceTypeToString(disk->device)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device type '%s' cannot be hotplugged"), + virDomainDiskDeviceTypeToString(disk->device)); break; } @@ -5300,9 +5300,9 @@ qemuDomainAttachDeviceControllerLive(struct qemud_driver *driver, ret = qemuDomainAttachPciControllerDevice(driver, vm, cont); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk controller bus '%s' cannot be hotplugged."), - virDomainControllerTypeToString(cont->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk controller bus '%s' cannot be hotplugged."), + virDomainControllerTypeToString(cont->type)); break; } return ret; @@ -5360,9 +5360,9 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot be attached"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot be attached"), + virDomainDeviceTypeToString(dev->type)); break; } @@ -5387,13 +5387,13 @@ qemuDomainDetachDeviceDiskLive(struct qemud_driver *driver, else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) ret = qemuDomainDetachDiskDevice(driver, vm, dev); else - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This type of disk cannot be hot unplugged")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This type of disk cannot be hot unplugged")); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device type '%s' cannot be detached"), - virDomainDiskDeviceTypeToString(disk->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device type '%s' cannot be detached"), + virDomainDiskDeviceTypeToString(disk->type)); break; } return ret; @@ -5412,9 +5412,9 @@ qemuDomainDetachDeviceControllerLive(struct qemud_driver *driver, ret = qemuDomainDetachPciControllerDevice(driver, vm, dev); break; default : - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk controller bus '%s' cannot be hotunplugged."), - virDomainControllerTypeToString(cont->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk controller bus '%s' cannot be hotunplugged."), + virDomainControllerTypeToString(cont->type)); } return ret; } @@ -5444,8 +5444,8 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, ret = qemuDomainDetachHostDevice(driver, vm, dev); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("This type of device cannot be hot unplugged")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("This type of device cannot be hot unplugged")); break; } @@ -5465,9 +5465,9 @@ qemuDomainChangeDiskMediaLive(virDomainObjPtr vm, if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto end; } if (qemuSetupDiskCgroup(driver, vm, cgroup, disk) < 0) @@ -5482,9 +5482,9 @@ qemuDomainChangeDiskMediaLive(virDomainObjPtr vm, dev->data.disk = NULL; break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk bus '%s' cannot be updated."), - virDomainDiskBusTypeToString(disk->bus)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk bus '%s' cannot be updated."), + virDomainDiskBusTypeToString(disk->bus)); break; } @@ -5519,9 +5519,9 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm, ret = qemuDomainChangeNet(driver, vm, dom, dev->data.net); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("device type '%s' cannot be updated"), - virDomainDeviceTypeToString(dev->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("device type '%s' cannot be updated"), + virDomainDeviceTypeToString(dev->type)); break; } @@ -5541,8 +5541,8 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if (virDomainDiskIndexByName(vmdef, disk->dst, true) >= 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("target %s already exists."), disk->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("target %s already exists."), disk->dst); return -1; } if (virDomainDiskInsert(vmdef, disk)) { @@ -5564,8 +5564,8 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, char macbuf[VIR_MAC_STRING_BUFLEN]; virMacAddrFormat(&net->mac, macbuf); - qemuReportError(VIR_ERR_INVALID_ARG, - _("mac %s already exists"), macbuf); + virReportError(VIR_ERR_INVALID_ARG, + _("mac %s already exists"), macbuf); return -1; } if (virDomainNetInsert(vmdef, net)) { @@ -5580,8 +5580,8 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_HOSTDEV: hostdev = dev->data.hostdev; if (virDomainHostdevFind(vmdef, hostdev, NULL) >= 0) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("device is already in the domain configuration")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("device is already in the domain configuration")); return -1; } if (virDomainHostdevInsert(vmdef, hostdev)) { @@ -5596,9 +5596,9 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_LEASE: lease = dev->data.lease; if (virDomainLeaseIndex(vmdef, lease) >= 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Lease %s in lockspace %s already exists"), - lease->key, NULLSTR(lease->lockspace)); + virReportError(VIR_ERR_INVALID_ARG, + _("Lease %s in lockspace %s already exists"), + lease->key, NULLSTR(lease->lockspace)); return -1; } if (virDomainLeaseInsert(vmdef, lease) < 0) @@ -5609,8 +5609,8 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("persistent attach of device is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent attach of device is not supported")); return -1; } return 0; @@ -5630,8 +5630,8 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_DISK: disk = dev->data.disk; if (!(det_disk = virDomainDiskRemoveByName(vmdef, disk->dst))) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("no target device %s"), disk->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("no target device %s"), disk->dst); return -1; } virDomainDiskDefFree(det_disk); @@ -5643,8 +5643,8 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, char macbuf[VIR_MAC_STRING_BUFLEN]; virMacAddrFormat(&net->mac, macbuf); - qemuReportError(VIR_ERR_INVALID_ARG, - _("no nic of mac %s"), macbuf); + virReportError(VIR_ERR_INVALID_ARG, + _("no nic of mac %s"), macbuf); return -1; } virDomainNetDefFree(det_net); @@ -5655,8 +5655,8 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, hostdev = dev->data.hostdev; if ((idx = virDomainHostdevFind(vmdef, hostdev, &det_hostdev)) < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("device not present in domain configuration")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("device not present in domain configuration")); return -1; } virDomainHostdevRemove(vmdef, idx); @@ -5667,17 +5667,17 @@ qemuDomainDetachDeviceConfig(virDomainDefPtr vmdef, case VIR_DOMAIN_DEVICE_LEASE: lease = dev->data.lease; if (!(det_lease = virDomainLeaseRemove(vmdef, lease))) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Lease %s in lockspace %s does not exist"), - lease->key, NULLSTR(lease->lockspace)); + virReportError(VIR_ERR_INVALID_ARG, + _("Lease %s in lockspace %s does not exist"), + lease->key, NULLSTR(lease->lockspace)); return -1; } virDomainLeaseDefFree(det_lease); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("persistent detach of device is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent detach of device is not supported")); return -1; } return 0; @@ -5696,15 +5696,15 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, disk = dev->data.disk; pos = virDomainDiskIndexByName(vmdef, disk->dst, false); if (pos < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("target %s doesn't exist."), disk->dst); + virReportError(VIR_ERR_INVALID_ARG, + _("target %s doesn't exist."), disk->dst); return -1; } orig = vmdef->disks[pos]; if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM) && !(orig->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("this disk doesn't support update")); + virReportError(VIR_ERR_INVALID_ARG, + _("this disk doesn't support update")); return -1; } /* @@ -5734,8 +5734,8 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, char macbuf[VIR_MAC_STRING_BUFLEN]; virMacAddrFormat(&net->mac, macbuf); - qemuReportError(VIR_ERR_INVALID_ARG, - _("mac %s doesn't exist"), macbuf); + virReportError(VIR_ERR_INVALID_ARG, + _("mac %s doesn't exist"), macbuf); return -1; } @@ -5749,8 +5749,8 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("persistent update of device is not supported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent update of device is not supported")); return -1; } return 0; @@ -5788,8 +5788,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -5804,17 +5804,17 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, flags |= VIR_DOMAIN_AFFECT_CONFIG; /* check consistency between flags and the vm state */ if (flags & VIR_DOMAIN_AFFECT_LIVE) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", - _("cannot do live update a device on " - "inactive domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", + _("cannot do live update a device on " + "inactive domain")); goto endjob; } } if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot modify device on transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot modify device on transient domain")); goto endjob; } @@ -5850,8 +5850,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, ret = qemuDomainUpdateDeviceConfig(vmdef, dev); break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown domain modify action %d"), action); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown domain modify action %d"), action); break; } @@ -5871,8 +5871,8 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, ret = qemuDomainUpdateDeviceLive(vm, dev_copy, dom, force); break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown domain modify action %d"), action); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown domain modify action %d"), action); ret = -1; break; } @@ -5959,8 +5959,8 @@ static int qemudDomainGetAutostart(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -5986,14 +5986,14 @@ static int qemudDomainSetAutostart(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!vm->persistent) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot set autostart for transient domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cannot set autostart for transient domain")); goto cleanup; } @@ -6084,8 +6084,8 @@ static char *qemuGetSchedulerType(virDomainPtr dom, qemuDriverLock(driver); if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup CPU controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup CPU controller is not mounted")); goto cleanup; } @@ -6188,8 +6188,8 @@ qemuDomainParseDeviceWeightStr(char *deviceWeightStr, return 0; error: - qemuReportError(VIR_ERR_INVALID_ARG, - _("unable to parse device weight '%s'"), deviceWeightStr); + virReportError(VIR_ERR_INVALID_ARG, + _("unable to parse device weight '%s'"), deviceWeightStr); cleanup: virBlkioDeviceWeightArrayClear(result, ndevices); VIR_FREE(result); @@ -6263,8 +6263,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -6274,15 +6274,15 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("blkio cgroup isn't mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + _("blkio cgroup isn't mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), + vm->def->name); goto cleanup; } } @@ -6295,8 +6295,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { if (params[i].value.ui > 1000 || params[i].value.ui < 100) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("out of blkio weight range.")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("out of blkio weight range.")); ret = -1; continue; } @@ -6351,8 +6351,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { if (params[i].value.ui > 1000 || params[i].value.ui < 100) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("out of blkio weight range.")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("out of blkio weight range.")); ret = -1; continue; } @@ -6417,8 +6417,8 @@ qemuDomainGetBlkioParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -6435,13 +6435,13 @@ qemuDomainGetBlkioParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); goto cleanup; } } @@ -6507,9 +6507,9 @@ qemuDomainGetBlkioParameters(virDomainPtr dom, switch (i) { case 0: /* fill blkio weight here */ if (virStrcpyStatic(param->field, VIR_DOMAIN_BLKIO_WEIGHT) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Field name '%s' too long"), - VIR_DOMAIN_BLKIO_WEIGHT); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Field name '%s' too long"), + VIR_DOMAIN_BLKIO_WEIGHT); goto cleanup; } param->value.ui = persistentDef->blkio.weight; @@ -6547,9 +6547,9 @@ qemuDomainGetBlkioParameters(virDomainPtr dom, param->type = VIR_TYPED_PARAM_STRING; if (virStrcpyStatic(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Field name '%s' too long"), - VIR_DOMAIN_BLKIO_DEVICE_WEIGHT); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Field name '%s' too long"), + VIR_DOMAIN_BLKIO_DEVICE_WEIGHT); goto cleanup; } break; @@ -6605,8 +6605,8 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -6616,14 +6616,14 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup memory controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup memory controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); goto cleanup; } } @@ -6712,8 +6712,8 @@ qemuDomainGetMemoryParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -6723,14 +6723,14 @@ qemuDomainGetMemoryParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup memory controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup memory controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); goto cleanup; } } @@ -6874,8 +6874,8 @@ qemuDomainSetNumaParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -6885,15 +6885,15 @@ qemuDomainSetNumaParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPUSET)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup cpuset controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup cpuset controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), + vm->def->name); goto cleanup; } } @@ -6905,8 +6905,8 @@ qemuDomainSetNumaParameters(virDomainPtr dom, if (STREQ(param->field, VIR_DOMAIN_NUMA_MODE)) { if ((flags & VIR_DOMAIN_AFFECT_LIVE) && vm->def->numatune.memory.mode != params[i].value.i) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("can't change numa mode for running domain")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("can't change numa mode for running domain")); ret = -1; goto cleanup; } @@ -6922,9 +6922,9 @@ qemuDomainSetNumaParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (vm->def->numatune.memory.mode != VIR_DOMAIN_NUMATUNE_MEM_STRICT) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("change of nodeset for running domain " - "requires strict numa mode")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("change of nodeset for running domain " + "requires strict numa mode")); ret = -1; continue; } @@ -7037,8 +7037,8 @@ qemuDomainGetNumaParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -7054,15 +7054,15 @@ qemuDomainGetNumaParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup memory controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup memory controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), + vm->def->name); goto cleanup; } } @@ -7261,8 +7261,8 @@ qemuSetSchedulerParametersFlags(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -7279,14 +7279,14 @@ qemuSetSchedulerParametersFlags(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup CPU controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup CPU controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), + vm->def->name); goto cleanup; } } @@ -7475,8 +7475,8 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -7494,14 +7494,14 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom, } if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup CPU controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup CPU controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); goto cleanup; } @@ -7584,17 +7584,17 @@ qemuDomainBlockResize(virDomainPtr dom, virCheckFlags(VIR_DOMAIN_BLOCK_RESIZE_BYTES, -1); if (path[0] == '\0') { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("empty path")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("empty path")); return -1; } /* We prefer operating on bytes. */ if ((flags & VIR_DOMAIN_BLOCK_RESIZE_BYTES) == 0) { if (size > ULLONG_MAX / 1024) { - qemuReportError(VIR_ERR_OVERFLOW, - _("size must be less than %llu"), - ULLONG_MAX / 1024); + virReportError(VIR_ERR_OVERFLOW, + _("size must be less than %llu"), + ULLONG_MAX / 1024); return -1; } size *= 1024; @@ -7607,8 +7607,8 @@ qemuDomainBlockResize(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain matching uuid '%s'"), uuidstr); goto cleanup; } @@ -7618,14 +7618,14 @@ qemuDomainBlockResize(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } if ((i = virDomainDiskIndexByName(vm->def, path, false)) < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid path: %s"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path: %s"), path); goto endjob; } disk = vm->def->disks[i]; @@ -7677,27 +7677,27 @@ qemuDomainBlockStats(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } if ((i = virDomainDiskIndexByName(vm->def, path, false)) < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid path: %s"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path: %s"), path); goto cleanup; } disk = vm->def->disks[i]; if (!disk->info.alias) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("missing disk device alias name for %s"), disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing disk device alias name for %s"), disk->dst); goto cleanup; } @@ -7706,8 +7706,8 @@ qemuDomainBlockStats(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -7762,29 +7762,29 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } if (*nparams != 0) { if ((i = virDomainDiskIndexByName(vm->def, path, false)) < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid path: %s"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path: %s"), path); goto cleanup; } disk = vm->def->disks[i]; if (!disk->info.alias) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("missing disk device alias name for %s"), - disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing disk device alias name for %s"), + disk->dst); goto cleanup; } } @@ -7796,8 +7796,8 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -7931,14 +7931,14 @@ qemudDomainInterfaceStats (virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -7954,8 +7954,8 @@ qemudDomainInterfaceStats (virDomainPtr dom, if (ret == 0) ret = linuxDomainInterfaceStats(path, stats); else - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid path, '%s' is not a known interface"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path, '%s' is not a known interface"), path); cleanup: if (vm) @@ -7968,8 +7968,8 @@ qemudDomainInterfaceStats (virDomainPtr dom, const char *path ATTRIBUTE_UNUSED, struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("interface stats not implemented on this platform")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("interface stats not implemented on this platform")); return -1; } #endif @@ -8012,8 +8012,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -8024,16 +8024,16 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, if (flags & VIR_DOMAIN_AFFECT_LIVE) { net = virDomainNetFind(vm->def, device); if (!net) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Can't find device %s"), device); + virReportError(VIR_ERR_INVALID_ARG, + _("Can't find device %s"), device); goto cleanup; } } if (flags & VIR_DOMAIN_AFFECT_CONFIG) { persistentNet = virDomainNetFind(persistentDef, device); if (!persistentNet) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Can't find device %s"), device); + virReportError(VIR_ERR_INVALID_ARG, + _("Can't find device %s"), device); goto cleanup; } } @@ -8106,9 +8106,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, } if (virNetDevBandwidthSet(net->ifname, newBandwidth) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot set bandwidth limits on %s"), - device); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot set bandwidth limits on %s"), + device); goto cleanup; } @@ -8175,8 +8175,8 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), dom->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), dom->uuid); goto cleanup; } @@ -8196,8 +8196,8 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom, net = virDomainNetFind(def, device); if (!net) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Can't find device %s"), device); + virReportError(VIR_ERR_INVALID_ARG, + _("Can't find device %s"), device); goto cleanup; } @@ -8289,8 +8289,8 @@ qemudDomainMemoryStats (virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -8298,8 +8298,8 @@ qemudDomainMemoryStats (virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); } else { qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); @@ -8309,8 +8309,8 @@ qemudDomainMemoryStats (virDomainPtr dom, if (ret >= 0 && ret < nr_stats) { long rss; if (qemudGetProcessInfo(NULL, NULL, &rss, vm->pid, 0) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("cannot get RSS for domain")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("cannot get RSS for domain")); } else { stats[ret].tag = VIR_DOMAIN_MEMORY_STAT_RSS; stats[ret].val = rss; @@ -8350,21 +8350,21 @@ qemudDomainBlockPeek (virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!path || path[0] == '\0') { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("NULL or empty path")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("NULL or empty path")); goto cleanup; } /* Check the path belongs to this domain. */ if (!(actual = virDomainDiskPathByName(vm->def, path))) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid path '%s'"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path '%s'"), path); goto cleanup; } path = actual; @@ -8418,14 +8418,14 @@ qemudDomainMemoryPeek (virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL")); goto cleanup; } @@ -8433,8 +8433,8 @@ qemudDomainMemoryPeek (virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -8515,28 +8515,28 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!path || path[0] == '\0') { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("NULL or empty path")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("NULL or empty path")); goto cleanup; } /* Check the path belongs to this domain. */ if ((i = virDomainDiskIndexByName(vm->def, path, false)) < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("invalid path %s not assigned to domain"), path); + virReportError(VIR_ERR_INVALID_ARG, + _("invalid path %s not assigned to domain"), path); goto cleanup; } disk = vm->def->disks[i]; if (!disk->src) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("disk %s does not currently have a source assigned"), - path); + virReportError(VIR_ERR_INVALID_ARG, + _("disk %s does not currently have a source assigned"), + path); goto cleanup; } path = disk->src; @@ -8552,9 +8552,9 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom, /* Probe for magic formats */ if (disk->driverType) { if ((format = virStorageFileFormatTypeFromString(disk->driverType)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown disk format %s for %s"), - disk->driverType, disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown disk format %s for %s"), + disk->driverType, disk->src); goto cleanup; } } else { @@ -8562,9 +8562,9 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom, if ((format = virStorageFileProbeFormat(disk->src)) < 0) goto cleanup; } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("no disk format for %s and probing is disabled"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no disk format for %s and probing is disabled"), + disk->src); goto cleanup; } } @@ -8757,25 +8757,25 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn, qemuDriverLock(driver); if (!dom_xml) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no domain XML passed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no domain XML passed")); goto cleanup; } if (!(flags & VIR_MIGRATE_TUNNELLED)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("PrepareTunnel called but no TUNNELLED flag set")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("PrepareTunnel called but no TUNNELLED flag set")); goto cleanup; } if (st == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("tunnelled migration requested but NULL stream passed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("tunnelled migration requested but NULL stream passed")); goto cleanup; } if (virLockManagerPluginUsesState(driver->lockManager)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot use migrate v2 protocol with lock manager %s"), - virLockManagerPluginGetName(driver->lockManager)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot use migrate v2 protocol with lock manager %s"), + virLockManagerPluginGetName(driver->lockManager)); goto cleanup; } @@ -8813,9 +8813,9 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, qemuDriverLock(driver); if (virLockManagerPluginUsesState(driver->lockManager)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot use migrate v2 protocol with lock manager %s"), - virLockManagerPluginGetName(driver->lockManager)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot use migrate v2 protocol with lock manager %s"), + virLockManagerPluginGetName(driver->lockManager)); goto cleanup; } @@ -8823,14 +8823,14 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, /* this is a logical error; we never should have gotten here with * VIR_MIGRATE_TUNNELLED set */ - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Tunnelled migration requested but invalid RPC method called")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Tunnelled migration requested but invalid RPC method called")); goto cleanup; } if (!dom_xml) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no domain XML passed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no domain XML passed")); goto cleanup; } @@ -8868,9 +8868,9 @@ qemudDomainMigratePerform (virDomainPtr dom, qemuDriverLock(driver); if (virLockManagerPluginUsesState(driver->lockManager)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot use migrate v2 protocol with lock manager %s"), - virLockManagerPluginGetName(driver->lockManager)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot use migrate v2 protocol with lock manager %s"), + virLockManagerPluginGetName(driver->lockManager)); goto cleanup; } @@ -8878,8 +8878,8 @@ qemudDomainMigratePerform (virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -8924,8 +8924,8 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn, qemuDriverLock(driver); vm = virDomainFindByName(&driver->domains, dname); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching name '%s'"), dname); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching name '%s'"), dname); goto cleanup; } @@ -8968,8 +8968,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -8984,8 +8984,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain, } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -9011,8 +9011,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain, goto endjob; if (qemuMigrationJobContinue(vm) == 0) { vm = NULL; - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("domain disappeared")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("domain disappeared")); VIR_FREE(xml); if (cookieout) VIR_FREE(*cookieout); @@ -9063,14 +9063,14 @@ qemuDomainMigratePrepare3(virConnectPtr dconn, /* this is a logical error; we never should have gotten here with * VIR_MIGRATE_TUNNELLED set */ - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Tunnelled migration requested but invalid RPC method called")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Tunnelled migration requested but invalid RPC method called")); goto cleanup; } if (!dom_xml) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no domain XML passed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no domain XML passed")); goto cleanup; } @@ -9104,18 +9104,18 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn, virCheckFlags(QEMU_MIGRATION_FLAGS, -1); if (!dom_xml) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no domain XML passed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no domain XML passed")); goto cleanup; } if (!(flags & VIR_MIGRATE_TUNNELLED)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("PrepareTunnel called but no TUNNELLED flag set")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("PrepareTunnel called but no TUNNELLED flag set")); goto cleanup; } if (st == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("tunnelled migration requested but NULL stream passed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("tunnelled migration requested but NULL stream passed")); goto cleanup; } @@ -9155,8 +9155,8 @@ qemuDomainMigratePerform3(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -9192,8 +9192,8 @@ qemuDomainMigrateFinish3(virConnectPtr dconn, qemuDriverLock(driver); vm = virDomainFindByName(&driver->domains, dname); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching name '%s'"), dname); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching name '%s'"), dname); goto cleanup; } @@ -9226,8 +9226,8 @@ qemuDomainMigrateConfirm3(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -9298,8 +9298,8 @@ qemudNodeDeviceGetPciInfo (virNodeDevicePtr dev, } if (!cap) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("device %s is not a PCI device"), dev->name); + virReportError(VIR_ERR_INVALID_ARG, + _("device %s is not a PCI device"), dev->name); goto out; } @@ -9362,13 +9362,13 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev) const char *other_name = pciDeviceGetUsedBy(other); if (other_name) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("PCI device %s is still in use by domain %s"), - pciDeviceGetName(pci), other_name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("PCI device %s is still in use by domain %s"), + pciDeviceGetName(pci), other_name); else - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("PCI device %s is still in use"), - pciDeviceGetName(pci)); + virReportError(VIR_ERR_OPERATION_INVALID, + _("PCI device %s is still in use"), + pciDeviceGetName(pci)); } pciDeviceReAttachInit(pci); @@ -9426,8 +9426,8 @@ qemuCPUCompare(virConnectPtr conn, qemuDriverLock(driver); if (!driver->caps) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot get host capabilities")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot get host capabilities")); } else if (!driver->caps->host.cpu) { VIR_WARN("cannot get host CPU capabilities"); ret = VIR_CPU_COMPARE_INCOMPATIBLE; @@ -9470,8 +9470,8 @@ static int qemuDomainGetJobInfo(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -9494,8 +9494,8 @@ static int qemuDomainGetJobInfo(virDomainPtr dom, info->type = VIR_DOMAIN_JOB_NONE; } } else { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -9520,8 +9520,8 @@ static int qemuDomainAbortJob(virDomainPtr dom) { if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -9529,21 +9529,21 @@ static int qemuDomainAbortJob(virDomainPtr dom) { goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } priv = vm->privateData; if (!priv->job.asyncJob || priv->job.dump_memory_only) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("no job is active on the domain")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("no job is active on the domain")); goto endjob; } else if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot abort incoming migration;" - " use virDomainDestroy instead")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot abort incoming migration;" + " use virDomainDestroy instead")); goto endjob; } @@ -9582,8 +9582,8 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); return -1; } @@ -9591,16 +9591,16 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } priv = vm->privateData; if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not being migrated")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not being migrated")); goto endjob; } @@ -9638,8 +9638,8 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); return -1; } @@ -9649,8 +9649,8 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -9695,8 +9695,8 @@ qemuDomainMigrateGetMaxSpeed(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -9729,9 +9729,9 @@ qemuDomainSnapshotIsAllowed(virDomainObjPtr vm) if ((disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) || (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK && STRNEQ_NULLABLE(disk->driverType, "qcow2"))) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Disk '%s' does not support snapshotting"), - disk->src); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Disk '%s' does not support snapshotting"), + disk->src); return false; } } @@ -9746,14 +9746,14 @@ qemuDomainSnapshotFSFreeze(struct qemud_driver *driver, int freezed; if (priv->agentError) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("QEMU guest agent is not " - "available due to an error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("QEMU guest agent is not " + "available due to an error")); return -1; } if (!priv->agent) { - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU guest agent is not configured")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU guest agent is not configured")); return -1; } @@ -9774,15 +9774,15 @@ qemuDomainSnapshotFSThaw(struct qemud_driver *driver, if (priv->agentError) { if (report) - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("QEMU guest agent is not " - "available due to an error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("QEMU guest agent is not " + "available due to an error")); return -1; } if (!priv->agent) { if (report) - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU guest agent is not configured")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU guest agent is not configured")); return -1; } @@ -9824,8 +9824,8 @@ qemuDomainSnapshotCreateActive(virConnectPtr conn, return -1; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -9840,8 +9840,8 @@ qemuDomainSnapshotCreateActive(virConnectPtr conn, resume = true; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto cleanup; } } @@ -9874,8 +9874,8 @@ cleanup: VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0 && virGetLastError() == NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("resuming after snapshot failed")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("resuming after snapshot failed")); } endjob: @@ -9904,8 +9904,8 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, qemuDomainObjPrivatePtr priv = vm->privateData; if (allow_reuse && !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("reuse is not supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("reuse is not supported with this QEMU binary")); goto cleanup; } @@ -9915,19 +9915,19 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, switch (disk->snapshot) { case VIR_DOMAIN_DISK_SNAPSHOT_INTERNAL: if (active) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("active qemu domains require external disk " - "snapshots; disk %s requested internal"), - disk->name); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("active qemu domains require external disk " + "snapshots; disk %s requested internal"), + disk->name); goto cleanup; } if (!vm->def->disks[i]->driverType || STRNEQ(vm->def->disks[i]->driverType, "qcow2")) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("internal snapshot for disk %s unsupported " - "for storage type %s"), - disk->name, - NULLSTR(vm->def->disks[i]->driverType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("internal snapshot for disk %s unsupported " + "for storage type %s"), + disk->name, + NULLSTR(vm->def->disks[i]->driverType)); goto cleanup; } found = true; @@ -9941,10 +9941,10 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, } } else if (STRNEQ(disk->driverType, "qcow2") && STRNEQ(disk->driverType, "qed")) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("external snapshot format for disk %s " - "is unsupported: %s"), - disk->name, disk->driverType); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("external snapshot format for disk %s " + "is unsupported: %s"), + disk->name, disk->driverType); goto cleanup; } if (stat(disk->file, &st) < 0) { @@ -9955,10 +9955,10 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, goto cleanup; } } else if (!(S_ISBLK(st.st_mode) || !st.st_size || allow_reuse)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("external snapshot file for disk %s already " - "exists and is not a block device: %s"), - disk->name, disk->file); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("external snapshot file for disk %s already " + "exists and is not a block device: %s"), + disk->name, disk->file); goto cleanup; } found = true; @@ -9970,16 +9970,16 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, case VIR_DOMAIN_DISK_SNAPSHOT_DEFAULT: default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected code path")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected code path")); goto cleanup; } } if (!found) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk snapshots require at least one disk to be " - "selected for snapshot")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk snapshots require at least one disk to be " + "selected for snapshot")); goto cleanup; } if (active) { @@ -9987,9 +9987,9 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def, qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) { *flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC; } else if (atomic && external > 1) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("atomic live snapshot of multiple disks " - "is unsupported")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("atomic live snapshot of multiple disks " + "is unsupported")); goto cleanup; } } @@ -10024,8 +10024,8 @@ qemuDomainSnapshotCreateSingleDiskActive(struct qemud_driver *driver, bool need_unlink = false; if (snap->snapshot != VIR_DOMAIN_DISK_SNAPSHOT_EXTERNAL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unexpected code path")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected code path")); return -1; } @@ -10210,16 +10210,16 @@ qemuDomainSnapshotCreateDiskActive(virConnectPtr conn, return -1; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES) && virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto endjob; } /* 'cgroup' is still NULL if cgroups are disabled. */ @@ -10252,8 +10252,8 @@ qemuDomainSnapshotCreateDiskActive(virConnectPtr conn, resume = true; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto cleanup; } } @@ -10349,8 +10349,8 @@ cleanup: VIR_DOMAIN_RUNNING_UNPAUSED, QEMU_ASYNC_JOB_NONE) < 0 && virGetLastError() == NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("resuming after snapshot failed")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("resuming after snapshot failed")); goto endjob; } } @@ -10409,8 +10409,8 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, if ((flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("quiesce requires disk-only")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("quiesce requires disk-only")); return NULL; } @@ -10427,19 +10427,19 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, virUUIDFormat(domain->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, domain->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (qemuProcessAutoDestroyActive(driver, vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is marked for auto destroy")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is marked for auto destroy")); goto cleanup; } if (!vm->persistent && (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot halt after transient domain snapshot")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot halt after transient domain snapshot")); goto cleanup; } @@ -10452,23 +10452,23 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, /* Prevent circular chains */ if (def->parent) { if (STREQ(def->name, def->parent)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("cannot set snapshot %s as its own parent"), - def->name); + virReportError(VIR_ERR_INVALID_ARG, + _("cannot set snapshot %s as its own parent"), + def->name); goto cleanup; } other = virDomainSnapshotFindByName(&vm->snapshots, def->parent); if (!other) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("parent %s for snapshot %s not found"), - def->parent, def->name); + virReportError(VIR_ERR_INVALID_ARG, + _("parent %s for snapshot %s not found"), + def->parent, def->name); goto cleanup; } while (other->def->parent) { if (STREQ(other->def->parent, def->name)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("parent %s would create cycle to %s"), - other->def->name, def->name); + virReportError(VIR_ERR_INVALID_ARG, + _("parent %s would create cycle to %s"), + other->def->name, def->name); goto cleanup; } other = virDomainSnapshotFindByName(&vm->snapshots, @@ -10484,9 +10484,9 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, /* Check that any replacement is compatible */ if (def->dom && memcmp(def->dom->uuid, domain->uuid, VIR_UUID_BUFLEN)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("definition for snapshot %s must use uuid %s"), - def->name, uuidstr); + virReportError(VIR_ERR_INVALID_ARG, + _("definition for snapshot %s must use uuid %s"), + def->name, uuidstr); goto cleanup; } other = virDomainSnapshotFindByName(&vm->snapshots, def->name); @@ -10495,18 +10495,18 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, other->def->state == VIR_DOMAIN_PAUSED) != (def->state == VIR_DOMAIN_RUNNING || def->state == VIR_DOMAIN_PAUSED)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("cannot change between online and offline " - "snapshot state in snapshot %s"), - def->name); + virReportError(VIR_ERR_INVALID_ARG, + _("cannot change between online and offline " + "snapshot state in snapshot %s"), + def->name); goto cleanup; } if ((other->def->state == VIR_DOMAIN_DISK_SNAPSHOT) != (def->state == VIR_DOMAIN_DISK_SNAPSHOT)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("cannot change between disk snapshot and " - "system checkpoint in snapshot %s"), - def->name); + virReportError(VIR_ERR_INVALID_ARG, + _("cannot change between disk snapshot and " + "system checkpoint in snapshot %s"), + def->name); goto cleanup; } if (other->def->dom) { @@ -10548,9 +10548,9 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) { if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk snapshots of inactive domains not " - "implemented yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk snapshots of inactive domains not " + "implemented yet")); goto cleanup; } if (virDomainSnapshotAlignDisks(def, @@ -10669,8 +10669,8 @@ static int qemuDomainSnapshotListNames(virDomainPtr domain, char **names, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -10699,8 +10699,8 @@ static int qemuDomainSnapshotNum(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -10729,8 +10729,8 @@ qemuDomainListAllSnapshots(virDomainPtr domain, virDomainSnapshotPtr **snaps, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -10762,16 +10762,16 @@ qemuDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(snapshot->domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -10802,16 +10802,16 @@ qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(snapshot->domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -10842,16 +10842,16 @@ qemuDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(snapshot->domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -10881,15 +10881,15 @@ static virDomainSnapshotPtr qemuDomainSnapshotLookupByName(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no snapshot with matching name '%s'"), name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no snapshot with matching name '%s'"), name); goto cleanup; } @@ -10916,8 +10916,8 @@ static int qemuDomainHasCurrentSnapshot(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -10946,23 +10946,23 @@ qemuDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(snapshot->domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } if (!snap->def->parent) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("snapshot '%s' does not have a parent"), - snap->def->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("snapshot '%s' does not have a parent"), + snap->def->name); goto cleanup; } @@ -10989,14 +10989,14 @@ static virDomainSnapshotPtr qemuDomainSnapshotCurrent(virDomainPtr domain, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!vm->current_snapshot) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s", - _("the domain does not have a current snapshot")); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s", + _("the domain does not have a current snapshot")); goto cleanup; } @@ -11024,16 +11024,16 @@ static char *qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, virUUIDFormat(snapshot->domain->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -11062,15 +11062,15 @@ qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, virUUIDFormat(snapshot->domain->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), snapshot->name); goto cleanup; } @@ -11102,16 +11102,16 @@ qemuDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot, virUUIDFormat(snapshot->domain->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -11175,16 +11175,16 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, virUUIDFormat(snapshot->domain->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -11193,22 +11193,22 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, snap->def->state != VIR_DOMAIN_PAUSED && (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)) == 0) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("transient domain needs to request run or pause " - "to revert to inactive snapshot")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("transient domain needs to request run or pause " + "to revert to inactive snapshot")); goto cleanup; } if (snap->def->state == VIR_DOMAIN_DISK_SNAPSHOT) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("revert to external disk snapshot not supported " - "yet")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("revert to external disk snapshot not supported " + "yet")); goto cleanup; } if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { if (!snap->def->dom) { - qemuReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, - _("snapshot '%s' lacks domain '%s' rollback info"), - snap->def->name, vm->def->name); + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, + _("snapshot '%s' lacks domain '%s' rollback info"), + snap->def->name, vm->def->name); goto cleanup; } if (virDomainObjIsActive(vm) && @@ -11216,8 +11216,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, || snap->def->state == VIR_DOMAIN_PAUSED) && (flags & (VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED))) { - qemuReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, - _("must respawn qemu to start inactive snapshot")); + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, + _("must respawn qemu to start inactive snapshot")); goto cleanup; } } @@ -11278,8 +11278,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) { /* Re-spawn error using correct category. */ if (err->code == VIR_ERR_CONFIG_UNSUPPORTED) - qemuReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", - err->str2); + virReportError(VIR_ERR_SNAPSHOT_REVERT_RISKY, "%s", + err->str2); goto endjob; } virResetError(err); @@ -11311,8 +11311,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, VIR_DOMAIN_EVENT_SUSPENDED, detail); if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } } @@ -11363,8 +11363,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, } else { /* Transitions 2, 5, 8 */ if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } rc = qemuProcessStartCPUs(driver, vm, snapshot->domain->conn, @@ -11543,16 +11543,16 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, virUUIDFormat(snapshot->domain->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } snap = virDomainSnapshotFindByName(&vm->snapshots, snapshot->name); if (!snap) { - qemuReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("no domain snapshot with matching name '%s'"), - snapshot->name); + virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("no domain snapshot with matching name '%s'"), + snapshot->name); goto cleanup; } @@ -11565,9 +11565,9 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, qemuDomainSnapshotCountExternal, &external); if (external) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("deletion of %d external disk snapshots not " - "supported yet"), external); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("deletion of %d external disk snapshots not " + "supported yet"), external); goto cleanup; } } @@ -11592,9 +11592,9 @@ static int qemuDomainSnapshotDelete(virDomainSnapshotPtr snapshot, snap->def->current = true; if (qemuDomainSnapshotWriteMetadata(vm, snap, driver->snapshotDir) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to set snapshot '%s' as current"), - snap->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to set snapshot '%s' as current"), + snap->def->name); snap->def->current = false; goto endjob; } @@ -11654,14 +11654,14 @@ static int qemuDomainMonitorCommand(virDomainPtr domain, const char *cmd, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(domain->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -11669,8 +11669,8 @@ static int qemuDomainMonitorCommand(virDomainPtr domain, const char *cmd, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); goto endjob; } @@ -11719,16 +11719,16 @@ static virDomainPtr qemuDomainAttach(virConnectPtr conn, goto cleanup; if (!monConfig) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("No monitor connection for pid %u"), pid_value); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("No monitor connection for pid %u"), pid_value); goto cleanup; } if (monConfig->type != VIR_DOMAIN_CHR_TYPE_UNIX) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Cannot connect to monitor connection of type '%s' " - "for pid %u"), - virDomainChrTypeToString(monConfig->type), - pid_value); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Cannot connect to monitor connection of type '%s' " + "for pid %u"), + virDomainChrTypeToString(monConfig->type), + pid_value); goto cleanup; } @@ -11807,14 +11807,14 @@ qemuDomainOpenConsole(virDomainPtr dom, vm = virDomainFindByUUID(&driver->domains, dom->uuid); qemuDriverUnlock(driver); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } @@ -11842,16 +11842,16 @@ qemuDomainOpenConsole(virDomainPtr dom, } if (!chr) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find character device %s"), - NULLSTR(dev_name)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find character device %s"), + NULLSTR(dev_name)); goto cleanup; } if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("character device %s is not using a PTY"), - NULLSTR(dev_name)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("character device %s is not using a PTY"), + NULLSTR(dev_name)); goto cleanup; } @@ -11862,8 +11862,8 @@ qemuDomainOpenConsole(virDomainPtr dom, (flags & VIR_DOMAIN_CONSOLE_FORCE) != 0); if (ret == 1) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Active console session exists for this domain")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Active console session exists for this domain")); ret = -1; } @@ -11901,8 +11901,8 @@ qemuDiskPathToAlias(virDomainObjPtr vm, const char *path, int *idx) cleanup: if (!ret) { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("No device found for specified path")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("No device found for specified path")); } return ret; } @@ -11927,13 +11927,13 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base, virUUIDFormat(dom->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); goto cleanup; } @@ -11941,18 +11941,18 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base, if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) { async = true; } else if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("block jobs not supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("block jobs not supported with this QEMU binary")); goto cleanup; } else if (base) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("partial block pull not supported with this " - "QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("partial block pull not supported with this " + "QEMU binary")); goto cleanup; } else if (mode == BLOCK_JOB_PULL && bandwidth) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("setting bandwidth at start of block pull not " - "supported with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting bandwidth at start of block pull not " + "supported with this QEMU binary")); goto cleanup; } @@ -11965,8 +11965,8 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); goto endjob; } @@ -12016,8 +12016,8 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base, virDomainObjLock(vm); if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); ret = -1; break; } @@ -12102,22 +12102,22 @@ qemuDomainOpenGraphics(virDomainPtr dom, virUUIDFormat(dom->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } priv = vm->privateData; if (idx >= vm->def->ngraphics) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No graphics backend with index %d"), idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No graphics backend with index %d"), idx); goto cleanup; } switch (vm->def->graphics[idx]->type) { @@ -12128,9 +12128,9 @@ qemuDomainOpenGraphics(virDomainPtr dom, protocol = "spice"; break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Can only open VNC or SPICE graphics backends, not %s"), - virDomainGraphicsTypeToString(vm->def->graphics[idx]->type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Can only open VNC or SPICE graphics backends, not %s"), + virDomainGraphicsTypeToString(vm->def->graphics[idx]->type)); goto cleanup; } @@ -12197,15 +12197,15 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, virUUIDFormat(dom->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } priv = vm->privateData; if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("block I/O throttling not supported with this " - "QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("block I/O throttling not supported with this " + "QEMU binary")); goto cleanup; } @@ -12252,15 +12252,15 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if ((info.total_bytes_sec && info.read_bytes_sec) || (info.total_bytes_sec && info.write_bytes_sec)) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of bytes_sec cannot be set at the same time")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("total and read/write of bytes_sec cannot be set at the same time")); goto endjob; } if ((info.total_iops_sec && info.read_iops_sec) || (info.total_iops_sec && info.write_iops_sec)) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of iops_sec cannot be set at the same time")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("total and read/write of iops_sec cannot be set at the same time")); goto endjob; } @@ -12306,7 +12306,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, persistentDef->disks[idx]->blkdeviotune = info; ret = virDomainSaveConfig(driver->configDir, persistentDef); if (ret < 0) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", + virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Write to config file failed")); goto endjob; } @@ -12352,8 +12352,8 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, virUUIDFormat(dom->uuid, uuidstr); vm = virDomainFindByUUID(&driver->domains, dom->uuid); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -12483,8 +12483,8 @@ qemuDomainGetDiskErrors(virDomainPtr dom, qemuDriverUnlock(driver); if (!vm) { - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -12494,8 +12494,8 @@ qemuDomainGetDiskErrors(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -12568,8 +12568,8 @@ qemuDomainSetMetadata(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -12592,14 +12592,14 @@ qemuDomainSetMetadata(virDomainPtr dom, goto no_memory; break; case VIR_DOMAIN_METADATA_ELEMENT: - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEmu driver does not support modifying" - "<metadata> element")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEmu driver does not support modifying" + "<metadata> element")); goto cleanup; break; default: - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("unknown metadata type")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("unknown metadata type")); goto cleanup; break; } @@ -12620,13 +12620,13 @@ qemuDomainSetMetadata(virDomainPtr dom, goto no_memory; break; case VIR_DOMAIN_METADATA_ELEMENT: - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU driver does not support" - "<metadata> element")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU driver does not support" + "<metadata> element")); goto cleanup; default: - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("unknown metadata type")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("unknown metadata type")); goto cleanup; break; } @@ -12668,8 +12668,8 @@ qemuDomainGetMetadata(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -12688,21 +12688,21 @@ qemuDomainGetMetadata(virDomainPtr dom, field = def->title; break; case VIR_DOMAIN_METADATA_ELEMENT: - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU driver does not support" - "<metadata> element")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU driver does not support" + "<metadata> element")); goto cleanup; break; default: - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("unknown metadata type")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("unknown metadata type")); goto cleanup; break; } if (!field) { - qemuReportError(VIR_ERR_NO_DOMAIN_METADATA, "%s", - _("Requested metadata element is not present")); + virReportError(VIR_ERR_NO_DOMAIN_METADATA, "%s", + _("Requested metadata element is not present")); goto cleanup; } @@ -12797,8 +12797,8 @@ getSumVcpuPercpuStats(virCgroupPtr group, int j; if (virCgroupForVcpu(group, i, &group_vcpu, 0) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("error accessing cgroup cpuacct for vcpu")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("error accessing cgroup cpuacct for vcpu")); goto cleanup; } @@ -12808,8 +12808,8 @@ getSumVcpuPercpuStats(virCgroupPtr group, pos = buf; for (j = 0; j < num; j++) { if (virStrToLong_ull(pos, &pos, 10, &tmp) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cpuacct parse error")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cpuacct parse error")); goto cleanup; } sum_cpu_time[j] += tmp; @@ -12864,9 +12864,9 @@ qemuDomainGetPercpuStats(virDomainPtr domain, } if (start_cpu > max_id) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("start_cpu %d larger than maximum of %d"), - start_cpu, max_id); + virReportError(VIR_ERR_INVALID_ARG, + _("start_cpu %d larger than maximum of %d"), + start_cpu, max_id); goto cleanup; } @@ -12886,8 +12886,8 @@ qemuDomainGetPercpuStats(virDomainPtr domain, if (!map[i]) { cpu_time = 0; } else if (virStrToLong_ull(pos, &pos, 10, &cpu_time) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cpuacct parse error")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cpuacct parse error")); goto cleanup; } else { n++; @@ -12916,8 +12916,8 @@ qemuDomainGetPercpuStats(virDomainPtr domain, /* Check that the mapping of online cpus didn't change mid-parse. */ map2 = nodeGetCPUmap(domain->conn, &max_id, "present"); if (!map2 || memcmp(map, map2, VIR_DOMAIN_CPUMASK_LEN) != 0) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("the set of online cpus changed while reading")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("the set of online cpus changed while reading")); goto cleanup; } @@ -12967,27 +12967,27 @@ qemuDomainGetCPUStats(virDomainPtr domain, vm = virDomainFindByUUID(&driver->domains, domain->uuid); if (vm == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No such domain %s"), domain->uuid); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No such domain %s"), domain->uuid); goto cleanup; } isActive = virDomainObjIsActive(vm); if (!isActive) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); goto cleanup; } if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPUACCT)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cgroup CPUACCT controller is not mounted")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cgroup CPUACCT controller is not mounted")); goto cleanup; } if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find cgroup for domain %s"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find cgroup for domain %s"), vm->def->name); goto cleanup; } @@ -13018,17 +13018,17 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, virCheckFlags(0, -1); if (duration) { - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("Duration not supported. Use 0 for now")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("Duration not supported. Use 0 for now")); return -1; } if (!(target == VIR_NODE_SUSPEND_TARGET_MEM || target == VIR_NODE_SUSPEND_TARGET_DISK || target == VIR_NODE_SUSPEND_TARGET_HYBRID)) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Unknown suspend target: %u"), - target); + virReportError(VIR_ERR_INVALID_ARG, + _("Unknown suspend target: %u"), + target); return -1; } @@ -13039,37 +13039,37 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } priv = vm->privateData; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto cleanup; } if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP) && (target == VIR_NODE_SUSPEND_TARGET_MEM || target == VIR_NODE_SUSPEND_TARGET_HYBRID)) { - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("Unable to suspend domain due to " - "missing system_wakeup monitor command")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("Unable to suspend domain due to " + "missing system_wakeup monitor command")); goto cleanup; } if (priv->agentError) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("QEMU guest agent is not available due to an error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("QEMU guest agent is not available due to an error")); goto cleanup; } if (!priv->agent) { - qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("QEMU guest agent is not configured")); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("QEMU guest agent is not configured")); goto cleanup; } @@ -13077,8 +13077,8 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -13114,8 +13114,8 @@ qemuDomainPMWakeup(virDomainPtr dom, if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); - qemuReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching uuid '%s'"), uuidstr); + virReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); goto cleanup; } @@ -13123,17 +13123,17 @@ qemuDomainPMWakeup(virDomainPtr dom, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } priv = vm->privateData; if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("Unable to wake up domain due to " - "missing system_wakeup monitor command")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Unable to wake up domain due to " + "missing system_wakeup monitor command")); goto endjob; } diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 434aa02..fb07c3c 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -31,6 +31,8 @@ #include "hostusb.h" #include "virnetdev.h" +#define VIR_FROM_THIS VIR_FROM_QEMU + static pciDeviceList * qemuGetPciHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) { @@ -271,10 +273,11 @@ qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf, case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH: case VIR_NETDEV_VPORT_PROFILE_8021QBG: case VIR_NETDEV_VPORT_PROFILE_LAST: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("virtualport type %s is " - "currently not supported on interfaces of type " - "hostdev"), - virNetDevVPortTypeToString(virtPort->virtPortType)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("virtualport type %s is " + "currently not supported on interfaces of type " + "hostdev"), + virNetDevVPortTypeToString(virtPort->virtPortType)); break; case VIR_NETDEV_VPORT_PROFILE_8021QBH: @@ -307,9 +310,9 @@ qemuDomainHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev, isvf = qemuDomainHostdevIsVirtualFunction(hostdev); if (isvf <= 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Interface type hostdev is currently supported on" - " SR-IOV Virtual Functions only")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Interface type hostdev is currently supported on" + " SR-IOV Virtual Functions only")); return ret; } @@ -345,9 +348,9 @@ qemuDomainHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev, isvf = qemuDomainHostdevIsVirtualFunction(hostdev); if (isvf <= 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Interface type hostdev is currently supported on" - " SR-IOV Virtual Functions only")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Interface type hostdev is currently supported on" + " SR-IOV Virtual Functions only")); return ret; } @@ -399,9 +402,9 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver, pciDevice *other; if (!pciDeviceIsAssignable(dev, !driver->relaxedACS)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("PCI device %s is not assignable"), - pciDeviceGetName(dev)); + virReportError(VIR_ERR_OPERATION_INVALID, + _("PCI device %s is not assignable"), + pciDeviceGetName(dev)); goto cleanup; } /* The device is in use by other active domain if @@ -411,13 +414,13 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver, const char *other_name = pciDeviceGetUsedBy(other); if (other_name) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("PCI device %s is in use by domain %s"), - pciDeviceGetName(dev), other_name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("PCI device %s is in use by domain %s"), + pciDeviceGetName(dev), other_name); else - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("PCI device %s is already in use"), - pciDeviceGetName(dev)); + virReportError(VIR_ERR_OPERATION_INVALID, + _("PCI device %s is already in use"), + pciDeviceGetName(dev)); goto cleanup; } } @@ -579,13 +582,13 @@ qemuPrepareHostdevUSBDevices(struct qemud_driver *driver, const char *other_name = usbDeviceGetUsedBy(tmp); if (other_name) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("USB device %s is in use by domain %s"), - usbDeviceGetName(tmp), other_name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("USB device %s is in use by domain %s"), + usbDeviceGetName(tmp), other_name); else - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("USB device %s is already in use"), - usbDeviceGetName(tmp)); + virReportError(VIR_ERR_OPERATION_INVALID, + _("USB device %s is already in use"), + usbDeviceGetName(tmp)); goto error; } @@ -653,9 +656,9 @@ qemuPrepareHostUSBDevices(struct qemud_driver *driver, goto cleanup; if (usbDeviceListCount(devs) > 1) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("multiple USB devices for %x:%x, " - "use <address> to specify one"), vendor, product); + virReportError(VIR_ERR_OPERATION_FAILED, + _("multiple USB devices for %x:%x, " + "use <address> to specify one"), vendor, product); usbDeviceListFree(devs); goto cleanup; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 09c8c97..20aefce 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -66,23 +66,23 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver, } if (!origdisk) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("No device with bus '%s' and target '%s'"), - virDomainDiskBusTypeToString(disk->bus), - disk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No device with bus '%s' and target '%s'"), + virDomainDiskBusTypeToString(disk->bus), + disk->dst); return -1; } if (!origdisk->info.alias) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("missing disk device alias name for %s"), origdisk->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("missing disk device alias name for %s"), origdisk->dst); return -1; } if (origdisk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY && origdisk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Removable media not supported for %s device"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Removable media not supported for %s device"), virDomainDiskDeviceTypeToString(disk->device)); return -1; } @@ -210,8 +210,8 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn, for (i = 0 ; i < vm->def->ndisks ; i++) { if (STREQ(vm->def->disks[i]->dst, disk->dst)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("target %s already exists"), disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("target %s already exists"), disk->dst); return -1; } } @@ -318,9 +318,9 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver, for (i = 0 ; i < vm->def->ncontrollers ; i++) { if ((vm->def->controllers[i]->type == controller->type) && (vm->def->controllers[i]->idx == controller->idx)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("target %s:%d already exists"), - type, controller->idx); + virReportError(VIR_ERR_OPERATION_FAILED, + _("target %s:%d already exists"), + type, controller->idx); return -1; } } @@ -335,8 +335,8 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver, if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && controller->model == -1 && !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("USB controller hotplug unsupported in this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("USB controller hotplug unsupported in this QEMU binary")); goto cleanup; } @@ -415,8 +415,8 @@ qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver, } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); /* cont doesn't need freeing here, since the reference * now held in def->controllers */ return NULL; @@ -440,8 +440,8 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn, for (i = 0 ; i < vm->def->ndisks ; i++) { if (STREQ(vm->def->disks[i]->dst, disk->dst)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("target %s already exists"), disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("target %s already exists"), disk->dst); return -1; } } @@ -458,9 +458,9 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn, /* We should have an address already, so make sure */ if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected disk address type %s"), - virDomainDeviceAddressTypeToString(disk->info.type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected disk address type %s"), + virDomainDeviceAddressTypeToString(disk->info.type)); goto error; } @@ -486,8 +486,8 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn, sa_assert (cont); if (cont->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("SCSI controller %d was missing its PCI address"), cont->idx); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("SCSI controller %d was missing its PCI address"), cont->idx); goto error; } @@ -563,8 +563,8 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn, for (i = 0 ; i < vm->def->ndisks ; i++) { if (STREQ(vm->def->disks[i]->dst, disk->dst)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("target %s already exists"), disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("target %s already exists"), disk->dst); return -1; } } @@ -581,8 +581,8 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn, /* XXX not correct once we allow attaching a USB CDROM */ if (!disk->src) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("disk source path is missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("disk source path is missing")); goto error; } @@ -692,8 +692,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, } if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_HOST_NET_ADD)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("installed qemu version does not support host_net_add")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("installed qemu version does not support host_net_add")); goto cleanup; } @@ -734,8 +734,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, vlan = qemuDomainNetVLAN(net); if (vlan < 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Unable to attach network devices without vlan")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Unable to attach network devices without vlan")); goto cleanup; } } @@ -784,8 +784,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, VIR_FORCE_CLOSE(vhostfd); if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto cleanup; } @@ -820,8 +820,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, /* set link state */ if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) { if (!net->info.alias) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("device alias not found: cannot set link state to down")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("device alias not found: cannot set link state to down")); } else { qemuDomainObjEnterMonitorWithDriver(driver, vm); @@ -832,8 +832,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, goto try_remove; } } else { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("setting of link state not supported: Link is up")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("setting of link state not supported: Link is up")); } qemuDomainObjExitMonitorWithDriver(driver, vm); @@ -953,8 +953,8 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver, } if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit during hotplug")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit during hotplug")); goto error; } @@ -1077,9 +1077,9 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver, qemuCgroupData data; if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto error; } @@ -1124,9 +1124,9 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver, usbDevice *usb = NULL; if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hostdev mode '%s' not supported"), - virDomainHostdevModeTypeToString(hostdev->mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hostdev mode '%s' not supported"), + virDomainHostdevModeTypeToString(hostdev->mode)); return -1; } @@ -1148,9 +1148,9 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver, goto cleanup; if (usbDeviceListCount(devs) > 1) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("multiple USB devices for %x:%x, " - "use <address> to specify one"), vendor, product); + virReportError(VIR_ERR_OPERATION_FAILED, + _("multiple USB devices for %x:%x, " + "use <address> to specify one"), vendor, product); usbDeviceListFree(devs); goto cleanup; } @@ -1199,9 +1199,9 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver, break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hostdev subsys type '%s' not supported"), - virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hostdev subsys type '%s' not supported"), + virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type)); goto error; } @@ -1246,8 +1246,8 @@ int qemuDomainChangeNetBridge(virDomainObjPtr vm, olddev->ifname, oldbridge, newbridge); if (virNetDevExists(newbridge) != 1) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("bridge %s doesn't exist"), newbridge); + virReportError(VIR_ERR_OPERATION_FAILED, + _("bridge %s doesn't exist"), newbridge); return -1; } @@ -1268,9 +1268,9 @@ int qemuDomainChangeNetBridge(virDomainObjPtr vm, ret = virNetDevBridgeAddPort(oldbridge, olddev->ifname); virDomainAuditNet(vm, NULL, olddev, "attach", ret == 0); if (ret < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("unable to recover former state by adding port" - "to bridge %s"), oldbridge); + virReportError(VIR_ERR_OPERATION_FAILED, + _("unable to recover former state by adding port" + "to bridge %s"), oldbridge); } return -1; } @@ -1291,8 +1291,8 @@ int qemuDomainChangeNetLinkState(struct qemud_driver *driver, VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate); if (!dev->info.alias) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("can't change link state: device alias not found")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("can't change link state: device alias not found")); return -1; } @@ -1321,14 +1321,14 @@ int qemuDomainChangeNet(struct qemud_driver *driver, int ret = 0; if (!olddev) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot find existing network device to modify")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot find existing network device to modify")); return -1; } if (olddev->type != dev->type) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot change network interface type")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot change network interface type")); return -1; } @@ -1340,8 +1340,8 @@ int qemuDomainChangeNet(struct qemud_driver *driver, if (STRNEQ_NULLABLE(olddev->data.ethernet.dev, dev->data.ethernet.dev) || STRNEQ_NULLABLE(olddev->script, dev->script) || STRNEQ_NULLABLE(olddev->data.ethernet.ipaddr, dev->data.ethernet.ipaddr)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify ethernet network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify ethernet network device configuration")); return -1; } break; @@ -1351,8 +1351,8 @@ int qemuDomainChangeNet(struct qemud_driver *driver, case VIR_DOMAIN_NET_TYPE_MCAST: if (STRNEQ_NULLABLE(olddev->data.socket.address, dev->data.socket.address) || olddev->data.socket.port != dev->data.socket.port) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify network socket device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify network socket device configuration")); return -1; } break; @@ -1361,8 +1361,8 @@ int qemuDomainChangeNet(struct qemud_driver *driver, if (STRNEQ_NULLABLE(olddev->data.network.name, dev->data.network.name) || STRNEQ_NULLABLE(olddev->data.network.portgroup, dev->data.network.portgroup) || !virNetDevVPortProfileEqual(olddev->data.network.virtPortProfile, dev->data.network.virtPortProfile)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify network device configuration")); return -1; } @@ -1372,16 +1372,16 @@ int qemuDomainChangeNet(struct qemud_driver *driver, /* allow changing brname, but not portprofile */ if (!virNetDevVPortProfileEqual(olddev->data.bridge.virtPortProfile, dev->data.bridge.virtPortProfile)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify bridge network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify bridge network device configuration")); return -1; } break; case VIR_DOMAIN_NET_TYPE_INTERNAL: if (STRNEQ_NULLABLE(olddev->data.internal.name, dev->data.internal.name)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify internal network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify internal network device configuration")); return -1; } break; @@ -1390,16 +1390,16 @@ int qemuDomainChangeNet(struct qemud_driver *driver, if (STRNEQ_NULLABLE(olddev->data.direct.linkdev, dev->data.direct.linkdev) || olddev->data.direct.mode != dev->data.direct.mode || !virNetDevVPortProfileEqual(olddev->data.direct.virtPortProfile, dev->data.direct.virtPortProfile)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify direct network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify direct network device configuration")); return -1; } break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to change config on '%s' network type"), - virDomainNetTypeToString(dev->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to change config on '%s' network type"), + virDomainNetTypeToString(dev->type)); break; } @@ -1407,16 +1407,16 @@ int qemuDomainChangeNet(struct qemud_driver *driver, /* all other unmodifiable parameters */ if (STRNEQ_NULLABLE(olddev->model, dev->model) || STRNEQ_NULLABLE(olddev->filter, dev->filter)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify network device configuration")); return -1; } /* check if device name has been set, if no, retain the autogenerated one */ if (dev->ifname && STRNEQ_NULLABLE(olddev->ifname, dev->ifname)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("cannot modify network device configuration")); + virReportError(VIR_ERR_NO_SUPPORT, + _("cannot modify network device configuration")); return -1; } @@ -1462,8 +1462,8 @@ qemuDomainChangeGraphics(struct qemud_driver *driver, int ret = -1; if (!olddev) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot find existing graphics device to modify")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot find existing graphics device to modify")); return -1; } @@ -1477,23 +1477,23 @@ qemuDomainChangeGraphics(struct qemud_driver *driver, if ((olddev->data.vnc.autoport != dev->data.vnc.autoport) || (!dev->data.vnc.autoport && (olddev->data.vnc.port != dev->data.vnc.port))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change port settings on vnc graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change port settings on vnc graphics")); return -1; } if (STRNEQ_NULLABLE(oldListenAddr,newListenAddr)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change listen address setting on vnc graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change listen address setting on vnc graphics")); return -1; } if (STRNEQ_NULLABLE(oldListenNetwork,newListenNetwork)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change listen network setting on vnc graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change listen network setting on vnc graphics")); return -1; } if (STRNEQ_NULLABLE(olddev->data.vnc.keymap, dev->data.vnc.keymap)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change keymap setting on vnc graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change keymap setting on vnc graphics")); return -1; } @@ -1530,23 +1530,23 @@ qemuDomainChangeGraphics(struct qemud_driver *driver, (olddev->data.spice.port != dev->data.spice.port)) || (!dev->data.spice.autoport && (olddev->data.spice.tlsPort != dev->data.spice.tlsPort))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change port settings on spice graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change port settings on spice graphics")); return -1; } if (STRNEQ_NULLABLE(oldListenAddr, newListenAddr)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change listen address setting on spice graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change listen address setting on spice graphics")); return -1; } if (STRNEQ_NULLABLE(oldListenNetwork, newListenNetwork)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot change listen network setting on spice graphics")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot change listen network setting on spice graphics")); return -1; } if (STRNEQ_NULLABLE(olddev->data.spice.keymap, dev->data.spice.keymap)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot change keymap setting on spice graphics")); return -1; } @@ -1584,9 +1584,9 @@ qemuDomainChangeGraphics(struct qemud_driver *driver, break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to change config on '%s' graphics type"), - virDomainGraphicsTypeToString(dev->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to change config on '%s' graphics type"), + virDomainGraphicsTypeToString(dev->type)); break; } @@ -1646,33 +1646,33 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver, i = qemuFindDisk(vm->def, dev->data.disk->dst); if (i < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("disk %s not found"), dev->data.disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("disk %s not found"), dev->data.disk->dst); goto cleanup; } detach = vm->def->disks[i]; if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug multifunction PCI device: %s"), - dev->data.disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot hot unplug multifunction PCI device: %s"), + dev->data.disk->dst); goto cleanup; } if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto cleanup; } } if (!virDomainDeviceAddressIsValid(&detach->info, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("device cannot be detached without a PCI address")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("device cannot be detached without a PCI address")); goto cleanup; } @@ -1750,15 +1750,15 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver, i = qemuFindDisk(vm->def, dev->data.disk->dst); if (i < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("disk %s not found"), dev->data.disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("disk %s not found"), dev->data.disk->dst); goto cleanup; } if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Underlying qemu does not support %s disk removal"), - virDomainDiskBusTypeToString(dev->data.disk->bus)); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Underlying qemu does not support %s disk removal"), + virDomainDiskBusTypeToString(dev->data.disk->bus)); goto cleanup; } @@ -1766,9 +1766,9 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver, if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto cleanup; } } @@ -1887,30 +1887,30 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver, } if (!detach) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("disk controller %s:%d not found"), - virDomainControllerTypeToString(dev->data.controller->type), - dev->data.controller->idx); + virReportError(VIR_ERR_OPERATION_FAILED, + _("disk controller %s:%d not found"), + virDomainControllerTypeToString(dev->data.controller->type), + dev->data.controller->idx); goto cleanup; } if (!virDomainDeviceAddressIsValid(&detach->info, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("device cannot be detached without a PCI address")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("device cannot be detached without a PCI address")); goto cleanup; } if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug multifunction PCI device: %s"), - dev->data.disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot hot unplug multifunction PCI device: %s"), + dev->data.disk->dst); goto cleanup; } if (qemuDomainControllerIsBusy(vm, detach)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("device cannot be detached: device is busy")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("device cannot be detached: device is busy")); goto cleanup; } @@ -1973,17 +1973,17 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver, pciDevice *activePci; if (qemuIsMultiFunctionDevice(vm->def, detach->info)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug multifunction PCI device: %.4x:%.2x:%.2x.%.1x"), - subsys->u.pci.domain, subsys->u.pci.bus, - subsys->u.pci.slot, subsys->u.pci.function); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot hot unplug multifunction PCI device: %.4x:%.2x:%.2x.%.1x"), + subsys->u.pci.domain, subsys->u.pci.bus, + subsys->u.pci.slot, subsys->u.pci.function); return -1; } if (!virDomainDeviceAddressIsValid(detach->info, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device cannot be detached without a PCI address")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("device cannot be detached without a PCI address")); return -1; } @@ -2042,14 +2042,14 @@ qemuDomainDetachHostUsbDevice(struct qemud_driver *driver, int ret; if (!detach->info->alias) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device cannot be detached without a device alias")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("device cannot be detached without a device alias")); return -1; } if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device cannot be detached with this QEMU version")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("device cannot be detached with this QEMU version")); return -1; } @@ -2088,9 +2088,9 @@ int qemuDomainDetachThisHostDevice(struct qemud_driver *driver, break; } if (idx >= vm->def->nhostdevs) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("device not found in hostdevs list (%d entries)"), - vm->def->nhostdevs); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("device not found in hostdevs list (%d entries)"), + vm->def->nhostdevs); return ret; } } @@ -2103,9 +2103,9 @@ int qemuDomainDetachThisHostDevice(struct qemud_driver *driver, ret = qemuDomainDetachHostUsbDevice(driver, vm, detach); break; default: - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hostdev subsys type '%s' not supported"), - virDomainHostdevSubsysTypeToString(detach->source.subsys.type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hostdev subsys type '%s' not supported"), + virDomainHostdevSubsysTypeToString(detach->source.subsys.type)); return -1; } @@ -2131,9 +2131,9 @@ int qemuDomainDetachHostDevice(struct qemud_driver *driver, int idx; if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hostdev mode '%s' not supported"), - virDomainHostdevModeTypeToString(hostdev->mode)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hostdev mode '%s' not supported"), + virDomainHostdevModeTypeToString(hostdev->mode)); return -1; } @@ -2142,25 +2142,25 @@ int qemuDomainDetachHostDevice(struct qemud_driver *driver, if (idx < 0) { switch(subsys->type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("host pci device %.4x:%.2x:%.2x.%.1x not found"), - subsys->u.pci.domain, subsys->u.pci.bus, - subsys->u.pci.slot, subsys->u.pci.function); + virReportError(VIR_ERR_OPERATION_FAILED, + _("host pci device %.4x:%.2x:%.2x.%.1x not found"), + subsys->u.pci.domain, subsys->u.pci.bus, + subsys->u.pci.slot, subsys->u.pci.function); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: if (subsys->u.usb.bus && subsys->u.usb.device) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("host usb device %03d.%03d not found"), - subsys->u.usb.bus, subsys->u.usb.device); + virReportError(VIR_ERR_OPERATION_FAILED, + _("host usb device %03d.%03d not found"), + subsys->u.usb.bus, subsys->u.usb.device); } else { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("host usb device vendor=0x%.4x product=0x%.4x not found"), - subsys->u.usb.vendor, subsys->u.usb.product); + virReportError(VIR_ERR_OPERATION_FAILED, + _("host usb device vendor=0x%.4x product=0x%.4x not found"), + subsys->u.usb.vendor, subsys->u.usb.product); } break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hostdev type %d"), subsys->type); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected hostdev type %d"), subsys->type); break; } return -1; @@ -2197,11 +2197,11 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver, } if (!detach) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("network device %02x:%02x:%02x:%02x:%02x:%02x not found"), - dev->data.net->mac.addr[0], dev->data.net->mac.addr[1], - dev->data.net->mac.addr[2], dev->data.net->mac.addr[3], - dev->data.net->mac.addr[4], dev->data.net->mac.addr[5]); + virReportError(VIR_ERR_OPERATION_FAILED, + _("network device %02x:%02x:%02x:%02x:%02x:%02x not found"), + dev->data.net->mac.addr[0], dev->data.net->mac.addr[1], + dev->data.net->mac.addr[2], dev->data.net->mac.addr[3], + dev->data.net->mac.addr[4], dev->data.net->mac.addr[5]); goto cleanup; } @@ -2214,21 +2214,21 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver, if (!virDomainDeviceAddressIsValid(&detach->info, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device cannot be detached without a PCI address")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("device cannot be detached without a PCI address")); goto cleanup; } if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot hot unplug multifunction PCI device :%s"), - dev->data.disk->dst); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot hot unplug multifunction PCI device :%s"), + dev->data.disk->dst); goto cleanup; } if ((vlan = qemuDomainNetVLAN(detach)) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("unable to determine original VLAN")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("unable to determine original VLAN")); goto cleanup; } @@ -2341,8 +2341,8 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver, if (ret == -2) { if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Graphics password only supported for VNC")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Graphics password only supported for VNC")); ret = -1; } else { ret = qemuMonitorSetVNCPassword(priv->mon, @@ -2367,8 +2367,8 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver, if (ret == -2) { /* XXX we could fake this with a timer */ if (auth->expires) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Expiry of passwords is not supported")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Expiry of passwords is not supported")); ret = -1; } else { ret = 0; @@ -2405,9 +2405,9 @@ int qemuDomainDetachLease(struct qemud_driver *driver, int i; if ((i = virDomainLeaseIndex(vm->def, lease)) < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("Lease %s in lockspace %s does not exist"), - lease->key, NULLSTR(lease->lockspace)); + virReportError(VIR_ERR_INVALID_ARG, + _("Lease %s in lockspace %s does not exist"), + lease->key, NULLSTR(lease->lockspace)); return -1; } diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index d176e7d..f8e2f90 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -164,16 +164,16 @@ qemuDomainExtractTLSSubject(const char *certdir) goto no_memory; if (virFileReadAll(certfile, 8192, &pemdata) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to read server cert %s"), certfile); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to read server cert %s"), certfile); goto error; } ret = gnutls_x509_crt_init(&cert); if (ret < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot initialize cert object: %s"), - gnutls_strerror(ret)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot initialize cert object: %s"), + gnutls_strerror(ret)); goto error; } @@ -182,9 +182,9 @@ qemuDomainExtractTLSSubject(const char *certdir) ret = gnutls_x509_crt_import(cert, &pemdatum, GNUTLS_X509_FMT_PEM); if (ret < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot load cert data from %s: %s"), - certfile, gnutls_strerror(ret)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot load cert data from %s: %s"), + certfile, gnutls_strerror(ret)); goto error; } @@ -277,8 +277,8 @@ qemuMigrationCookieNew(virDomainObjPtr dom) if (!(mig->localHostname = virGetHostname(NULL))) goto error; if (virGetHostUUID(mig->localHostuuid) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to obtain host UUID")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to obtain host UUID")); goto error; } @@ -298,8 +298,8 @@ qemuMigrationCookieAddGraphics(qemuMigrationCookiePtr mig, virDomainObjPtr dom) { if (mig->flags & QEMU_MIGRATION_COOKIE_GRAPHICS) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Migration graphics data already present")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Migration graphics data already present")); return -1; } @@ -324,8 +324,8 @@ qemuMigrationCookieAddLockstate(qemuMigrationCookiePtr mig, qemuDomainObjPrivatePtr priv = dom->privateData; if (mig->flags & QEMU_MIGRATION_COOKIE_LOCKSTATE) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Migration lockstate data already present")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Migration lockstate data already present")); return -1; } @@ -355,8 +355,8 @@ qemuMigrationCookieAddPersistent(qemuMigrationCookiePtr mig, virDomainObjPtr dom) { if (mig->flags & QEMU_MIGRATION_COOKIE_PERSISTENT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Migration persistent data already present")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Migration persistent data already present")); return -1; } @@ -474,32 +474,32 @@ qemuMigrationCookieGraphicsXMLParse(xmlXPathContextPtr ctxt) goto no_memory; if (!(tmp = virXPathString("string(./graphics/@type)", ctxt))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing type attribute in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing type attribute in migration data")); goto error; } if ((grap->type = virDomainGraphicsTypeFromString(tmp)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown graphics type %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown graphics type %s"), tmp); VIR_FREE(tmp); goto error; } VIR_FREE(tmp); if (virXPathInt("string(./graphics/@port)", ctxt, &grap->port) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing port attribute in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing port attribute in migration data")); goto error; } if (grap->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { if (virXPathInt("string(./graphics/@tlsPort)", ctxt, &grap->tlsPort) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing tlsPort attribute in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing tlsPort attribute in migration data")); goto error; } } if (!(grap->listen = virXPathString("string(./graphics/@listen)", ctxt))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing listen attribute in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing listen attribute in migration data")); goto error; } /* Optional */ @@ -535,14 +535,14 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, /* Extract domain name */ if (!(tmp = virXPathString("string(./name[1])", ctxt))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing name element in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing name element in migration data")); goto error; } if (STRNEQ(tmp, mig->name)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Incoming cookie data had unexpected name %s vs %s"), - tmp, mig->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Incoming cookie data had unexpected name %s vs %s"), + tmp, mig->name); goto error; } VIR_FREE(tmp); @@ -550,45 +550,45 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, /* Extract domain uuid */ tmp = virXPathString("string(./uuid[1])", ctxt); if (!tmp) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing uuid element in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing uuid element in migration data")); goto error; } virUUIDFormat(mig->uuid, uuidstr); if (STRNEQ(tmp, uuidstr)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Incoming cookie data had unexpected UUID %s vs %s"), - tmp, uuidstr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Incoming cookie data had unexpected UUID %s vs %s"), + tmp, uuidstr); } VIR_FREE(tmp); /* Check & forbid "localhost" migration */ if (!(mig->remoteHostname = virXPathString("string(./hostname[1])", ctxt))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing hostname element in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing hostname element in migration data")); goto error; } if (STREQ(mig->remoteHostname, mig->localHostname)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Attempt to migrate guest to the same host %s"), - mig->remoteHostname); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Attempt to migrate guest to the same host %s"), + mig->remoteHostname); goto error; } if (!(tmp = virXPathString("string(./hostuuid[1])", ctxt))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing hostuuid element in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing hostuuid element in migration data")); goto error; } if (virUUIDParse(tmp, mig->remoteHostuuid) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed hostuuid element in migration data")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed hostuuid element in migration data")); goto error; } if (memcmp(mig->remoteHostuuid, mig->localHostuuid, VIR_UUID_BUFLEN) == 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Attempt to migrate guest to the same host %s"), - tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Attempt to migrate guest to the same host %s"), + tmp); goto error; } VIR_FREE(tmp); @@ -602,23 +602,23 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, int val; char *str = virXMLPropString(nodes[i], "name"); if (!str) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing feature name")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing feature name")); goto error; } if ((val = qemuMigrationCookieFlagTypeFromString(str)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown migration cookie feature %s"), - str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown migration cookie feature %s"), + str); VIR_FREE(str); goto error; } if ((flags & (1 << val)) == 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unsupported migration cookie feature %s"), - str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unsupported migration cookie feature %s"), + str); VIR_FREE(str); } VIR_FREE(str); @@ -634,8 +634,8 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, virXPathBoolean("count(./lockstate) > 0", ctxt)) { mig->lockDriver = virXPathString("string(./lockstate[1]/@driver)", ctxt); if (!mig->lockDriver) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing lock driver name in migration cookie")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing lock driver name in migration cookie")); goto error; } mig->lockState = virXPathString("string(./lockstate[1]/leases[1])", ctxt); @@ -646,10 +646,10 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, if ((flags & QEMU_MIGRATION_COOKIE_PERSISTENT) && virXPathBoolean("count(./domain) > 0", ctxt)) { if ((n = virXPathNodeSet("./domain", ctxt, &nodes)) > 1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Too many domain elements in " - "migration cookie: %d"), - n); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Too many domain elements in " + "migration cookie: %d"), + n); goto error; } mig->persistent = virDomainDefParseNode(driver->caps, doc, nodes[0], @@ -744,8 +744,8 @@ qemuMigrationEatCookie(struct qemud_driver *driver, /* Parse & validate incoming cookie (if any) */ if (cookiein && cookieinlen && cookiein[cookieinlen-1] != '\0') { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Migration cookie was not NULL terminated")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Migration cookie was not NULL terminated")); goto error; } @@ -764,17 +764,17 @@ qemuMigrationEatCookie(struct qemud_driver *driver, if (mig->flags & QEMU_MIGRATION_COOKIE_LOCKSTATE) { if (!mig->lockDriver) { if (virLockManagerPluginUsesState(driver->lockManager)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Missing %s lock state for migration cookie"), - virLockManagerPluginGetName(driver->lockManager)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing %s lock state for migration cookie"), + virLockManagerPluginGetName(driver->lockManager)); goto error; } } else if (STRNEQ(mig->lockDriver, virLockManagerPluginGetName(driver->lockManager))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Source host lock driver %s different from target %s"), - mig->lockDriver, - virLockManagerPluginGetName(driver->lockManager)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Source host lock driver %s different from target %s"), + mig->lockDriver, + virLockManagerPluginGetName(driver->lockManager)); goto error; } } @@ -803,23 +803,23 @@ qemuMigrationIsAllowed(struct qemud_driver *driver, virDomainObjPtr vm, if (vm) { if (qemuProcessAutoDestroyActive(driver, vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is marked for auto destroy")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is marked for auto destroy")); return false; } if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots, NULL, 0))) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("cannot migrate domain with %d snapshots"), - nsnapshots); + virReportError(VIR_ERR_OPERATION_INVALID, + _("cannot migrate domain with %d snapshots"), + nsnapshots); return false; } def = vm->def; } if (def->nhostdevs > 0) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("Domain with assigned host devices cannot be migrated")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("Domain with assigned host devices cannot be migrated")); return false; } @@ -852,9 +852,9 @@ qemuMigrationIsSafe(virDomainDefPtr def) continue; } - qemuReportError(VIR_ERR_MIGRATE_UNSAFE, "%s", - _("Migration may lead to data corruption if disks" - " use cache != none")); + virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s", + _("Migration may lead to data corruption if disks" + " use cache != none")); return false; } } @@ -922,8 +922,8 @@ qemuMigrationUpdateJobStatus(struct qemud_driver *driver, switch (status) { case QEMU_MONITOR_MIGRATION_STATUS_INACTIVE: priv->job.info.type = VIR_DOMAIN_JOB_NONE; - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("%s: %s"), job, _("is not active")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("%s: %s"), job, _("is not active")); break; case QEMU_MONITOR_MIGRATION_STATUS_ACTIVE: @@ -945,14 +945,14 @@ qemuMigrationUpdateJobStatus(struct qemud_driver *driver, case QEMU_MONITOR_MIGRATION_STATUS_ERROR: priv->job.info.type = VIR_DOMAIN_JOB_FAILED; - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("%s: %s"), job, _("unexpectedly failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("%s: %s"), job, _("unexpectedly failed")); break; case QEMU_MONITOR_MIGRATION_STATUS_CANCELLED: priv->job.info.type = VIR_DOMAIN_JOB_CANCELLED; - qemuReportError(VIR_ERR_OPERATION_ABORTED, - _("%s: %s"), job, _("canceled by client")); + virReportError(VIR_ERR_OPERATION_ABORTED, + _("%s: %s"), job, _("canceled by client")); break; } @@ -992,8 +992,8 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm, goto cleanup; if (dconn && virConnectIsAlive(dconn) <= 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("Lost connection to destination host")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Lost connection to destination host")); goto cleanup; } @@ -1158,8 +1158,8 @@ char *qemuMigrationBegin(struct qemud_driver *driver, goto cleanup; if (STRNEQ(def->name, vm->def->name)) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("target domain name doesn't match source name")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("target domain name doesn't match source name")); goto cleanup; } @@ -1371,8 +1371,8 @@ qemuMigrationPrepareAny(struct qemud_driver *driver, */ if (qemuMigrationJobContinue(vm) == 0) { vm = NULL; - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("domain disappeared")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("domain disappeared")); goto cleanup; } @@ -1480,9 +1480,9 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver, goto cleanup; if (STRPREFIX(hostname, "localhost")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("hostname on destination resolved to localhost," - " but migration requires an FQDN")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("hostname on destination resolved to localhost," + " but migration requires an FQDN")); goto cleanup; } @@ -1502,9 +1502,9 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver, * characters in hostname part don't matter. */ if (!STRPREFIX (uri_in, "tcp:")) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("only tcp URIs are supported for KVM/QEMU" - " migrations")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("only tcp URIs are supported for KVM/QEMU" + " migrations")); goto cleanup; } @@ -1526,8 +1526,8 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver, p++; /* definitely has a ':' in it, see above */ this_port = virParseNumber (&p); if (this_port == -1 || p-uri_in != strlen (uri_in)) { - qemuReportError(VIR_ERR_INVALID_ARG, - "%s", _("URI ended with incorrect ':port'")); + virReportError(VIR_ERR_INVALID_ARG, + "%s", _("URI ended with incorrect ':port'")); goto cleanup; } } @@ -1850,10 +1850,10 @@ qemuMigrationRun(struct qemud_driver *driver, if (virLockManagerPluginUsesState(driver->lockManager) && !cookieout) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Migration with lock driver %s requires" - " cookie support"), - virLockManagerPluginGetName(driver->lockManager)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Migration with lock driver %s requires" + " cookie support"), + virLockManagerPluginGetName(driver->lockManager)); return -1; } @@ -1932,8 +1932,8 @@ qemuMigrationRun(struct qemud_driver *driver, ret = -1; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto cleanup; } @@ -2102,8 +2102,8 @@ static int doTunnelMigrate(struct qemud_driver *driver, if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) && !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX) && !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("Source qemu is too old to support tunnelled migration")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Source qemu is too old to support tunnelled migration")); return -1; } @@ -2233,15 +2233,15 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver, * in qemuDomainObjEnterRemoteWithDriver, so check again */ if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto cleanup; } if (!(flags & VIR_MIGRATE_TUNNELLED) && (uri_out == NULL)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("domainMigratePrepare2 did not set uri")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("domainMigratePrepare2 did not set uri")); cancelled = 1; goto finish; } @@ -2378,8 +2378,8 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver, if (!(flags & VIR_MIGRATE_TUNNELLED) && (uri_out == NULL)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("domainMigratePrepare3 did not set uri")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("domainMigratePrepare3 did not set uri")); cancelled = 1; goto finish; } @@ -2529,8 +2529,8 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver, dconn = virConnectOpen(dconnuri); qemuDomainObjExitRemoteWithDriver(driver, vm); if (dconn == NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Failed to connect to remote libvirt URI %s"), dconnuri); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to connect to remote libvirt URI %s"), dconnuri); return -1; } @@ -2550,15 +2550,15 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver, qemuDomainObjExitRemoteWithDriver(driver, vm); if (!p2p) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("Destination libvirt does not support peer-to-peer migration protocol")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("Destination libvirt does not support peer-to-peer migration protocol")); goto cleanup; } /* domain may have been stopped while we were talking to remote daemon */ if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto cleanup; } @@ -2620,8 +2620,8 @@ qemuMigrationPerformJob(struct qemud_driver *driver, goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("domain is not running")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); goto endjob; } @@ -2816,8 +2816,8 @@ qemuMigrationPerform(struct qemud_driver *driver, if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) { if (cookieinlen) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("received unexpected cookie with P2P migration")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("received unexpected cookie with P2P migration")); return -1; } @@ -2827,8 +2827,8 @@ qemuMigrationPerform(struct qemud_driver *driver, v3proto); } else { if (dconnuri) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unexpected dconnuri parameter with non-peer2peer migration")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unexpected dconnuri parameter with non-peer2peer migration")); return -1; } @@ -2863,9 +2863,9 @@ qemuMigrationVPAssociatePortProfiles(virDomainDefPtr def) { def->uuid, VIR_NETDEV_VPORT_PROFILE_OP_MIGRATE_IN_FINISH, false) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Port profile Associate failed for %s"), - net->ifname); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Port profile Associate failed for %s"), + net->ifname); goto err_exit; } VIR_DEBUG("Port profile Associate succeeded for %s", net->ifname); @@ -2943,8 +2943,8 @@ qemuMigrationFinish(struct qemud_driver *driver, */ if (retcode == 0) { if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } @@ -2990,8 +2990,8 @@ qemuMigrationFinish(struct qemud_driver *driver, vm->persistent = 0; } if (!vmdef) - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("can't get vmdef")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("can't get vmdef")); goto endjob; } @@ -3014,8 +3014,8 @@ qemuMigrationFinish(struct qemud_driver *driver, VIR_DOMAIN_RUNNING_MIGRATED, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("resume operation failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("resume operation failed")); /* Need to save the current error, in case shutting * down the process overwrites it */ @@ -3144,8 +3144,8 @@ int qemuMigrationConfirm(struct qemud_driver *driver, VIR_DOMAIN_RUNNING_MIGRATED, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("resume operation failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("resume operation failed")); goto cleanup; } @@ -3214,9 +3214,9 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm, VIR_CGROUP_CONTROLLER_DEVICES)) { if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find cgroup for %s"), - vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find cgroup for %s"), + vm->def->name); goto cleanup; } rc = virCgroupAllowDevicePath(cgroup, path, @@ -3401,7 +3401,7 @@ qemuMigrationJobIsActive(virDomainObjPtr vm, else msg = _("domain '%s' is not being migrated"); - qemuReportError(VIR_ERR_OPERATION_INVALID, msg, vm->def->name); + virReportError(VIR_ERR_OPERATION_INVALID, msg, vm->def->name); return false; } return true; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 42a5d6c..ac78b29 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -286,8 +286,8 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; if (virStrcpyStatic(addr.sun_path, monitor) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Monitor path %s too big for destination"), monitor); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Monitor path %s too big for destination"), monitor); goto error; } @@ -329,8 +329,8 @@ qemuMonitorOpenPty(const char *monitor) int monfd; if ((monfd = open(monitor, O_RDWR)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open monitor path %s"), monitor); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open monitor path %s"), monitor); return -1; } @@ -451,8 +451,8 @@ qemuMonitorIOWrite(qemuMonitorPtr mon) return 0; if (mon->msg->txFD != -1 && !mon->hasSendFD) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Monitor does not support sending of file descriptors")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Monitor does not support sending of file descriptors")); return -1; } @@ -577,9 +577,9 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) { if (mon->fd != fd || mon->watch != watch) { if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) eof = true; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("event from unexpected fd %d!=%d / watch %d!=%d"), - mon->fd, fd, mon->watch, watch); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("event from unexpected fd %d!=%d / watch %d!=%d"), + mon->fd, fd, mon->watch, watch); error = true; } else if (mon->lastError.code != VIR_ERR_OK) { if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) @@ -612,23 +612,23 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) { if (!error && events & VIR_EVENT_HANDLE_HANGUP) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("End of file from monitor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("End of file from monitor")); eof = 1; events &= ~VIR_EVENT_HANDLE_HANGUP; } if (!error && !eof && events & VIR_EVENT_HANDLE_ERROR) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid file descriptor while waiting for monitor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid file descriptor while waiting for monitor")); eof = 1; events &= ~VIR_EVENT_HANDLE_ERROR; } if (!error && events) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unhandled event %d for monitor fd %d"), - events, mon->fd); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unhandled event %d for monitor fd %d"), + events, mon->fd); error = 1; } } @@ -640,8 +640,8 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) { } else { virErrorPtr err = virGetLastError(); if (!err) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Error while processing monitor IO")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while processing monitor IO")); virCopyLastError(&mon->lastError); virResetLastError(); } @@ -698,8 +698,8 @@ qemuMonitorOpen(virDomainObjPtr vm, qemuMonitorPtr mon; if (!cb || !cb->eofNotify) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("EOF notify callback must be supplied")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("EOF notify callback must be supplied")); return NULL; } @@ -709,14 +709,14 @@ qemuMonitorOpen(virDomainObjPtr vm, } if (virMutexInit(&mon->lock) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize monitor mutex")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot initialize monitor mutex")); VIR_FREE(mon); return NULL; } if (virCondInit(&mon->notify) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize monitor condition")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot initialize monitor condition")); virMutexDestroy(&mon->lock); VIR_FREE(mon); return NULL; @@ -739,22 +739,22 @@ qemuMonitorOpen(virDomainObjPtr vm, break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to handle monitor type: %s"), - virDomainChrTypeToString(config->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to handle monitor type: %s"), + virDomainChrTypeToString(config->type)); goto cleanup; } if (mon->fd == -1) goto cleanup; if (virSetCloseExec(mon->fd) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to set monitor close-on-exec flag")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to set monitor close-on-exec flag")); goto cleanup; } if (virSetNonBlock(mon->fd) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to put monitor into non-blocking mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to put monitor into non-blocking mode")); goto cleanup; } @@ -765,8 +765,8 @@ qemuMonitorOpen(virDomainObjPtr vm, VIR_EVENT_HANDLE_READABLE, qemuMonitorIO, mon, qemuMonitorUnwatch)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to register monitor events")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to register monitor events")); goto cleanup; } qemuMonitorRef(mon); @@ -813,8 +813,8 @@ void qemuMonitorClose(qemuMonitorPtr mon) if (mon->lastError.code == VIR_ERR_OK) { virErrorPtr err = virSaveLastError(); - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Qemu monitor was closed")); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Qemu monitor was closed")); virCopyLastError(&mon->lastError); if (err) { virSetError(err); @@ -866,8 +866,8 @@ int qemuMonitorSend(qemuMonitorPtr mon, while (!mon->msg->finished) { if (virCondWait(&mon->notify, &mon->lock) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to wait on monitor condition")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to wait on monitor condition")); goto cleanup; } } @@ -902,8 +902,8 @@ int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon, json_cmd = qemuMonitorUnescapeArg(cmd); if (!json_cmd) { VIR_DEBUG("Could not unescape command: %s", cmd); - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to unescape command")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to unescape command")); goto cleanup; } ret = qemuMonitorJSONHumanCommandWithFd(mon, json_cmd, scm_fd, reply); @@ -1105,8 +1105,8 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon, VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1155,8 +1155,8 @@ qemuMonitorStartCPUs(qemuMonitorPtr mon, VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1175,8 +1175,8 @@ qemuMonitorStopCPUs(qemuMonitorPtr mon) VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1197,8 +1197,8 @@ qemuMonitorGetStatus(qemuMonitorPtr mon, VIR_DEBUG("mon=%p, running=%p, reason=%p", mon, running, reason); if (!mon || !running) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("both monitor and running must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("both monitor and running must not be NULL")); return -1; } @@ -1216,8 +1216,8 @@ int qemuMonitorSystemPowerdown(qemuMonitorPtr mon) VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1235,8 +1235,8 @@ int qemuMonitorSystemReset(qemuMonitorPtr mon) VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1255,8 +1255,8 @@ int qemuMonitorGetCPUInfo(qemuMonitorPtr mon, VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1275,8 +1275,8 @@ int qemuMonitorSetLink(qemuMonitorPtr mon, VIR_DEBUG("mon=%p, name=%p:%s, state=%u", mon, name, name, state); if (!mon || !name) { - qemuReportError(VIR_ERR_INVALID_ARG, - _("monitor || name must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, + _("monitor || name must not be NULL")); return -1; } @@ -1294,8 +1294,8 @@ int qemuMonitorGetVirtType(qemuMonitorPtr mon, VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1314,8 +1314,8 @@ int qemuMonitorGetBalloonInfo(qemuMonitorPtr mon, VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1335,8 +1335,8 @@ int qemuMonitorGetMemoryStats(qemuMonitorPtr mon, VIR_DEBUG("mon=%p stats=%p nstats=%u", mon, stats, nr_stats); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1353,8 +1353,8 @@ qemuMonitorBlockIOStatusToError(const char *status) int st = qemuMonitorBlockIOStatusTypeFromString(status); if (st < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown block IO status: %s"), status); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown block IO status: %s"), status); return -1; } @@ -1382,8 +1382,8 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon) VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return NULL; } @@ -1412,9 +1412,9 @@ qemuMonitorBlockInfoLookup(virHashTablePtr blockInfo, VIR_DEBUG("blockInfo=%p dev=%s", blockInfo, NULLSTR(devname)); if (!(info = virHashLookup(blockInfo, devname))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find info for device '%s'"), - NULLSTR(devname)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find info for device '%s'"), + NULLSTR(devname)); } return info; @@ -1436,8 +1436,8 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon, VIR_DEBUG("mon=%p dev=%s", mon, dev_name); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1472,8 +1472,8 @@ int qemuMonitorGetBlockStatsParamsNumber(qemuMonitorPtr mon, VIR_DEBUG("mon=%p nparams=%p", mon, nparams); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1525,8 +1525,8 @@ int qemuMonitorSetVNCPassword(qemuMonitorPtr mon, mon, password); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1548,9 +1548,9 @@ static const char* qemuMonitorTypeToProtocol(int type) case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: return "spice"; default: - qemuReportError(VIR_ERR_INVALID_ARG, - _("unsupported protocol type %s"), - virDomainGraphicsTypeToString(type)); + virReportError(VIR_ERR_INVALID_ARG, + _("unsupported protocol type %s"), + virDomainGraphicsTypeToString(type)); return NULL; } } @@ -1571,8 +1571,8 @@ int qemuMonitorSetPassword(qemuMonitorPtr mon, mon, protocol, password, action_if_connected); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1603,8 +1603,8 @@ int qemuMonitorExpirePassword(qemuMonitorPtr mon, mon, protocol, expire_time); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1625,8 +1625,8 @@ int qemuMonitorSetBalloon(qemuMonitorPtr mon, VIR_DEBUG("mon=%p newmem=%lu", mon, newmem); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1644,8 +1644,8 @@ int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, int online) VIR_DEBUG("mon=%p cpu=%d online=%d", mon, cpu, online); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1665,8 +1665,8 @@ int qemuMonitorEjectMedia(qemuMonitorPtr mon, VIR_DEBUG("mon=%p dev_name=%s force=%d", mon, dev_name, force); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1688,8 +1688,8 @@ int qemuMonitorChangeMedia(qemuMonitorPtr mon, mon, dev_name, newmedia, format); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1711,8 +1711,8 @@ int qemuMonitorSaveVirtualMemory(qemuMonitorPtr mon, mon, offset, length, path); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1733,8 +1733,8 @@ int qemuMonitorSavePhysicalMemory(qemuMonitorPtr mon, mon, offset, length, path); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1753,8 +1753,8 @@ int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon, VIR_DEBUG("mon=%p bandwidth=%lu", mon, bandwidth); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1773,8 +1773,8 @@ int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon, VIR_DEBUG("mon=%p downtime=%llu", mon, downtime); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1796,8 +1796,8 @@ int qemuMonitorGetMigrationStatus(qemuMonitorPtr mon, VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1824,8 +1824,8 @@ int qemuMonitorMigrateToFd(qemuMonitorPtr mon, mon, fd, flags); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1857,8 +1857,8 @@ int qemuMonitorMigrateToHost(qemuMonitorPtr mon, mon, hostname, port, flags); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1889,8 +1889,8 @@ int qemuMonitorMigrateToCommand(qemuMonitorPtr mon, mon, argv, flags); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -1931,15 +1931,15 @@ int qemuMonitorMigrateToFile(qemuMonitorPtr mon, mon, argv, target, offset, flags); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } if (offset % QEMU_MONITOR_MIGRATE_TO_FILE_BS) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("file offset must be a multiple of %llu"), - QEMU_MONITOR_MIGRATE_TO_FILE_BS); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("file offset must be a multiple of %llu"), + QEMU_MONITOR_MIGRATE_TO_FILE_BS); return -1; } @@ -1996,8 +1996,8 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon, mon, unixfile, flags); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2021,8 +2021,8 @@ int qemuMonitorMigrateCancel(qemuMonitorPtr mon) VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2044,8 +2044,8 @@ int qemuMonitorDumpToFd(qemuMonitorPtr mon, mon, fd, flags, begin, length); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2053,8 +2053,8 @@ int qemuMonitorDumpToFd(qemuMonitorPtr mon, /* We don't have qemuMonitorTextDump(), so we should check mon->json * here. */ - qemuReportError(VIR_ERR_NO_SUPPORT, "%s", - _("dump-guest-memory is not supported in text mode")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("dump-guest-memory is not supported in text mode")); return -1; } @@ -2108,8 +2108,8 @@ int qemuMonitorAddUSBDisk(qemuMonitorPtr mon, VIR_DEBUG("mon=%p path=%s", mon, path); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2129,8 +2129,8 @@ int qemuMonitorAddUSBDeviceExact(qemuMonitorPtr mon, VIR_DEBUG("mon=%p bus=%d dev=%d", mon, bus, dev); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2150,8 +2150,8 @@ int qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr mon, mon, vendor, product); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2173,8 +2173,8 @@ int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon, hostAddr->domain, hostAddr->bus, hostAddr->slot, hostAddr->function); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2196,8 +2196,8 @@ int qemuMonitorAddPCIDisk(qemuMonitorPtr mon, mon, path, bus); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2217,8 +2217,8 @@ int qemuMonitorAddPCINetwork(qemuMonitorPtr mon, VIR_DEBUG("mon=%p nicstr=%s", mon, nicstr); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2239,8 +2239,8 @@ int qemuMonitorRemovePCIDevice(qemuMonitorPtr mon, guestAddr->slot, guestAddr->function); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2261,21 +2261,21 @@ int qemuMonitorSendFileHandle(qemuMonitorPtr mon, mon, fdname, fd); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } if (fd < 0) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("fd must be valid")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("fd must be valid")); return -1; } if (!mon->hasSendFD) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("qemu is not using a unix socket monitor, " - "cannot send fd %s"), fdname); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("qemu is not using a unix socket monitor, " + "cannot send fd %s"), fdname); return -1; } @@ -2299,8 +2299,8 @@ int qemuMonitorCloseFileHandle(qemuMonitorPtr mon, error = virSaveLastError(); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); goto cleanup; } @@ -2330,8 +2330,8 @@ int qemuMonitorAddHostNetwork(qemuMonitorPtr mon, vhostfd, NULLSTR(vhostfd_name)); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2369,8 +2369,8 @@ int qemuMonitorRemoveHostNetwork(qemuMonitorPtr mon, mon, netname); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2394,8 +2394,8 @@ int qemuMonitorAddNetdev(qemuMonitorPtr mon, vhostfd, NULLSTR(vhostfd_name)); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2431,8 +2431,8 @@ int qemuMonitorRemoveNetdev(qemuMonitorPtr mon, mon, alias); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2452,8 +2452,8 @@ int qemuMonitorGetPtyPaths(qemuMonitorPtr mon, mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2473,8 +2473,8 @@ int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2499,8 +2499,8 @@ int qemuMonitorAttachDrive(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2519,8 +2519,8 @@ int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2538,8 +2538,8 @@ int qemuMonitorDriveDel(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2557,8 +2557,8 @@ int qemuMonitorDelDevice(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2580,8 +2580,8 @@ int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2614,8 +2614,8 @@ int qemuMonitorAddDrive(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2635,8 +2635,8 @@ int qemuMonitorSetDrivePassphrase(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2654,8 +2654,8 @@ int qemuMonitorCreateSnapshot(qemuMonitorPtr mon, const char *name) VIR_DEBUG("mon=%p, name=%s",mon,name); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2673,8 +2673,8 @@ int qemuMonitorLoadSnapshot(qemuMonitorPtr mon, const char *name) VIR_DEBUG("mon=%p, name=%s",mon,name); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2692,8 +2692,8 @@ int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const char *name) VIR_DEBUG("mon=%p, name=%s",mon,name); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2718,8 +2718,8 @@ qemuMonitorDiskSnapshot(qemuMonitorPtr mon, virJSONValuePtr actions, mon, actions, device, file, format, reuse); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2728,8 +2728,8 @@ qemuMonitorDiskSnapshot(qemuMonitorPtr mon, virJSONValuePtr actions, reuse); } else { if (actions || STRNEQ(format, "qcow2") || reuse) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("text monitor lacks several snapshot features")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("text monitor lacks several snapshot features")); return -1; } ret = qemuMonitorTextDiskSnapshot(mon, device, file); @@ -2748,8 +2748,8 @@ qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions) if (mon->json) ret = qemuMonitorJSONTransaction(mon, actions); else - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("transaction requires JSON monitor")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("transaction requires JSON monitor")); return ret; } @@ -2808,8 +2808,8 @@ int qemuMonitorScreendump(qemuMonitorPtr mon, VIR_DEBUG("mon=%p, file=%s", mon, file); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG,"%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG,"%s", + _("monitor must not be NULL")); return -1; } @@ -2839,9 +2839,9 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon, /* Convert bandwidth MiB to bytes */ speed = bandwidth; if (speed > ULLONG_MAX / 1024 / 1024) { - qemuReportError(VIR_ERR_OVERFLOW, - _("bandwidth must be less than %llu"), - ULLONG_MAX / 1024 / 1024); + virReportError(VIR_ERR_OVERFLOW, + _("bandwidth must be less than %llu"), + ULLONG_MAX / 1024 / 1024); return -1; } speed <<= 20; @@ -2850,8 +2850,8 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon, ret = qemuMonitorJSONBlockJob(mon, device, base, speed, info, mode, modern); else - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("block jobs require JSON monitor")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("block jobs require JSON monitor")); return ret; } @@ -2950,8 +2950,8 @@ int qemuMonitorOpenGraphics(qemuMonitorPtr mon, int ret; if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } @@ -2976,14 +2976,14 @@ int qemuMonitorSystemWakeup(qemuMonitorPtr mon) VIR_DEBUG("mon=%p", mon); if (!mon) { - qemuReportError(VIR_ERR_INVALID_ARG, "%s", - _("monitor must not be NULL")); + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("monitor must not be NULL")); return -1; } if (!mon->json) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("JSON monitor is required")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("JSON monitor is required")); return -1; } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a99bf60..5c16284 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -147,8 +147,8 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon, goto cleanup; if (obj->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Parsed JSON reply '%s' isn't an object"), line); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parsed JSON reply '%s' isn't an object"), line); goto cleanup; } @@ -168,12 +168,12 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon, obj = NULL; ret = 0; } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected JSON reply '%s'"), line); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected JSON reply '%s'"), line); } } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown JSON reply '%s'"), line); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unknown JSON reply '%s'"), line); } cleanup: @@ -237,8 +237,8 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon, if (!(id = qemuMonitorNextCommandID(mon))) goto cleanup; if (virJSONValueObjectAppendString(cmd, "id", id) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to append command 'id' string")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to append command 'id' string")); goto cleanup; } } @@ -264,8 +264,8 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon, if (ret == 0) { if (!msg.rxObject) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing monitor reply object")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing monitor reply object")); ret = -1; } else { *reply = msg.rxObject; @@ -337,14 +337,14 @@ qemuMonitorJSONCheckError(virJSONValuePtr cmd, /* Only send the user the command name + friendly error */ if (!error) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute QEMU command '%s'"), - qemuMonitorJSONCommandName(cmd)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to execute QEMU command '%s'"), + qemuMonitorJSONCommandName(cmd)); else - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute QEMU command '%s': %s"), - qemuMonitorJSONCommandName(cmd), - qemuMonitorJSONStringifyError(error)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to execute QEMU command '%s': %s"), + qemuMonitorJSONCommandName(cmd), + qemuMonitorJSONStringifyError(error)); VIR_FREE(cmdstr); VIR_FREE(replystr); @@ -355,9 +355,9 @@ qemuMonitorJSONCheckError(virJSONValuePtr cmd, VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s", cmdstr, replystr); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to execute QEMU command '%s'"), - qemuMonitorJSONCommandName(cmd)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to execute QEMU command '%s'"), + qemuMonitorJSONCommandName(cmd)); VIR_FREE(cmdstr); VIR_FREE(replystr); return -1; @@ -415,9 +415,9 @@ qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...) char type; if (strlen(key) < 3) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("argument key '%s' is too short, missing type prefix"), - key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("argument key '%s' is too short, missing type prefix"), + key); goto error; } @@ -434,9 +434,9 @@ qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...) case 's': { char *val = va_arg(args, char *); if (!val) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("argument key '%s' must not have null value"), - key); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("argument key '%s' must not have null value"), + key); goto error; } ret = virJSONValueObjectAppendString(jargs, key, val); @@ -478,8 +478,8 @@ qemuMonitorJSONMakeCommandRaw(bool wrap, const char *cmdname, ...) ret = virJSONValueObjectAppend(jargs, key, val); } break; default: - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unsupported data type '%c' for arg '%s'"), type, key - 2); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unsupported data type '%c' for arg '%s'"), type, key - 2); goto error; } if (ret < 0) @@ -538,8 +538,8 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, const char *firstkeyword) for (i = 0 ; i < nkeywords ; i++) { if (values[i] == NULL) { if (i != 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected empty keyword in %s"), str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected empty keyword in %s"), str); goto error; } else { /* This 3rd arg isn't a typo - the way the parser works is @@ -912,8 +912,8 @@ qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon, goto cleanup; if (!(obj = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("human monitor command was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("human monitor command was missing return data")); goto cleanup; } @@ -1153,14 +1153,14 @@ qemuMonitorJSONGetStatus(qemuMonitorPtr mon, ret = -1; if (!(data = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-status reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("query-status reply was missing return data")); goto cleanup; } if (virJSONValueObjectGetBoolean(data, "running", running) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-status reply was missing running state")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("query-status reply was missing running state")); goto cleanup; } @@ -1256,20 +1256,20 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply, int ncpus; if (!(data = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cpu reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cpu reply was missing return data")); goto cleanup; } if (data->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cpu information was not an array")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cpu information was not an array")); goto cleanup; } if ((ncpus = virJSONValueArraySize(data)) <= 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cpu information was empty")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cpu information was empty")); goto cleanup; } @@ -1283,14 +1283,14 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply, int cpu; int thread; if (!entry) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("character device information was missing array element")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("character device information was missing array element")); goto cleanup; } if (virJSONValueObjectGetNumberInt(entry, "CPU", &cpu) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cpu information was missing cpu number")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cpu information was missing cpu number")); goto cleanup; } @@ -1302,9 +1302,9 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply, } if (cpu != i) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected cpu index %d expecting %d"), - i, cpu); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected cpu index %d expecting %d"), + i, cpu); goto cleanup; } @@ -1371,15 +1371,15 @@ int qemuMonitorJSONGetVirtType(qemuMonitorPtr mon, bool val = false; if (!(data = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info kvm reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info kvm reply was missing return data")); ret = -1; goto cleanup; } if (virJSONValueObjectGetBoolean(data, "enabled", &val) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info kvm reply missing 'running' field")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info kvm reply missing 'running' field")); ret = -1; goto cleanup; } @@ -1428,15 +1428,15 @@ int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon, unsigned long long mem; if (!(data = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing return data")); ret = -1; goto cleanup; } if (virJSONValueObjectGetNumberUlong(data, "actual", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon data")); ret = -1; goto cleanup; } @@ -1483,16 +1483,16 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, unsigned long long mem; if (!(data = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing return data")); ret = -1; goto cleanup; } if (virJSONValueObjectHasKey(data, "actual") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "actual", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon actual")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon actual")); ret = -1; goto cleanup; } @@ -1503,8 +1503,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, if (virJSONValueObjectHasKey(data, "mem_swapped_in") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "mem_swapped_in", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon mem_swapped_in")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon mem_swapped_in")); ret = -1; goto cleanup; } @@ -1514,8 +1514,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, } if (virJSONValueObjectHasKey(data, "mem_swapped_out") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "mem_swapped_out", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon mem_swapped_out")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon mem_swapped_out")); ret = -1; goto cleanup; } @@ -1525,8 +1525,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, } if (virJSONValueObjectHasKey(data, "major_page_faults") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "major_page_faults", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon major_page_faults")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon major_page_faults")); ret = -1; goto cleanup; } @@ -1536,8 +1536,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, } if (virJSONValueObjectHasKey(data, "minor_page_faults") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "minor_page_faults", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon minor_page_faults")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon minor_page_faults")); ret = -1; goto cleanup; } @@ -1547,8 +1547,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, } if (virJSONValueObjectHasKey(data, "free_mem") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "free_mem", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon free_mem")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon free_mem")); ret = -1; goto cleanup; } @@ -1558,8 +1558,8 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, } if (virJSONValueObjectHasKey(data, "total_mem") && (got < nr_stats)) { if (virJSONValueObjectGetNumberUlong(data, "total_mem", &mem) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info balloon reply was missing balloon total_mem")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info balloon reply was missing balloon total_mem")); ret = -1; goto cleanup; } @@ -1604,7 +1604,7 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, devices = virJSONValueObjectGet(reply, "return"); if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("block info reply was missing device list")); goto cleanup; } @@ -1616,14 +1616,14 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, const char *status; if (!dev || dev->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("block info device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block info device entry was not in expected format")); goto cleanup; } if ((thisdev = virJSONValueObjectGetString(dev, "device")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("block info device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block info device entry was not in expected format")); goto cleanup; } @@ -1641,16 +1641,16 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, } if (virJSONValueObjectGetBoolean(dev, "removable", &info->removable) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s value"), - "removable"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s value"), + "removable"); goto cleanup; } if (virJSONValueObjectGetBoolean(dev, "locked", &info->locked) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s value"), - "locked"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s value"), + "locked"); goto cleanup; } @@ -1722,8 +1722,8 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, devices = virJSONValueObjectGet(reply, "return"); if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats reply was missing device list")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats reply was missing device list")); goto cleanup; } @@ -1732,14 +1732,14 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, virJSONValuePtr stats; const char *thisdev; if (!dev || dev->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats device entry was not in expected format")); goto cleanup; } if ((thisdev = virJSONValueObjectGetString(dev, "device")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats device entry was not in expected format")); goto cleanup; } @@ -1756,20 +1756,20 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, found = 1; if ((stats = virJSONValueObjectGet(dev, "stats")) == NULL || stats->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats stats entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats stats entry was not in expected format")); goto cleanup; } if (virJSONValueObjectGetNumberLong(stats, "rd_bytes", rd_bytes) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "rd_bytes"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "rd_bytes"); goto cleanup; } if (virJSONValueObjectGetNumberLong(stats, "rd_operations", rd_req) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), "rd_operations"); goto cleanup; } @@ -1777,55 +1777,55 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon, virJSONValueObjectHasKey(stats, "rd_total_time_ns") && (virJSONValueObjectGetNumberLong(stats, "rd_total_time_ns", rd_total_times) < 0)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "rd_total_time_ns"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "rd_total_time_ns"); goto cleanup; } if (virJSONValueObjectGetNumberLong(stats, "wr_bytes", wr_bytes) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "wr_bytes"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "wr_bytes"); goto cleanup; } if (virJSONValueObjectGetNumberLong(stats, "wr_operations", wr_req) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "wr_operations"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "wr_operations"); goto cleanup; } if (wr_total_times && virJSONValueObjectHasKey(stats, "wr_total_time_ns") && (virJSONValueObjectGetNumberLong(stats, "wr_total_time_ns", wr_total_times) < 0)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "wr_total_time_ns"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "wr_total_time_ns"); goto cleanup; } if (flush_req && virJSONValueObjectHasKey(stats, "flush_operations") && (virJSONValueObjectGetNumberLong(stats, "flush_operations", flush_req) < 0)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "flush_operations"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "flush_operations"); goto cleanup; } if (flush_total_times && virJSONValueObjectHasKey(stats, "flush_total_time_ns") && (virJSONValueObjectGetNumberLong(stats, "flush_total_time_ns", flush_total_times) < 0)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "flush_total_time_ns"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "flush_total_time_ns"); goto cleanup; } } if (!found) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find statistics for device '%s'"), dev_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find statistics for device '%s'"), dev_name); goto cleanup; } ret = 0; @@ -1861,23 +1861,23 @@ int qemuMonitorJSONGetBlockStatsParamsNumber(qemuMonitorPtr mon, devices = virJSONValueObjectGet(reply, "return"); if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats reply was missing device list")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats reply was missing device list")); goto cleanup; } dev = virJSONValueArrayGet(devices, 0); if (!dev || dev->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats device entry was not in expected format")); goto cleanup; } if ((stats = virJSONValueObjectGet(dev, "stats")) == NULL || stats->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats stats entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats stats entry was not in expected format")); goto cleanup; } @@ -1936,8 +1936,8 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon, devices = virJSONValueObjectGet(reply, "return"); if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats reply was missing device list")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats reply was missing device list")); goto cleanup; } @@ -1947,14 +1947,14 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon, virJSONValuePtr parent; const char *thisdev; if (!dev || dev->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats device entry was not in expected format")); goto cleanup; } if ((thisdev = virJSONValueObjectGetString(dev, "device")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats device entry was not in expected format")); goto cleanup; } @@ -1971,29 +1971,29 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon, found = 1; if ((parent = virJSONValueObjectGet(dev, "parent")) == NULL || parent->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats parent entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats parent entry was not in expected format")); goto cleanup; } if ((stats = virJSONValueObjectGet(parent, "stats")) == NULL || stats->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats stats entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("blockstats stats entry was not in expected format")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(stats, "wr_highest_offset", extent) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot read %s statistic"), - "wr_highest_offset"); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot read %s statistic"), + "wr_highest_offset"); goto cleanup; } } if (!found) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find statistics for device '%s'"), dev_name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find statistics for device '%s'"), dev_name); goto cleanup; } ret = 0; @@ -2373,48 +2373,48 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply, unsigned long long t; if (!(ret = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info migration reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info migration reply was missing return data")); return -1; } if (!(statusstr = virJSONValueObjectGetString(ret, "status"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("info migration reply was missing return status")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("info migration reply was missing return status")); return -1; } if ((*status = qemuMonitorMigrationStatusTypeFromString(statusstr)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected migration status in %s"), statusstr); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected migration status in %s"), statusstr); return -1; } if (*status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE) { virJSONValuePtr ram = virJSONValueObjectGet(ret, "ram"); if (!ram) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but no RAM info was set")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but no RAM info was set")); return -1; } if (virJSONValueObjectGetNumberUlong(ram, "transferred", transferred) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but RAM 'transferred' " - "data was missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'transferred' " + "data was missing")); return -1; } if (virJSONValueObjectGetNumberUlong(ram, "remaining", remaining) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but RAM 'remaining' " - "data was missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'remaining' " + "data was missing")); return -1; } if (virJSONValueObjectGetNumberUlong(ram, "total", total) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("migration was active, but RAM 'total' " - "data was missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'total' " + "data was missing")); return -1; } @@ -2424,23 +2424,23 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply, } if (virJSONValueObjectGetNumberUlong(disk, "transferred", &t) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("disk migration was active, but 'transferred' " - "data was missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk migration was active, but 'transferred' " + "data was missing")); return -1; } *transferred += t; if (virJSONValueObjectGetNumberUlong(disk, "remaining", &t) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("disk migration was active, but 'remaining' " - "data was missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk migration was active, but 'remaining' " + "data was missing")); return -1; } *remaining += t; if (virJSONValueObjectGetNumberUlong(disk, "total", &t) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("disk migration was active, but 'total' " - "data was missing")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("disk migration was active, but 'total' " + "data was missing")); return -1; } *total += t; @@ -2601,8 +2601,8 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon, int qemuMonitorJSONAddUSBDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED, const char *path ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("usb_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("usb_add not supported in JSON mode")); return -1; } @@ -2611,8 +2611,8 @@ int qemuMonitorJSONAddUSBDeviceExact(qemuMonitorPtr mon ATTRIBUTE_UNUSED, int bus ATTRIBUTE_UNUSED, int dev ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("usb_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("usb_add not supported in JSON mode")); return -1; } @@ -2621,8 +2621,8 @@ int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon ATTRIBUTE_UNUSED, int vendor ATTRIBUTE_UNUSED, int product ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("usb_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("usb_add not supported in JSON mode")); return -1; } @@ -2631,8 +2631,8 @@ int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainDevicePCIAddress *hostAddr ATTRIBUTE_UNUSED, virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("pci_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("pci_add not supported in JSON mode")); return -1; } @@ -2642,8 +2642,8 @@ int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED, const char *bus ATTRIBUTE_UNUSED, virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("pci_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("pci_add not supported in JSON mode")); return -1; } @@ -2652,8 +2652,8 @@ int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon ATTRIBUTE_UNUSED, const char *nicstr ATTRIBUTE_UNUSED, virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("pci_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("pci_add not supported in JSON mode")); return -1; } @@ -2661,8 +2661,8 @@ int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon ATTRIBUTE_UNUSED, int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("pci_del not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("pci_del not supported in JSON mode")); return -1; } @@ -2833,14 +2833,14 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply, int i; if (!(data = virJSONValueObjectGet(reply, "return"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("character device reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("character device reply was missing return data")); goto cleanup; } if (data->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("character device information was not an array")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("character device information was not an array")); goto cleanup; } @@ -2849,20 +2849,20 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply, const char *type; const char *id; if (!entry) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("character device information was missing array element")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("character device information was missing array element")); goto cleanup; } if (!(type = virJSONValueObjectGetString(entry, "filename"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("character device information was missing filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("character device information was missing filename")); goto cleanup; } if (!(id = virJSONValueObjectGetString(entry, "label"))) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("character device information was missing filename")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("character device information was missing filename")); goto cleanup; } @@ -2874,8 +2874,8 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply, } if (virHashAddEntry(paths, id, path) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to save chardev path '%s'"), path); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to save chardev path '%s'"), path); VIR_FREE(path); goto cleanup; } @@ -2918,8 +2918,8 @@ int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon ATTRIBUTE_UNUSED, const char *bus ATTRIBUTE_UNUSED, virDomainDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("pci_add not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("pci_add not supported in JSON mode")); return -1; } @@ -2932,20 +2932,20 @@ qemuMonitorJSONGetGuestDriveAddress(virJSONValuePtr reply, addr = virJSONValueObjectGet(reply, "return"); if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("drive_add reply was missing device address")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("drive_add reply was missing device address")); return -1; } if (virJSONValueObjectGetNumberUint(addr, "bus", &driveAddr->bus) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("drive_add reply was missing device bus number")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("drive_add reply was missing device bus number")); return -1; } if (virJSONValueObjectGetNumberUint(addr, "unit", &driveAddr->unit) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("drive_add reply was missing device unit number")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("drive_add reply was missing device unit number")); return -1; } @@ -2995,8 +2995,8 @@ int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon, int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon ATTRIBUTE_UNUSED, qemuMonitorPCIAddress **addrs ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-pci not supported in JSON mode")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("query-pci not supported in JSON mode")); return -1; } @@ -3341,9 +3341,9 @@ int qemuMonitorJSONArbitraryCommand(qemuMonitorPtr mon, if (hmp) { if (!qemuMonitorCheckHMP(mon, NULL)) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("HMP passthrough is not supported by qemu" - " process; only QMP commands can be used")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("HMP passthrough is not supported by qemu" + " process; only QMP commands can be used")); return -1; } return qemuMonitorJSONHumanCommandWithFd(mon, cmd_str, -1, reply_str); @@ -3441,8 +3441,8 @@ static int qemuMonitorJSONGetBlockJobInfoOne(virJSONValuePtr entry, unsigned long long speed_bytes; if ((this_dev = virJSONValueObjectGetString(entry, "device")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("entry was missing 'device'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("entry was missing 'device'")); return -1; } if (!STREQ(this_dev, device)) @@ -3450,8 +3450,8 @@ static int qemuMonitorJSONGetBlockJobInfoOne(virJSONValuePtr entry, type = virJSONValueObjectGetString(entry, "type"); if (!type) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("entry was missing 'type'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("entry was missing 'type'")); return -1; } if (STREQ(type, "stream")) @@ -3460,21 +3460,21 @@ static int qemuMonitorJSONGetBlockJobInfoOne(virJSONValuePtr entry, info->type = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN; if (virJSONValueObjectGetNumberUlong(entry, "speed", &speed_bytes) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("entry was missing 'speed'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("entry was missing 'speed'")); return -1; } info->bandwidth = speed_bytes / 1024ULL / 1024ULL; if (virJSONValueObjectGetNumberUlong(entry, "offset", &info->cur) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("entry was missing 'offset'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("entry was missing 'offset'")); return -1; } if (virJSONValueObjectGetNumberUlong(entry, "len", &info->end) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("entry was missing 'len'")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("entry was missing 'len'")); return -1; } return 0; @@ -3495,28 +3495,28 @@ static int qemuMonitorJSONGetBlockJobInfo(virJSONValuePtr reply, return -1; if ((data = virJSONValueObjectGet(reply, "return")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("reply was missing return data")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("reply was missing return data")); return -1; } if (data->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unrecognized format of block job information")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unrecognized format of block job information")); return -1; } if ((nr_results = virJSONValueArraySize(data)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to determine array size")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to determine array size")); return -1; } for (i = 0; i < nr_results; i++) { virJSONValuePtr entry = virJSONValueArrayGet(data, i); if (!entry) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing array element")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing array element")); return -1; } if (qemuMonitorJSONGetBlockJobInfoOne(entry, device, info) == 0) @@ -3543,14 +3543,14 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon, const char *cmd_name = NULL; if (base && (mode != BLOCK_JOB_PULL || !modern)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("only modern block pull supports base: %s"), base); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("only modern block pull supports base: %s"), base); return -1; } if (speed && mode == BLOCK_JOB_PULL && !modern) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("only modern block pull supports speed: %llu"), - speed); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("only modern block pull supports speed: %llu"), + speed); return -1; } @@ -3593,22 +3593,22 @@ qemuMonitorJSONBlockJob(qemuMonitorPtr mon, if (ret == 0 && virJSONValueObjectHasKey(reply, "error")) { ret = -1; if (qemuMonitorJSONHasError(reply, "DeviceNotActive")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("No active operation on device: %s"), - device); + virReportError(VIR_ERR_OPERATION_INVALID, + _("No active operation on device: %s"), + device); } else if (qemuMonitorJSONHasError(reply, "DeviceInUse")){ - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Device %s in use"), device); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Device %s in use"), device); } else if (qemuMonitorJSONHasError(reply, "NotSupported")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Operation is not supported for device: %s"), - device); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Operation is not supported for device: %s"), + device); } else if (qemuMonitorJSONHasError(reply, "CommandNotFound")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Command '%s' is not found"), cmd_name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Command '%s' is not found"), cmd_name); } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unexpected error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unexpected error")); } } @@ -3661,8 +3661,8 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result, io_throttle = virJSONValueObjectGet(result, "return"); if (!io_throttle || io_throttle->type != VIR_JSON_TYPE_ARRAY) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _(" block_io_throttle reply was missing device list")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _(" block_io_throttle reply was missing device list")); goto cleanup; } @@ -3672,14 +3672,14 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result, const char *current_dev; if (!temp_dev || temp_dev->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("block_io_throttle device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block_io_throttle device entry was not in expected format")); goto cleanup; } if ((current_dev = virJSONValueObjectGetString(temp_dev, "device")) == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("block_io_throttle device entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block_io_throttle device entry was not in expected format")); goto cleanup; } @@ -3692,53 +3692,53 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr result, found = 1; if ((inserted = virJSONValueObjectGet(temp_dev, "inserted")) == NULL || inserted->type != VIR_JSON_TYPE_OBJECT) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("block_io_throttle inserted entry was not in expected format")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("block_io_throttle inserted entry was not in expected format")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(inserted, "bps", &reply->total_bytes_sec) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot read total_bytes_sec")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot read total_bytes_sec")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(inserted, "bps_rd", &reply->read_bytes_sec) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot read read_bytes_sec")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot read read_bytes_sec")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(inserted, "bps_wr", &reply->write_bytes_sec) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot read write_bytes_sec")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot read write_bytes_sec")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(inserted, "iops", &reply->total_iops_sec) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot read total_iops_sec")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot read total_iops_sec")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(inserted, "iops_rd", &reply->read_iops_sec) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot read read_iops_sec")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot read read_iops_sec")); goto cleanup; } if (virJSONValueObjectGetNumberUlong(inserted, "iops_wr", &reply->write_iops_sec) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot read write_iops_sec")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot read write_iops_sec")); goto cleanup; } break; } if (!found) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find throttling info for device '%s'"), - device); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find throttling info for device '%s'"), + device); goto cleanup; } ret = 0; @@ -3771,14 +3771,14 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon, if (ret == 0 && virJSONValueObjectHasKey(result, "error")) { if (qemuMonitorJSONHasError(result, "DeviceNotActive")) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("No active operation on device: %s"), device); + virReportError(VIR_ERR_OPERATION_INVALID, + _("No active operation on device: %s"), device); else if (qemuMonitorJSONHasError(result, "NotSupported")) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Operation is not supported for device: %s"), device); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Operation is not supported for device: %s"), device); else - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unexpected error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unexpected error")); ret = -1; } @@ -3804,14 +3804,14 @@ int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon, if (ret == 0 && virJSONValueObjectHasKey(result, "error")) { if (qemuMonitorJSONHasError(result, "DeviceNotActive")) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("No active operation on device: %s"), device); + virReportError(VIR_ERR_OPERATION_INVALID, + _("No active operation on device: %s"), device); else if (qemuMonitorJSONHasError(result, "NotSupported")) - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Operation is not supported for device: %s"), device); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Operation is not supported for device: %s"), device); else - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unexpected error")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unexpected error")); ret = -1; } diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 086b06b..c7de172 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -173,8 +173,8 @@ int qemuMonitorTextIOProcess(qemuMonitorPtr mon ATTRIBUTE_UNUSED, /* Handled, so skip forward over password prompt */ start = passwd; } else { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Password request seen, but no handler available")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Password request seen, but no handler available")); return -1; } } @@ -321,9 +321,9 @@ qemuMonitorSendDiskPassphrase(qemuMonitorPtr mon, pathStart = strstr(data, DISK_ENCRYPTION_PREFIX); pathEnd = strstr(data, DISK_ENCRYPTION_POSTFIX); if (!pathStart || !pathEnd || pathStart >= pathEnd) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to extract disk path from %s"), - data); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to extract disk path from %s"), + data); return -1; } @@ -389,8 +389,8 @@ qemuMonitorTextStopCPUs(qemuMonitorPtr mon) { char *info; if (qemuMonitorHMPCommand(mon, "stop", &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot stop CPU execution")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot stop CPU execution")); return -1; } VIR_FREE(info); @@ -410,8 +410,8 @@ qemuMonitorTextGetStatus(qemuMonitorPtr mon, *reason = VIR_DOMAIN_PAUSED_UNKNOWN; if (qemuMonitorHMPCommand(mon, "info status", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot get status info")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot get status info")); return -1; } @@ -433,8 +433,8 @@ qemuMonitorTextGetStatus(qemuMonitorPtr mon, *reason = qemuMonitorVMStatusToPausedReason(status); *running = false; } else { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("unexpected reply from info status: %s"), reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("unexpected reply from info status: %s"), reply); goto cleanup; } @@ -450,8 +450,8 @@ int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon) { char *info; if (qemuMonitorHMPCommand(mon, "system_powerdown", &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("system shutdown operation failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("system shutdown operation failed")); return -1; } VIR_FREE(info); @@ -474,23 +474,23 @@ int qemuMonitorTextSetLink(qemuMonitorPtr mon, const char *name, enum virDomainN goto error; } if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("set_link operation failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("set_link operation failed")); goto error; } /* check if set_link command is supported */ if (strstr(info, "\nunknown ")) { - qemuReportError(VIR_ERR_NO_SUPPORT, - "%s", - _("\'set_link\' not supported by this qemu")); + virReportError(VIR_ERR_NO_SUPPORT, + "%s", + _("\'set_link\' not supported by this qemu")); goto error; } /* check if qemu didn't reject device name */ if (strstr(info, "\nDevice ")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("device name rejected")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("device name rejected")); goto error; } @@ -509,8 +509,8 @@ int qemuMonitorTextSystemReset(qemuMonitorPtr mon) { char *info; if (qemuMonitorHMPCommand(mon, "system_reset", &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("system reset operation failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("system reset operation failed")); return -1; } VIR_FREE(info); @@ -528,8 +528,8 @@ int qemuMonitorTextGetCPUInfo(qemuMonitorPtr mon, size_t ncpupids = 0; if (qemuMonitorHMPCommand(mon, "info cpus", &qemucpus) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot run monitor command to fetch CPU thread info")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot run monitor command to fetch CPU thread info")); return -1; } @@ -609,8 +609,8 @@ int qemuMonitorTextGetVirtType(qemuMonitorPtr mon, *virtType = VIR_DOMAIN_VIRT_QEMU; if (qemuMonitorHMPCommand(mon, "info kvm", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not query kvm status")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not query kvm status")); return -1; } @@ -716,8 +716,8 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon, char *offset; if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not query memory balloon allocation")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not query memory balloon allocation")); return -1; } @@ -726,14 +726,14 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon, struct _virDomainMemoryStat stats[1]; if (qemuMonitorParseBalloonInfo(offset, stats, 1) == 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected balloon information '%s'"), reply); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected balloon information '%s'"), reply); goto cleanup; } if (stats[0].tag != VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected balloon information '%s'"), reply); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected balloon information '%s'"), reply); goto cleanup; } @@ -760,8 +760,8 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon, char *offset; if (qemuMonitorHMPCommand(mon, "info balloon", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not query memory balloon statistics")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not query memory balloon statistics")); return -1; } @@ -787,15 +787,15 @@ int qemuMonitorTextGetBlockInfo(qemuMonitorPtr mon, int tmp; if (qemuMonitorHMPCommand(mon, "info block", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("info block command failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("info block command failed")); goto cleanup; } if (strstr(reply, "\ninfo ")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", - _("info block not supported by this qemu")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", + _("info block not supported by this qemu")); goto cleanup; } @@ -906,8 +906,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, int devnamelen = strlen(dev_name); if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("'info blockstats' command failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("'info blockstats' command failed")); goto cleanup; } @@ -917,9 +917,9 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, * to detect if qemu supports the command. */ if (strstr(info, "\ninfo ")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", - _("'info blockstats' not supported by this qemu")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", + _("'info blockstats' not supported by this qemu")); goto cleanup; } @@ -1016,8 +1016,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon, } /* If we reach here then the device was not found. */ - qemuReportError (VIR_ERR_INVALID_ARG, - _("no stats found for device %s"), dev_name); + virReportError (VIR_ERR_INVALID_ARG, + _("no stats found for device %s"), dev_name); cleanup: VIR_FREE(info); @@ -1033,8 +1033,8 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon, const char *p, *eol; if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("'info blockstats' command failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("'info blockstats' command failed")); goto cleanup; } @@ -1044,9 +1044,9 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon, * to detect if qemu supports the command. */ if (strstr(info, "\ninfo ")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", - _("'info blockstats' not supported by this qemu")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", + _("'info blockstats' not supported by this qemu")); goto cleanup; } @@ -1096,8 +1096,8 @@ int qemuMonitorTextGetBlockExtent(qemuMonitorPtr mon ATTRIBUTE_UNUSED, const char *dev_name ATTRIBUTE_UNUSED, unsigned long long *extent ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to query block extent with this QEMU")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unable to query block extent with this QEMU")); return -1; } @@ -1117,8 +1117,8 @@ int qemuMonitorTextBlockResize(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to resize block")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to resize block")); goto cleanup; } @@ -1173,8 +1173,8 @@ int qemuMonitorTextSetVNCPassword(qemuMonitorPtr mon, qemuMonitorSendVNCPassphrase, (char *)password, -1, &info) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("setting VNC password failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("setting VNC password failed")); return -1; } VIR_FREE(info); @@ -1198,8 +1198,8 @@ int qemuMonitorTextSetPassword(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("setting password failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("setting password failed")); goto cleanup; } @@ -1232,8 +1232,8 @@ int qemuMonitorTextExpirePassword(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("expiring password failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("expiring password failed")); goto cleanup; } @@ -1271,8 +1271,8 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not balloon memory allocation")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not balloon memory allocation")); VIR_FREE(cmd); return -1; } @@ -1308,8 +1308,8 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online) } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not change CPU online status")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not change CPU online status")); VIR_FREE(cmd); return -1; } @@ -1343,8 +1343,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("could not eject media on %s"), dev_name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("could not eject media on %s"), dev_name); goto cleanup; } @@ -1352,8 +1352,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon, * device not found, device is locked ... * No message is printed on success it seems */ if (c_strcasestr(reply, "device ")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("could not eject media on %s: %s"), dev_name, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("could not eject media on %s: %s"), dev_name, reply); goto cleanup; } @@ -1387,8 +1387,8 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("could not change media on %s"), dev_name); + virReportError(VIR_ERR_OPERATION_FAILED, + _("could not change media on %s"), dev_name); goto cleanup; } @@ -1396,15 +1396,15 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon, * device not found, device is locked ... * No message is printed on success it seems */ if (c_strcasestr(reply, "device ")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("could not change media on %s: %s"), dev_name, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("could not change media on %s: %s"), dev_name, reply); goto cleanup; } /* Could not open message indicates bad filename */ if (strstr(reply, "Could not open ")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("could not change media on %s: %s"), dev_name, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("could not change media on %s: %s"), dev_name, reply); goto cleanup; } @@ -1439,8 +1439,8 @@ static int qemuMonitorTextSaveMemory(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("could not save memory region to '%s'"), path); + virReportError(VIR_ERR_OPERATION_FAILED, + _("could not save memory region to '%s'"), path); goto cleanup; } @@ -1486,8 +1486,8 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not restrict migration speed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not restrict migration speed")); goto cleanup; } @@ -1513,8 +1513,8 @@ int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("could not set maximum migration downtime")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("could not set maximum migration downtime")); goto cleanup; } @@ -1554,8 +1554,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, *total = 0; if (qemuMonitorHMPCommand(mon, "info migrate", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot query migration status")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot query migration status")); return -1; } @@ -1563,15 +1563,15 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_PREFIX); end = strchr(tmp, '\r'); if (end == NULL) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected migration status in %s"), reply); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected migration status in %s"), reply); goto cleanup; } *end = '\0'; if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected migration status in %s"), reply); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected migration status in %s"), reply); goto cleanup; } @@ -1583,9 +1583,9 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_TRANSFER_PREFIX); if (virStrToLong_ull(tmp, &end, 10, transferred) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse migration data transferred " - "statistic %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse migration data transferred " + "statistic %s"), tmp); goto cleanup; } *transferred *= 1024; @@ -1596,9 +1596,9 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_REMAINING_PREFIX); if (virStrToLong_ull(tmp, &end, 10, remaining) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse migration data remaining " - "statistic %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse migration data remaining " + "statistic %s"), tmp); goto cleanup; } *remaining *= 1024; @@ -1609,9 +1609,9 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_TOTAL_PREFIX); if (virStrToLong_ull(tmp, &end, 10, total) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse migration data total " - "statistic %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse migration data total " + "statistic %s"), tmp); goto cleanup; } *total *= 1024; @@ -1625,9 +1625,9 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_DISK_TRANSFER_PREFIX); if (virStrToLong_ull(tmp, &end, 10, &disk_transferred) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse disk migration data " - "transferred statistic %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse disk migration data " + "transferred statistic %s"), tmp); goto cleanup; } *transferred += disk_transferred * 1024; @@ -1638,9 +1638,9 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_DISK_REMAINING_PREFIX); if (virStrToLong_ull(tmp, &end, 10, &disk_remaining) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse disk migration data remaining " - "statistic %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse disk migration data remaining " + "statistic %s"), tmp); goto cleanup; } *remaining += disk_remaining * 1024; @@ -1651,9 +1651,9 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon, tmp += strlen(MIGRATION_DISK_TOTAL_PREFIX); if (virStrToLong_ull(tmp, &end, 10, &disk_total) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse disk migration data total " - "statistic %s"), tmp); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse disk migration data total " + "statistic %s"), tmp); goto cleanup; } *total += disk_total * 1024; @@ -1705,22 +1705,22 @@ int qemuMonitorTextMigrate(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to start migration to %s"), dest); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to start migration to %s"), dest); goto cleanup; } /* Now check for "fail" in the output string */ if (strstr(info, "fail") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("migration to '%s' failed: %s"), dest, info); + virReportError(VIR_ERR_OPERATION_FAILED, + _("migration to '%s' failed: %s"), dest, info); goto cleanup; } /* If the command isn't supported then qemu prints: * unknown command: migrate" */ if (strstr(info, "unknown command:")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("migration to '%s' not supported by this qemu: %s"), dest, info); + virReportError(VIR_ERR_OPERATION_INVALID, + _("migration to '%s' not supported by this qemu: %s"), dest, info); goto cleanup; } @@ -1740,8 +1740,8 @@ int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon) char *info = NULL; if (qemuMonitorHMPCommand(mon, "migrate_cancel", &info) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot run monitor command to cancel migration")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot run monitor command to cancel migration")); return -1; } VIR_FREE(info); @@ -1769,8 +1769,8 @@ int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon, if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) { VIR_FREE(cmd); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot run monitor command to relocate graphics client")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot run monitor command to relocate graphics client")); return -1; } VIR_FREE(cmd); @@ -1800,16 +1800,16 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &info) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot run monitor command to add usb disk")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot run monitor command to add usb disk")); goto cleanup; } /* If the command failed qemu prints: * Could not add ... */ if (strstr(info, "Could not add ")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("unable to add USB disk %s: %s"), path, info); + virReportError(VIR_ERR_OPERATION_FAILED, + _("unable to add USB disk %s: %s"), path, info); goto cleanup; } @@ -1836,16 +1836,16 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot attach usb device")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot attach usb device")); goto cleanup; } /* If the command failed qemu prints: * Could not add ... */ if (strstr(reply, "Could not add ")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("adding usb device failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("adding usb device failed")); goto cleanup; } @@ -1977,20 +1977,20 @@ int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot attach host pci device")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot attach host pci device")); goto cleanup; } if (strstr(reply, "invalid type: host")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("PCI device assignment is not supported by this version of qemu")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("PCI device assignment is not supported by this version of qemu")); goto cleanup; } if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("parsing pci_add reply failed: %s"), reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("parsing pci_add reply failed: %s"), reply); goto cleanup; } @@ -2028,8 +2028,8 @@ try_command: } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot attach %s disk %s"), bus, path); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot attach %s disk %s"), bus, path); goto cleanup; } @@ -2041,8 +2041,8 @@ try_command: goto try_command; } - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("adding %s disk failed %s: %s"), bus, path, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("adding %s disk failed %s: %s"), bus, path, reply); goto cleanup; } @@ -2070,14 +2070,14 @@ int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to add NIC with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to add NIC with '%s'"), cmd); goto cleanup; } if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("parsing pci_add reply failed: %s"), reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("parsing pci_add reply failed: %s"), reply); goto cleanup; } @@ -2114,8 +2114,8 @@ try_command: } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("failed to remove PCI device")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("failed to remove PCI device")); goto cleanup; } @@ -2133,9 +2133,9 @@ try_command: * nothing is printed on success */ if (strstr(reply, "invalid slot") || strstr(reply, "Invalid pci address")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"), - guestAddr->domain, guestAddr->bus, guestAddr->slot, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"), + guestAddr->domain, guestAddr->bus, guestAddr->slot, reply); goto cleanup; } @@ -2162,23 +2162,23 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon, } if (qemuMonitorHMPCommandWithFd(mon, cmd, fd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to pass fd to qemu with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to pass fd to qemu with '%s'"), cmd); goto cleanup; } /* If the command isn't supported then qemu prints: * unknown command: getfd" */ if (strstr(reply, "unknown command:")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("qemu does not support sending of file handles: %s"), - reply); + virReportError(VIR_ERR_OPERATION_INVALID, + _("qemu does not support sending of file handles: %s"), + reply); goto cleanup; } if (STRNEQ(reply, "")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to send file handle '%s': %s"), + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to send file handle '%s': %s"), fdname, reply); goto cleanup; } @@ -2205,17 +2205,17 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to close fd in qemu with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to close fd in qemu with '%s'"), cmd); goto cleanup; } /* If the command isn't supported then qemu prints: * unknown command: getfd" */ if (strstr(reply, "unknown command:")) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("qemu does not support closing of file handles: %s"), - reply); + virReportError(VIR_ERR_OPERATION_INVALID, + _("qemu does not support closing of file handles: %s"), + reply); goto cleanup; } @@ -2241,15 +2241,15 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to add host net with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to add host net with '%s'"), cmd); goto cleanup; } if (STRNEQ(reply, "")) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to add host net: %s"), - reply); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to add host net: %s"), + reply); goto cleanup; } @@ -2276,8 +2276,8 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to remove host network in qemu with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to remove host network in qemu with '%s'"), cmd); goto cleanup; } @@ -2305,8 +2305,8 @@ int qemuMonitorTextAddNetdev(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to add netdev with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to add netdev with '%s'"), cmd); goto cleanup; } @@ -2334,8 +2334,8 @@ int qemuMonitorTextRemoveNetdev(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to remove netdev in qemu with '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to remove netdev in qemu with '%s'"), cmd); goto cleanup; } @@ -2369,8 +2369,8 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon, int ret = -1; if (qemuMonitorHMPCommand(mon, "info chardev", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("failed to retrieve chardev info in qemu with 'info chardev'")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("failed to retrieve chardev info in qemu with 'info chardev'")); return -1; } @@ -2420,9 +2420,9 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon, } if (virHashAddEntry(paths, id, path) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to save chardev path '%s'"), - path); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to save chardev path '%s'"), + path); VIR_FREE(path); goto cleanup; } @@ -2454,8 +2454,8 @@ try_command: } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot attach %s disk controller"), bus); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot attach %s disk controller"), bus); goto cleanup; } @@ -2467,8 +2467,8 @@ try_command: goto try_command; } - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("adding %s disk controller failed: %s"), bus, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("adding %s disk controller failed: %s"), bus, reply); goto cleanup; } @@ -2553,14 +2553,14 @@ try_command: } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to attach drive '%s'"), drivestr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to attach drive '%s'"), drivestr); goto cleanup; } if (strstr(reply, "unknown command:")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("drive hotplug is not supported")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("drive hotplug is not supported")); goto cleanup; } @@ -2571,8 +2571,8 @@ try_command: tryOldSyntax = 1; goto try_command; } - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("adding %s disk failed: %s"), drivestr, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("adding %s disk failed: %s"), drivestr, reply); goto cleanup; } @@ -2626,8 +2626,8 @@ cleanup: (p) += strlen(lbl); #define GET_INT(p, base, val) \ if (virStrToLong_ui((p), &(p), (base), &(val)) < 0) { \ - qemuReportError(VIR_ERR_OPERATION_FAILED, \ - _("cannot parse value for %s"), #val); \ + virReportError(VIR_ERR_OPERATION_FAILED, \ + _("cannot parse value for %s"), #val); \ break; \ } #define SKIP_SPACE(p) \ @@ -2644,8 +2644,8 @@ int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon, *retaddrs = NULL; if (qemuMonitorHMPCommand(mon, "info pci", &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("cannot query PCI addresses")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("cannot query PCI addresses")); return -1; } @@ -2737,14 +2737,14 @@ int qemuMonitorTextDelDevice(qemuMonitorPtr mon, VIR_DEBUG("TextDelDevice devalias=%s", devalias); if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot detach %s device"), devalias); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot detach %s device"), devalias); goto cleanup; } if (STRNEQ(reply, "")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("detaching %s device failed: %s"), devalias, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("detaching %s device failed: %s"), devalias, reply); goto cleanup; } @@ -2777,8 +2777,8 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot attach %s device"), devicestr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot attach %s device"), devicestr); goto cleanup; } @@ -2793,8 +2793,8 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon, /* Otherwise, if the command succeeds, no output is sent. So * any non-empty string shows an error */ if (STRNEQ(reply, "")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("adding %s device failed: %s"), devicestr, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("adding %s device failed: %s"), devicestr, reply); goto cleanup; } @@ -2830,20 +2830,20 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to add drive '%s'"), drivestr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to add drive '%s'"), drivestr); goto cleanup; } if (strstr(reply, "unknown command:")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("drive hotplug is not supported")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("drive hotplug is not supported")); goto cleanup; } if (strstr(reply, "could not open disk image")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("open disk image file failed")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("open disk image file failed")); goto cleanup; } @@ -2878,8 +2878,8 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("cannot delete %s drive"), drivestr); + virReportError(VIR_ERR_OPERATION_FAILED, + _("cannot delete %s drive"), drivestr); goto cleanup; } @@ -2895,8 +2895,8 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon, /* NB: device not found errors mean the drive was auto-deleted and we * ignore the error */ } else if (STRNEQ(reply, "")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("deleting %s drive failed: %s"), drivestr, reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("deleting %s drive failed: %s"), drivestr, reply); goto cleanup; } @@ -2931,18 +2931,18 @@ int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("failed to set disk password")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("failed to set disk password")); goto cleanup; } if (strstr(reply, "unknown command:")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("setting disk password is not supported")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("setting disk password is not supported")); goto cleanup; } else if (strstr(reply, "The entered password is invalid")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("the disk password is incorrect")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("the disk password is incorrect")); goto cleanup; } @@ -2969,28 +2969,28 @@ int qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, const char *name) } if (qemuMonitorHMPCommand(mon, cmd, &reply)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to take snapshot using command '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to take snapshot using command '%s'"), cmd); goto cleanup; } if (strstr(reply, "Error while creating snapshot") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Failed to take snapshot: %s"), reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to take snapshot: %s"), reply); goto cleanup; } else if (strstr(reply, "No block device can accept snapshots") != NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("this domain does not have a device to take snapshots")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("this domain does not have a device to take snapshots")); goto cleanup; } else if (strstr(reply, "Could not open VM state file") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); goto cleanup; } else if (strstr(reply, "Error") != NULL && strstr(reply, "while writing VM") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); goto cleanup; } @@ -3017,39 +3017,39 @@ int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char *name) } if (qemuMonitorHMPCommand(mon, cmd, &reply)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to restore snapshot using command '%s'"), - cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to restore snapshot using command '%s'"), + cmd); goto cleanup; } if (strstr(reply, "No block device supports snapshots") != NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("this domain does not have a device to load snapshots")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("this domain does not have a device to load snapshots")); goto cleanup; } else if (strstr(reply, "Could not find snapshot") != NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("the snapshot '%s' does not exist, and was not loaded"), - name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("the snapshot '%s' does not exist, and was not loaded"), + name); goto cleanup; } else if (strstr(reply, "Snapshots not supported on device") != NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", reply); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply); goto cleanup; } else if (strstr(reply, "Could not open VM state file") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); goto cleanup; } else if (strstr(reply, "Error") != NULL && strstr(reply, "while loading VM state") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); goto cleanup; } else if (strstr(reply, "Error") != NULL && strstr(reply, "while activating snapshot on") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); goto cleanup; } @@ -3075,24 +3075,24 @@ int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name) goto cleanup; } if (qemuMonitorHMPCommand(mon, cmd, &reply)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to delete snapshot using command '%s'"), - cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to delete snapshot using command '%s'"), + cmd); goto cleanup; } if (strstr(reply, "No block device supports snapshots") != NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("this domain does not have a device to delete snapshots")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("this domain does not have a device to delete snapshots")); goto cleanup; } else if (strstr(reply, "Snapshots not supported on device") != NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", reply); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply); goto cleanup; } else if (strstr(reply, "Error") != NULL && strstr(reply, "while deleting snapshot") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", reply); goto cleanup; } @@ -3121,15 +3121,15 @@ qemuMonitorTextDiskSnapshot(qemuMonitorPtr mon, const char *device, } if (qemuMonitorHMPCommand(mon, cmd, &reply)) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to take snapshot using command '%s'"), cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to take snapshot using command '%s'"), cmd); goto cleanup; } if (strstr(reply, "error while creating qcow2") != NULL || strstr(reply, "unknown command:") != NULL) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("Failed to take snapshot: %s"), reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("Failed to take snapshot: %s"), reply); goto cleanup; } @@ -3159,8 +3159,8 @@ int qemuMonitorTextArbitraryCommand(qemuMonitorPtr mon, const char *cmd, ret = qemuMonitorHMPCommand(mon, safecmd, reply); if (ret != 0) - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to run cmd '%s'"), safecmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to run cmd '%s'"), safecmd); VIR_FREE(safecmd); @@ -3189,9 +3189,9 @@ int qemuMonitorTextInjectNMI(qemuMonitorPtr mon) return 0; fail: - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to inject NMI using command '%s'"), - cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to inject NMI using command '%s'"), + cmd); return -1; } @@ -3211,9 +3211,9 @@ int qemuMonitorTextSendKey(qemuMonitorPtr mon, virBufferAddLit(&buf, "sendkey "); for (i = 0; i < nkeycodes; i++) { if (keycodes[i] > 0xffff) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("keycode %d is invalid: 0x%X"), - i, keycodes[i]); + virReportError(VIR_ERR_OPERATION_FAILED, + _("keycode %d is invalid: 0x%X"), + i, keycodes[i]); virBufferFreeAndReset(&buf); return -1; } @@ -3233,15 +3233,15 @@ int qemuMonitorTextSendKey(qemuMonitorPtr mon, cmd = virBufferContentAndReset(&buf); if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to send key using command '%s'"), - cmd); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to send key using command '%s'"), + cmd); goto cleanup; } if (STRNEQ(reply, "")) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - _("failed to send key '%s'"), reply); + virReportError(VIR_ERR_OPERATION_FAILED, + _("failed to send key '%s'"), reply); goto cleanup; } @@ -3266,8 +3266,8 @@ int qemuMonitorTextScreendump(qemuMonitorPtr mon, const char *file) } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("taking screenshot failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("taking screenshot failed")); goto cleanup; } @@ -3300,8 +3300,8 @@ int qemuMonitorTextOpenGraphics(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, - "%s", _("adding graphics client failed")); + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("adding graphics client failed")); goto cleanup; } @@ -3339,15 +3339,15 @@ int qemuMonitorTextSetBlockIoThrottle(qemuMonitorPtr mon, } if (qemuMonitorHMPCommand(mon, cmd, &result) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot run monitor command")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot run monitor command")); ret = -1; goto cleanup; } if (qemuMonitorTextCommandNotFound(cmd_name, result)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Command '%s' is not found"), cmd_name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Command '%s' is not found"), cmd_name); ret = -1; goto cleanup; } @@ -3429,8 +3429,8 @@ qemuMonitorTextParseBlockIoThrottle(const char *result, p++; } - qemuReportError(VIR_ERR_INVALID_ARG, - _("No info for device '%s'"), device); + virReportError(VIR_ERR_INVALID_ARG, + _("No info for device '%s'"), device); cleanup: return ret; @@ -3445,15 +3445,15 @@ int qemuMonitorTextGetBlockIoThrottle(qemuMonitorPtr mon, const char *cmd_name = "info block"; if (qemuMonitorHMPCommand(mon, cmd_name, &result) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot run monitor command")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot run monitor command")); ret = -1; goto cleanup; } if (qemuMonitorTextCommandNotFound(cmd_name, result)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - _("Command '%s' is not found"), cmd_name); + virReportError(VIR_ERR_OPERATION_INVALID, + _("Command '%s' is not found"), cmd_name); ret = -1; goto cleanup; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d8169e8..97403be 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -368,9 +368,9 @@ qemuProcessFindDomainDiskByPath(virDomainObjPtr vm, if (i >= 0) return vm->def->disks[i]; - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("no disk found with path %s"), - path); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no disk found with path %s"), + path); return NULL; } @@ -391,9 +391,9 @@ qemuProcessFindDomainDiskByAlias(virDomainObjPtr vm, return disk; } - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("no disk found with alias %s"), - alias); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no disk found with alias %s"), + alias); return NULL; } @@ -411,24 +411,24 @@ qemuProcessGetVolumeQcowPassphrase(virConnectPtr conn, virStorageEncryptionPtr enc; if (!disk->encryption) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("disk %s does not have any encryption information"), - disk->src); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("disk %s does not have any encryption information"), + disk->src); return -1; } enc = disk->encryption; if (!conn) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot find secrets without a connection")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("cannot find secrets without a connection")); goto cleanup; } if (conn->secretDriver == NULL || conn->secretDriver->lookupByUUID == NULL || conn->secretDriver->getValue == NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("secret storage not supported")); + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("secret storage not supported")); goto cleanup; } @@ -436,8 +436,8 @@ qemuProcessGetVolumeQcowPassphrase(virConnectPtr conn, enc->nsecrets != 1 || enc->secrets[0]->type != VIR_STORAGE_ENCRYPTION_SECRET_TYPE_PASSPHRASE) { - qemuReportError(VIR_ERR_XML_ERROR, - _("invalid <encryption> for volume %s"), disk->src); + virReportError(VIR_ERR_XML_ERROR, + _("invalid <encryption> for volume %s"), disk->src); goto cleanup; } @@ -454,9 +454,9 @@ qemuProcessGetVolumeQcowPassphrase(virConnectPtr conn, if (memchr(data, '\0', size) != NULL) { memset(data, 0, size); VIR_FREE(data); - qemuReportError(VIR_ERR_XML_ERROR, - _("format='qcow' passphrase for %s must not contain a " - "'\\0'"), disk->src); + virReportError(VIR_ERR_XML_ERROR, + _("format='qcow' passphrase for %s must not contain a " + "'\\0'"), disk->src); goto cleanup; } @@ -550,8 +550,8 @@ qemuProcessFakeReboot(void *opaque) goto cleanup; if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } @@ -563,8 +563,8 @@ qemuProcessFakeReboot(void *opaque) qemuDomainObjExitMonitorWithDriver(driver, vm); if (!virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("guest unexpectedly quit")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("guest unexpectedly quit")); goto endjob; } @@ -572,8 +572,8 @@ qemuProcessFakeReboot(void *opaque) VIR_DOMAIN_RUNNING_BOOTED, QEMU_ASYNC_JOB_NONE) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("resume operation failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("resume operation failed")); goto endjob; } priv->gotShutdown = false; @@ -1326,16 +1326,16 @@ qemuProcessReadLogOutput(virDomainObjPtr vm, } if (got == buflen-1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Out of space while reading %s log output: %s"), - what, buf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Out of space while reading %s log output: %s"), + what, buf); goto cleanup; } if (isdead) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Process exited while reading %s log output: %s"), - what, buf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Process exited while reading %s log output: %s"), + what, buf); goto cleanup; } @@ -1348,9 +1348,9 @@ qemuProcessReadLogOutput(virDomainObjPtr vm, retries--; } - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Timed out while reading %s log output: %s"), - what, buf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Timed out while reading %s log output: %s"), + what, buf); cleanup: VIR_FREE(debug); @@ -1435,8 +1435,8 @@ qemuProcessLookupPTYs(virDomainChrDefPtr *devices, /* neither the log output nor 'info chardev' had a * pty path for this chardev, report an error */ - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("no assigned pty for device %s"), id); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no assigned pty for device %s"), id); return -1; } else { /* 'info chardev' had no pty path for this chardev, @@ -1627,9 +1627,9 @@ cleanup: /* VM is dead, any other error raised in the interim is probably * not as important as the qemu cmdline output */ qemuProcessReadLogFD(logfd, buf, buf_size, strlen(buf)); - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("process exited while connecting to monitor: %s"), - buf); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("process exited while connecting to monitor: %s"), + buf); ret = -1; } @@ -1672,10 +1672,10 @@ qemuProcessDetectVcpuPIDs(struct qemud_driver *driver, qemuDomainObjExitMonitorWithDriver(driver, vm); if (ncpupids != vm->def->vcpus) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("got wrong number of vCPU pids from QEMU monitor. " - "got %d, wanted %d"), - ncpupids, vm->def->vcpus); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("got wrong number of vCPU pids from QEMU monitor. " + "got %d, wanted %d"), + ncpupids, vm->def->vcpus); VIR_FREE(cpupids); return -1; } @@ -1720,8 +1720,8 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm, } if (numa_available() < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Host kernel is not aware of NUMA.")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Host kernel is not aware of NUMA.")); return -1; } @@ -1731,8 +1731,8 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm, for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; i++) { if (tmp_nodemask[i]) { if (i > NUMA_NUM_NODES) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Host cannot support NUMA node %d"), i); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Host cannot support NUMA node %d"), i); return -1; } if (i > maxnode && !warned) { @@ -1760,9 +1760,9 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm, } if (nnodes != 1) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("NUMA memory tuning in 'preferred' mode " - "only supports single node")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("NUMA memory tuning in 'preferred' mode " + "only supports single node")); goto cleanup; } @@ -1774,8 +1774,8 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm, /* XXX: Shouldn't go here, as we already do checking when * parsing domain XML. */ - qemuReportError(VIR_ERR_XML_ERROR, - "%s", _("Invalid mode for memory NUMA tuning.")); + virReportError(VIR_ERR_XML_ERROR, + "%s", _("Invalid mode for memory NUMA tuning.")); goto cleanup; } @@ -1790,8 +1790,8 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm, const char *nodemask ATTRIBUTE_UNUSED) { if (vm->def->numatune.memory.nodemask) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libvirt is compiled without NUMA tuning support")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libvirt is compiled without NUMA tuning support")); return -1; } @@ -1814,9 +1814,9 @@ qemuGetNumadAdvice(virDomainDefPtr def) virCommandSetOutputBuffer(cmd, &output); if (virCommandRun(cmd, NULL) < 0) - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to query numad for the " - "advisory nodeset")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to query numad for the " + "advisory nodeset")); virCommandFree(cmd); return output; @@ -1825,8 +1825,8 @@ qemuGetNumadAdvice(virDomainDefPtr def) static char * qemuGetNumadAdvice(virDomainDefPtr def ATTRIBUTE_UNUSED) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("numad is not available on this host")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("numad is not available on this host")); return NULL; } #endif @@ -1920,8 +1920,8 @@ qemuProcessSetLinkStates(virDomainObjPtr vm) VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias); if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) { - qemuReportError(VIR_ERR_NO_SUPPORT, - _("Setting of link state is not supported by this qemu")); + virReportError(VIR_ERR_NO_SUPPORT, + _("Setting of link state is not supported by this qemu")); return -1; } @@ -1929,7 +1929,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm) def->nets[i]->info.alias, VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN); if (ret != 0) { - qemuReportError(VIR_ERR_OPERATION_FAILED, + virReportError(VIR_ERR_OPERATION_FAILED, _("Couldn't set link state on interface: %s"), def->nets[i]->info.alias); break; } @@ -1961,8 +1961,8 @@ qemuProcessSetVcpuAffinites(virConnectPtr conn, return 0; if (priv->vcpupids == NULL) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cpu affinity is not supported")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("cpu affinity is not supported")); return -1; } @@ -2330,9 +2330,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->disks[i]->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for VirtIO disk %s"), - vm->def->disks[i]->dst); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for VirtIO disk %s"), + vm->def->disks[i]->dst); return -1; } } @@ -2344,9 +2344,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->nets[i]->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for %s NIC"), - vm->def->nets[i]->model); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for %s NIC"), + vm->def->nets[i]->model); return -1; } } @@ -2358,9 +2358,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->controllers[i]->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for controller %s"), - virDomainControllerTypeToString(vm->def->controllers[i]->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for controller %s"), + virDomainControllerTypeToString(vm->def->controllers[i]->type)); return -1; } } @@ -2372,9 +2372,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->videos[i]->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for video adapter %s"), - virDomainVideoTypeToString(vm->def->videos[i]->type)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for video adapter %s"), + virDomainVideoTypeToString(vm->def->videos[i]->type)); return -1; } } @@ -2386,9 +2386,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->sounds[i]->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for sound adapter %s"), - virDomainSoundModelTypeToString(vm->def->sounds[i]->model)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for sound adapter %s"), + virDomainSoundModelTypeToString(vm->def->sounds[i]->model)); return -1; } } @@ -2399,9 +2399,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->watchdog->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for watchdog %s"), - virDomainWatchdogModelTypeToString(vm->def->watchdog->model)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for watchdog %s"), + virDomainWatchdogModelTypeToString(vm->def->watchdog->model)); return -1; } } @@ -2411,9 +2411,9 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm, if (qemuProcessAssignNextPCIAddress(&(vm->def->memballoon->info), vendor, product, addrs, naddrs) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find PCI address for balloon %s"), - virDomainMemballoonModelTypeToString(vm->def->memballoon->model)); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot find PCI address for balloon %s"), + virDomainMemballoonModelTypeToString(vm->def->memballoon->model)); return -1; } } @@ -3273,9 +3273,9 @@ qemuProcessReconnectHelper(void *payload, virConnectClose(data->conn); - qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not create thread. QEMU initialization " - "might be incomplete")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not create thread. QEMU initialization " + "might be incomplete")); if (qemuDomainObjEndJob(src->driver, obj) == 0) { obj = NULL; } else if (virDomainObjUnref(obj) > 0) { @@ -3354,8 +3354,8 @@ int qemuProcessStart(virConnectPtr conn, VIR_DEBUG("Beginning VM startup process"); if (virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("VM is already active")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("VM is already active")); return -1; } @@ -3420,8 +3420,8 @@ int qemuProcessStart(virConnectPtr conn, vm->def->graphics[0]->data.vnc.autoport) { int port = qemuProcessNextFreePort(driver, QEMU_VNC_PORT_MIN); if (port < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to find an unused VNC port")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to find an unused VNC port")); goto cleanup; } vm->def->graphics[0]->data.vnc.port = port; @@ -3432,8 +3432,8 @@ int qemuProcessStart(virConnectPtr conn, port = qemuProcessNextFreePort(driver, QEMU_VNC_PORT_MIN); if (port < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to find an unused SPICE port")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to find an unused SPICE port")); goto cleanup; } @@ -3446,8 +3446,8 @@ int qemuProcessStart(virConnectPtr conn, int tlsPort = qemuProcessNextFreePort(driver, vm->def->graphics[0]->data.spice.port + 1); if (tlsPort < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Unable to find an unused SPICE TLS port")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Unable to find an unused SPICE TLS port")); qemuProcessReturnPort(driver, port); goto cleanup; } @@ -3492,10 +3492,10 @@ int qemuProcessStart(virConnectPtr conn, if (vm->def->virtType == VIR_DOMAIN_VIRT_KVM) { VIR_DEBUG("Checking for KVM availability"); if (access("/dev/kvm", F_OK) != 0) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Domain requires KVM, but it is not available. " - "Check that virtualization is enabled in the host BIOS, " - "and host configuration is setup to load the kvm modules.")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Domain requires KVM, but it is not available. " + "Check that virtualization is enabled in the host BIOS, " + "and host configuration is setup to load the kvm modules.")); goto cleanup; } } @@ -3658,8 +3658,8 @@ int qemuProcessStart(virConnectPtr conn, /* wait for qemu process to show up */ if (ret == 0) { if (virPidFileReadPath(priv->pidfile, &vm->pid) < 0) { - qemuReportError(VIR_ERR_INTERNAL_ERROR, - _("Domain %s didn't show up"), vm->def->name); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Domain %s didn't show up"), vm->def->name); ret = -1; } #if 0 @@ -3790,9 +3790,9 @@ int qemuProcessStart(virConnectPtr conn, VIR_DEBUG("Setting initial memory amount"); cur_balloon = vm->def->mem.cur_balloon; if (cur_balloon != vm->def->mem.cur_balloon) { - qemuReportError(VIR_ERR_OVERFLOW, - _("unable to set balloon to %lld"), - vm->def->mem.cur_balloon); + virReportError(VIR_ERR_OVERFLOW, + _("unable to set balloon to %lld"), + vm->def->mem.cur_balloon); goto cleanup; } qemuDomainObjEnterMonitorWithDriver(driver, vm); @@ -3809,8 +3809,8 @@ int qemuProcessStart(virConnectPtr conn, VIR_DOMAIN_RUNNING_BOOTED, QEMU_ASYNC_JOB_NONE) < 0) { if (virGetLastError() == NULL) - qemuReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("resume operation failed")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("resume operation failed")); goto cleanup; } } else { @@ -4199,8 +4199,8 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, VIR_DEBUG("Beginning VM attach process"); if (virDomainObjIsActive(vm)) { - qemuReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("VM is already active")); + virReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("VM is already active")); return -1; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the QEMU driver to use virReportError instead of the qemuReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/qemu/qemu_agent.c | 142 ++-- src/qemu/qemu_capabilities.c | 16 +- src/qemu/qemu_cgroup.c | 26 +- src/qemu/qemu_command.c | 1066 ++++++++++++------------ src/qemu/qemu_conf.c | 26 +- src/qemu/qemu_conf.h | 4 - src/qemu/qemu_domain.c | 94 +-- src/qemu/qemu_driver.c | 1834 +++++++++++++++++++++--------------------- src/qemu/qemu_hostdev.c | 59 +- src/qemu/qemu_hotplug.c | 362 ++++----- src/qemu/qemu_migration.c | 284 +++---- src/qemu/qemu_monitor.c | 384 ++++----- src/qemu/qemu_monitor_json.c | 546 ++++++------- src/qemu/qemu_monitor_text.c | 532 ++++++------ src/qemu/qemu_process.c | 216 ++--- 16 files changed, 2795 insertions(+), 2797 deletions(-)
ACK, mechanic, but *HUGE*. While reviewing I found some places that would require polishing but are pre-existing. I'm attatching the patch for that. Peter

On Thu, Jul 19, 2012 at 12:51:04PM +0200, Peter Krempa wrote:
On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the QEMU driver to use virReportError instead of the qemuReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/qemu/qemu_agent.c | 142 ++-- src/qemu/qemu_capabilities.c | 16 +- src/qemu/qemu_cgroup.c | 26 +- src/qemu/qemu_command.c | 1066 ++++++++++++------------ src/qemu/qemu_conf.c | 26 +- src/qemu/qemu_conf.h | 4 - src/qemu/qemu_domain.c | 94 +-- src/qemu/qemu_driver.c | 1834 +++++++++++++++++++++--------------------- src/qemu/qemu_hostdev.c | 59 +- src/qemu/qemu_hotplug.c | 362 ++++----- src/qemu/qemu_migration.c | 284 +++---- src/qemu/qemu_monitor.c | 384 ++++----- src/qemu/qemu_monitor_json.c | 546 ++++++------- src/qemu/qemu_monitor_text.c | 532 ++++++------ src/qemu/qemu_process.c | 216 ++--- 16 files changed, 2795 insertions(+), 2797 deletions(-)
ACK, mechanic, but *HUGE*. While reviewing I found some places that would require polishing but are pre-existing. I'm attatching the patch for that.
Peter
From 071801e62511cc9db451f18a87d1f0ab772687d3 Mon Sep 17 00:00:00 2001 Message-Id: <071801e62511cc9db451f18a87d1f0ab772687d3.1342695008.git.pkrempa@redhat.com> From: Peter Krempa <pkrempa@redhat.com> Date: Thu, 19 Jul 2012 12:48:12 +0200 Subject: [PATCH] qemu: Add missing "%s" before translation macros and break long lines.
This patch cleans up some missing "%s" before translation macros, breaks long lines and some other style cleanups found while reviewing DanPB's massive cleanup for virReportError.
Mixing actual bug fixes (missing "%s") with whitespace/style cleanups is a bad idea. I've pushed a cut down version of your patch, which just applies the "%s" fixes. Feel free to update what's left of your style cleanup & repost Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

From: "Daniel P. Berrange" <berrange@redhat.com> Update the nodeinfo helper code to use virReportError instead of the nodeReportError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/nodeinfo.c | 104 +++++++++++++++++++++++++++----------------------------- 2 files changed, 50 insertions(+), 55 deletions(-) diff --git a/cfg.mk b/cfg.mk index 6e1f6af..334a5c5 100644 --- a/cfg.mk +++ b/cfg.mk @@ -508,7 +508,6 @@ sc_avoid_attribute_unused_in_header: msg_gen_function = msg_gen_function += VIR_ERROR msg_gen_function += lxcError -msg_gen_function += nodeReportError msg_gen_function += regerror msg_gen_function += vah_error msg_gen_function += vah_warning diff --git a/src/nodeinfo.c b/src/nodeinfo.c index a892e7a..ad4c787 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -52,10 +52,6 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#define nodeReportError(code, ...) \ - virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - #ifdef __linux__ # define CPUINFO_PATH "/proc/cpuinfo" # define SYSFS_SYSTEM_PATH "/sys/devices/system" @@ -114,9 +110,9 @@ virNodeGetCpuValue(const char *dir, unsigned int cpu, const char *file, goto cleanup; } if (virStrToLong_i(value_str, &tmp, 10, &value) < 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - _("could not convert '%s' to an integer"), - value_str); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("could not convert '%s' to an integer"), + value_str); goto cleanup; } @@ -269,8 +265,8 @@ virNodeParseNode(const char *node, int *sockets, int *cores, int *threads) /* Parse socket */ sock = virNodeParseSocket(node, cpu); if (!CPU_ISSET(sock, &sock_map)) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("CPU socket topology has changed")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("CPU socket topology has changed")); goto cleanup; } @@ -357,8 +353,8 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, buf++; if (*buf != ':' || !buf[1]) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("parsing cpu MHz from cpuinfo")); goto cleanup; } @@ -380,8 +376,8 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, buf++; if (*buf != ':' || !buf[1]) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("parsing cpu MHz from cpuinfo")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("parsing cpu MHz from cpuinfo")); goto cleanup; } @@ -479,17 +475,17 @@ fallback: done: /* There should always be at least one cpu, socket, node, and thread. */ if (nodeinfo->cpus == 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no CPUs found")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no CPUs found")); goto cleanup; } if (nodeinfo->sockets == 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no sockets found")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no sockets found")); goto cleanup; } if (nodeinfo->threads == 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no threads found")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no threads found")); goto cleanup; } @@ -560,8 +556,8 @@ int linuxNodeGetCPUStats(FILE *procstat, switch (i) { case 0: /* fill kernel cpu time here */ if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_KERNEL) == NULL) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Field kernel cpu time too long for destination")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field kernel cpu time too long for destination")); goto cleanup; } param->value = (sys + irq + softirq) * TICK_TO_NSEC; @@ -569,8 +565,8 @@ int linuxNodeGetCPUStats(FILE *procstat, case 1: /* fill user cpu time here */ if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_USER) == NULL) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Field kernel cpu time too long for destination")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field kernel cpu time too long for destination")); goto cleanup; } param->value = (usr + ni) * TICK_TO_NSEC; @@ -578,8 +574,8 @@ int linuxNodeGetCPUStats(FILE *procstat, case 2: /* fill idle cpu time here */ if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_IDLE) == NULL) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Field kernel cpu time too long for destination")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field kernel cpu time too long for destination")); goto cleanup; } param->value = idle * TICK_TO_NSEC; @@ -587,8 +583,8 @@ int linuxNodeGetCPUStats(FILE *procstat, case 3: /* fill iowait cpu time here */ if (virStrcpyStatic(param->field, VIR_NODE_CPU_STATS_IOWAIT) == NULL) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Field kernel cpu time too long for destination")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field kernel cpu time too long for destination")); goto cleanup; } param->value = iowait * TICK_TO_NSEC; @@ -673,8 +669,8 @@ int linuxNodeGetMemoryStats(FILE *meminfo, for (i = 0; i < 2; i++) { p = strchr(p, ' '); if (p == NULL) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no prefix found")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no prefix found")); goto cleanup; } p++; @@ -692,8 +688,8 @@ int linuxNodeGetMemoryStats(FILE *meminfo, virNodeMemoryStatsPtr param = ¶ms[k++]; if (virStrcpyStatic(param->field, convp->field) == NULL) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Field kernel memory too long for destination")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Field kernel memory too long for destination")); goto cleanup; } param->value = val; @@ -706,8 +702,8 @@ int linuxNodeGetMemoryStats(FILE *meminfo, } if (found == 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no available memory line found")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("no available memory line found")); goto cleanup; } @@ -792,8 +788,8 @@ cleanup: } #else /* XXX Solaris will need an impl later if they port QEMU driver */ - nodeReportError(VIR_ERR_NO_SUPPORT, "%s", - _("node info not implemented on this platform")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("node info not implemented on this platform")); return -1; #endif } @@ -821,8 +817,8 @@ int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED, return ret; } #else - nodeReportError(VIR_ERR_NO_SUPPORT, "%s", - _("node CPU stats not implemented on this platform")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("node CPU stats not implemented on this platform")); return -1; #endif } @@ -851,8 +847,8 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, # if HAVE_NUMACTL if (numa_available() < 0) { # endif - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("NUMA not supported on this host")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("NUMA not supported on this host")); return -1; # if HAVE_NUMACTL } @@ -888,8 +884,8 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, return ret; } #else - nodeReportError(VIR_ERR_NO_SUPPORT, "%s", - _("node memory stats not implemented on this platform")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("node memory stats not implemented on this platform")); return -1; #endif } @@ -912,8 +908,8 @@ nodeGetCPUmap(virConnectPtr conn ATTRIBUTE_UNUSED, VIR_FREE(path); return cpumap; #else - nodeReportError(VIR_ERR_NO_SUPPORT, "%s", - _("node cpumap not implemented on this platform")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("node cpumap not implemented on this platform")); return NULL; #endif } @@ -1006,15 +1002,15 @@ nodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED, int maxCell; if (numa_available() < 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("NUMA not supported on this host")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("NUMA not supported on this host")); goto cleanup; } maxCell = numa_max_node(); if (startCell > maxCell) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - _("start cell %d out of range (0-%d)"), - startCell, maxCell); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("start cell %d out of range (0-%d)"), + startCell, maxCell); goto cleanup; } lastCell = startCell + maxCells - 1; @@ -1024,7 +1020,7 @@ nodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED, for (numCells = 0, n = startCell ; n <= lastCell ; n++) { long long mem; if (numa_node_size64(n, &mem) < 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, + virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to query NUMA free memory for node: %d"), n); goto cleanup; @@ -1044,16 +1040,16 @@ nodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED) int n; if (numa_available() < 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("NUMA not supported on this host")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("NUMA not supported on this host")); goto cleanup; } for (n = 0 ; n <= numa_max_node() ; n++) { long long mem; if (numa_node_size64(n, &mem) < 0) { - nodeReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to query NUMA free memory")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to query NUMA free memory")); goto cleanup; } freeMem += mem; @@ -1073,15 +1069,15 @@ int nodeGetCellsFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED, int startCell ATTRIBUTE_UNUSED, int maxCells ATTRIBUTE_UNUSED) { - nodeReportError(VIR_ERR_NO_SUPPORT, "%s", - _("NUMA memory information not available on this platform")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("NUMA memory information not available on this platform")); return -1; } unsigned long long nodeGetFreeMemory(virConnectPtr conn ATTRIBUTE_UNUSED) { - nodeReportError(VIR_ERR_NO_SUPPORT, "%s", - _("NUMA memory information not available on this platform")); + virReportError(VIR_ERR_NO_SUPPORT, "%s", + _("NUMA memory information not available on this platform")); return 0; } #endif -- 1.7.10.4

On 18.07.2012 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the nodeinfo helper code to use virReportError instead of the nodeReportError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - src/nodeinfo.c | 104 +++++++++++++++++++++++++++----------------------------- 2 files changed, 50 insertions(+), 55 deletions(-)
ACK Michal

From: "Daniel P. Berrange" <berrange@redhat.com> Update the XenAPI driver to use virReportError instead of the xenapiError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/xenapi/xenapi_driver.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index a91f497..38a7cd0 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -43,10 +43,6 @@ #define VIR_FROM_THIS VIR_FROM_XENAPI -#define xenapiError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - static int xenapiDefaultConsoleType(const char *ostype) { @@ -1123,8 +1119,8 @@ xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus, xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session; if (flags != VIR_DOMAIN_VCPU_LIVE) { - xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), - flags); + virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), + flags); return -1; } @@ -1293,8 +1289,8 @@ xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags) xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session; if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { - xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), - flags); + virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), + flags); return -1; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the XenAPI driver to use virReportError instead of the xenapiError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/xenapi/xenapi_driver.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
ACK. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the libvirtd config handling code to use virReportError instead of the virConfError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - daemon/libvirtd-config.c | 60 ++++++++++++++++++++++------------------------ 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/cfg.mk b/cfg.mk index 334a5c5..1ceae3c 100644 --- a/cfg.mk +++ b/cfg.mk @@ -511,7 +511,6 @@ msg_gen_function += lxcError msg_gen_function += regerror msg_gen_function += vah_error msg_gen_function += vah_warning -msg_gen_function += virConfError msg_gen_function += virGenericReportError msg_gen_function += virLibConnError msg_gen_function += virLibDomainError diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index 6781e05..2875927 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -35,10 +35,6 @@ #define VIR_FROM_THIS VIR_FROM_CONF -#define virConfError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - /* Allocate an array of malloc'd strings from the config file, filename * (used only in diagnostics), using handle "conf". Upon error, return -1 * and free any allocated memory. Otherwise, save the array in *list_arg @@ -56,17 +52,17 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg, switch (p->type) { case VIR_CONF_STRING: if (VIR_ALLOC_N(list, 2) < 0) { - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("failed to allocate memory for %s config list"), - key); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("failed to allocate memory for %s config list"), + key); return -1; } list[0] = strdup (p->str); list[1] = NULL; if (list[0] == NULL) { - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("failed to allocate memory for %s config list value"), - key); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("failed to allocate memory for %s config list value"), + key); VIR_FREE(list); return -1; } @@ -78,17 +74,17 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg, for (pp = p->list; pp; pp = pp->next) len++; if (VIR_ALLOC_N(list, 1+len) < 0) { - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("failed to allocate memory for %s config list"), - key); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("failed to allocate memory for %s config list"), + key); return -1; } for (i = 0, pp = p->list; pp; ++i, pp = pp->next) { if (pp->type != VIR_CONF_STRING) { - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("remoteReadConfigFile: %s: %s:" - " must be a string or list of strings"), - filename, key); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("remoteReadConfigFile: %s: %s:" + " must be a string or list of strings"), + filename, key); VIR_FREE(list); return -1; } @@ -98,9 +94,9 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg, for (j = 0 ; j < i ; j++) VIR_FREE(list[j]); VIR_FREE(list); - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("failed to allocate memory for %s config list value"), - key); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("failed to allocate memory for %s config list value"), + key); return -1; } @@ -110,10 +106,10 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg, } default: - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("remoteReadConfigFile: %s: %s:" - " must be a string or list of strings"), - filename, key); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("remoteReadConfigFile: %s: %s:" + " must be a string or list of strings"), + filename, key); return -1; } @@ -127,11 +123,11 @@ checkType (virConfValuePtr p, const char *filename, const char *key, virConfType required_type) { if (p->type != required_type) { - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("remoteReadConfigFile: %s: %s: invalid type:" - " got %s; expected %s"), filename, key, - virConfTypeName (p->type), - virConfTypeName (required_type)); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("remoteReadConfigFile: %s: %s: invalid type:" + " got %s; expected %s"), filename, key, + virConfTypeName (p->type), + virConfTypeName (required_type)); return -1; } return 0; @@ -189,9 +185,9 @@ static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, cons } else if (STREQ(p->str, "polkit")) { *auth = VIR_NET_SERVER_SERVICE_AUTH_POLKIT; } else { - virConfError(VIR_ERR_CONFIG_UNSUPPORTED, - _("remoteReadConfigFile: %s: %s: unsupported auth %s"), - filename, key, p->str); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("remoteReadConfigFile: %s: %s: unsupported auth %s"), + filename, key, p->str); return -1; } -- 1.7.10.4

On 07/18/12 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the libvirtd config handling code to use virReportError instead of the virConfError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- cfg.mk | 1 - daemon/libvirtd-config.c | 60 ++++++++++++++++++++++------------------------ 2 files changed, 28 insertions(+), 33 deletions(-)
ACK. Peter

From: "Daniel P. Berrange" <berrange@redhat.com> Update the libvirtd dispatch code to use virReportError instead of the virNetError custom macro Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/remote.c | 214 ++++++++++++++++++++++++------------------------ daemon/stream.c | 22 ++--- src/rpc/gendispatch.pl | 6 +- 3 files changed, 117 insertions(+), 125 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 9334221..a323852 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -52,17 +52,13 @@ #define VIR_FROM_THIS VIR_FROM_RPC -#define virNetError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - #if SIZEOF_LONG < 8 # define HYPER_TO_TYPE(_type, _to, _from) \ do { \ if ((_from) != (_type)(_from)) { \ - virNetError(VIR_ERR_OVERFLOW, \ - _("conversion from hyper to %s overflowed"), \ - #_type); \ + virReportError(VIR_ERR_OVERFLOW, \ + _("conversion from hyper to %s overflowed"), \ + #_type); \ goto cleanup; \ } \ (_to) = (_from); \ @@ -712,13 +708,13 @@ remoteDispatchOpen(virNetServerPtr server, virMutexLock(&priv->lock); /* Already opened? */ if (priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection already open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection already open")); goto cleanup; } if (virNetServerKeepAliveRequired(server) && !priv->keepalive_supported) { - virNetError(VIR_ERR_OPERATION_FAILED, "%s", - _("keepalive support is required to connect")); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("keepalive support is required to connect")); goto cleanup; } @@ -776,7 +772,7 @@ remoteDispatchDomainGetSchedulerType(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -863,8 +859,8 @@ remoteSerializeTypedParameters(virTypedParameterPtr params, } break; default: - virNetError(VIR_ERR_RPC, _("unknown parameter type: %d"), - params[i].type); + virReportError(VIR_ERR_RPC, _("unknown parameter type: %d"), + params[i].type); goto cleanup; } j++; @@ -899,7 +895,7 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val, /* Check the length of the returned list carefully. */ if (args_params_len > limit) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, args_params_len) < 0) { @@ -913,9 +909,9 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val, for (i = 0; i < args_params_len; ++i) { if (virStrcpyStatic(params[i].field, args_params_val[i].field) == NULL) { - virNetError(VIR_ERR_INTERNAL_ERROR, - _("Parameter %s too big for destination"), - args_params_val[i].field); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Parameter %s too big for destination"), + args_params_val[i].field); goto cleanup; } params[i].type = args_params_val[i].value.type; @@ -953,8 +949,8 @@ remoteDeserializeTypedParameters(remote_typed_param *args_params_val, } break; default: - virNetError(VIR_ERR_INTERNAL_ERROR, _("unknown parameter type: %d"), - params[i].type); + virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown parameter type: %d"), + params[i].type); goto cleanup; } } @@ -985,12 +981,12 @@ remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server ATTRIBUTE_UNUS virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) @@ -1039,7 +1035,7 @@ remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED, struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1094,12 +1090,12 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server ATTRIBUTE virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) @@ -1150,13 +1146,13 @@ remoteDispatchDomainMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } if (args->maxStats > REMOTE_DOMAIN_MEMORY_STATS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", - _("maxStats > REMOTE_DOMAIN_MEMORY_STATS_MAX")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("maxStats > REMOTE_DOMAIN_MEMORY_STATS_MAX")); goto cleanup; } @@ -1214,7 +1210,7 @@ remoteDispatchDomainBlockPeek(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1226,8 +1222,8 @@ remoteDispatchDomainBlockPeek(virNetServerPtr server ATTRIBUTE_UNUSED, flags = args->flags; if (size > REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, - "%s", _("size > maximum buffer size")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("size > maximum buffer size")); goto cleanup; } @@ -1271,7 +1267,7 @@ remoteDispatchDomainBlockStatsFlags(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1280,7 +1276,7 @@ remoteDispatchDomainBlockStatsFlags(virNetServerPtr server ATTRIBUTE_UNUSED, flags = args->flags; if (nparams > REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -1336,7 +1332,7 @@ remoteDispatchDomainMemoryPeek(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1347,8 +1343,8 @@ remoteDispatchDomainMemoryPeek(virNetServerPtr server ATTRIBUTE_UNUSED, flags = args->flags; if (size > REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, - "%s", _("size > maximum buffer size")); + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("size > maximum buffer size")); goto cleanup; } @@ -1389,7 +1385,7 @@ remoteDispatchDomainGetSecurityLabel(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1436,7 +1432,7 @@ remoteDispatchNodeGetSecurityModel(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1482,7 +1478,7 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1490,13 +1486,13 @@ remoteDispatchDomainGetVcpuPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED, goto cleanup; if (args->ncpumaps > REMOTE_VCPUINFO_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps > REMOTE_VCPUINFO_MAX")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps > REMOTE_VCPUINFO_MAX")); goto cleanup; } if (INT_MULTIPLY_OVERFLOW(args->ncpumaps, args->maplen) || args->ncpumaps * args->maplen > REMOTE_CPUMAPS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); goto cleanup; } @@ -1553,7 +1549,7 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1561,13 +1557,13 @@ remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED, goto cleanup; if (args->maxinfo > REMOTE_VCPUINFO_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX")); goto cleanup; } if (INT_MULTIPLY_OVERFLOW(args->maxinfo, args->maplen) || args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX")); goto cleanup; } @@ -1639,7 +1635,7 @@ remoteDispatchDomainMigratePrepare(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1696,7 +1692,7 @@ remoteDispatchDomainMigratePrepare2(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -1747,14 +1743,14 @@ remoteDispatchDomainGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } flags = args->flags; if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -1812,14 +1808,14 @@ remoteDispatchDomainGetNumaParameters(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } flags = args->flags; if (nparams > REMOTE_DOMAIN_NUMA_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -1877,14 +1873,14 @@ remoteDispatchDomainGetBlkioParameters(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } flags = args->flags; if (nparams > REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -1943,14 +1939,14 @@ remoteDispatchNodeGetCPUStats(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } flags = args->flags; if (nparams > REMOTE_NODE_CPU_STATS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -2021,14 +2017,14 @@ remoteDispatchNodeGetMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } flags = args->flags; if (nparams > REMOTE_NODE_MEMORY_STATS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -2096,7 +2092,7 @@ remoteDispatchDomainGetBlockJobInfo(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -2138,12 +2134,12 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } if (nparams > REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } @@ -2323,8 +2319,8 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED, authfail: virResetLastError(); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); virNetMessageSaveError(rerr); PROBE(RPC_SERVER_CLIENT_AUTH_FAIL, "client=%p auth=%d", @@ -2474,8 +2470,8 @@ error: virNetSASLSessionFree(priv->sasl); priv->sasl = NULL; virResetLastError(); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); if (rv < 0) virNetMessageSaveError(rerr); virMutexUnlock(&priv->lock); @@ -2572,8 +2568,8 @@ error: virNetSASLSessionFree(priv->sasl); priv->sasl = NULL; virResetLastError(); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); if (rv < 0) virNetMessageSaveError(rerr); virMutexUnlock(&priv->lock); @@ -2588,8 +2584,8 @@ remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED, remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED) { VIR_WARN("Client tried unsupported SASL auth"); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); virNetMessageSaveError(rerr); return -1; } @@ -2602,8 +2598,8 @@ remoteDispatchAuthSaslStart(virNetServerPtr server ATTRIBUTE_UNUSED, remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED) { VIR_WARN("Client tried unsupported SASL auth"); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); virNetMessageSaveError(rerr); return -1; } @@ -2616,8 +2612,8 @@ remoteDispatchAuthSaslStep(virNetServerPtr server ATTRIBUTE_UNUSED, remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED) { VIR_WARN("Client tried unsupported SASL auth"); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); virNetMessageSaveError(rerr); return -1; } @@ -2710,11 +2706,11 @@ error: virResetLastError(); if (authdismissed) { - virNetError(VIR_ERR_AUTH_CANCELLED, "%s", - _("authentication cancelled by user")); + virReportError(VIR_ERR_AUTH_CANCELLED, "%s", + _("authentication cancelled by user")); } else { - virNetError(VIR_ERR_AUTH_FAILED, "%s", - pkout && *pkout ? pkout : _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + pkout && *pkout ? pkout : _("authentication failed")); } VIR_FREE(pkout); @@ -2859,8 +2855,8 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED, error: VIR_FREE(ident); virResetLastError(); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); virNetMessageSaveError(rerr); virMutexUnlock(&priv->lock); return -1; @@ -2888,8 +2884,8 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED, remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED) { VIR_ERROR(_("client tried unsupported PolicyKit init request")); - virNetError(VIR_ERR_AUTH_FAILED, "%s", - _("authentication failed")); + virReportError(VIR_ERR_AUTH_FAILED, "%s", + _("authentication failed")); virNetMessageSaveError(rerr); return -1; } @@ -2915,7 +2911,7 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -2968,14 +2964,14 @@ remoteDispatchDomainEventsRegister(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } virMutexLock(&priv->lock); if (priv->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE] != -1) { - virNetError(VIR_ERR_INTERNAL_ERROR, _("domain event %d already registered"), VIR_DOMAIN_EVENT_ID_LIFECYCLE); + virReportError(VIR_ERR_INTERNAL_ERROR, _("domain event %d already registered"), VIR_DOMAIN_EVENT_ID_LIFECYCLE); goto cleanup; } @@ -3009,14 +3005,14 @@ remoteDispatchDomainEventsDeregister(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } virMutexLock(&priv->lock); if (priv->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE] < 0) { - virNetError(VIR_ERR_INTERNAL_ERROR, _("domain event %d not registered"), VIR_DOMAIN_EVENT_ID_LIFECYCLE); + virReportError(VIR_ERR_INTERNAL_ERROR, _("domain event %d not registered"), VIR_DOMAIN_EVENT_ID_LIFECYCLE); goto cleanup; } @@ -3087,7 +3083,7 @@ remoteDispatchSecretGetValue(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3124,7 +3120,7 @@ remoteDispatchDomainGetState(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3157,7 +3153,7 @@ remoteDispatchDomainEventsRegisterAny(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3165,12 +3161,12 @@ remoteDispatchDomainEventsRegisterAny(virNetServerPtr server ATTRIBUTE_UNUSED, if (args->eventID >= VIR_DOMAIN_EVENT_ID_LAST || args->eventID < 0) { - virNetError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"), args->eventID); + virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"), args->eventID); goto cleanup; } if (priv->domainEventCallbackID[args->eventID] != -1) { - virNetError(VIR_ERR_INTERNAL_ERROR, _("domain event %d already registered"), args->eventID); + virReportError(VIR_ERR_INTERNAL_ERROR, _("domain event %d already registered"), args->eventID); goto cleanup; } @@ -3206,7 +3202,7 @@ remoteDispatchDomainEventsDeregisterAny(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3214,13 +3210,13 @@ remoteDispatchDomainEventsDeregisterAny(virNetServerPtr server ATTRIBUTE_UNUSED, if (args->eventID >= VIR_DOMAIN_EVENT_ID_LAST || args->eventID < 0) { - virNetError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"), args->eventID); + virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"), args->eventID); goto cleanup; } callbackID = priv->domainEventCallbackID[args->eventID]; if (callbackID < 0) { - virNetError(VIR_ERR_INTERNAL_ERROR, _("domain event %d not registered"), args->eventID); + virReportError(VIR_ERR_INTERNAL_ERROR, _("domain event %d not registered"), args->eventID); goto cleanup; } @@ -3252,7 +3248,7 @@ qemuDispatchMonitorCommand(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3293,7 +3289,7 @@ remoteDispatchDomainMigrateBegin3(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3344,7 +3340,7 @@ remoteDispatchDomainMigratePrepare3(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3404,7 +3400,7 @@ remoteDispatchDomainMigratePerform3(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3458,7 +3454,7 @@ remoteDispatchDomainMigrateFinish3(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3507,7 +3503,7 @@ remoteDispatchDomainMigrateConfirm3(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3555,7 +3551,7 @@ static int remoteDispatchSupportsFeature( } if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3595,7 +3591,7 @@ remoteDispatchDomainOpenGraphics(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3640,14 +3636,14 @@ remoteDispatchDomainGetInterfaceParameters(virNetServerPtr server ATTRIBUTE_UNUS virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } flags = args->flags; if (nparams > REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (VIR_ALLOC_N(params, nparams) < 0) { @@ -3704,16 +3700,16 @@ remoteDispatchDomainGetCPUStats(virNetServerPtr server ATTRIBUTE_UNUSED, priv = virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } if (args->nparams > REMOTE_NODE_CPU_STATS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large")); goto cleanup; } if (args->ncpus > REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpus too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpus too large")); goto cleanup; } @@ -3779,7 +3775,7 @@ static int remoteDispatchDomainGetDiskErrors( virNetServerClientGetPrivateData(client); if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3787,8 +3783,8 @@ static int remoteDispatchDomainGetDiskErrors( goto cleanup; if (args->maxerrors > REMOTE_DOMAIN_DISK_ERRORS_MAX) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", - _("maxerrors too large")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("maxerrors too large")); goto cleanup; } @@ -3842,7 +3838,7 @@ remoteDispatchDomainListAllSnapshots(virNetServerPtr server ATTRIBUTE_UNUSED, virDomainPtr dom = NULL; if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } @@ -3903,7 +3899,7 @@ remoteDispatchDomainSnapshotListAllChildren(virNetServerPtr server ATTRIBUTE_UNU virDomainSnapshotPtr snapshot = NULL; if (!priv->conn) { - virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); goto cleanup; } diff --git a/daemon/stream.c b/daemon/stream.c index bb66f75..a0e96af 100644 --- a/daemon/stream.c +++ b/daemon/stream.c @@ -32,10 +32,6 @@ #define VIR_FROM_THIS VIR_FROM_STREAMS -#define virNetError(code, ...) \ - virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) - struct daemonClientStream { daemonClientPrivatePtr priv; int refs; @@ -233,11 +229,11 @@ daemonStreamEvent(virStreamPtr st, int events, void *opaque) virStreamEventRemoveCallback(stream->st); virStreamAbort(stream->st); if (events & VIR_STREAM_EVENT_HANGUP) - virNetError(VIR_ERR_RPC, - "%s", _("stream had unexpected termination")); + virReportError(VIR_ERR_RPC, + "%s", _("stream had unexpected termination")); else - virNetError(VIR_ERR_RPC, - "%s", _("stream had I/O failure")); + virReportError(VIR_ERR_RPC, + "%s", _("stream had I/O failure")); msg = virNetMessageNew(false); if (!msg) { @@ -618,13 +614,13 @@ daemonStreamHandleAbort(virNetServerClientPtr client, virStreamAbort(stream->st); if (msg->header.status == VIR_NET_ERROR) - virNetError(VIR_ERR_RPC, - "%s", _("stream aborted at client request")); + virReportError(VIR_ERR_RPC, + "%s", _("stream aborted at client request")); else { VIR_WARN("unexpected stream status %d", msg->header.status); - virNetError(VIR_ERR_RPC, - _("stream aborted with unexpected status %d"), - msg->header.status); + virReportError(VIR_ERR_RPC, + _("stream aborted with unexpected status %d"), + msg->header.status); } return virNetServerProgramSendReplyError(remoteProgram, diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 36248fd..1fb5971 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -778,15 +778,15 @@ elsif ($opt_b) { print "\n"; print " if (!priv->conn) {\n"; - print " virNetError(VIR_ERR_INTERNAL_ERROR, \"%s\", _(\"connection not open\"));\n"; + print " virReportError(VIR_ERR_INTERNAL_ERROR, \"%s\", _(\"connection not open\"));\n"; print " goto cleanup;\n"; print " }\n"; print "\n"; if ($single_ret_as_list) { print " if (args->$single_ret_list_max_var > $single_ret_list_max_define) {\n"; - print " virNetError(VIR_ERR_INTERNAL_ERROR,\n"; - print " \"%s\", _(\"max$single_ret_list_name > $single_ret_list_max_define\"));\n"; + print " virReportError(VIR_ERR_INTERNAL_ERROR,\n"; + print " \"%s\", _(\"max$single_ret_list_name > $single_ret_list_max_define\"));\n"; print " goto cleanup;\n"; print " }\n"; print "\n"; -- 1.7.10.4

On 18.07.2012 20:40, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Update the libvirtd dispatch code to use virReportError instead of the virNetError custom macro
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- daemon/remote.c | 214 ++++++++++++++++++++++++------------------------ daemon/stream.c | 22 ++--- src/rpc/gendispatch.pl | 6 +- 3 files changed, 117 insertions(+), 125 deletions(-)
ACK Michal
participants (6)
-
Daniel P. Berrange
-
Eric Blake
-
Jiri Denemark
-
Martin Kletzander
-
Michal Privoznik
-
Peter Krempa