From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466623; cv=none; d=zohomail.com; s=zohoarc; b=bB0FGFbzN71Jz5KV0tjTcOdoz7Y0eENcKlwiOlJzELVY9se6JeXwXHxUbvwV1XGvj1Ukr0MMJl+2l8l/dgGG70+IMTLPwuE1dd2//lJzLndVvaIvmkz2F6pCjcrgT54Q9KEBDxTqCjSeMOXcjijRr8wBQVavij8qrXGDjhG+I1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466623; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6nwKJ5MgeP5Z5vMaha3zAf6k+18P5zTyEMBUUXgLVTw=; b=ePu0uhWh9vH491GatF0DBewd6d5weW6GqsedfCNBratmpRv4iIr2kZaQafGATtukCuT1pmGv1saY61QwoDKdVnDU3YuT1EpQnuKf0WqwB1zZnNV8R0l5+07V+HCbbYx81OFoFXhpy9crDqpBCmUMb0RfC7qTmFfX+R430KGL3B4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674466623953897.5247076275203; Mon, 23 Jan 2023 01:37:03 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-SHvgBu7ePu6R6zz8ulk8RA-1; Mon, 23 Jan 2023 04:36:02 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A24363C31DE8; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F541175A2; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 74054194658D; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2E3551946589 for ; Mon, 23 Jan 2023 09:35:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 12061492D0F; Mon, 23 Jan 2023 09:35:57 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD759492B02 for ; Mon, 23 Jan 2023 09:35:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466622; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6nwKJ5MgeP5Z5vMaha3zAf6k+18P5zTyEMBUUXgLVTw=; b=fDifS6zcQsCYP706nQq39HQYgIokaTOAIyMRpakND3jMS2QntjvLFdbhKyxWjE8TJXLubc NwtjBzzuSYpM3fYGGjv76RzFMkB534fjDOOVl/WOMHKnlwQhij/3ammSfK+QNdDx8ty0ts BO7bXbwfW5Z5geJjvM2IVuiQrg8p0No= X-MC-Unique: SHvgBu7ePu6R6zz8ulk8RA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/8] vbox: Introduce VBOX_QUERY_INTERFACE() Date: Mon, 23 Jan 2023 10:35:48 +0100 Message-Id: <17f035aa1b0fe39c35ed64d468724af9aa1041ce.1674466489.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466626095100001 Content-Type: text/plain; charset="utf-8"; x-default="true" So far we haven't needed to use a different interface for objects we are working with. We were happy with calling their respective vtbl callbacks. Well, this will change soon as we will query an exception (type of nsIException) but will need to promote it to IVirtualBoxErrorInfo class. This promoting is done by QueryInterface() callback which accepts 3 arguments: the original object, ID of the new interface and address where to store the promoted object. As this is very basic operation, available to every object, it is part of the ISupports interface among with other goodies like AddRef() and Release(). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.h | 3 +++ src/vbox/vbox_tmpl.c | 6 ++++++ src/vbox/vbox_uniformed_api.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h index 1fb922aaf0..38afdfddfa 100644 --- a/src/vbox/vbox_common.h +++ b/src/vbox/vbox_common.h @@ -405,6 +405,9 @@ typedef nsISupports IKeyboard; abort(); \ } while (0) =20 +#define VBOX_QUERY_INTERFACE(nsi, iid, resultp) \ + gVBoxAPI.nsUISupports.QueryInterface((void*)(nsi), iid, resultp) + #define VBOX_ADDREF(arg) gVBoxAPI.nsUISupports.AddRef((void= *)(arg)) =20 #define VBOX_RELEASE(arg) \ diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 52b1c93b6d..f01f8bd487 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -563,6 +563,11 @@ static void* _handleHostGetNetworkInterfaces(IHost *ho= st) return host->vtbl->GetNetworkInterfaces; } =20 +static nsresult _nsisupportsQueryInterface(nsISupports *nsi, const nsID *i= id, void **resultp) +{ + return nsi->vtbl->QueryInterface(nsi, iid, resultp); +} + static nsresult _nsisupportsRelease(nsISupports *nsi) { return nsi->vtbl->Release(nsi); @@ -2238,6 +2243,7 @@ static vboxUniformedArray _UArray =3D { }; =20 static vboxUniformednsISupports _nsUISupports =3D { + .QueryInterface =3D _nsisupportsQueryInterface, .Release =3D _nsisupportsRelease, .AddRef =3D _nsisupportsAddRef, }; diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index 18f352d98e..3ac6ba92a6 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -145,6 +145,7 @@ typedef struct { =20 /* Functions for nsISupports */ typedef struct { + nsresult (*QueryInterface)(nsISupports *nsi, const nsID *iid, void **r= esultp); nsresult (*Release)(nsISupports *nsi); nsresult (*AddRef)(nsISupports *nsi); } vboxUniformednsISupports; --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466569; cv=none; d=zohomail.com; s=zohoarc; b=SPXImr5gLTZJm7wuIVu6rmOX50ey8YWmTaqkQwz+a+fpnHPDxzmKsrAO1zUJHwQFGSEbcSaKCKNVExguEzy0fzpIlnaSaNBJBgjxEj/cavjG00MwYGAJjS5Fann8Qb2h9apcDk48JtcqsaTgs71BHGjW73DZrgUxtq45d0+f//M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466569; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oGQS7Xsg9ts/fM8t/poNuzR05957NH+K3fwfjiMo4+k=; b=gkLDRuOsS4G9eV0hjk3GWG8iXMUyZ2CBADojZYJY7QN1rpioU+I9WSVJA6v6r9yswW30hne5PSxur9TCf4fJ4kIRvcublrKuLsPJ1nEiCRU7339SFBw26/veeX/hsia87otJ8yVJslsfpldY3qOYAa0KNCKv72yrGeE8iY+BT8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674466569632368.28513917520115; Mon, 23 Jan 2023 01:36:09 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-326-yX9Vu8tGOPaT5BnWH-GrtA-1; Mon, 23 Jan 2023 04:36:01 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 49668886063; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 326542166B33; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1CACA194658C; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C1E4B1946589 for ; Mon, 23 Jan 2023 09:35:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A34BC492D0F; Mon, 23 Jan 2023 09:35:57 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49731492B02 for ; Mon, 23 Jan 2023 09:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466568; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oGQS7Xsg9ts/fM8t/poNuzR05957NH+K3fwfjiMo4+k=; b=aysqL89hAIe1Bd44H4WTMlIHkLXbUEsBC46yvAb2fSlfcJc32NNLtVOs4/Zu8EhAz8LfPx 6JODVhd1lvTZ8xiqGCKdkD4+v12tKph5of2Kssb8Kuw5DEY3ywPMvppKvu+V0OY/o+Goh9 hnt/Bnba5/zenJveFEvgpM3cuaQQLhE= X-MC-Unique: yX9Vu8tGOPaT5BnWH-GrtA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/8] vbox: Introduce IVirtualBoxErrorInfo interface Date: Mon, 23 Jan 2023 10:35:49 +0100 Message-Id: <8fb40909510d2066173059a6780ade606842faac.1674466489.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466571763100007 Content-Type: text/plain; charset="utf-8"; x-default="true" The IVirtualBoxErrorInfo interface allows us to query error messages from VirtualBox. Since VirtualBox has stacked errors we need the GetNext() method too. The odd one, that sticks out is GetIID() as it is not part of the interface as defined bu VirtualBox header files. BUT, we need to get the interface UUID (which MAY change across each release) so that it can be passed to VBOX_QUERY_INTERFACE() introduced earlier. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.h | 1 + src/vbox/vbox_tmpl.c | 34 ++++++++++++++++++++++++++++++++++ src/vbox/vbox_uniformed_api.h | 8 ++++++++ 3 files changed, 43 insertions(+) diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h index 38afdfddfa..78c36dcb19 100644 --- a/src/vbox/vbox_common.h +++ b/src/vbox/vbox_common.h @@ -361,6 +361,7 @@ typedef nsISupports IHost; typedef nsISupports IHostNetworkInterface; typedef nsISupports IDHCPServer; typedef nsISupports IKeyboard; +typedef nsISupports IVirtualBoxErrorInfo; =20 /* Macros for all vbox drivers. */ =20 diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index f01f8bd487..06cdd82e12 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -2169,6 +2169,32 @@ _keyboardPutScancodes(IKeyboard *keyboard, PRUint32 = scancodesSize, codesStored); } =20 +static const nsID * +_virtualBoxErrorInfoGetIID(void) +{ + static const nsID ret =3D IVIRTUALBOXERRORINFO_IID; + + return &ret; +} + +static nsresult +_virtualBoxErrorInfoGetComponent(IVirtualBoxErrorInfo *errInfo, PRUnichar = **component) +{ + return errInfo->vtbl->GetComponent(errInfo, component); +} + +static nsresult +_virtualBoxErrorInfoGetNext(IVirtualBoxErrorInfo *errInfo, IVirtualBoxErro= rInfo **next) +{ + return errInfo->vtbl->GetNext(errInfo, next); +} + +static nsresult +_virtualBoxErrorInfoGetText(IVirtualBoxErrorInfo *errInfo, PRUnichar **tex= t) +{ + return errInfo->vtbl->GetText(errInfo, text); +} + static bool _machineStateOnline(PRUint32 state) { return ((state >=3D MachineState_FirstOnline) && @@ -2526,6 +2552,13 @@ static vboxUniformedIKeyboard _UIKeyboard =3D { .PutScancodes =3D _keyboardPutScancodes, }; =20 +static vboxUniformedIVirtualBoxErrorInfo _UIVirtualBoxErrorInfo =3D { + .GetIID =3D _virtualBoxErrorInfoGetIID, + .GetComponent =3D _virtualBoxErrorInfoGetComponent, + .GetNext =3D _virtualBoxErrorInfoGetNext, + .GetText =3D _virtualBoxErrorInfoGetText, +}; + static uniformedMachineStateChecker _machineStateChecker =3D { .Online =3D _machineStateOnline, .Inactive =3D _machineStateInactive, @@ -2571,6 +2604,7 @@ void NAME(InstallUniformedAPI)(vboxUniformedAPI *pVBo= xAPI) pVBoxAPI->UIHNInterface =3D _UIHNInterface; pVBoxAPI->UIDHCPServer =3D _UIDHCPServer; pVBoxAPI->UIKeyboard =3D _UIKeyboard; + pVBoxAPI->UIVirtualBoxErrorInfo =3D _UIVirtualBoxErrorInfo; pVBoxAPI->machineStateChecker =3D _machineStateChecker; =20 pVBoxAPI->chipsetType =3D 1; diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index 3ac6ba92a6..b0674b4815 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -498,6 +498,13 @@ typedef struct { PRInt32 *scanCodes, PRUint32 *codesStored); } vboxUniformedIKeyboard; =20 +typedef struct { + const nsID * (*GetIID)(void); + nsresult (*GetComponent)(IVirtualBoxErrorInfo *errInfo, PRUnichar **co= mponent); + nsresult (*GetNext)(IVirtualBoxErrorInfo *errInfo, IVirtualBoxErrorInf= o **next); + nsresult (*GetText)(IVirtualBoxErrorInfo *errInfo, PRUnichar **text); +} vboxUniformedIVirtualBoxErrorInfo; + typedef struct { bool (*Online)(PRUint32 state); bool (*Inactive)(PRUint32 state); @@ -545,6 +552,7 @@ typedef struct { vboxUniformedIHNInterface UIHNInterface; vboxUniformedIDHCPServer UIDHCPServer; vboxUniformedIKeyboard UIKeyboard; + vboxUniformedIVirtualBoxErrorInfo UIVirtualBoxErrorInfo; uniformedMachineStateChecker machineStateChecker; /* vbox API features */ bool chipsetType; --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466569; cv=none; d=zohomail.com; s=zohoarc; b=a7okXcG73RxpeOH9//vpg68H889/eUey1Ra0d7C5/wsmr0lY69jJnY/iDDgS+5bbWk3QpVTmA6kPEkuedjZAR3OxM8WUaQeoKFDkRL1C7gcGaaM/mPVQH/JTR1fVmGT1s3jKd8AvQsVjE+ImfmsPAe4BBNbuuMy+vhJKUulvKvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466569; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ejNqQqkaHR8M1Lirt1JUp/RbCnz27/0K5L+PTOgNWYU=; b=iLDhqX0gJKx4emRhE/2s25DBRWMQllSfiae5ptnRxqxTXYOvuRymbq7Qq2/4hHs4KLI3wQ5ymi2TR495W4x/AwO0yBYeBZ+ANbgNBfurnpDySpph/BU6MVaALgrE9riTFFvoczE5pYDMJlO6tWUVdTzriafPIOOWvbw2Pu/uWco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674466569161140.2733655016001; Mon, 23 Jan 2023 01:36:09 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-183-pn-sIuAIPO-cwKyv_G43_A-1; Mon, 23 Jan 2023 04:36:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97D1B8030DE; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 828FC40C2004; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 64EDE194658D; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6296C1946589 for ; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 54326492B03; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB8EE492B02 for ; Mon, 23 Jan 2023 09:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466568; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ejNqQqkaHR8M1Lirt1JUp/RbCnz27/0K5L+PTOgNWYU=; b=BGDa6gaN9ZLCUp+JelbRcLmz+MA/R2C89xFwjJpUxhAOBAEufM+lM03RXaBw3HAr/u9uyM JZw6hfr/JholVaSeZQ53D4+MOaDPfGCoSDs7N/o8TztrnOEiQ2vwGfrI3jdYZ9j0fqMgXq sxyzI7B17afJbp/rgSIxmKBFE+b3cyY= X-MC-Unique: pn-sIuAIPO-cwKyv_G43_A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/8] vbox: Introduce vboxUniformedPFN::GetException() Date: Mon, 23 Jan 2023 10:35:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466569744100004 Content-Type: text/plain; charset="utf-8"; x-default="true" The GetException() method can be used to obtain the latest exception that occurred in VirtualBox. Calling the method does not reset the exception though. For that we'll need to call another method (introduced in following commit). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.h | 2 ++ src/vbox/vbox_tmpl.c | 6 ++++++ src/vbox/vbox_uniformed_api.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h index 78c36dcb19..08da0845a6 100644 --- a/src/vbox/vbox_common.h +++ b/src/vbox/vbox_common.h @@ -109,6 +109,7 @@ typedef unsigned long PRUword; =20 #define nsnull 0 typedef PRUint32 nsresult; +#define HRESULT nsresult =20 #if defined(__GNUC__) && (__GNUC__ > 2) # define NS_LIKELY(x) (__builtin_expect((x), 1)) @@ -362,6 +363,7 @@ typedef nsISupports IHostNetworkInterface; typedef nsISupports IDHCPServer; typedef nsISupports IKeyboard; typedef nsISupports IVirtualBoxErrorInfo; +typedef struct nsIException nsIException; =20 /* Macros for all vbox drivers. */ =20 diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 06cdd82e12..ba7dc34a6b 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -483,6 +483,11 @@ static int _pfnUtf8ToUtf16(PCVBOXXPCOM pFuncs, const c= har *pszString, PRUnichar return pFuncs->pfnUtf8ToUtf16(pszString, ppwszString); } =20 +static HRESULT _pfnGetException(PCVBOXXPCOM pFuncs, IErrorInfo **ppExcepti= on) +{ + return pFuncs->pfnGetException(ppException); +} + static void _vboxIIDInitialize(vboxIID *iid) { memset(iid, 0, sizeof(vboxIID)); @@ -2237,6 +2242,7 @@ static vboxUniformedPFN _UPFN =3D { .Utf8Free =3D _pfnUtf8Free, .Utf16ToUtf8 =3D _pfnUtf16ToUtf8, .Utf8ToUtf16 =3D _pfnUtf8ToUtf16, + .GetException =3D _pfnGetException, }; =20 static vboxUniformedIID _UIID =3D { diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index b0674b4815..465a7877d9 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -109,6 +109,7 @@ typedef struct { void (*Utf8Free)(PCVBOXXPCOM pFuncs, char *pszString); int (*Utf16ToUtf8)(PCVBOXXPCOM pFuncs, const PRUnichar *pwszString, ch= ar **ppszString); int (*Utf8ToUtf16)(PCVBOXXPCOM pFuncs, const char *pszString, PRUnicha= r **ppwszString); + HRESULT (*GetException)(PCVBOXXPCOM pFuncs, nsIException **ppException= ); } vboxUniformedPFN; =20 /* Functions for vboxIID */ --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466573; cv=none; d=zohomail.com; s=zohoarc; b=NUO3vvzzrR7mFw8ipdJZhEHTYkiiSULd1GOZs5HWDfAYF/aQ/SnCwMG2VuvkTJo7nLkhtcxAIPwcDX/3+QfyaOba70+Hc3y+BIwoFrkVGGfpZ5ULBo+q2mIPrD/cIPOThm2xunPOhvjQBpX+l92J7TVweI5hPaUEp5VFPpIG3xQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466573; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4LSm9zB2G2Y+MO8y+uL7hV8aeScGx4OyDGjEZg3Hfa0=; b=Vx3O9Wy0Ee6TXAFW3Xw+AND4hfXhlmlmw2JYuE2PGkUxgmUg+CPHLBVbVgaJo0JlM/vVXJo0VChvQOLBJAlN95fOqW3LOg1hXc1LLUi3Rk+aHefGzKdzMFfTa+s603/714qVC8B32Al/Ej+XUxTZ3FI6Fe3R3mhx7cLNa2mlfrw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16744665731891021.4357337165177; Mon, 23 Jan 2023 01:36:13 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-4FP9e04vMnad-25qjBxwiw-1; Mon, 23 Jan 2023 04:36:05 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDD8018A63F9; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA092492C3C; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A801A19465B5; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC4A11946589 for ; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E3A3C492B02; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A92C492B03 for ; Mon, 23 Jan 2023 09:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466572; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4LSm9zB2G2Y+MO8y+uL7hV8aeScGx4OyDGjEZg3Hfa0=; b=XCu1ZdZNJNq4eIvlSLEm0L+mEVpkKPi4m49+w24bPFg+UMQNidhn53gkX/hs7hpBE5urVD FDm6dz4QgKgVy8bM8SCY3R1AkvJSdZMQZrxHtUnYPmGUrn3DVG1Ea+KPXmD/d/CRg8Uq+K i94xTprfUFshQogZuQQtl/dsnziLvJE= X-MC-Unique: 4FP9e04vMnad-25qjBxwiw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 4/8] vbox: Introduce vboxUniformedPFN::ClearException() Date: Mon, 23 Jan 2023 10:35:51 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466573750100009 Content-Type: text/plain; charset="utf-8"; x-default="true" The ClearException() method clears the latest exception inside of VirtualBox. This needed because obtaining an exception via GetException() does not clear it. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_tmpl.c | 6 ++++++ src/vbox/vbox_uniformed_api.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index ba7dc34a6b..a0c6a8f287 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -488,6 +488,11 @@ static HRESULT _pfnGetException(PCVBOXXPCOM pFuncs, IE= rrorInfo **ppException) return pFuncs->pfnGetException(ppException); } =20 +static HRESULT _pfnClearException(PCVBOXXPCOM pFuncs) +{ + return pFuncs->pfnClearException(); +} + static void _vboxIIDInitialize(vboxIID *iid) { memset(iid, 0, sizeof(vboxIID)); @@ -2243,6 +2248,7 @@ static vboxUniformedPFN _UPFN =3D { .Utf16ToUtf8 =3D _pfnUtf16ToUtf8, .Utf8ToUtf16 =3D _pfnUtf8ToUtf16, .GetException =3D _pfnGetException, + .ClearException =3D _pfnClearException, }; =20 static vboxUniformedIID _UIID =3D { diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index 465a7877d9..2d61ed97fa 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -110,6 +110,7 @@ typedef struct { int (*Utf16ToUtf8)(PCVBOXXPCOM pFuncs, const PRUnichar *pwszString, ch= ar **ppszString); int (*Utf8ToUtf16)(PCVBOXXPCOM pFuncs, const char *pszString, PRUnicha= r **ppwszString); HRESULT (*GetException)(PCVBOXXPCOM pFuncs, nsIException **ppException= ); + HRESULT (*ClearException)(PCVBOXXPCOM pFuncs); } vboxUniformedPFN; =20 /* Functions for vboxIID */ --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466626; cv=none; d=zohomail.com; s=zohoarc; b=a0D51yA2q3li++k3RzW8iiFwouhOjetkp6aZVmPu4/0BD9Kxt6o38sb6lgCdfVvctHZ5xNtrP1jWNbw+0zaU1m5DglMgpQSghS4fP9ff37ck83lWjIZnXH9y3hreUHLE8FSTTwAUvOOifctoN6ahOR9lz03dtkhnoGN61sjLz4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466626; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GOgcvk/TgoL2UsFkvGwwzTffy+wx0njNvVJsQ3qObV4=; b=i2zyuhCk2/sc59RWTM7T6F2tPuI8up4m19CML9ZhipMvPPvIcluydAs4Bu3jJ+4YZdRCtGF3uLz6jhRXQb6Ni1ieQmAIc1b8OFvvoqjaMEKL6BhOIdO//o3LO1l55gk04Yo+n9jAogsRcA4OxRl5IunevUfJ4cqWPB5DjeT9FTw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674466626205190.43850423156061; Mon, 23 Jan 2023 01:37:06 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-ReOLINXtPC2yjZi8XuCAhA-1; Mon, 23 Jan 2023 04:36:04 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5493886475; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2564C15BAD; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B10C8194658D; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 89DBA1946589 for ; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7F2B1492B03; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2667A492B02 for ; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GOgcvk/TgoL2UsFkvGwwzTffy+wx0njNvVJsQ3qObV4=; b=JtMgrEE6e8ctlVmZm+86uk2KpvIWEua2MVmbSFRLNXH0G1BhvXLix2cmJ5RRBz2arJPEt+ f0TVF4LQnBvwS6cvf3vzYv4QaQb5WgED85O6jPUpCRA1VXTKGWq2BW6xsvVQ+GeV2aaZNu rT5qnTOzIRkhpYY73MNzRCFvCeWIN28= X-MC-Unique: ReOLINXtPC2yjZi8XuCAhA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/8] vbox: Introduce vboxReportError() Date: Mon, 23 Jan 2023 10:35:52 +0100 Message-Id: <0beca945f3cdaeb05c65de14ed358547c5bd6fa4.1674466489.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466628065100005 Content-Type: text/plain; charset="utf-8"; x-default="true" When a VirtualBox API fails it produced an exception. Until now, we did not have correct APIs wired up to get the exception and its error message. Thus, we were left with plain: virReportError("virtualbox API failed, rc=3D%08x", rc); This is not very user friendly because those rc values are hard to parse (e.g. some values are defined as a sum of a base value and some other value) and also it expects users to know where to look. But now that we have all machinery needed for querying exceptions, vboxReportError() can be introduced. The aim is to query VirtualBox exceptions and append them after the error message we intent to report. If the exception can't be queried successfully, this behaves exactly like virReportError(). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.c | 113 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index bd77641d39..2a913e5975 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -63,6 +63,119 @@ static struct _vboxDriver *vbox_driver; static struct _vboxDriver *vboxDriverObjNew(void); static __thread bool vboxDriverDisposed; =20 +#define vboxReportError(errcode, ...) \ + vboxReportErrorHelper(data, errcode, __FILE__, \ + __FUNCTION__, __LINE__, __VA_ARGS__) + +static void G_GNUC_PRINTF(6, 7) G_GNUC_UNUSED +vboxReportErrorHelper(struct _vboxDriver *data, + int errcode, + const char *filename, + const char *funcname, + size_t linenr, + const char *fmt, ...) +{ + int save_errno =3D errno; + g_auto(virBuffer) errBuf =3D VIR_BUFFER_INITIALIZER; + nsIException *ex =3D NULL; + IVirtualBoxErrorInfo *ei =3D NULL; + const nsID *vboxErrorInfoIID =3D NULL; + bool multipleLines =3D false; + nsresult rc; + g_autofree char *detail =3D NULL; + + if (fmt) { + va_list args; + + va_start(args, fmt); + detail =3D g_strdup_vprintf(fmt, args); + va_end(args); + } + + rc =3D gVBoxAPI.UPFN.GetException(data->pFuncs, &ex); + if (NS_FAILED(rc) || !ex) { + VIR_WARN("failed to get exception object"); + goto report; + } + + vboxErrorInfoIID =3D gVBoxAPI.UIVirtualBoxErrorInfo.GetIID(); + rc =3D VBOX_QUERY_INTERFACE(ex, vboxErrorInfoIID, (void **)&ei); + if (NS_FAILED(rc) || !ei) { + VIR_WARN("unable to typecast exception object"); + goto report; + } + + while (ei) { + IVirtualBoxErrorInfo *ei_next =3D NULL; + PRUnichar *componentUtf16 =3D NULL; + char *componentUtf8 =3D NULL; + PRUnichar *textUtf16 =3D NULL; + char *textUtf8 =3D NULL; + + rc =3D gVBoxAPI.UIVirtualBoxErrorInfo.GetComponent(ei, &componentU= tf16); + if (NS_FAILED(rc)) { + VIR_WARN("failed to get error text"); + goto report; + } + + rc =3D gVBoxAPI.UIVirtualBoxErrorInfo.GetText(ei, &textUtf16); + if (NS_FAILED(rc)) { + VBOX_UTF16_FREE(componentUtf16); + VIR_WARN("failed to get error text"); + goto report; + } + + VBOX_UTF16_TO_UTF8(componentUtf16, &componentUtf8); + VBOX_UTF16_FREE(componentUtf16); + + VBOX_UTF16_TO_UTF8(textUtf16, &textUtf8); + VBOX_UTF16_FREE(textUtf16); + + virBufferAsprintf(&errBuf, "%s: %s", componentUtf8, textUtf8); + VBOX_UTF8_FREE(componentUtf8); + VBOX_UTF8_FREE(textUtf8); + + if (multipleLines) + virBufferAddChar(&errBuf, '\n'); + else + multipleLines =3D true; + + rc =3D gVBoxAPI.UIVirtualBoxErrorInfo.GetNext(ei, &ei_next); + if (NS_FAILED(rc)) { + break; + } + + VBOX_RELEASE(ei); + ei =3D ei_next; + } + + report: + if (virBufferUse(&errBuf)) { + const char *vboxErr =3D virBufferCurrentContent(&errBuf); + g_autofree char *newDetail =3D NULL; + + if (!detail || STREQ(detail, "")) { + newDetail =3D g_strdup(vboxErr); + } else { + newDetail =3D g_strdup_printf("%s: %s", detail, vboxErr); + } + + VIR_FREE(detail); + detail =3D g_steal_pointer(&newDetail); + } + + virReportErrorHelper(VIR_FROM_THIS, errcode, filename, funcname, linen= r, "%s", detail); + + rc =3D gVBoxAPI.UPFN.ClearException(data->pFuncs); + if (NS_FAILED(rc)) { + VIR_WARN("failed to clear exception"); + } + + VBOX_RELEASE(ei); + VBOX_RELEASE(ex); + errno =3D save_errno; +} + static int vboxDomainDevicesDefPostParse(virDomainDeviceDef *dev G_GNUC_UNUSED, const virDomainDef *def G_GNUC_UNUSED, --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466626; cv=none; d=zohomail.com; s=zohoarc; b=kbvzyB7N6SOE7/YeBmtFvYDt3OzAbdnvCXUIBL+QP93ZFJCD35lfkLalM5LbfW72ggTDDL4/c8Z8bW3NOMZapzt2tyo6Qs12WCmn1ZrALQCQ3riW+NbNoAnAK7uCGmnInEG5Ma8cAW2KN6QyMBDBnao/vuboFPBdvlMolPRmmqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466626; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=seEaWGfYBLRCrDuMsK0eWgdAdlipj3HMV7daRKelO70=; b=fF4PfLu/cwCoIJs5c06w5D3RqujlvRCPdg3lec3pFc8JPN3Q2ylmZXl8JSNrjoMJnhw5mqbEBFQ2lYO60yHUdLnI18n5pon4bJYibuVihw5Gm2hiYiM2rZCa61HjPmW/Tzjmu103GcLAmqsYtumggqaMP6dDjjMGrzM64u/CtUc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674466626688605.2093072444152; Mon, 23 Jan 2023 01:37:06 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-QTPSO5ibNnCP1jEhUI_gmg-1; Mon, 23 Jan 2023 04:36:04 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 599CE88F47E; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AB36492C3F; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EA4C019465B2; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A5FB61946589 for ; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8B550492B02; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id B851C492B03 for ; Mon, 23 Jan 2023 09:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=seEaWGfYBLRCrDuMsK0eWgdAdlipj3HMV7daRKelO70=; b=C8S2VxhjLohgaK4NlS9/isD7Iw3EpviDn7w94kKS6PcTifD5CkA77PK6tMBcJDpoSGxGCk e6F1LsGYedsbr2kO1m3LrQhTtq8iJVzxRgClZEFKtHog8uP8+NTFfRZFuneubtiQC/oUGR DJfBNlaegsd7OL3fVH6Q73l73mAdPGs= X-MC-Unique: QTPSO5ibNnCP1jEhUI_gmg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 6/8] vbox: Replace virReportError() with vboxReportError() Date: Mon, 23 Jan 2023 10:35:53 +0100 Message-Id: <3c2818cb80236f8b0ef06be01d7fbee9cf383866.1674466489.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466628171100007 Content-Type: text/plain; charset="utf-8"; x-default="true" Now that we have vboxReportError() which reports VirtualBox errors too, we can switch the code to use the former. And since the vboxReportError() is designed to behave exactly like virReportError() we can do that almost everywhere, regardless of the source of the error. There are a few exceptions though, for instance, when initializing VirtualBox SDK (we don't have all the objects needed for querying exceptions yet), or when invalid combination of arguments was passed to an API of ours, or when a function from other module (e.g. src/conf/) failed. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.c | 1157 ++++++++++++++++++++-------------------- 1 file changed, 579 insertions(+), 578 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 2a913e5975..b7b61df080 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -391,8 +391,8 @@ static int openSessionForMachine(struct _vboxDriver *da= ta, const unsigned char * =20 /* Get machine for the call to VBOX_SESSION_OPEN_EXISTING */ if (NS_FAILED(gVBoxAPI.UIVirtualBox.GetMachine(data->vboxObj, iid, mac= hine))) { - virReportError(VIR_ERR_NO_DOMAIN, "%s", - _("no domain with matching uuid")); + vboxReportError(VIR_ERR_NO_DOMAIN, "%s", + _("no domain with matching uuid")); return -1; } =20 @@ -492,9 +492,9 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: case VIR_DOMAIN_CONTROLLER_TYPE_ISA: case VIR_DOMAIN_CONTROLLER_TYPE_LAST: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The vbox driver does not support %s controller t= ype"), - virDomainControllerTypeToString(controller->type)); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The vbox driver does not support %s controller = type"), + virDomainControllerTypeToString(controller->type)); return -1; } =20 @@ -526,16 +526,16 @@ vboxSetStorageController(virDomainControllerDef *cont= roller, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_NCR53C90: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DC390: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AM53C974: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The vbox driver does not support %s SCSI " - "controller model"), - virDomainControllerModelSCSITypeToString(contro= ller->model)); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The vbox driver does not support %s SCSI " + "controller model"), + virDomainControllerModelSCSITypeToString(contr= oller->model)); goto cleanup; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected SCSI controller model %d"), - controller->model); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected SCSI controller model %d"), + controller->model); goto cleanup; } /* libvirt ide model =3D> vbox ide model */ @@ -555,9 +555,9 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, break; case VIR_DOMAIN_CONTROLLER_MODEL_IDE_LAST: case VIR_DOMAIN_CONTROLLER_MODEL_IDE_DEFAULT: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unexpected IDE controller model %d"), - controller->model); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unexpected IDE controller model %d"), + controller->model); goto cleanup; } } @@ -570,10 +570,10 @@ vboxSetStorageController(virDomainControllerDef *cont= roller, vboxBusType, &vboxControl= ler); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to add storage controller " - "(name: %s, busType: %d), rc=3D%08x"), - debugName, vboxBusType, rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to add storage controller " + "(name: %s, busType: %d), rc=3D%08x"), + debugName, vboxBusType, rc); goto cleanup; } =20 @@ -582,7 +582,7 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, rc =3D gVBoxAPI.UIStorageController.SetControllerType(vboxControll= er, vboxModel); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, + vboxReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to change storage controller model, " "rc=3D%08x"), rc); goto cleanup; @@ -798,9 +798,9 @@ static int vboxConnectListDomains(virConnectPtr conn, i= nt *ids, int nids) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Domains, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of Domains, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 @@ -840,8 +840,8 @@ static int vboxConnectNumOfDomains(virConnectPtr conn) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get number of Domains, rc=3D%08x"), (u= nsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get number of Domains, rc=3D%08x"), (= unsigned)rc); goto cleanup; } =20 @@ -886,16 +886,16 @@ static virDomainPtr vboxDomainLookupByID(virConnectPt= r conn, int id) /* Internal vbox IDs start from 0, the public libvirt ID * starts from 1, so refuse id =3D=3D 0, and adjust the rest */ if (id =3D=3D 0) { - virReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), id); + vboxReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), id); return NULL; } id =3D id - 1; =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return NULL; } =20 @@ -960,8 +960,8 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, VBOX_IID_INITIALIZE(&iid); rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return NULL; } =20 @@ -1032,8 +1032,8 @@ vboxDomainLookupByName(virConnectPtr conn, const char= *name) VBOX_IID_INITIALIZE(&iid); rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return NULL; } =20 @@ -1166,11 +1166,11 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDri= ver *data, IMachine *machine) deviceSlot =3D disk->info.addr.drive.bus; =20 if (type !=3D VIR_STORAGE_TYPE_FILE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported storage type %s, the only suppor= ted " - "type is %s"), - virStorageTypeToString(type), - virStorageTypeToString(VIR_STORAGE_TYPE_FILE)); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported storage type %s, the only suppo= rted " + "type is %s"), + virStorageTypeToString(type), + virStorageTypeToString(VIR_STORAGE_TYPE_FILE)); ret =3D -1; goto cleanup; } @@ -1178,8 +1178,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) switch ((virDomainDiskDevice) disk->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: if (!src) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Missing disk source file path")); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Missing disk source file path")); ret =3D -1; goto cleanup; } @@ -1201,9 +1201,9 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) break; case VIR_DOMAIN_DISK_DEVICE_LUN: case VIR_DOMAIN_DISK_DEVICE_LAST: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The vbox driver does not support %s disk dev= ice"), - virDomainDiskDeviceTypeToString(disk->device)); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The vbox driver does not support %s disk de= vice"), + virDomainDiskDeviceTypeToString(disk->device)); ret =3D -1; goto cleanup; } @@ -1242,9 +1242,9 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) case VIR_DOMAIN_DISK_BUS_SD: case VIR_DOMAIN_DISK_BUS_NONE: case VIR_DOMAIN_DISK_BUS_LAST: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The vbox driver does not support %s bus type= "), - virDomainDiskBusTypeToString(disk->bus)); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The vbox driver does not support %s bus typ= e"), + virDomainDiskBusTypeToString(disk->bus)); ret =3D -1; goto cleanup; } @@ -1273,19 +1273,19 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDri= ver *data, IMachine *machine) } =20 if (!medium) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to open the following disk/dvd/fl= oppy " - "to the machine: %s, rc=3D%08x"), src, rc= ); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to open the following disk/dvd/f= loppy " + "to the machine: %s, rc=3D%08x"), src, r= c); ret =3D -1; goto cleanup; } =20 rc =3D gVBoxAPI.UIMedium.GetId(medium, &mediumUUID); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Can't get the UUID of the file to be att= ached " - "as harddisk/dvd/floppy: %s, rc=3D%08x"), - src, rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Can't get the UUID of the file to be at= tached " + "as harddisk/dvd/floppy: %s, rc=3D%08x"), + src, rc); ret =3D -1; goto cleanup; } @@ -1318,9 +1318,9 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) medium); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not attach the file as " - "harddisk/dvd/floppy: %s, rc=3D%08x"), src, r= c); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not attach the file as " + "harddisk/dvd/floppy: %s, rc=3D%08x"), src, = rc); ret =3D -1; goto cleanup; } else { @@ -1429,8 +1429,8 @@ vboxAttachNetwork(virDomainDef *def, struct _vboxDriv= er *data, IMachine *machine VIR_DEBUG("NIC(%zu): ipaddr: %s", i, ipStr); VIR_FREE(ipStr); } else if (def->nets[i]->guestIP.nips > 1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Driver does not support setting multiple= IP addresses")); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Driver does not support setting multipl= e IP addresses")); return -1; } } @@ -1981,39 +1981,39 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const = char *xml, unsigned int flags rc =3D gVBoxAPI.UIVirtualBox.CreateMachine(data, def, &machine, uuidst= r); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not define a domain, rc=3D%08x"), (unsigne= d)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not define a domain, rc=3D%08x"), (unsign= ed)rc); goto cleanup; } =20 rc =3D gVBoxAPI.UIMachine.SetMemorySize(machine, VIR_DIV_UP(def->mem.cur_balloon,= 1024)); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the domain to: = %llu Kb, " - "rc=3D%08x"), - def->mem.cur_balloon, (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the memory size of the domain to:= %llu Kb, " + "rc=3D%08x"), + def->mem.cur_balloon, (unsigned)rc); } =20 if (virDomainDefHasVcpusOffline(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("current vcpu count must equal maximum")); + vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("current vcpu count must equal maximum")); } rc =3D gVBoxAPI.UIMachine.SetCPUCount(machine, virDomainDefGetVcpusMax= (def)); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of virtual CPUs to: %u,= rc=3D%08x"), - virDomainDefGetVcpusMax(def), (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the number of virtual CPUs to: %u= , rc=3D%08x"), + virDomainDefGetVcpusMax(def), (unsigned)rc); } =20 rc =3D gVBoxAPI.UIMachine.SetCPUProperty(machine, CPUPropertyType_PAE, def->features[VIR_DOMAIN_FEATUR= E_PAE] =3D=3D VIR_TRISTATE_SWITCH_ON); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not change PAE status to: %s, rc=3D%08x"), - (def->features[VIR_DOMAIN_FEATURE_PAE] =3D=3D VIR_T= RISTATE_SWITCH_ON) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not change PAE status to: %s, rc=3D%08x"), + (def->features[VIR_DOMAIN_FEATURE_PAE] =3D=3D VIR_= TRISTATE_SWITCH_ON) + ? _("Enabled") : _("Disabled"), (unsigned)rc); } =20 gVBoxAPI.UIMachine.GetBIOSSettings(machine, &bios); @@ -2022,19 +2022,19 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const = char *xml, unsigned int flags def->features[VIR_DOMA= IN_FEATURE_ACPI] =3D=3D VIR_TRISTATE_SWITCH_ON= ); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not change ACPI status to: %s, rc=3D%0= 8x"), - (def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D = VIR_TRISTATE_SWITCH_ON) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not change ACPI status to: %s, rc=3D%= 08x"), + (def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D= VIR_TRISTATE_SWITCH_ON) + ? _("Enabled") : _("Disabled"), (unsigned)rc); } rc =3D gVBoxAPI.UIBIOSSettings.SetIOAPICEnabled(bios, def->features[VIR_DO= MAIN_FEATURE_APIC] =3D=3D VIR_TRISTATE_SWITCH_= ON); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not change APIC status to: %s, rc=3D%0= 8x"), - (def->features[VIR_DOMAIN_FEATURE_APIC] =3D=3D = VIR_TRISTATE_SWITCH_ON) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not change APIC status to: %s, rc=3D%= 08x"), + (def->features[VIR_DOMAIN_FEATURE_APIC] =3D=3D= VIR_TRISTATE_SWITCH_ON) + ? _("Enabled") : _("Disabled"), (unsigned)rc); } VBOX_RELEASE(bios); } @@ -2042,8 +2042,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags /* Register the machine before attaching other devices to it */ rc =3D gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not define a domain, rc=3D%08x"), (unsigne= d)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not define a domain, rc=3D%08x"), (unsign= ed)rc); goto cleanup; } =20 @@ -2086,8 +2086,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags */ rc =3D gVBoxAPI.UIMachine.SaveSettings(machine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to save VM settings, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to save VM settings, rc=3D%08x"), rc); machineReady =3D false; } =20 @@ -2143,8 +2143,8 @@ static int vboxDomainUndefineFlags(virDomainPtr dom, = unsigned int flags) gVBoxAPI.deleteConfig(machine); ret =3D 0; } else { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not delete the domain, rc=3D%08x"), (unsig= ned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not delete the domain, rc=3D%08x"), (unsi= gned)rc); } =20 vboxIIDUnalloc(&iid); @@ -2265,8 +2265,8 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IMac= hine *machine, vboxIID *iid &progress); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("OpenRemoteSession/LaunchVMProcess failed, domain= can't be started")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("OpenRemoteSession/LaunchVMProcess failed, domai= n can't be started")); goto cleanup; } else { PRBool completed =3D 0; @@ -2316,15 +2316,15 @@ static int vboxDomainCreateWithFlags(virDomainPtr d= om, unsigned int flags) virCheckFlags(0, -1); =20 if (!dom->name) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Error while reading the domain name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Error while reading the domain name")); return -1; } =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return -1; } =20 @@ -2353,10 +2353,10 @@ static int vboxDomainCreateWithFlags(virDomainPtr d= om, unsigned int flags) if (gVBoxAPI.machineStateChecker.NotStart(state)) { ret =3D vboxStartMachine(dom, i, machine, &iid); } else { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine is not in " - "poweroff|saved|aborted state, so " - "couldn't start it")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine is not in " + "poweroff|saved|aborted state, so " + "couldn't start it")); ret =3D -1; } } @@ -2424,8 +2424,8 @@ static int vboxDomainIsActive(virDomainPtr dom) VBOX_IID_INITIALIZE(&iid); rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return ret; } =20 @@ -2555,14 +2555,14 @@ static int vboxDomainSuspend(virDomainPtr dom) VBOX_RELEASE(console); ret =3D 0; } else { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("error while suspending the domain")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("error while suspending the domain")); goto cleanup; } gVBoxAPI.UISession.Close(data->vboxSession); } else { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine not in running state to suspend it")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine not in running state to suspend it")); goto cleanup; } =20 @@ -2606,14 +2606,14 @@ static int vboxDomainResume(virDomainPtr dom) VBOX_RELEASE(console); ret =3D 0; } else { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("error while resuming the domain")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("error while resuming the domain")); goto cleanup; } gVBoxAPI.UISession.Close(data->vboxSession); } else { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine not paused, so can't resume it")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine not paused, so can't resume it")); goto cleanup; } =20 @@ -2651,12 +2651,12 @@ static int vboxDomainShutdownFlags(virDomainPtr dom= , unsigned int flags) gVBoxAPI.UIMachine.GetState(machine, &state); =20 if (gVBoxAPI.machineStateChecker.Paused(state)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine paused, so can't power it down")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine paused, so can't power it down")); goto cleanup; } else if (gVBoxAPI.machineStateChecker.PoweredOff(state)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine already powered down")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine already powered down")); goto cleanup; } =20 @@ -2717,8 +2717,8 @@ static int vboxDomainReboot(virDomainPtr dom, unsigne= d int flags) } gVBoxAPI.UISession.Close(data->vboxSession); } else { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine not running, so can't reboot it")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine not running, so can't reboot it")); goto cleanup; } =20 @@ -2756,8 +2756,8 @@ static int vboxDomainDestroyFlags(virDomainPtr dom, u= nsigned int flags) gVBoxAPI.UIMachine.GetState(machine, &state); =20 if (gVBoxAPI.machineStateChecker.PoweredOff(state)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine already powered down")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("machine already powered down")); goto cleanup; } =20 @@ -2819,8 +2819,8 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsi= gned long memory) gVBoxAPI.UIMachine.GetState(machine, &state); =20 if (!gVBoxAPI.machineStateChecker.PoweredOff(state)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("memory size can't be changed unless domain is po= wered down")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("memory size can't be changed unless domain is p= owered down")); goto cleanup; } =20 @@ -2837,10 +2837,10 @@ static int vboxDomainSetMemory(virDomainPtr dom, un= signed long memory) gVBoxAPI.UIMachine.SaveSettings(machine); ret =3D 0; } else { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the " - "domain to: %lu Kb, rc=3D%08x"), - memory, (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the memory size of the " + "domain to: %lu Kb, rc=3D%08x"), + memory, (unsigned)rc); } } gVBoxAPI.UISession.Close(data->vboxSession); @@ -2866,8 +2866,8 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDom= ainInfoPtr info) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return -1; } =20 @@ -2977,7 +2977,7 @@ static int vboxDomainSetVcpusFlags(virDomainPtr dom, = unsigned int nvcpus, return ret; =20 if (flags !=3D VIR_DOMAIN_AFFECT_LIVE) { - virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)")= , flags); + vboxReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"= ), flags); return -1; } =20 @@ -2993,19 +2993,19 @@ static int vboxDomainSetVcpusFlags(virDomainPtr dom= , unsigned int nvcpus, gVBoxAPI.UIMachine.SaveSettings(machine); ret =3D 0; } else { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of cpus of the = domain " - "to: %u, rc=3D%08x"), - CPUCount, (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not set the number of cpus of the= domain " + "to: %u, rc=3D%08x"), + CPUCount, (unsigned)rc); } VBOX_RELEASE(machine); } else { - virReportError(VIR_ERR_NO_DOMAIN, - _("no domain with matching id %d"), dom->id); + vboxReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching id %d"), dom->id); } } else { - virReportError(VIR_ERR_NO_DOMAIN, - _("can't open session to the domain with id %d"), d= om->id); + vboxReportError(VIR_ERR_NO_DOMAIN, + _("can't open session to the domain with id %d"), = dom->id); } gVBoxAPI.UISession.Close(data->vboxSession); =20 @@ -3029,7 +3029,7 @@ static int vboxDomainGetVcpusFlags(virDomainPtr dom, = unsigned int flags) return ret; =20 if (flags !=3D (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) { - virReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)")= , flags); + vboxReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"= ), flags); return -1; } =20 @@ -3296,8 +3296,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(mediumAttachment, &me= dium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get IMedium, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get IMedium, rc=3D%08x"), rc); goto cleanup; } =20 @@ -3336,17 +3336,17 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver= *data, IMachine *machine) =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(mediumAttachment, &me= dium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get IMedium, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get IMedium, rc=3D%08x"), rc); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetController(mediumAttachment, &controllerName); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get storage controller name, rc=3D= %08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to get storage controller name, rc= =3D%08x"), + rc); goto cleanup; } =20 @@ -3354,44 +3354,44 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver= *data, IMachine *machine) controllerName, &controller); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get storage controller by name, rc= =3D%08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get storage controller by name, r= c=3D%08x"), + rc); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetType(mediumAttachment, &devi= ceType); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get device type, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get device type, rc=3D%08x"), rc); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetPort(mediumAttachment, &devi= cePort); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get device port, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get device port, rc=3D%08x"), rc); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetDevice(mediumAttachment, &de= viceSlot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get device slot, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get device slot, rc=3D%08x"), rc); goto cleanup; } rc =3D gVBoxAPI.UIStorageController.GetBus(controller, &storageBus= ); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get storage controller bus, rc=3D%= 08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get storage controller bus, rc=3D= %08x"), + rc); goto cleanup; } =20 if (medium) { rc =3D gVBoxAPI.UIMedium.GetLocation(medium, &mediumLocUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get medium storage location, r= c=3D%08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get medium storage location, = rc=3D%08x"), + rc); goto cleanup; } =20 @@ -3401,8 +3401,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) =20 rc =3D gVBoxAPI.UIMedium.GetReadOnly(medium, &readOnly); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get read only state, rc=3D%08x= "), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get read only state, rc=3D%08= x"), rc); goto cleanup; } } @@ -3411,9 +3411,9 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) sdCount); =20 if (!disk->dst) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not generate medium name for the disk " - "at: port:%d, slot:%d"), devicePort, deviceSl= ot); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not generate medium name for the disk= " + "at: port:%d, slot:%d"), devicePort, deviceS= lot); goto cleanup; } =20 @@ -3467,8 +3467,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) =20 break; case StorageBus_Null: - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unsupported null storage bus")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unsupported null storage bus")); goto cleanup; } =20 @@ -3489,8 +3489,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) case DeviceType_USB: case DeviceType_SharedFolder: case DeviceType_Null: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unsupported vbox device type: %d"), deviceTy= pe); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unsupported vbox device type: %d"), deviceT= ype); goto cleanup; } =20 @@ -4228,9 +4228,9 @@ static int vboxConnectListDefinedDomains(virConnectPt= r conn, rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Defined Domains, rc=3D%08x= "), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of Defined Domains, rc=3D%08= x"), + (unsigned)rc); goto cleanup; } =20 @@ -4281,9 +4281,9 @@ static int vboxConnectNumOfDefinedDomains(virConnectP= tr conn) rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get number of Defined Domains, rc=3D%0= 8x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get number of Defined Domains, rc=3D%= 08x"), + (unsigned)rc); goto cleanup; } =20 @@ -4373,9 +4373,9 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr do= m, writable, PR_FALSE); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not attach shared folder '%s', rc= =3D%08x"), - dev->data.fs->dst, (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not attach shared folder '%s', rc= =3D%08x"), + dev->data.fs->dst, (unsigned)rc); ret =3D -1; } else { ret =3D 0; @@ -4388,7 +4388,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr do= m, VBOX_RELEASE(machine); =20 if (ret =3D=3D -VIR_ERR_ARGUMENT_UNSUPPORTED) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported de= vice type %d"), dev->type); + vboxReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported d= evice type %d"), dev->type); ret =3D -1; } } @@ -4491,9 +4491,9 @@ static int vboxDomainDetachDevice(virDomainPtr dom, c= onst char *xml) rc =3D gVBoxAPI.UIMachine.RemoveSharedFolder(machine, nameUtf1= 6); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not detach shared folder '%s', rc= =3D%08x"), - dev->data.fs->dst, (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not detach shared folder '%s', rc= =3D%08x"), + dev->data.fs->dst, (unsigned)rc); } else { ret =3D 0; } @@ -4504,7 +4504,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, c= onst char *xml) VBOX_RELEASE(machine); =20 if (ret =3D=3D -VIR_ERR_ARGUMENT_UNSUPPORTED) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported de= vice type %d"), dev->type); + vboxReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("Unsupported d= evice type %d"), dev->type); ret =3D -1; } } @@ -4548,15 +4548,15 @@ static int vboxCloseDisksRecursively(virDomainPtr d= om, char *location) AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } rc =3D gVBoxAPI.UIMedium.GetChildren(medium, &childrenSize, &children); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get disk children")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get disk children")); goto cleanup; } for (i =3D 0; i < childrenSize; i++) { @@ -4566,15 +4566,15 @@ static int vboxCloseDisksRecursively(virDomainPtr d= om, char *location) char *childLocation =3D NULL; rc =3D gVBoxAPI.UIMedium.GetLocation(childMedium, &childLocati= onUtf); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get childMedium location")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get childMedium location")); goto cleanup; } VBOX_UTF16_TO_UTF8(childLocationUtf, &childLocation); VBOX_UTF16_FREE(childLocationUtf); if (vboxCloseDisksRecursively(dom, childLocation) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to close disk children")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close disk children")); goto cleanup; } VIR_FREE(childLocation); @@ -4582,9 +4582,9 @@ static int vboxCloseDisksRecursively(virDomainPtr dom= , char *location) } rc =3D gVBoxAPI.UIMedium.Close(medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 @@ -4672,8 +4672,8 @@ vboxSnapshotRedefine(virDomainPtr dom, /* It may failed when the machine is not mutable. */ rc =3D gVBoxAPI.UIMachine.GetSettingsFilePath(machine, &settingsFilePa= th); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get settings file path")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get settings file path")); goto cleanup; } VBOX_UTF16_TO_UTF8(settingsFilePath, &settingsFilePath_Utf8); @@ -4681,8 +4681,8 @@ vboxSnapshotRedefine(virDomainPtr dom, /* Getting the machine name to retrieve the machine location path. */ rc =3D gVBoxAPI.UIMachine.GetName(machine, &machineNameUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get machine name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get machine name")); goto cleanup; } VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName); @@ -4690,16 +4690,16 @@ vboxSnapshotRedefine(virDomainPtr dom, nameTmpUse =3D g_strdup_printf("%s.vbox", machineName); machineLocationPath =3D virStringReplace(settingsFilePath_Utf8, nameTm= pUse, ""); if (machineLocationPath =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get the machine location path")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get the machine location path")); goto cleanup; } =20 /* We create the xml struct with the settings file path. */ snapshotMachineDesc =3D virVBoxSnapshotConfLoadVboxFile(settingsFilePa= th_Utf8, machineLocationPath); if (snapshotMachineDesc =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot create a vboxSnapshotXmlPtr")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot create a vboxSnapshotXmlPtr")); goto cleanup; } if (snapshotMachineDesc->currentSnapshot !=3D NULL) { @@ -4715,8 +4715,8 @@ vboxSnapshotRedefine(virDomainPtr dom, * the machine unregistration. */ if (virVBoxSnapshotConfRemoveFakeDisks(snapshotMachineDesc) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to remove Fake Disks")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to remove Fake Disks")); goto cleanup; } realReadWriteDisksPathSize =3D virVBoxSnapshotConfGetRWDisksPathsF= romLibvirtXML(currentSnapshotXmlFilePath, @@ -4726,9 +4726,9 @@ vboxSnapshotRedefine(virDomainPtr dom, /* The read-only disk number is necessarily greater or equal to the * read-write disk number */ if (realReadOnlyDisksPathSize < realReadWriteDisksPathSize) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("The read only disk number must be greater or= equal to the " - " read write disk number")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("The read only disk number must be greater o= r equal to the " + " read write disk number")); goto cleanup; } for (it =3D 0; it < realReadWriteDisksPathSize; it++) { @@ -4749,9 +4749,9 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &readWriteMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); VBOX_UTF16_FREE(locationUtf); goto cleanup; } @@ -4759,8 +4759,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(readWriteMedium, &iid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get the read write medium id")= ); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get the read write medium id"= )); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid); @@ -4768,8 +4768,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetFormat(readWriteMedium, &formatUtf= ); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get the read write medium form= at")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get the read write medium for= mat")); goto cleanup; } VBOX_UTF16_TO_UTF8(formatUtf, &format); @@ -4795,16 +4795,16 @@ vboxSnapshotRedefine(virDomainPtr dom, if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(readWriteDis= k, snapshotMachineDesc->mediaRegis= try, parentUuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to add hard disk to media Registr= y")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to add hard disk to media Regist= ry")); VIR_FREE(readWriteDisk); goto cleanup; } rc =3D gVBoxAPI.UIMedium.Close(readWriteMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } } @@ -4840,8 +4840,8 @@ vboxSnapshotRedefine(virDomainPtr dom, diskInMediaRegistry =3D virVBoxSnapshotConfDiskIsInMediaRegistry(s= napshotMachineDesc, def->parent.dom->d= isks[it]->src->path); if (diskInMediaRegistry =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to know if disk is in media registry"= )); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to know if disk is in media registry= ")); goto cleanup; } if (diskInMediaRegistry =3D=3D 1) /* Nothing to do. */ @@ -4855,9 +4855,9 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &readOnlyMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); VBOX_UTF16_FREE(locationUtf); goto cleanup; } @@ -4865,8 +4865,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(readOnlyMedium, &iid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get hard disk id")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get hard disk id")); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid); @@ -4874,8 +4874,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetFormat(readOnlyMedium, &formatUtf); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get hard disk format")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get hard disk format")); VIR_FREE(uuid); goto cleanup; } @@ -4885,17 +4885,17 @@ vboxSnapshotRedefine(virDomainPtr dom, /* This disk is already in the media registry */ rc =3D gVBoxAPI.UIMedium.GetParent(readOnlyMedium, &parentReadOnly= Medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get parent hard disk")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get parent hard disk")); VIR_FREE(uuid); goto cleanup; } =20 rc =3D gVBoxAPI.UIMedium.GetId(parentReadOnlyMedium, &parentiid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get hard disk id, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to get hard disk id, rc=3D%08x"), + (unsigned)rc); VIR_FREE(uuid); goto cleanup; } @@ -4904,9 +4904,9 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.Close(readOnlyMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close HardDisk, rc=3D%08x"), + (unsigned)rc); VIR_FREE(uuid); VIR_FREE(parentUuid); goto cleanup; @@ -4919,9 +4919,9 @@ vboxSnapshotRedefine(virDomainPtr dom, readOnlyDisk->location =3D g_strdup(def->parent.dom->disks[it]->sr= c->path); =20 if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(readOnlyDisk, sn= apshotMachineDesc->mediaRegistry, - parentUuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to add hard disk to media registry")); + parentUuid) < 0)= { + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to add hard disk to media registry")= ); VIR_FREE(readOnlyDisk); goto cleanup; } @@ -4933,9 +4933,9 @@ vboxSnapshotRedefine(virDomainPtr dom, &aMediaSize, &aMedia); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to unregister machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to unregister machine, rc=3D%08x"), + (unsigned)rc); goto cleanup; } VBOX_RELEASE(machine); @@ -4953,8 +4953,8 @@ vboxSnapshotRedefine(virDomainPtr dom, char *locationUtf8 =3D NULL; rc =3D gVBoxAPI.UIMedium.GetLocation(medium, &locationUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get medium location")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get medium location")); goto cleanup; } VBOX_UTF16_TO_UTF8(locationUtf16, &locationUtf8); @@ -4965,18 +4965,18 @@ vboxSnapshotRedefine(virDomainPtr dom, resultCodeUnion resultCode; rc =3D gVBoxAPI.UIMedium.DeleteStorage(medium, &progress); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to delete medium, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to delete medium, rc=3D%08x"= ), + (unsigned)rc); VIR_FREE(locationUtf8); goto cleanup; } gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode); if (RC_FAILED(resultCode)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Error while closing medium, rc=3D%08= x"), - resultCode.uResultCode); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while closing medium, rc=3D%0= 8x"), + resultCode.uResultCode); VIR_FREE(locationUtf8); goto cleanup; } @@ -4998,8 +4998,8 @@ vboxSnapshotRedefine(virDomainPtr dom, /* Close all disks that failed to close normally. */ for (it =3D 0; it < snapshotMachineDesc->mediaRegistry->ndisks; it++) { if (vboxCloseDisksRecursively(dom, snapshotMachineDesc->mediaRegis= try->disks[it]->location) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to close recursively all disks")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close recursively all disks")); goto cleanup; } } @@ -5059,8 +5059,8 @@ vboxSnapshotRedefine(virDomainPtr dom, VIR_FREE(tmp); } if (virVBoxSnapshotConfAddSnapshotToXmlMachine(newSnapshotPtr, snapsho= tMachineDesc, def->parent.parent_name) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to add the snapshot to the machine descri= ption")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to add the snapshot to the machine descr= iption")); goto cleanup; } /* @@ -5099,9 +5099,9 @@ vboxSnapshotRedefine(virDomainPtr dom, &medium); VBOX_UTF16_FREE(locationUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } } @@ -5132,9 +5132,9 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } VBOX_UTF16_FREE(locationUtf16); @@ -5143,8 +5143,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetFormat(medium, &formatUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get disk format")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get disk format")); VIR_FREE(disk); goto cleanup; } @@ -5157,8 +5157,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(medium, &iid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get disk uuid")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get disk uuid")); VIR_FREE(disk); goto cleanup; } @@ -5168,8 +5168,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetParent(medium, &parentDisk); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get disk parent")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get disk parent")); VIR_FREE(disk); goto cleanup; } @@ -5180,8 +5180,8 @@ vboxSnapshotRedefine(virDomainPtr dom, if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(disk, snapshotMachineDesc->mediaRegis= try, parentUuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to add hard disk to the media reg= istry")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to add hard disk to the media re= gistry")); VIR_FREE(disk); goto cleanup; } @@ -5194,8 +5194,8 @@ vboxSnapshotRedefine(virDomainPtr dom, it + 1, &searchResultTab); if (resultSize !=3D it + 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID %s"), searchResu= ltTab[it]); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find UUID %s"), searchRes= ultTab[it]); goto cleanup; } =20 @@ -5212,9 +5212,9 @@ vboxSnapshotRedefine(virDomainPtr dom, /* Close disk */ rc =3D gVBoxAPI.UIMedium.Close(medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } } @@ -5246,9 +5246,9 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); VBOX_UTF16_FREE(locationUtf16); goto cleanup; } @@ -5256,9 +5256,9 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(medium, &parentiid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get hardDisk Id, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to get hardDisk Id, rc=3D%08x"), + (unsigned)rc); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid); @@ -5275,9 +5275,9 @@ vboxSnapshotRedefine(virDomainPtr dom, VBOX_UTF16_FREE(newLocation); VBOX_UTF16_FREE(formatUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to create HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to create HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 @@ -5287,9 +5287,9 @@ vboxSnapshotRedefine(virDomainPtr dom, gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode); if (RC_FAILED(resultCode)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Error while creating diff storage, rc=3D= %08x"), - resultCode.uResultCode); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while creating diff storage, rc= =3D%08x"), + resultCode.uResultCode); goto cleanup; } VBOX_RELEASE(progress); @@ -5302,9 +5302,9 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(newMedium, &iid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get medium uuid, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to get medium uuid, rc=3D%08x"), + (unsigned)rc); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid); @@ -5321,8 +5321,8 @@ vboxSnapshotRedefine(virDomainPtr dom, if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(newHardDisk, snapshotMachineDesc->mediaRegis= try, parentUuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to add hard disk to the media reg= istry")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to add hard disk to the media re= gistry")); goto cleanup; } newHardDisk =3D NULL; /* Consumed by above */ @@ -5333,8 +5333,8 @@ vboxSnapshotRedefine(virDomainPtr dom, it + 1, &searchResultTab); if (resultSize !=3D it + 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID %s"), searchResultTa= b[it]); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find UUID %s"), searchResultT= ab[it]); goto cleanup; } =20 @@ -5350,9 +5350,9 @@ vboxSnapshotRedefine(virDomainPtr dom, /* Closing the "fake" disk */ rc =3D gVBoxAPI.UIMedium.Close(newMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close the new medium, rc=3D%08= x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close the new medium, rc=3D%0= 8x"), + (unsigned)rc); goto cleanup; } } @@ -5367,8 +5367,8 @@ vboxSnapshotRedefine(virDomainPtr dom, data->xmlopt, VIR_DOMAIN_SNAPSHOT_F= ORMAT_SECURE); if (snapshotContent =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get snapshot content")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get snapshot content")); goto cleanup; } if (virFileWriteStr(currentSnapshotXmlFilePath, snapshotContent, 0= 644) < 0) { @@ -5399,16 +5399,16 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } rc =3D gVBoxAPI.UIMedium.Close(medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close HardDisk, rc=3D%08x"), + (unsigned)rc); goto cleanup; } VBOX_UTF16_FREE(locationUtf16); @@ -5417,25 +5417,25 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 /* Now, we rewrite the 'machineName'.vbox file to redefine the machine= . */ if (virVBoxSnapshotConfSaveVboxFile(snapshotMachineDesc, settingsFileP= ath_Utf8) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to serialize the machine description")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to serialize the machine description")); goto cleanup; } rc =3D gVBoxAPI.UIVirtualBox.OpenMachine(data->vboxObj, settingsFilePath, &machine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open Machine, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 rc =3D gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to register Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to register Machine, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 @@ -5510,8 +5510,8 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMachine.GetState(machine, &state); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } =20 @@ -5524,9 +5524,9 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, if (NS_SUCCEEDED(rc)) rc =3D gVBoxAPI.UISession.GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not open VirtualBox session with domain %s= "), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not open VirtualBox session with domain %= s"), + dom->name); goto cleanup; } =20 @@ -5538,24 +5538,24 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIConsole.TakeSnapshot(console, name, description, &pr= ogress); if (NS_FAILED(rc) || !progress) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not take snapshot of domain %s"), dom->nam= e); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not take snapshot of domain %s"), dom->na= me); goto cleanup; } =20 gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); gVBoxAPI.UIProgress.GetResultCode(progress, &result); if (RC_FAILED(result)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not take snapshot of domain %s"), dom->nam= e); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not take snapshot of domain %s"), dom->na= me); goto cleanup; } =20 rc =3D gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get current snapshot of domain %s"), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get current snapshot of domain %s"), + dom->name); goto cleanup; } =20 @@ -5577,6 +5577,7 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, IMachine *machine, ISnapshot ***snapshots) { + struct _vboxDriver *data =3D dom->conn->privateData; vboxIID empty; ISnapshot **list =3D NULL; PRUint32 count; @@ -5587,9 +5588,9 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, VBOX_IID_INITIALIZE(&empty); rc =3D gVBoxAPI.UIMachine.GetSnapshotCount(machine, &count); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get snapshot count for domain %s"), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get snapshot count for domain %s"), + dom->name); goto error; } =20 @@ -5600,9 +5601,9 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMachine.FindSnapshot(machine, &empty, list); if (NS_FAILED(rc) || !list[0]) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get root snapshot for domain %s"), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get root snapshot for domain %s"), + dom->name); goto error; } =20 @@ -5613,16 +5614,16 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, size_t i; =20 if (!list[next]) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected number of snapshots < %u"), count= ); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected number of snapshots < %u"), coun= t); goto error; } =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&children, list[next], gVBoxAPI.UArray.handleSnapshotGe= tChildren(list[next])); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not get children snapshots")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not get children snapshots")); goto error; } for (i =3D 0; i < children.count; i++) { @@ -5630,8 +5631,8 @@ vboxDomainSnapshotGetAll(virDomainPtr dom, if (!child) continue; if (top =3D=3D count) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected number of snapshots > %u"), c= ount); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected number of snapshots > %u"), = count); gVBoxAPI.UArray.vboxArrayRelease(&children); goto error; } @@ -5675,8 +5676,8 @@ vboxDomainSnapshotGet(struct _vboxDriver *data, =20 rc =3D gVBoxAPI.UISnapshot.GetName(snapshots[i], &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not get snapshot name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not get snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &nameUtf8); @@ -5690,9 +5691,9 @@ vboxDomainSnapshotGet(struct _vboxDriver *data, } =20 if (!snapshot) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("domain %s has no snapshots with name %s"), - dom->name, name); + vboxReportError(VIR_ERR_OPERATION_INVALID, + _("domain %s has no snapshots with name %s"), + dom->name, name); goto cleanup; } =20 @@ -5738,8 +5739,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *d= ef, =20 rc =3D gVBoxAPI.UISnapshot.GetId(snap, &snapIid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not get snapshot id")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get snapshot id")); goto cleanup; } =20 @@ -5747,16 +5748,16 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef = *def, vboxIIDUnalloc(&snapIid); rc =3D gVBoxAPI.UISnapshot.GetMachine(snap, &snapMachine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get machine")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get machine")); goto cleanup; } def->ndisks =3D 0; rc =3D gVBoxAPI.UArray.vboxArrayGet(&mediumAttachments, snapMachine, gVBoxAPI.UArray.handleMachineGetMedi= umAttachments(snapMachine)); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("no medium attachments")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("no medium attachments")); goto cleanup; } /* get the number of attachments */ @@ -5767,8 +5768,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *d= ef, =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &m= edium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get medium")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get medium")); goto cleanup; } if (medium) { @@ -5807,8 +5808,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *d= ef, rc =3D gVBoxAPI.UIMediumAttachment.GetController(imediumattach, &storageControllerN= ame); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get storage controller name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get storage controller name")); goto cleanup; } =20 @@ -5817,45 +5818,45 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef = *def, &storageControl= ler); VBOX_UTF16_FREE(storageControllerName); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get storage controller by name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get storage controller by name")); goto cleanup; } =20 rc =3D gVBoxAPI.UIStorageController.GetBus(storageController, &sto= rageBus); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get storage controller bus")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get storage controller bus")); VBOX_RELEASE(storageController); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetType(imediumattach, &deviceT= ype); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get medium attachment type")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get medium attachment type")); VBOX_RELEASE(storageController); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetPort(imediumattach, &deviceP= ort); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get medium attachment port")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get medium attachment port")); VBOX_RELEASE(storageController); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetDevice(imediumattach, &devic= eSlot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get medium attachment slot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get medium attachment slot")); VBOX_RELEASE(storageController); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &disk); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get medium")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get medium")); VBOX_RELEASE(storageController); goto cleanup; } @@ -5877,16 +5878,16 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef = *def, handle =3D gVBoxAPI.UArray.handleMediumGetChildren(disk); rc =3D gVBoxAPI.UArray.vboxArrayGet(&children, disk, handle); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get children disk")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get children disk")); goto cleanup; } handle =3D gVBoxAPI.UArray.handleMediumGetSnapshotIds(disk); rc =3D gVBoxAPI.UArray.vboxArrayGetWithIIDArg(&snapshotIids, disk, handle, &domiid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get snapshot ids")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get snapshot ids")); goto cleanup; } for (j =3D 0; j < children.count; ++j) { @@ -5898,8 +5899,8 @@ vboxSnapshotGetReadWriteDisks(virDomainSnapshotDef *d= ef, if (STREQ(diskSnapIdStr, snapshotUuidStr)) { rc =3D gVBoxAPI.UIMedium.GetLocation(child, &childLocU= tf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get disk location")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get disk location")); VBOX_RELEASE(storageController); VBOX_RELEASE(disk); VBOX_RELEASE(child); @@ -5970,8 +5971,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, =20 rc =3D gVBoxAPI.UISnapshot.GetMachine(snap, &snapMachine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get machine")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get machine")); goto cleanup; } /* @@ -5981,8 +5982,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, rc =3D gVBoxAPI.UArray.vboxArrayGet(&mediumAttachments, snapMachine, gVBoxAPI.UArray.handleMachineGetMedi= umAttachments(snapMachine)); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get medium attachments")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get medium attachments")); goto cleanup; } /* get the number of attachments */ @@ -5993,8 +5994,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &m= edium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get medium")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get medium")); goto cleanup; } if (medium) { @@ -6029,8 +6030,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, continue; rc =3D gVBoxAPI.UIMediumAttachment.GetController(imediumattach, &s= torageControllerName); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get storage controller name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get storage controller name")); goto cleanup; } if (!storageControllerName) @@ -6040,35 +6041,35 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *= def, &storageControl= ler); VBOX_UTF16_FREE(storageControllerName); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get storage controller")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get storage controller")); goto cleanup; } if (!storageController) continue; rc =3D gVBoxAPI.UIStorageController.GetBus(storageController, &sto= rageBus); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get storage controller bus")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get storage controller bus")); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetPort(imediumattach, &deviceP= ort); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get medium attachment port")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get medium attachment port")); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetDevice(imediumattach, &devic= eSlot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get device slot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get device slot")); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(imediumattach, &disk); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get medium")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get medium")); goto cleanup; } =20 @@ -6088,8 +6089,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, =20 rc =3D gVBoxAPI.UIMedium.GetLocation(disk, &mediumLocUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get disk location")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get disk location")); goto cleanup; } VBOX_UTF16_TO_UTF8(mediumLocUtf16, &mediumLocUtf8); @@ -6099,8 +6100,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, VBOX_UTF8_FREE(mediumLocUtf8); rc =3D gVBoxAPI.UIMedium.GetReadOnly(disk, &readOnly); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get read only attribute")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get read only attribute")); goto cleanup; } =20 @@ -6109,9 +6110,9 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, deviceSlot, sdCount); if (!defdom->disks[diskCount]->dst) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not generate medium name for the disk " - "at: port:%d, slot:%d"), devicePort, deviceSl= ot); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not generate medium name for the disk= " + "at: port:%d, slot:%d"), devicePort, deviceS= lot); ret =3D -1; goto cleanup; } @@ -6131,8 +6132,8 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, =20 rc =3D gVBoxAPI.UIMediumAttachment.GetType(imediumattach, &deviceT= ype); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get medium attachment type")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get medium attachment type")); goto cleanup; } if (deviceType =3D=3D DeviceType_HardDisk) @@ -6232,9 +6233,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSn= apshotPtr snapshot, =20 rc =3D gVBoxAPI.UISnapshot.GetDescription(snap, &str16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get description of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get description of snapshot %s"), + snapshot->name); goto cleanup; } if (str16) { @@ -6246,9 +6247,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSn= apshotPtr snapshot, =20 rc =3D gVBoxAPI.UISnapshot.GetTimeStamp(snap, ×tamp); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get creation time of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get creation time of snapshot %s"), + snapshot->name); goto cleanup; } /* timestamp is in milliseconds while creationTime in seconds */ @@ -6256,17 +6257,17 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomain= SnapshotPtr snapshot, =20 rc =3D gVBoxAPI.UISnapshot.GetParent(snap, &parent); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get parent of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get parent of snapshot %s"), + snapshot->name); goto cleanup; } if (parent) { rc =3D gVBoxAPI.UISnapshot.GetName(parent, &str16); if (NS_FAILED(rc) || !str16) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get name of parent of snapshot %s"= ), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get name of parent of snapshot %s= "), + snapshot->name); goto cleanup; } VBOX_UTF16_TO_UTF8(str16, &str8); @@ -6277,9 +6278,9 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSn= apshotPtr snapshot, =20 rc =3D gVBoxAPI.UISnapshot.GetOnline(snap, &online); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get online state of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get online state of snapshot %s"), + snapshot->name); goto cleanup; } if (online) @@ -6325,9 +6326,9 @@ static int vboxDomainSnapshotNum(virDomainPtr dom, un= signed int flags) =20 rc =3D gVBoxAPI.UIMachine.GetSnapshotCount(machine, &snapshotCount); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get snapshot count for domain %s"), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get snapshot count for domain %s"), + dom->name); goto cleanup; } =20 @@ -6375,9 +6376,9 @@ static int vboxDomainSnapshotListNames(virDomainPtr d= om, char **names, snapshots =3D g_new0(ISnapshot *, 1); rc =3D gVBoxAPI.UIMachine.FindSnapshot(machine, &empty, snapshots); if (NS_FAILED(rc) || !snapshots[0]) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get root snapshot for domain %s"), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get root snapshot for domain %s"), + dom->name); goto cleanup; } count =3D 1; @@ -6395,8 +6396,8 @@ static int vboxDomainSnapshotListNames(virDomainPtr d= om, char **names, =20 rc =3D gVBoxAPI.UISnapshot.GetName(snapshots[i], &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("could not get snapshot name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("could not get snapshot name")); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); @@ -6469,8 +6470,8 @@ static int vboxDomainHasCurrentSnapshot(virDomainPtr = dom, =20 rc =3D gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot")); goto cleanup; } =20 @@ -6513,23 +6514,23 @@ vboxDomainSnapshotGetParent(virDomainSnapshotPtr sn= apshot, =20 rc =3D gVBoxAPI.UISnapshot.GetParent(snap, &parent); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get parent of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get parent of snapshot %s"), + snapshot->name); goto cleanup; } if (!parent) { - virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, - _("snapshot '%s' does not have a parent"), - snapshot->name); + vboxReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, + _("snapshot '%s' does not have a parent"), + snapshot->name); goto cleanup; } =20 rc =3D gVBoxAPI.UISnapshot.GetName(parent, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get name of parent of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get name of parent of snapshot %s"), + snapshot->name); goto cleanup; } VBOX_UTF16_TO_UTF8(nameUtf16, &name); @@ -6568,21 +6569,21 @@ vboxDomainSnapshotCurrent(virDomainPtr dom, unsigne= d int flags) =20 rc =3D gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &snapshot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot")); goto cleanup; } =20 if (!snapshot) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("domain has no snapshots")); + vboxReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain has no snapshots")); goto cleanup; } =20 rc =3D gVBoxAPI.UISnapshot.GetName(snapshot, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot name")); goto cleanup; } =20 @@ -6626,8 +6627,8 @@ static int vboxDomainSnapshotIsCurrent(virDomainSnaps= hotPtr snapshot, =20 rc =3D gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, ¤t); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot")); goto cleanup; } if (!current) { @@ -6637,8 +6638,8 @@ static int vboxDomainSnapshotIsCurrent(virDomainSnaps= hotPtr snapshot, =20 rc =3D gVBoxAPI.UISnapshot.GetName(current, &nameUtf16); if (NS_FAILED(rc) || !nameUtf16) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get current snapshot name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get current snapshot name")); goto cleanup; } =20 @@ -6715,30 +6716,30 @@ static int vboxDomainRevertToSnapshot(virDomainSnap= shotPtr snapshot, =20 rc =3D gVBoxAPI.UISnapshot.GetOnline(newSnapshot, &online); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get online state of snapshot %s"), - snapshot->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get online state of snapshot %s"), + snapshot->name); goto cleanup; } =20 rc =3D gVBoxAPI.UIMachine.GetCurrentSnapshot(machine, &prevSnapshot); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not get current snapshot of domain %s"), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not get current snapshot of domain %s"), + dom->name); goto cleanup; } =20 rc =3D gVBoxAPI.UIMachine.GetState(machine, &state); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } =20 if (gVBoxAPI.machineStateChecker.Online(state)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot revert snapshot of running domain")); + vboxReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot revert snapshot of running domain")); goto cleanup; } =20 @@ -6774,19 +6775,19 @@ vboxDomainSnapshotDeleteSingle(struct _vboxDriver *= data, VBOX_IID_INITIALIZE(&iid); rc =3D gVBoxAPI.UISnapshot.GetId(snapshot, &iid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get snapshot UUID")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get snapshot UUID")); goto cleanup; } =20 rc =3D gVBoxAPI.UIConsole.DeleteSnapshot(console, &iid, &progress); if (NS_FAILED(rc) || !progress) { if (rc =3D=3D VBOX_E_INVALID_VM_STATE) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot delete domain snapshot for running do= main")); + vboxReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot delete domain snapshot for running d= omain")); } else { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not delete snapshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not delete snapshot")); } goto cleanup; } @@ -6794,8 +6795,8 @@ vboxDomainSnapshotDeleteSingle(struct _vboxDriver *da= ta, gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); gVBoxAPI.UIProgress.GetResultCode(progress, &result); if (RC_FAILED(result)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not delete snapshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not delete snapshot")); goto cleanup; } =20 @@ -6820,8 +6821,8 @@ vboxDomainSnapshotDeleteTree(struct _vboxDriver *data, rc =3D gVBoxAPI.UArray.vboxArrayGet(&children, snapshot, gVBoxAPI.UArray.handleSnapshotGetChildren(snapshot)); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get children snapshots")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get children snapshots")); goto cleanup; } =20 @@ -6885,16 +6886,16 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) =20 defXml =3D vboxDomainSnapshotGetXMLDesc(snapshot, 0); if (!defXml) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get XML Desc of snapshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get XML Desc of snapshot")); goto cleanup; } def =3D virDomainSnapshotDefParseString(defXml, data->xmlopt, NULL, NULL, VIR_DOMAIN_SNAPSHOT_PARSE_REDEFI= NE); if (!def) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get a virDomainSnapshotDef *")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get a virDomainSnapshotDef *")); goto cleanup; } =20 @@ -6902,8 +6903,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) goto cleanup; rc =3D gVBoxAPI.UIMachine.GetSettingsFilePath(machine, &settingsFilePa= thUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get settings file path")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get settings file path")); goto cleanup; } VBOX_UTF16_TO_UTF8(settingsFilePathUtf16, &settingsFilepath); @@ -6911,29 +6912,29 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) /* Getting the machine name to retrieve the machine location path. */ rc =3D gVBoxAPI.UIMachine.GetName(machine, &machineNameUtf16); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot get machine name")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot get machine name")); goto cleanup; } VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName); nameTmpUse =3D g_strdup_printf("%s.vbox", machineName); machineLocationPath =3D virStringReplace(settingsFilepath, nameTmpUse,= ""); if (machineLocationPath =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get the machine location path")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get the machine location path")); goto cleanup; } snapshotMachineDesc =3D virVBoxSnapshotConfLoadVboxFile(settingsFilepa= th, machineLocationPath); if (!snapshotMachineDesc) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot create a vboxSnapshotXmlPtr")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot create a vboxSnapshotXmlPtr")); goto cleanup; } =20 isCurrent =3D virVBoxSnapshotConfIsCurrentSnapshot(snapshotMachineDesc= , def->parent.name); if (isCurrent < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to know if the snapshot is the current sn= apshot")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to know if the snapshot is the current s= napshot")); goto cleanup; } if (isCurrent) { @@ -6966,13 +6967,13 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) readOnly =3D virVBoxSnapshotConfHardDiskPtrByLocation(snap= shotMachineDesc, def->parent.dom->disks[it= ]->src->path); if (!readOnly) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot get hard disk by location")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot get hard disk by location")); goto cleanup; } if (readOnly->parent =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("The read only disk has no parent")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("The read only disk has no parent")); goto cleanup; } =20 @@ -6983,17 +6984,17 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open HardDisk, rc=3D%08x"= ), + (unsigned)rc); goto cleanup; } =20 rc =3D gVBoxAPI.UIMedium.GetId(medium, &parentiid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get hardDisk Id, rc=3D%08x= "), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to get hardDisk Id, rc=3D%08= x"), + (unsigned)rc); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid); @@ -7009,9 +7010,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) newLocation, &newMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to create HardDisk, rc=3D%08x= "), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to create HardDisk, rc=3D%08= x"), + (unsigned)rc); goto cleanup; } VBOX_UTF16_FREE(formatUtf16); @@ -7023,9 +7024,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode); if (RC_FAILED(resultCode)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Error while creating diff storage, r= c=3D%08x"), - resultCode.uResultCode); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while creating diff storage, = rc=3D%08x"), + resultCode.uResultCode); goto cleanup; } VBOX_RELEASE(progress); @@ -7038,9 +7039,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) =20 rc =3D gVBoxAPI.UIMedium.GetId(newMedium, &iid); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get medium uuid, rc=3D%08x= "), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to get medium uuid, rc=3D%08= x"), + (unsigned)rc); VIR_FREE(disk); goto cleanup; } @@ -7058,8 +7059,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) if (virVBoxSnapshotConfAddHardDiskToMediaRegistry(disk, snapshotMachineDesc->mediaR= egistry, parentUuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to add hard disk to the media= registry")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to add hard disk to the medi= a registry")); goto cleanup; } /* Adding fake disks to the machine storage controllers */ @@ -7069,8 +7070,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) it + 1, &searchResultTab); if (resultSize !=3D it + 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID %s"), searchResu= ltTab[it]); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find UUID %s"), searchRes= ultTab[it]); goto cleanup; } =20 @@ -7086,9 +7087,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) /* Closing the "fake" disk */ rc =3D gVBoxAPI.UIMedium.Close(newMedium); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close the new medium, rc= =3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to close the new medium, rc= =3D%08x"), + (unsigned)rc); goto cleanup; } } @@ -7099,9 +7100,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) uuidRO =3D virVBoxSnapshotConfHardDiskUuidByLocation(snaps= hotMachineDesc, def->parent.dom->dis= ks[it]->src->path); if (!uuidRO) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("No such disk in media registry %s"), - def->parent.dom->disks[it]->src->path); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("No such disk in media registry %s"), + def->parent.dom->disks[it]->src->path); goto cleanup; } =20 @@ -7110,9 +7111,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) it + 1, &searchResultTab); if (resultSize !=3D it + 1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID %s"), - searchResultTab[it]); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find UUID %s"), + searchResultTab[it]); goto cleanup; } =20 @@ -7134,13 +7135,13 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) virVBoxSnapshotConfHardDiskUuidByLocation(snapshotMachineDesc, def->disks[it].src->= path); if (!uuidRW) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID for location %s"), def->= disks[it].src->path); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find UUID for location %s"), def-= >disks[it].src->path); goto cleanup; } if (virVBoxSnapshotConfRemoveHardDisk(snapshotMachineDesc->mediaRe= gistry, uuidRW) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to remove disk from media registry. u= uid =3D %s"), uuidRW); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to remove disk from media registry. = uuid =3D %s"), uuidRW); goto cleanup; } } @@ -7151,13 +7152,13 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) virVBoxSnapshotConfHardDiskUuidByLocation(snapshotMachineD= esc, def->parent.dom-= >disks[it]->src->path); if (!uuidRO) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID for location %s"), d= ef->parent.dom->disks[it]->src->path); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to find UUID for location %s"), = def->parent.dom->disks[it]->src->path); goto cleanup; } if (virVBoxSnapshotConfRemoveHardDisk(snapshotMachineDesc->med= iaRegistry, uuidRO) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to remove disk from media registr= y. uuid =3D %s"), uuidRO); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to remove disk from media regist= ry. uuid =3D %s"), uuidRO); goto cleanup; } } @@ -7167,9 +7168,9 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) &aMediaSize, &aMedia); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to unregister machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to unregister machine, rc=3D%08x"), + (unsigned)rc); goto cleanup; } VBOX_RELEASE(machine); @@ -7189,17 +7190,17 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) resultCodeUnion resultCode; rc =3D gVBoxAPI.UIMedium.DeleteStorage(medium, &progress); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to delete medium, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to delete medium, rc=3D%08x"), + (unsigned)rc); goto cleanup; } gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); gVBoxAPI.UIProgress.GetResultCode(progress, &resultCode); if (RC_FAILED(resultCode)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Error while closing medium, rc=3D%08x"), - resultCode.uResultCode); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while closing medium, rc=3D%08x"), + resultCode.uResultCode); goto cleanup; } VBOX_RELEASE(progress); @@ -7218,8 +7219,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) =20 /* removing the snapshot */ if (virVBoxSnapshotConfRemoveSnapshot(snapshotMachineDesc, def->parent= .name) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to remove snapshot %s"), def->parent.name= ); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to remove snapshot %s"), def->parent.nam= e); goto cleanup; } =20 @@ -7228,8 +7229,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) if (def->parent.parent_name !=3D NULL) { virVBoxSnapshotConfSnapshot *snap =3D virVBoxSnapshotConfSnaps= hotByName(snapshotMachineDesc->snapshot, def->parent.parent_name); if (!snap) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get the snapshot to remove")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get the snapshot to remove")); goto cleanup; } snapshotMachineDesc->currentSnapshot =3D g_strdup(snap->uuid); @@ -7238,25 +7239,25 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) =20 /* Registering the machine */ if (virVBoxSnapshotConfSaveVboxFile(snapshotMachineDesc, settingsFilep= ath) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to serialize the machine description")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to serialize the machine description")); goto cleanup; } rc =3D gVBoxAPI.UIVirtualBox.OpenMachine(data->vboxObj, settingsFilePathUtf16, &machine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to open Machine, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 rc =3D gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to register Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to register Machine, rc=3D%08x"), + (unsigned)rc); goto cleanup; } =20 @@ -7305,8 +7306,8 @@ static int vboxDomainSnapshotDelete(virDomainSnapshot= Ptr snapshot, =20 rc =3D gVBoxAPI.UIMachine.GetState(machine, &state); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get domain state")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get domain state")); goto cleanup; } =20 @@ -7317,13 +7318,13 @@ static int vboxDomainSnapshotDelete(virDomainSnapsh= otPtr snapshot, rc =3D gVBoxAPI.UArray.vboxArrayGet(&snapChildren, snap, gVBoxAPI.UArray.handleSnapshotGetChildren(sna= p)); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get snapshot children")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get snapshot children")); goto cleanup; } if (snapChildren.count !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot delete metadata of a snapshot with ch= ildren")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot delete metadata of a snapshot with c= hildren")); goto cleanup; } else if (gVBoxAPI.vboxSnapshotRedefine) { ret =3D vboxDomainSnapshotDeleteMetadataOnly(snapshot); @@ -7332,8 +7333,8 @@ static int vboxDomainSnapshotDelete(virDomainSnapshot= Ptr snapshot, } =20 if (gVBoxAPI.machineStateChecker.Online(state)) { - virReportError(VIR_ERR_OPERATION_INVALID, "%s", - _("cannot delete snapshots of running domain")); + vboxReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("cannot delete snapshots of running domain")); goto cleanup; } =20 @@ -7341,9 +7342,9 @@ static int vboxDomainSnapshotDelete(virDomainSnapshot= Ptr snapshot, if (NS_SUCCEEDED(rc)) rc =3D gVBoxAPI.UISession.GetConsole(data->vboxSession, &console); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not open VirtualBox session with domain %s= "), - dom->name); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("could not open VirtualBox session with domain %= s"), + dom->name); goto cleanup; } =20 @@ -7388,16 +7389,16 @@ vboxDomainScreenshot(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMachine.GetMonitorCount(machine, &max_screen); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to get monitor count")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to get monitor count")); VBOX_RELEASE(machine); return NULL; } =20 if (screen >=3D max_screen) { - virReportError(VIR_ERR_INVALID_ARG, - _("screen ID higher than monitor " - "count (%d)"), max_screen); + vboxReportError(VIR_ERR_INVALID_ARG, + _("screen ID higher than monitor " + "count (%d)"), max_screen); VBOX_RELEASE(machine); return NULL; } @@ -7437,8 +7438,8 @@ vboxDomainScreenshot(virDomainPtr dom, &xOrigin, &yOr= igin); =20 if (NS_FAILED(rc) || !width || !height) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to get screen resolution")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to get screen resolution")); goto endjob; } =20 @@ -7447,8 +7448,8 @@ vboxDomainScreenshot(virDomainPtr dom, &screenDa= taSize, &screenDa= ta); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("failed to take screenshot")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("failed to take screenshot")); goto endjob; } =20 @@ -7467,8 +7468,8 @@ vboxDomainScreenshot(virDomainPtr dom, ret =3D g_strdup("image/png"); =20 if (virFDStreamOpenFile(st, tmp, 0, 0, O_RDONLY) < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("unable to open stream")); + vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("unable to open stream")); VIR_FREE(ret); } endjob: @@ -7534,8 +7535,8 @@ vboxConnectListAllDomains(virConnectPtr conn, =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of domains, rc=3D%08x"), (uns= igned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of domains, rc=3D%08x"), (un= signed)rc); goto cleanup; } =20 @@ -7572,8 +7573,8 @@ vboxConnectListAllDomains(virConnectPtr conn, if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT)) { rc =3D gVBoxAPI.UIMachine.GetSnapshotCount(machine, &snapshotCou= nt); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("could not get snapshot count for listed do= mains")); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not get snapshot count for listed d= omains")); goto cleanup; } if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT) && @@ -7734,8 +7735,8 @@ vboxDomainHasManagedSaveImage(virDomainPtr dom, unsig= ned int flags) VBOX_IID_INITIALIZE(&iid); rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); return ret; } =20 @@ -7818,11 +7819,11 @@ vboxDomainSendKey(virDomainPtr dom, keycode =3D virKeycodeValueTranslate(codeset, VIR_KEYCODE_SET_= XT, keyDownCodes[i]); if (keycode < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot translate keycode %u of %s codese= t to" - " xt keycode"), - keyDownCodes[i], - virKeycodeSetTypeToString(codeset)); + vboxReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot translate keycode %u of %s codes= et to" + " xt keycode"), + keyDownCodes[i], + virKeycodeSetTypeToString(codeset)); goto cleanup; } keyDownCodes[i] =3D keycode; @@ -7837,27 +7838,27 @@ vboxDomainSendKey(virDomainPtr dom, rc =3D gVBoxAPI.UISession.OpenExisting(data, &iid, machine); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Unable to open VirtualBox session with domain %s= "), - dom->name); + vboxReportError(VIR_ERR_OPERATION_FAILED, + _("Unable to open VirtualBox session with domain %= s"), + dom->name); goto cleanup; } =20 rc =3D gVBoxAPI.UISession.GetConsole(data->vboxSession, &console); =20 if (NS_FAILED(rc) || !console) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Unable to get Console object for domain %s"), - dom->name); + vboxReportError(VIR_ERR_OPERATION_FAILED, + _("Unable to get Console object for domain %s"), + dom->name); goto cleanup; } =20 rc =3D gVBoxAPI.UIConsole.GetKeyboard(console, &keyboard); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Unable to get Keyboard object for domain %s"), - dom->name); + vboxReportError(VIR_ERR_OPERATION_FAILED, + _("Unable to get Keyboard object for domain %s"), + dom->name); goto cleanup; } =20 @@ -7865,9 +7866,9 @@ vboxDomainSendKey(virDomainPtr dom, &codesStored); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Unable to send keyboard scancodes for domain %s"= ), - dom->name); + vboxReportError(VIR_ERR_OPERATION_FAILED, + _("Unable to send keyboard scancodes for domain %s= "), + dom->name); goto cleanup; } =20 @@ -7880,9 +7881,9 @@ vboxDomainSendKey(virDomainPtr dom, &codesStored); =20 if (NS_FAILED(rc)) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("Unable to send keyboard scan codes to domain %s"= ), - dom->name); + vboxReportError(VIR_ERR_OPERATION_FAILED, + _("Unable to send keyboard scan codes to domain %s= "), + dom->name); goto cleanup; } =20 --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466625; cv=none; d=zohomail.com; s=zohoarc; b=OhD35tYxom7pKqY20PusRY1Uf6bpwy0wpeM1zKf8vB4YB+m5IbT6s9ViTqLrhiCJVyXblO8J079ShvVnjVojB3Vz//xniU4s4hyY6s/P8zxC2EQqBvBM2ekI//Ilfm+/BfJhyLKvGvS4wI1uM/323AjQmQ9KS1ytAoOKxU//Eos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466625; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M/+X1dEqS8XmDsN8JCa/4zQoOCUaDbk2X+ChVbF1kj0=; b=MptOs3IKKvP0ANiSXhMKKmxOCreHSgTepyAQf3HFbNjK98VFqpd8ThlDLQACQGfalJlOw84zANm2TDp4yoI3aBFG8xm8lGfezzTcUdhZfR/UZD7sBfq7DVXvC6TOIATj6VTTmFwIkvm18yi0Sf9/OsrY2wJR0fiq6C/WQ5iEaTU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1674466624997156.59604123642805; Mon, 23 Jan 2023 01:37:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-r-TGwddmMVGoBmkeRoN51g-1; Mon, 23 Jan 2023 04:36:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79899100F907; Mon, 23 Jan 2023 09:36:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 676EDC15BA0; Mon, 23 Jan 2023 09:36:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4110F194658C; Mon, 23 Jan 2023 09:36:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 44F6D19466DF for ; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 27CF1492D0F; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id C35AF492B02 for ; Mon, 23 Jan 2023 09:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466623; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=M/+X1dEqS8XmDsN8JCa/4zQoOCUaDbk2X+ChVbF1kj0=; b=bxxi60vPE7VE88ZMnC6jHMJNkdNTFxukiei45QZjppXDM70I+126bRDyST49Jx6POGNMJu KOBj9+ql2CLI+7TQeISbovi2V1cMRV1E8h1VrlBPa3va/5BeTEPECsi1+5miSchTNkUf0Y APi9rZFzHNINRQ9Uj82JIhr2yYeEh94= X-MC-Unique: r-TGwddmMVGoBmkeRoN51g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 7/8] vbox: Move error messages onto a single line Date: Mon, 23 Jan 2023 10:35:54 +0100 Message-Id: <51dc4d4531efb2fd9bd0b566a7d9a3ca3da469f7.1674466489.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466626133100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Our coding style suggests error messages to be on a single line for easier git grep. Since I'm touching them anyways, let's make them follow our own suggestion. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.c | 52 +++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index b7b61df080..cf404ea9d7 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -527,8 +527,7 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DC390: case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AM53C974: vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("The vbox driver does not support %s SCSI " - "controller model"), + _("The vbox driver does not support %s SCSI co= ntroller model"), virDomainControllerModelSCSITypeToString(contr= oller->model)); goto cleanup; case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_DEFAULT: @@ -571,8 +570,7 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to add storage controller " - "(name: %s, busType: %d), rc=3D%08x"), + _("Failed to add storage controller (name: %s, bus= Type: %d), rc=3D%08x"), debugName, vboxBusType, rc); goto cleanup; } @@ -583,8 +581,7 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, vboxModel); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to change storage controller model, " - "rc=3D%08x"), rc); + _("Failed to change storage controller model, = rc=3D%08x"), rc); goto cleanup; } } @@ -1167,8 +1164,7 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) =20 if (type !=3D VIR_STORAGE_TYPE_FILE) { vboxReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported storage type %s, the only suppo= rted " - "type is %s"), + _("Unsupported storage type %s, the only suppo= rted type is %s"), virStorageTypeToString(type), virStorageTypeToString(VIR_STORAGE_TYPE_FILE)); ret =3D -1; @@ -1274,8 +1270,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) =20 if (!medium) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to open the following disk/dvd/f= loppy " - "to the machine: %s, rc=3D%08x"), src, r= c); + _("Failed to open the following disk/dvd/f= loppy to the machine: %s, rc=3D%08x"), + src, rc); ret =3D -1; goto cleanup; } @@ -1283,8 +1279,7 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) rc =3D gVBoxAPI.UIMedium.GetId(medium, &mediumUUID); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Can't get the UUID of the file to be at= tached " - "as harddisk/dvd/floppy: %s, rc=3D%08x"), + _("Can't get the UUID of the file to be at= tached as harddisk/dvd/floppy: %s, rc=3D%08x"), src, rc); ret =3D -1; goto cleanup; @@ -1319,8 +1314,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not attach the file as " - "harddisk/dvd/floppy: %s, rc=3D%08x"), src, = rc); + _("Could not attach the file as harddisk/dvd/f= loppy: %s, rc=3D%08x"), + src, rc); ret =3D -1; goto cleanup; } else { @@ -1990,8 +1985,7 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags VIR_DIV_UP(def->mem.cur_balloon,= 1024)); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the domain to:= %llu Kb, " - "rc=3D%08x"), + _("could not set the memory size of the domain to:= %llu Kb, rc=3D%08x"), def->mem.cur_balloon, (unsigned)rc); } =20 @@ -2354,9 +2348,7 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom= , unsigned int flags) ret =3D vboxStartMachine(dom, i, machine, &iid); } else { vboxReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("machine is not in " - "poweroff|saved|aborted state, so " - "couldn't start it")); + _("machine is not in poweroff|saved|ab= orted state, so couldn't start it")); ret =3D -1; } } @@ -2838,8 +2830,7 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsi= gned long memory) ret =3D 0; } else { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the " - "domain to: %lu Kb, rc=3D%08x"), + _("could not set the memory size of the domain= to: %lu Kb, rc=3D%08x"), memory, (unsigned)rc); } } @@ -2994,8 +2985,7 @@ static int vboxDomainSetVcpusFlags(virDomainPtr dom, = unsigned int nvcpus, ret =3D 0; } else { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of cpus of the= domain " - "to: %u, rc=3D%08x"), + _("could not set the number of cpus of the= domain to: %u, rc=3D%08x"), CPUCount, (unsigned)rc); } VBOX_RELEASE(machine); @@ -3412,8 +3402,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) =20 if (!disk->dst) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not generate medium name for the disk= " - "at: port:%d, slot:%d"), devicePort, deviceS= lot); + _("Could not generate medium name for the disk= at: port:%d, slot:%d"), + devicePort, deviceSlot); goto cleanup; } =20 @@ -4727,8 +4717,7 @@ vboxSnapshotRedefine(virDomainPtr dom, * read-write disk number */ if (realReadOnlyDisksPathSize < realReadWriteDisksPathSize) { vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("The read only disk number must be greater o= r equal to the " - " read write disk number")); + _("The read only disk number must be greater o= r equal to the read write disk number")); goto cleanup; } for (it =3D 0; it < realReadWriteDisksPathSize; it++) { @@ -6111,8 +6100,7 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDef *de= f, sdCount); if (!defdom->disks[diskCount]->dst) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not generate medium name for the disk= " - "at: port:%d, slot:%d"), devicePort, deviceS= lot); + _("Could not generate medium name for the disk= at: port:%d, slot:%d"), devicePort, deviceSlot); ret =3D -1; goto cleanup; } @@ -7397,8 +7385,7 @@ vboxDomainScreenshot(virDomainPtr dom, =20 if (screen >=3D max_screen) { vboxReportError(VIR_ERR_INVALID_ARG, - _("screen ID higher than monitor " - "count (%d)"), max_screen); + _("screen ID higher than monitor count (%d)"), max= _screen); VBOX_RELEASE(machine); return NULL; } @@ -7820,8 +7807,7 @@ vboxDomainSendKey(virDomainPtr dom, keyDownCodes[i]); if (keycode < 0) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot translate keycode %u of %s codes= et to" - " xt keycode"), + _("cannot translate keycode %u of %s codes= et to xt keycode"), keyDownCodes[i], virKeycodeSetTypeToString(codeset)); goto cleanup; --=20 2.39.1 From nobody Sun May 19 06:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674466576; cv=none; d=zohomail.com; s=zohoarc; b=AeOM/EhZgH73YSPOTu6tDArQvGNPtXz3VGz5Hl/R2Sd3gUVES35ErXp+mrfCL6YX4BM2oxR3Fmoyt4jrbjU8THjuUgq6wKAto8K02G/z8aYzxflOk/CEhbx+3IWBM8N8pCXI9K+t3oHjpwCepGq+8iwSQfRqhEABg/Q8AvZaT0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466576; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vV8lHC/xFlyABehuyMkZxsYw81V8o9LoEQQzYvRtfJY=; b=DmebJyZzN+WPAmVxJ8y4CVPDsHvnHDIeeYNLUpS0hbUT3LdHxAyXp5JqBR3WnBJAtNwaxuZpaHXJsDdvBqiSbHOZxfUmnPnQ1cao0539LG7Uz0+q48S6zN3M2oiH9nF2g5aDMHIUmJCqVdIEs9TnDgUd2GmGyaSqE1Qx4qzWaRM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674466576213765.4223552424527; Mon, 23 Jan 2023 01:36:16 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-CWwM1vUKOYSzZNZPYsMLzQ-1; Mon, 23 Jan 2023 04:36:07 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C2EC2806045; Mon, 23 Jan 2023 09:36:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D06A40ED76E; Mon, 23 Jan 2023 09:36:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0B02D194658C; Mon, 23 Jan 2023 09:36:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D944C1946A6C for ; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BB319492B03; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60D6A492D0F for ; Mon, 23 Jan 2023 09:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466575; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vV8lHC/xFlyABehuyMkZxsYw81V8o9LoEQQzYvRtfJY=; b=gTV9cBi5euhjr45uddvQpMqnOJhuM54+Jug1CWsIl95dOz026LR6d1mH37X4XJmMsCzfDt IOYoX8aZzNpaXShaKgJfnXH80VGMYpkuJKhsrWT6hW8T5jcHvmF8hgZEbilk+NSp26Zk2T tpJynBO8eK+6V9b8Zx+sVGbCZLROa38= X-MC-Unique: CWwM1vUKOYSzZNZPYsMLzQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 8/8] vbox: Stop reporting RC in error messages Date: Mon, 23 Jan 2023 10:35:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466577956100001 Content-Type: text/plain; charset="utf-8"; x-default="true" As shown in the commit that introduced vboxReportError(), we are appending the retval of a failed VirtualBox API onto our error messages. Well, this is no longer needed because vboxReportError() already appends the VirtualBox error in plain text. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_common.c | 301 ++++++++++++++++++----------------------- 1 file changed, 132 insertions(+), 169 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index cf404ea9d7..0a83cc5a61 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -570,8 +570,8 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to add storage controller (name: %s, bus= Type: %d), rc=3D%08x"), - debugName, vboxBusType, rc); + _("Failed to add storage controller (name: %s, bus= Type: %d)"), + debugName, vboxBusType); goto cleanup; } =20 @@ -581,7 +581,7 @@ vboxSetStorageController(virDomainControllerDef *contro= ller, vboxModel); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to change storage controller model, = rc=3D%08x"), rc); + _("Failed to change storage controller model")= ); goto cleanup; } } @@ -795,9 +795,8 @@ static int vboxConnectListDomains(virConnectPtr conn, i= nt *ids, int nids) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Domains, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of Domains")); goto cleanup; } =20 @@ -837,8 +836,8 @@ static int vboxConnectNumOfDomains(virConnectPtr conn) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get number of Domains, rc=3D%08x"), (= unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get number of Domains")); goto cleanup; } =20 @@ -891,8 +890,8 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr = conn, int id) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of machines")); return NULL; } =20 @@ -958,7 +957,7 @@ virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + _("Could not get list of machines")); return NULL; } =20 @@ -1030,7 +1029,7 @@ vboxDomainLookupByName(virConnectPtr conn, const char= *name) rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + _("Could not get list of machines")); return NULL; } =20 @@ -1270,8 +1269,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) =20 if (!medium) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to open the following disk/dvd/f= loppy to the machine: %s, rc=3D%08x"), - src, rc); + _("Failed to open the following disk/dvd/f= loppy to the machine: %s"), + src); ret =3D -1; goto cleanup; } @@ -1279,8 +1278,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) rc =3D gVBoxAPI.UIMedium.GetId(medium, &mediumUUID); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Can't get the UUID of the file to be at= tached as harddisk/dvd/floppy: %s, rc=3D%08x"), - src, rc); + _("Can't get the UUID of the file to be at= tached as harddisk/dvd/floppy: %s"), + src); ret =3D -1; goto cleanup; } @@ -1314,8 +1313,8 @@ vboxAttachDrives(virDomainDef *def, struct _vboxDrive= r *data, IMachine *machine) =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not attach the file as harddisk/dvd/f= loppy: %s, rc=3D%08x"), - src, rc); + _("Could not attach the file as harddisk/dvd/f= loppy: %s"), + src); ret =3D -1; goto cleanup; } else { @@ -1977,7 +1976,7 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not define a domain, rc=3D%08x"), (unsign= ed)rc); + _("could not define a domain")); goto cleanup; } =20 @@ -1985,8 +1984,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags VIR_DIV_UP(def->mem.cur_balloon,= 1024)); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the domain to:= %llu Kb, rc=3D%08x"), - def->mem.cur_balloon, (unsigned)rc); + _("could not set the memory size of the domain to:= %llu Kb"), + def->mem.cur_balloon); } =20 if (virDomainDefHasVcpusOffline(def)) { @@ -1996,8 +1995,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags rc =3D gVBoxAPI.UIMachine.SetCPUCount(machine, virDomainDefGetVcpusMax= (def)); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of virtual CPUs to: %u= , rc=3D%08x"), - virDomainDefGetVcpusMax(def), (unsigned)rc); + _("could not set the number of virtual CPUs to: %u= "), + virDomainDefGetVcpusMax(def)); } =20 rc =3D gVBoxAPI.UIMachine.SetCPUProperty(machine, CPUPropertyType_PAE, @@ -2005,9 +2004,9 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags VIR_TRISTATE_SWITCH_ON); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not change PAE status to: %s, rc=3D%08x"), + _("could not change PAE status to: %s"), (def->features[VIR_DOMAIN_FEATURE_PAE] =3D=3D VIR_= TRISTATE_SWITCH_ON) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + ? _("Enabled") : _("Disabled")); } =20 gVBoxAPI.UIMachine.GetBIOSSettings(machine, &bios); @@ -2017,18 +2016,18 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const = char *xml, unsigned int flags VIR_TRISTATE_SWITCH_ON= ); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not change ACPI status to: %s, rc=3D%= 08x"), + _("could not change ACPI status to: %s"), (def->features[VIR_DOMAIN_FEATURE_ACPI] =3D=3D= VIR_TRISTATE_SWITCH_ON) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + ? _("Enabled") : _("Disabled")); } rc =3D gVBoxAPI.UIBIOSSettings.SetIOAPICEnabled(bios, def->features[VIR_DO= MAIN_FEATURE_APIC] =3D=3D VIR_TRISTATE_SWITCH_= ON); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not change APIC status to: %s, rc=3D%= 08x"), + _("could not change APIC status to: %s"), (def->features[VIR_DOMAIN_FEATURE_APIC] =3D=3D= VIR_TRISTATE_SWITCH_ON) - ? _("Enabled") : _("Disabled"), (unsigned)rc); + ? _("Enabled") : _("Disabled")); } VBOX_RELEASE(bios); } @@ -2036,8 +2035,8 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags /* Register the machine before attaching other devices to it */ rc =3D gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not define a domain, rc=3D%08x"), (unsign= ed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not define a domain")); goto cleanup; } =20 @@ -2081,7 +2080,7 @@ vboxDomainDefineXMLFlags(virConnectPtr conn, const ch= ar *xml, unsigned int flags rc =3D gVBoxAPI.UIMachine.SaveSettings(machine); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to save VM settings, rc=3D%08x"), rc); + _("Failed to save VM settings")); machineReady =3D false; } =20 @@ -2137,8 +2136,8 @@ static int vboxDomainUndefineFlags(virDomainPtr dom, = unsigned int flags) gVBoxAPI.deleteConfig(machine); ret =3D 0; } else { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not delete the domain, rc=3D%08x"), (unsi= gned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not delete the domain")); } =20 vboxIIDUnalloc(&iid); @@ -2317,8 +2316,8 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom= , unsigned int flags) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of machines")); return -1; } =20 @@ -2417,7 +2416,7 @@ static int vboxDomainIsActive(virDomainPtr dom) rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + _("Could not get list of machines")); return ret; } =20 @@ -2830,8 +2829,8 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsi= gned long memory) ret =3D 0; } else { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the memory size of the domain= to: %lu Kb, rc=3D%08x"), - memory, (unsigned)rc); + _("could not set the memory size of the domain= to: %lu Kb"), + memory); } } gVBoxAPI.UISession.Close(data->vboxSession); @@ -2857,8 +2856,8 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDom= ainInfoPtr info) =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of machines")); return -1; } =20 @@ -2985,8 +2984,8 @@ static int vboxDomainSetVcpusFlags(virDomainPtr dom, = unsigned int nvcpus, ret =3D 0; } else { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not set the number of cpus of the= domain to: %u, rc=3D%08x"), - CPUCount, (unsigned)rc); + _("could not set the number of cpus of the= domain to: %u"), + CPUCount); } VBOX_RELEASE(machine); } else { @@ -3286,8 +3285,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) =20 rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(mediumAttachment, &me= dium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get IMedium, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get IMedium")); goto cleanup; } =20 @@ -3327,16 +3326,15 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver= *data, IMachine *machine) rc =3D gVBoxAPI.UIMediumAttachment.GetMedium(mediumAttachment, &me= dium); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get IMedium, rc=3D%08x"), rc); + _("Could not get IMedium")); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetController(mediumAttachment, &controllerName); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get storage controller name, rc= =3D%08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to get storage controller name")); goto cleanup; } =20 @@ -3344,44 +3342,41 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver= *data, IMachine *machine) controllerName, &controller); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get storage controller by name, r= c=3D%08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get storage controller by name")); goto cleanup; } =20 rc =3D gVBoxAPI.UIMediumAttachment.GetType(mediumAttachment, &devi= ceType); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get device type, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get device type")); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetPort(mediumAttachment, &devi= cePort); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get device port, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get device port")); goto cleanup; } rc =3D gVBoxAPI.UIMediumAttachment.GetDevice(mediumAttachment, &de= viceSlot); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get device slot, rc=3D%08x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get device slot")); goto cleanup; } rc =3D gVBoxAPI.UIStorageController.GetBus(controller, &storageBus= ); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get storage controller bus, rc=3D= %08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get storage controller bus")); goto cleanup; } =20 if (medium) { rc =3D gVBoxAPI.UIMedium.GetLocation(medium, &mediumLocUtf16); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get medium storage location, = rc=3D%08x"), - rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get medium storage location")= ); goto cleanup; } =20 @@ -3391,8 +3386,8 @@ vboxDumpDisks(virDomainDef *def, struct _vboxDriver *= data, IMachine *machine) =20 rc =3D gVBoxAPI.UIMedium.GetReadOnly(medium, &readOnly); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get read only state, rc=3D%08= x"), rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get read only state")); goto cleanup; } } @@ -4218,9 +4213,8 @@ static int vboxConnectListDefinedDomains(virConnectPt= r conn, rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of Defined Domains, rc=3D%08= x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of Defined Domains")); goto cleanup; } =20 @@ -4271,9 +4265,8 @@ static int vboxConnectNumOfDefinedDomains(virConnectP= tr conn) rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GET_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get number of Defined Domains, rc=3D%= 08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get number of Defined Domains")); goto cleanup; } =20 @@ -4364,8 +4357,8 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr do= m, =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not attach shared folder '%s', rc= =3D%08x"), - dev->data.fs->dst, (unsigned)rc); + _("could not attach shared folder '%s'"), + dev->data.fs->dst); ret =3D -1; } else { ret =3D 0; @@ -4482,8 +4475,8 @@ static int vboxDomainDetachDevice(virDomainPtr dom, c= onst char *xml) =20 if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("could not detach shared folder '%s', rc= =3D%08x"), - dev->data.fs->dst, (unsigned)rc); + _("could not detach shared folder '%s'"), + dev->data.fs->dst); } else { ret =3D 0; } @@ -4538,9 +4531,8 @@ static int vboxCloseDisksRecursively(virDomainPtr dom= , char *location) AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); goto cleanup; } rc =3D gVBoxAPI.UIMedium.GetChildren(medium, &childrenSize, &children); @@ -4572,9 +4564,8 @@ static int vboxCloseDisksRecursively(virDomainPtr dom= , char *location) } rc =3D gVBoxAPI.UIMedium.Close(medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close HardDisk")); goto cleanup; } =20 @@ -4738,9 +4729,8 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &readWriteMedium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); VBOX_UTF16_FREE(locationUtf); goto cleanup; } @@ -4791,9 +4781,8 @@ vboxSnapshotRedefine(virDomainPtr dom, } rc =3D gVBoxAPI.UIMedium.Close(readWriteMedium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close HardDisk")); goto cleanup; } } @@ -4845,8 +4834,7 @@ vboxSnapshotRedefine(virDomainPtr dom, &readOnlyMedium); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + _("Unable to open HardDisk")); VBOX_UTF16_FREE(locationUtf); goto cleanup; } @@ -4882,9 +4870,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(parentReadOnlyMedium, &parentiid); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get hard disk id, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get hard disk id")); VIR_FREE(uuid); goto cleanup; } @@ -4893,9 +4880,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.Close(readOnlyMedium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close HardDisk")); VIR_FREE(uuid); VIR_FREE(parentUuid); goto cleanup; @@ -4922,9 +4908,8 @@ vboxSnapshotRedefine(virDomainPtr dom, &aMediaSize, &aMedia); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to unregister machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to unregister machine")); goto cleanup; } VBOX_RELEASE(machine); @@ -4954,9 +4939,8 @@ vboxSnapshotRedefine(virDomainPtr dom, resultCodeUnion resultCode; rc =3D gVBoxAPI.UIMedium.DeleteStorage(medium, &progress); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to delete medium, rc=3D%08x"= ), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to delete medium")); VIR_FREE(locationUtf8); goto cleanup; } @@ -5088,9 +5072,8 @@ vboxSnapshotRedefine(virDomainPtr dom, &medium); VBOX_UTF16_FREE(locationUtf16); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); goto cleanup; } } @@ -5121,9 +5104,8 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); goto cleanup; } VBOX_UTF16_FREE(locationUtf16); @@ -5201,9 +5183,8 @@ vboxSnapshotRedefine(virDomainPtr dom, /* Close disk */ rc =3D gVBoxAPI.UIMedium.Close(medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close HardDisk")); goto cleanup; } } @@ -5235,9 +5216,8 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); VBOX_UTF16_FREE(locationUtf16); goto cleanup; } @@ -5245,9 +5225,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(medium, &parentiid); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get hardDisk Id, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get hardDisk Id")); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid); @@ -5264,9 +5243,8 @@ vboxSnapshotRedefine(virDomainPtr dom, VBOX_UTF16_FREE(newLocation); VBOX_UTF16_FREE(formatUtf16); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to create HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to create HardDisk")); goto cleanup; } =20 @@ -5291,9 +5269,8 @@ vboxSnapshotRedefine(virDomainPtr dom, =20 rc =3D gVBoxAPI.UIMedium.GetId(newMedium, &iid); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get medium uuid, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get medium uuid")); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &iid, &uuid); @@ -5339,9 +5316,8 @@ vboxSnapshotRedefine(virDomainPtr dom, /* Closing the "fake" disk */ rc =3D gVBoxAPI.UIMedium.Close(newMedium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close the new medium, rc=3D%0= 8x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close the new medium")); goto cleanup; } } @@ -5388,16 +5364,14 @@ vboxSnapshotRedefine(virDomainPtr dom, AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); goto cleanup; } rc =3D gVBoxAPI.UIMedium.Close(medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close HardDisk, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close HardDisk")); goto cleanup; } VBOX_UTF16_FREE(locationUtf16); @@ -5414,17 +5388,15 @@ vboxSnapshotRedefine(virDomainPtr dom, settingsFilePath, &machine); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open Machine")); goto cleanup; } =20 rc =3D gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to register Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to register Machine")); goto cleanup; } =20 @@ -6972,17 +6944,15 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) AccessMode_ReadWrite, &medium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open HardDisk, rc=3D%08x"= ), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open HardDisk")); goto cleanup; } =20 rc =3D gVBoxAPI.UIMedium.GetId(medium, &parentiid); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get hardDisk Id, rc=3D%08= x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get hardDisk Id")); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid); @@ -6998,9 +6968,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) newLocation, &newMedium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to create HardDisk, rc=3D%08= x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to create HardDisk")); goto cleanup; } VBOX_UTF16_FREE(formatUtf16); @@ -7027,9 +6996,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) =20 rc =3D gVBoxAPI.UIMedium.GetId(newMedium, &iid); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to get medium uuid, rc=3D%08= x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to get medium uuid")); VIR_FREE(disk); goto cleanup; } @@ -7075,9 +7043,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) /* Closing the "fake" disk */ rc =3D gVBoxAPI.UIMedium.Close(newMedium); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to close the new medium, rc= =3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to close the new medium")); goto cleanup; } } @@ -7156,9 +7123,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) &aMediaSize, &aMedia); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to unregister machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to unregister machine")); goto cleanup; } VBOX_RELEASE(machine); @@ -7178,9 +7144,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) resultCodeUnion resultCode; rc =3D gVBoxAPI.UIMedium.DeleteStorage(medium, &progress); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to delete medium, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to delete medium")); goto cleanup; } gVBoxAPI.UIProgress.WaitForCompletion(progress, -1); @@ -7235,17 +7200,15 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) settingsFilePathUtf16, &machine); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to open Machine")); goto cleanup; } =20 rc =3D gVBoxAPI.UIVirtualBox.RegisterMachine(data->vboxObj, machine); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to register Machine, rc=3D%08x"), - (unsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to register Machine")); goto cleanup; } =20 @@ -7522,8 +7485,8 @@ vboxConnectListAllDomains(virConnectPtr conn, =20 rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of domains, rc=3D%08x"), (un= signed)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of domains")); goto cleanup; } =20 @@ -7722,8 +7685,8 @@ vboxDomainHasManagedSaveImage(virDomainPtr dom, unsig= ned int flags) VBOX_IID_INITIALIZE(&iid); rc =3D gVBoxAPI.UArray.vboxArrayGet(&machines, data->vboxObj, ARRAY_GE= T_MACHINES); if (NS_FAILED(rc)) { - vboxReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not get list of machines, rc=3D%08x"), (u= nsigned)rc); + vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not get list of machines")); return ret; } =20 --=20 2.39.1