From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554365008342715.0889836489774; Thu, 4 Apr 2019 01:03:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4986A307D9D0; Thu, 4 Apr 2019 08:03:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B9BB646C0; Thu, 4 Apr 2019 08:03:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D26E441F3C; Thu, 4 Apr 2019 08:03:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x34828vP022158 for ; Thu, 4 Apr 2019 04:02:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id F367E6C763; Thu, 4 Apr 2019 08:02:07 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDB316C760 for ; Thu, 4 Apr 2019 08:02:07 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 812F1308339F for ; Thu, 4 Apr 2019 08:02:06 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347sfAf089279 for ; Thu, 4 Apr 2019 04:02:06 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rncwubws5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:01:56 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:47 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:44 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481gP252428808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:43 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C80D6AE053; Thu, 4 Apr 2019 08:01:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95622AE051; Thu, 4 Apr 2019 08:01:42 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:42 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:28 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0016-0000-0000-0000026B20B7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0017-0000-0000-000032C73187 Message-Id: <20190404080134.4897-2-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 04 Apr 2019 08:02:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 04 Apr 2019 08:02:06 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 1/7] qemu: monitor: move event data structure to domain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 04 Apr 2019 08:03:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In order to later process the event data, we need to be able to access it over the lifetime of the domain. So, as an initial step, let's move the event data structure and utility functions to qemu_domain.[ch] and rename them appropriately to make it accessible for other users. Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- src/qemu/qemu_domain.c | 53 +++++++++++++++++++++++++++++++++++- src/qemu/qemu_domain.h | 42 ++++++++++++++++++++++++++++ src/qemu/qemu_driver.c | 6 ++-- src/qemu/qemu_monitor.c | 53 +----------------------------------- src/qemu/qemu_monitor.h | 48 ++++---------------------------- src/qemu/qemu_monitor_json.c | 20 +++++++------- src/qemu/qemu_process.c | 2 +- 7 files changed, 114 insertions(+), 110 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fab237d0..cfd88aff 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13859,7 +13859,7 @@ qemuProcessEventFree(struct qemuProcessEvent *event) =20 switch (event->eventType) { case QEMU_PROCESS_EVENT_GUESTPANIC: - qemuMonitorEventPanicInfoFree(event->data); + qemuDomainStatePanicInfoFree(event->data); break; case QEMU_PROCESS_EVENT_RDMA_GID_STATUS_CHANGED: qemuMonitorEventRdmaGidStatusFree(event->data); @@ -13988,3 +13988,54 @@ qemuDomainNVRAMPathGenerate(virQEMUDriverConfigPtr= cfg, =20 return 0; } + + +char * +qemuDomainStatePanicInfoFormatMsg(qemuDomainStatePanicInfoPtr info) +{ + char *ret =3D NULL; + + switch (info->type) { + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV: + ignore_value(virAsprintf(&ret, + "hyper-v: arg1=3D'0x%llx', arg2=3D'0x%llx= ', " + "arg3=3D'0x%llx', arg4=3D'0x%llx', arg5= =3D'0x%llx'", + info->data.hyperv.arg1, info->data.hyperv= .arg2, + info->data.hyperv.arg3, info->data.hyperv= .arg4, + info->data.hyperv.arg5)); + break; + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390: + ignore_value(virAsprintf(&ret, "s390: core=3D'%d' psw-mask=3D'0x%0= 16llx' " + "psw-addr=3D'0x%016llx' reason=3D'%s'", + info->data.s390.core, + info->data.s390.psw_mask, + info->data.s390.psw_addr, + info->data.s390.reason)); + break; + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE: + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST: + break; + } + + return ret; +} + + +void +qemuDomainStatePanicInfoFree(qemuDomainStatePanicInfoPtr info) +{ + if (!info) + return; + + switch (info->type) { + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390: + VIR_FREE(info->data.s390.reason); + break; + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE: + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV: + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST: + break; + } + + VIR_FREE(info); +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 742632f6..df2a08f0 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -269,6 +269,48 @@ struct _qemuDomainSecretInfo { } s; }; =20 +typedef enum { + QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE =3D 0, + QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV, + QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390, + + QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST +} qemuDomainStatePanicInfoType; + +typedef struct _qemuDomainStatePanicInfoHyperv qemuDomainStatePanicInfoHyp= erv; +typedef qemuDomainStatePanicInfoHyperv *qemuDomainStatePanicInfoHypervPtr; +struct _qemuDomainStatePanicInfoHyperv { + /* Hyper-V specific guest panic information (HV crash MSRs) */ + unsigned long long arg1; + unsigned long long arg2; + unsigned long long arg3; + unsigned long long arg4; + unsigned long long arg5; +}; + +typedef struct _qemuDomainStatePanicInfoS390 qemuDomainStatePanicInfoS390; +typedef qemuDomainStatePanicInfoS390 *qemuDomainStatePanicInfoS390Ptr; +struct _qemuDomainStatePanicInfoS390 { + /* S390 specific guest panic information */ + int core; + unsigned long long psw_mask; + unsigned long long psw_addr; + char *reason; +}; + +typedef struct _qemuDomainStatePanicInfo qemuDomainStatePanicInfo; +typedef qemuDomainStatePanicInfo *qemuDomainStatePanicInfoPtr; +struct _qemuDomainStatePanicInfo { + qemuDomainStatePanicInfoType type; + union { + qemuDomainStatePanicInfoHyperv hyperv; + qemuDomainStatePanicInfoS390 s390; + } data; +}; + +char *qemuDomainStatePanicInfoFormatMsg(qemuDomainStatePanicInfoPtr info); +void qemuDomainStatePanicInfoFree(qemuDomainStatePanicInfoPtr info); + typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate; typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr; struct _qemuDomainObjPrivate { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 85a93f9e..b6c9f7b8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4163,9 +4163,9 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver, static void qemuProcessGuestPanicEventInfo(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuMonitorEventPanicInfoPtr info) + qemuDomainStatePanicInfoPtr info) { - char *msg =3D qemuMonitorGuestPanicEventInfoFormatMsg(info); + char *msg =3D qemuDomainStatePanicInfoFormatMsg(info); char *timestamp =3D virTimeStringNow(); =20 if (msg && timestamp) @@ -4180,7 +4180,7 @@ static void processGuestPanicEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, int action, - qemuMonitorEventPanicInfoPtr info) + qemuDomainStatePanicInfoPtr info) { qemuDomainObjPrivatePtr priv =3D vm->privateData; virObjectEventPtr event =3D NULL; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index babcbde8..38da68e4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1389,7 +1389,7 @@ qemuMonitorEmitResume(qemuMonitorPtr mon) =20 int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon, - qemuMonitorEventPanicInfoPtr info) + qemuDomainStatePanicInfoPtr info) { int ret =3D -1; VIR_DEBUG("mon=3D%p", mon); @@ -4280,57 +4280,6 @@ qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon) } =20 =20 -char * -qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info) -{ - char *ret =3D NULL; - - switch (info->type) { - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV: - ignore_value(virAsprintf(&ret, - "hyper-v: arg1=3D'0x%llx', arg2=3D'0x%llx= ', " - "arg3=3D'0x%llx', arg4=3D'0x%llx', arg5= =3D'0x%llx'", - info->data.hyperv.arg1, info->data.hyperv= .arg2, - info->data.hyperv.arg3, info->data.hyperv= .arg4, - info->data.hyperv.arg5)); - break; - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390: - ignore_value(virAsprintf(&ret, "s390: core=3D'%d' psw-mask=3D'0x%0= 16llx' " - "psw-addr=3D'0x%016llx' reason=3D'%s'", - info->data.s390.core, - info->data.s390.psw_mask, - info->data.s390.psw_addr, - info->data.s390.reason)); - break; - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE: - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST: - break; - } - - return ret; -} - - -void -qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info) -{ - if (!info) - return; - - switch (info->type) { - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390: - VIR_FREE(info->data.s390.reason); - break; - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE: - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV: - case QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST: - break; - } - - VIR_FREE(info); -} - - void qemuMonitorEventRdmaGidStatusFree(qemuMonitorRdmaGidStatusPtr info) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 086195ff..7b675835 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -39,6 +39,9 @@ typedef qemuMonitor *qemuMonitorPtr; typedef struct _qemuMonitorMessage qemuMonitorMessage; typedef qemuMonitorMessage *qemuMonitorMessagePtr; =20 +typedef struct _qemuDomainStatePanicInfo qemuDomainStatePanicInfo; +typedef qemuDomainStatePanicInfo *qemuDomainStatePanicInfoPtr; + typedef int (*qemuMonitorPasswordHandler)(qemuMonitorPtr mon, qemuMonitorMessagePtr msg, const char *data, @@ -67,45 +70,6 @@ struct _qemuMonitorMessage { void *passwordOpaque; }; =20 -typedef enum { - QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE =3D 0, - QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV, - QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390, - - QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST -} qemuMonitorEventPanicInfoType; - -typedef struct _qemuMonitorEventPanicInfoHyperv qemuMonitorEventPanicInfoH= yperv; -typedef qemuMonitorEventPanicInfoHyperv *qemuMonitorEventPanicInfoHypervPt= r; -struct _qemuMonitorEventPanicInfoHyperv { - /* Hyper-V specific guest panic information (HV crash MSRs) */ - unsigned long long arg1; - unsigned long long arg2; - unsigned long long arg3; - unsigned long long arg4; - unsigned long long arg5; -}; - -typedef struct _qemuMonitorEventPanicInfoS390 qemuMonitorEventPanicInfoS39= 0; -typedef qemuMonitorEventPanicInfoS390 *qemuMonitorEventPanicInfoS390Ptr; -struct _qemuMonitorEventPanicInfoS390 { - /* S390 specific guest panic information */ - int core; - unsigned long long psw_mask; - unsigned long long psw_addr; - char *reason; -}; - -typedef struct _qemuMonitorEventPanicInfo qemuMonitorEventPanicInfo; -typedef qemuMonitorEventPanicInfo *qemuMonitorEventPanicInfoPtr; -struct _qemuMonitorEventPanicInfo { - qemuMonitorEventPanicInfoType type; - union { - qemuMonitorEventPanicInfoHyperv hyperv; - qemuMonitorEventPanicInfoS390 s390; - } data; -}; - =20 typedef struct _qemuMonitorRdmaGidStatus qemuMonitorRdmaGidStatus; typedef qemuMonitorRdmaGidStatus *qemuMonitorRdmaGidStatusPtr; @@ -117,8 +81,6 @@ struct _qemuMonitorRdmaGidStatus { }; =20 =20 -char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr= info); -void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info); void qemuMonitorEventRdmaGidStatusFree(qemuMonitorRdmaGidStatusPtr info); =20 typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon, @@ -209,7 +171,7 @@ typedef int (*qemuMonitorDomainPMSuspendDiskCallback)(q= emuMonitorPtr mon, void *opaque); typedef int (*qemuMonitorDomainGuestPanicCallback)(qemuMonitorPtr mon, virDomainObjPtr vm, - qemuMonitorEventPanicIn= foPtr info, + qemuDomainStatePanicInf= oPtr info, void *opaque); typedef int (*qemuMonitorDomainDeviceDeletedCallback)(qemuMonitorPtr mon, virDomainObjPtr vm, @@ -431,7 +393,7 @@ int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon, unsigned long long actual); int qemuMonitorEmitPMSuspendDisk(qemuMonitorPtr mon); int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon, - qemuMonitorEventPanicInfoPtr info); + qemuDomainStatePanicInfoPtr info); int qemuMonitorEmitDeviceDeleted(qemuMonitorPtr mon, const char *devAlias); int qemuMonitorEmitNicRxFilterChanged(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8e6c3ccd..10b00767 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -629,15 +629,15 @@ static void qemuMonitorJSONHandleResume(qemuMonitorPt= r mon, virJSONValuePtr data } =20 =20 -static qemuMonitorEventPanicInfoPtr +static qemuDomainStatePanicInfoPtr qemuMonitorJSONGuestPanicExtractInfoHyperv(virJSONValuePtr data) { - qemuMonitorEventPanicInfoPtr ret; + qemuDomainStatePanicInfoPtr ret; =20 if (VIR_ALLOC(ret) < 0) return NULL; =20 - ret->type =3D QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV; + ret->type =3D QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV; =20 if (virJSONValueObjectGetNumberUlong(data, "arg1", &ret->data.hyperv.a= rg1) < 0 || virJSONValueObjectGetNumberUlong(data, "arg2", &ret->data.hyperv.a= rg2) < 0 || @@ -652,14 +652,14 @@ qemuMonitorJSONGuestPanicExtractInfoHyperv(virJSONVal= uePtr data) return ret; =20 error: - qemuMonitorEventPanicInfoFree(ret); + qemuDomainStatePanicInfoFree(ret); return NULL; } =20 -static qemuMonitorEventPanicInfoPtr +static qemuDomainStatePanicInfoPtr qemuMonitorJSONGuestPanicExtractInfoS390(virJSONValuePtr data) { - qemuMonitorEventPanicInfoPtr ret; + qemuDomainStatePanicInfoPtr ret; int core; unsigned long long psw_mask, psw_addr; const char *reason =3D NULL; @@ -667,7 +667,7 @@ qemuMonitorJSONGuestPanicExtractInfoS390(virJSONValuePt= r data) if (VIR_ALLOC(ret) < 0) return NULL; =20 - ret->type =3D QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390; + ret->type =3D QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390; =20 if (virJSONValueObjectGetNumberInt(data, "core", &core) < 0 || virJSONValueObjectGetNumberUlong(data, "psw-mask", &psw_mask) < 0 = || @@ -687,11 +687,11 @@ qemuMonitorJSONGuestPanicExtractInfoS390(virJSONValue= Ptr data) return ret; =20 error: - qemuMonitorEventPanicInfoFree(ret); + qemuDomainStatePanicInfoFree(ret); return NULL; } =20 -static qemuMonitorEventPanicInfoPtr +static qemuDomainStatePanicInfoPtr qemuMonitorJSONGuestPanicExtractInfo(virJSONValuePtr data) { const char *type =3D virJSONValueObjectGetString(data, "type"); @@ -712,7 +712,7 @@ qemuMonitorJSONHandleGuestPanic(qemuMonitorPtr mon, virJSONValuePtr data) { virJSONValuePtr infojson =3D virJSONValueObjectGetObject(data, "info"); - qemuMonitorEventPanicInfoPtr info =3D NULL; + qemuDomainStatePanicInfoPtr info =3D NULL; =20 if (infojson) info =3D qemuMonitorJSONGuestPanicExtractInfo(infojson); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index dc7317b7..aec4af8f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1259,7 +1259,7 @@ qemuProcessHandlePMSuspendDisk(qemuMonitorPtr mon ATT= RIBUTE_UNUSED, static int qemuProcessHandleGuestPanic(qemuMonitorPtr mon ATTRIBUTE_UNUSED, virDomainObjPtr vm, - qemuMonitorEventPanicInfoPtr info, + qemuDomainStatePanicInfoPtr info, void *opaque) { virQEMUDriverPtr driver =3D opaque; --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554364928397892.425417064442; Thu, 4 Apr 2019 01:02:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B99D307D986; Thu, 4 Apr 2019 08:02:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47D616B2DF; Thu, 4 Apr 2019 08:02:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7508741F3D; Thu, 4 Apr 2019 08:02:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x348216p022029 for ; Thu, 4 Apr 2019 04:02:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3EF4608A5; Thu, 4 Apr 2019 08:02:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BAF8B665C0 for ; Thu, 4 Apr 2019 08:01:59 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E56487645 for ; Thu, 4 Apr 2019 08:01:58 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347sfoN077555 for ; Thu, 4 Apr 2019 04:01:57 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rnc9qx42p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:01:54 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:46 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:45 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481iNe58196194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:44 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 048C4AE055; Thu, 4 Apr 2019 08:01:44 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D411DAE04D; Thu, 4 Apr 2019 08:01:43 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:43 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:29 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0028-0000-0000-0000035D21F0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0029-0000-0000-0000241C2EC7 Message-Id: <20190404080134.4897-3-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 04 Apr 2019 08:01:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 04 Apr 2019 08:01:58 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 2/7] qemu: domain: store and update panic info X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 04 Apr 2019 08:02:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Let's store additional state information in the hypervisor-specific private data to virDomainObj. For now, just consider panic state in QEMU domains for which additional information is available from the guest crash event handler. Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- src/qemu/qemu_domain.c | 27 +++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 5 +++++ src/qemu/qemu_driver.c | 2 ++ 3 files changed, 34 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index cfd88aff..6949628d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2052,6 +2052,9 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr= priv) virBitmapFree(priv->migrationCaps); priv->migrationCaps =3D NULL; =20 + qemuDomainStatePanicInfoFree(priv->panicInfo); + priv->panicInfo =3D NULL; + qemuDomainObjResetJob(priv); qemuDomainObjResetAsyncJob(priv); } @@ -14021,6 +14024,30 @@ qemuDomainStatePanicInfoFormatMsg(qemuDomainStateP= anicInfoPtr info) } =20 =20 +void +qemuDomainStatePanicInfoSet(virDomainObjPtr vm, + qemuDomainStatePanicInfoPtr info) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + + if (!priv->panicInfo && VIR_ALLOC(priv->panicInfo) < 0) + return; + + memcpy(priv->panicInfo, info, sizeof(*info)); + + switch (info->type) { + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390: + ignore_value(VIR_STRDUP(priv->panicInfo->data.s390.reason, + info->data.s390.reason)); + break; + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE: + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV: + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST: + break; + } +} + + void qemuDomainStatePanicInfoFree(qemuDomainStatePanicInfoPtr info) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index df2a08f0..31de8ee1 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -309,6 +309,8 @@ struct _qemuDomainStatePanicInfo { }; =20 char *qemuDomainStatePanicInfoFormatMsg(qemuDomainStatePanicInfoPtr info); +void qemuDomainStatePanicInfoSet(virDomainObjPtr vm, + qemuDomainStatePanicInfoPtr info); void qemuDomainStatePanicInfoFree(qemuDomainStatePanicInfoPtr info); =20 typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate; @@ -418,6 +420,9 @@ struct _qemuDomainObjPrivate { =20 /* true if global -mem-prealloc appears on cmd line */ bool memPrealloc; + + /* store extra information for panicked domain state */ + qemuDomainStatePanicInfoPtr panicInfo; }; =20 # define QEMU_DOMAIN_PRIVATE(vm) \ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b6c9f7b8..b9d1aaa1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4171,6 +4171,8 @@ qemuProcessGuestPanicEventInfo(virQEMUDriverPtr drive= r, if (msg && timestamp) qemuDomainLogAppendMessage(driver, vm, "%s: panic %s\n", timestamp= , msg); =20 + qemuDomainStatePanicInfoSet(vm, info); + VIR_FREE(timestamp); VIR_FREE(msg); } --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554364928583600.3476020391921; Thu, 4 Apr 2019 01:02:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0AFF3025495; Thu, 4 Apr 2019 08:02:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 482E51001E7B; Thu, 4 Apr 2019 08:02:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6B793181AC44; Thu, 4 Apr 2019 08:02:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x34821iZ022011 for ; Thu, 4 Apr 2019 04:02:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5975919724; Thu, 4 Apr 2019 08:02:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51D3019C78 for ; Thu, 4 Apr 2019 08:01:58 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4FD5356CF for ; Thu, 4 Apr 2019 08:01:57 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347sgsa089312 for ; Thu, 4 Apr 2019 04:01:57 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rncwubwtp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:01:56 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:47 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:46 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481jep52887774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:45 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4007FAE045; Thu, 4 Apr 2019 08:01:45 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10CA0AE053; Thu, 4 Apr 2019 08:01:45 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:45 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:30 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0028-0000-0000-0000035D21F1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0029-0000-0000-0000241C2EC8 Message-Id: <20190404080134.4897-4-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 04 Apr 2019 08:01:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 04 Apr 2019 08:01:57 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 3/7] lib: introduce virDomainGetStateParams function X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 04 Apr 2019 08:02:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This API function extends the virDomainGetState function by returning additional state information as a dictionary of typed parameters. Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- include/libvirt/libvirt-domain.h | 76 ++++++++++++++++++++++++++++++++ src/driver-hypervisor.h | 9 ++++ src/libvirt-domain.c | 62 ++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ 4 files changed, 152 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 7d36820b..b0118e4a 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1292,6 +1292,82 @@ int virDomainGetState (vir= DomainPtr domain, int *reason, unsigned int flags); =20 +typedef enum { + VIR_DOMAIN_STATE_PARAM_TYPE_NONE, + VIR_DOMAIN_STATE_PARAM_TYPE_QEMU_HYPERV, + VIR_DOMAIN_STATE_PARAM_TYPE_QEMU_S390, + + VIR_DOMAIN_STATE_PARAM_TYPE_LAST +} virDomainStateParamType; + +/** + * VIR_DOMAIN_STATE_PARAM_TYPE: + * specifies the type of additional state information available + */ +# define VIR_DOMAIN_STATE_PARAM_TYPE "info_type" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG1: + * Hyper-V-specific panic state information: HV crash MSR1 + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG1 "crashed.pani= cked.hyperv.arg1" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG2: + * Hyper-V-specific panic state information: HV crash MSR2 + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG2 "crashed.pani= cked.hyperv.arg2" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG3: + * Hyper-V-specific panic state information: HV crash MSR3 + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG3 "crashed.pani= cked.hyperv.arg3" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG4: + * Hyper-V-specific panic state information: HV crash MSR4 + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG4 "crashed.pani= cked.hyperv.arg4" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG5: + * Hyper-V-specific panic state information: HV crash MSR5 + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_HYPERV_ARG5 "crashed.pani= cked.hyperv.arg5" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_CORE: + * S390-specific panic state information: panicked core + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_CORE "crashed.panick= ed.s390.core" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_PSW_MASK: + * S390-specific panic state information: PSW mask + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_PSW_MASK "crashed.pa= nicked.s390.psw_mask" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_PSW_ADDR: + * S390-specific panic state information: PSW address + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_PSW_ADDR "crashed.pa= nicked.s390.psw_addr" + +/** + * VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_REASON: + * S390-specific panic state information: human-readable reason + */ +# define VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S390_REASON "crashed.pani= cked.s390.reason" + +int virDomainGetStateParams(virDomainPtr domain, + int *state, + int *reason, + virTypedParameterPtr *para= ms, + int *nparams, + unsigned int flags); + + /** * VIR_DOMAIN_CPU_STATS_CPUTIME: * cpu usage (sum of both vcpu and hypervisor usage) in nanoseconds, diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 5315e33d..fd6ed690 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -220,6 +220,14 @@ typedef int int *reason, unsigned int flags); =20 +typedef int +(*virDrvDomainGetStateParams)(virDomainPtr domain, + int *state, + int *reason, + virTypedParameterPtr *params, + int *nparams, + unsigned int flags); + typedef int (*virDrvDomainGetControlInfo)(virDomainPtr domain, virDomainControlInfoPtr info, @@ -1390,6 +1398,7 @@ struct _virHypervisorDriver { virDrvDomainGetBlkioParameters domainGetBlkioParameters; virDrvDomainGetInfo domainGetInfo; virDrvDomainGetState domainGetState; + virDrvDomainGetStateParams domainGetStateParams; virDrvDomainGetControlInfo domainGetControlInfo; virDrvDomainSave domainSave; virDrvDomainSaveFlags domainSaveFlags; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index be5b1f67..4fabae82 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2502,6 +2502,68 @@ virDomainGetState(virDomainPtr domain, } =20 =20 +/** + * virDomainGetStateParams: + * @domain: a domain object + * @state: returned state of the domain (one of virDomainState) + * @reason: returned reason which led to @state (one of virDomain*Reason) + * @params: where to store additional state information, must be freed by + * the caller + * @nparams: number of items in @params + * @flags: bitwise-OR of virDomainGetStateFlags, + * not currently used yet, callers should always pass 0 + * + * Extract domain state. Each state is accompanied by a reason (if known) + * and optional detailed information. + * + * Possible fields returned in @params are defined by VIR_DOMAIN_STATE_PAR= AMS_* + * macros and new fields will likely be introduced in the future so callers + * may receive fields that they do not understand in case they talk to a n= ewer + * server. The caller is responsible to free allocated memory returned in + * @params by calling virTypedParamsFree. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +virDomainGetStateParams(virDomainPtr domain, + int *state, + int *reason, + virTypedParameterPtr *params, + int *nparams, + unsigned int flags) +{ + virConnectPtr conn =3D domain->conn; + + VIR_DOMAIN_DEBUG(domain, "params=3D%p, nparams=3D%p, flags=3D0x%x", + params, nparams, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + if (params) + virCheckNonNullArgGoto(nparams, error); + + if (VIR_DRV_SUPPORTS_FEATURE(conn->driver, conn, + VIR_DRV_FEATURE_TYPED_PARAM_STRING)) + flags |=3D VIR_TYPED_PARAM_STRING_OKAY; + + if (conn->driver->domainGetStateParams) { + int ret; + ret =3D conn->driver->domainGetStateParams(domain, state, reason, + params, nparams, flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(domain->conn); + return -1; +} + + /** * virDomainGetControlInfo: * @domain: a domain object diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index dbce3336..26744e27 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -819,4 +819,9 @@ LIBVIRT_5.2.0 { virConnectGetStoragePoolCapabilities; } LIBVIRT_4.10.0; =20 +LIBVIRT_5.3.0 { + global: + virDomainGetStateParams; +} LIBVIRT_5.2.0; + # .... define new API here using predicted next version number .... --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554365175264600.0470344221628; Thu, 4 Apr 2019 01:06:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 14FE058E43; Thu, 4 Apr 2019 08:06:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E097019C68; Thu, 4 Apr 2019 08:06:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9CADF181AC43; Thu, 4 Apr 2019 08:06:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x34824ZM022076 for ; Thu, 4 Apr 2019 04:02:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id D0E106C75C; Thu, 4 Apr 2019 08:02:04 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9C256C758 for ; Thu, 4 Apr 2019 08:02:02 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 288FA4E92A for ; Thu, 4 Apr 2019 08:02:01 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347se08077445 for ; Thu, 4 Apr 2019 04:02:00 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rnc9qx4ba-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:01:59 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:50 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:48 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481kl255509184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:46 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7AF4AAE058; Thu, 4 Apr 2019 08:01:46 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B90AAE055; Thu, 4 Apr 2019 08:01:46 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:46 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:31 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0012-0000-0000-0000030B2178 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0013-0000-0000-000021432F18 Message-Id: <20190404080134.4897-5-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 04 Apr 2019 08:02:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 04 Apr 2019 08:02:01 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 4/7] remote: implement remoteDomainGetStateParams X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 04 Apr 2019 08:06:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Implement the API function virDomainGetStateParams for the remote driver and wire up the remote protocol. Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- src/remote/remote_daemon_dispatch.c | 50 +++++++++++++++++++++++++++++ src/remote/remote_driver.c | 48 +++++++++++++++++++++++++++ src/remote/remote_protocol.x | 22 ++++++++++++- src/remote_protocol-structs | 13 ++++++++ 4 files changed, 132 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index df282590..e1e48559 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -7392,3 +7392,53 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPt= r errors, } return -1; } + +static int +remoteDispatchDomainGetStateParams(virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_state_params_args *ar= gs, + remote_domain_get_state_params_ret *ret) +{ + virDomainPtr dom =3D NULL; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int rv =3D -1; + struct daemonClientPrivate *priv =3D + virNetServerClientGetPrivateData(client); + + if (!priv->conn) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); + goto cleanup; + } + + if (!(dom =3D get_nonnull_domain(priv->conn, args->dom))) + goto cleanup; + + if (virDomainGetStateParams(dom, &ret->state, &ret->reason, ¶ms, + &nparams, args->flags) < 0) + goto cleanup; + + if (nparams > REMOTE_DOMAIN_STATE_PARAMS_MAX) { + virReportError(VIR_ERR_RPC, + _("Too many state information entries '%d' for limi= t '%d'"), + nparams, REMOTE_DOMAIN_STATE_PARAMS_MAX); + goto cleanup; + } + + if (virTypedParamsSerialize(params, nparams, + (virTypedParameterRemotePtr *) &ret->param= s.params_val, + &ret->params.params_len, + VIR_TYPED_PARAM_STRING_OKAY) < 0) + goto cleanup; + + rv =3D 0; + + cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + virTypedParamsFree(params, nparams); + virObjectUnref(dom); + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 5c4dd412..6907e457 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8131,6 +8131,53 @@ remoteStorageVolGetInfoFlags(virStorageVolPtr vol, return rv; } =20 +static int +remoteDomainGetStateParams(virDomainPtr domain, + int *state, + int *reason, + virTypedParameterPtr *params, + int *nparams, + unsigned int flags) +{ + int rv =3D -1; + remote_domain_get_state_params_args args; + remote_domain_get_state_params_ret ret; + struct private_data *priv =3D domain->conn->privateData; + + remoteDriverLock(priv); + + make_nonnull_domain(&args.dom, domain); + args.flags =3D flags; + + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_STATE_PARAMS, + (xdrproc_t) xdr_remote_domain_get_state_params_args, (char *)= &args, + (xdrproc_t) xdr_remote_domain_get_state_params_ret, (char *) = &ret) =3D=3D -1) + goto done; + + if (state) + *state =3D ret.state; + if (reason) + *reason =3D ret.reason; + + if (params && + virTypedParamsDeserialize((virTypedParameterRemotePtr) ret.params.= params_val, + ret.params.params_len, + REMOTE_DOMAIN_STATE_PARAMS_MAX, + params, nparams) < 0) { + goto cleanup; + } + + rv =3D 0; + + cleanup: + xdr_free((xdrproc_t) xdr_remote_domain_get_state_params_ret, + (char *) &ret); + done: + remoteDriverUnlock(priv); + return rv; +} + =20 /* get_nonnull_domain and get_nonnull_network turn an on-wire * (name, uuid) pair into virDomainPtr or virNetworkPtr object. @@ -8326,6 +8373,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainSetPerfEvents =3D remoteDomainSetPerfEvents, /* 1.3.3 */ .domainGetInfo =3D remoteDomainGetInfo, /* 0.3.0 */ .domainGetState =3D remoteDomainGetState, /* 0.9.2 */ + .domainGetStateParams =3D remoteDomainGetStateParams, /* 5.3.0 */ .domainGetControlInfo =3D remoteDomainGetControlInfo, /* 0.9.3 */ .domainSave =3D remoteDomainSave, /* 0.3.0 */ .domainSaveFlags =3D remoteDomainSaveFlags, /* 0.9.4 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 74be4b37..6db1ccc1 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -263,6 +263,9 @@ const REMOTE_NODE_SEV_INFO_MAX =3D 64; /* Upper limit on number of launch security information entries */ const REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX =3D 64; =20 +/* Upper limit on number of state information entries */ +const REMOTE_DOMAIN_STATE_PARAMS_MAX =3D 16; + /* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */ typedef opaque remote_uuid[VIR_UUID_BUFLEN]; =20 @@ -2789,6 +2792,17 @@ struct remote_domain_get_state_ret { int reason; }; =20 +struct remote_domain_get_state_params_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_get_state_params_ret { + int state; + int reason; + remote_typed_param params; +}; + struct remote_domain_migrate_begin3_args { remote_nonnull_domain dom; remote_string xmlin; @@ -6342,5 +6356,11 @@ enum remote_procedure { * @generate: both * @acl: connect:read */ - REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES =3D 403 + REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES =3D 403, + + /** + * @generate: none + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_GET_STATE_PARAMS =3D 404 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 768189c5..edecc4e4 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2162,6 +2162,18 @@ struct remote_domain_get_state_ret { int state; int reason; }; +struct remote_domain_get_state_params_args { + remote_nonnull_domain dom; + u_int flags; +}; +struct remote_domain_get_state_params_ret { + int state; + int reason; + struct { + u_int params_len; + remote_typed_param * params_val; + } params; +}; struct remote_domain_migrate_begin3_args { remote_nonnull_domain dom; remote_string xmlin; @@ -3385,4 +3397,5 @@ enum remote_procedure { REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS =3D 401, REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS =3D 402, REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES =3D 403, + REMOTE_PROC_DOMAIN_GET_STATE_PARAMS =3D 404, }; --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15543651056191.332275513168156; Thu, 4 Apr 2019 01:05:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1979F66982; Thu, 4 Apr 2019 08:05:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D28F31001E65; Thu, 4 Apr 2019 08:05:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5921C181AC43; Thu, 4 Apr 2019 08:05:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x34831IP022255 for ; Thu, 4 Apr 2019 04:03:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1941619C71; Thu, 4 Apr 2019 08:03:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13D1C19C6A for ; Thu, 4 Apr 2019 08:02:58 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FB79307E04D for ; Thu, 4 Apr 2019 08:02:58 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347t48i094139 for ; Thu, 4 Apr 2019 04:02:57 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rncjt4se4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:02:55 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:52 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:49 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481lXj50987198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:47 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC70AAE057; Thu, 4 Apr 2019 08:01:47 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 879DFAE045; Thu, 4 Apr 2019 08:01:47 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:47 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:32 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0028-0000-0000-0000035D21F3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0029-0000-0000-0000241C2EC9 Message-Id: <20190404080134.4897-6-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=914 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 04 Apr 2019 08:02:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 04 Apr 2019 08:02:58 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 5/7] qemu: implement qemuDomainGetStateParams X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 04 Apr 2019 08:05:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Implement the API function virDomainGetStateParams for the QEMU hypervisor driver. Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- src/qemu/qemu_driver.c | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b9d1aaa1..864579da 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2641,6 +2641,123 @@ qemuDomainGetState(virDomainPtr dom, return ret; } =20 +static int +qemuDomainGetStateParams(virDomainPtr dom, + int *state, + int *reason, + virTypedParameterPtr *params, + int *nparams, + unsigned int flags) +{ + int ret =3D -1; + virDomainObjPtr vm; + qemuDomainStatePanicInfoPtr info =3D NULL; + virTypedParameterPtr par =3D NULL; + int npar =3D 0, maxparams =3D 0; + + virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); + + if (!(vm =3D qemuDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainGetStateParamsEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + *state =3D virDomainObjGetState(vm, reason); + + info =3D QEMU_DOMAIN_PRIVATE(vm)->panicInfo; + + if (!info) { + if (virTypedParamsAddInt(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_TYPE, + VIR_DOMAIN_STATE_PARAM_TYPE_NONE) < 0) { + goto cleanup; + } + } else if (*state =3D=3D VIR_DOMAIN_CRASHED && + *reason =3D=3D VIR_DOMAIN_CRASHED_PANICKED) { + switch (info->type) { + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV: + if (virTypedParamsAddInt(&par, &npar, + &maxparams, + VIR_DOMAIN_STATE_PARAM_TYPE, + VIR_DOMAIN_STATE_PARAM_TYPE_QEMU_HYPE= RV) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_HYPERV_ARG1, + info->data.hyperv.arg1) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_HYPERV_ARG2, + info->data.hyperv.arg2) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_HYPERV_ARG3, + info->data.hyperv.arg3) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_HYPERV_ARG4, + info->data.hyperv.arg4) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_HYPERV_ARG5, + info->data.hyperv.arg5) < 0) { + goto cleanup; + } + break; + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390: + if (virTypedParamsAddInt(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_TYPE, + VIR_DOMAIN_STATE_PARAM_TYPE_QEMU_S390= ) < 0) { + goto cleanup; + } + if (virTypedParamsAddInt(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICK= ED_S390_CORE, + info->data.s390.core) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_S390_PSW_MASK, + info->data.s390.psw_mask) < 0) { + goto cleanup; + } + if (virTypedParamsAddULLong(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_S390_PSW_ADDR, + info->data.s390.psw_addr) < 0) { + goto cleanup; + } + if (virTypedParamsAddString(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PAN= ICKED_S390_REASON, + info->data.s390.reason) < 0) { + goto cleanup; + } + break; + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE: + case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST: + if (virTypedParamsAddInt(&par, &npar, &maxparams, + VIR_DOMAIN_STATE_PARAM_TYPE, + VIR_DOMAIN_STATE_PARAM_TYPE_NONE) < 0= ) { + goto cleanup; + } + break; + } + } + + VIR_STEAL_PTR(*params, par); + *nparams =3D npar; + npar =3D 0; + ret =3D 0; + + cleanup: + virTypedParamsFree(par, npar); + virDomainObjEndAPI(&vm); + return ret; +} + static int qemuDomainGetControlInfo(virDomainPtr dom, virDomainControlInfoPtr info, @@ -22337,6 +22454,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainGetBlkioParameters =3D qemuDomainGetBlkioParameters, /* 0.9.0 */ .domainGetInfo =3D qemuDomainGetInfo, /* 0.2.0 */ .domainGetState =3D qemuDomainGetState, /* 0.9.2 */ + .domainGetStateParams =3D qemuDomainGetStateParams, /* 5.3.0 */ .domainGetControlInfo =3D qemuDomainGetControlInfo, /* 0.9.3 */ .domainSave =3D qemuDomainSave, /* 0.2.0 */ .domainSaveFlags =3D qemuDomainSaveFlags, /* 0.9.4 */ --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554365184153862.1827146051563; Thu, 4 Apr 2019 01:06:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA5B58765E; Thu, 4 Apr 2019 08:06:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A815884DAE; Thu, 4 Apr 2019 08:06:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6192D41F3E; Thu, 4 Apr 2019 08:06:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3483ksJ022289 for ; Thu, 4 Apr 2019 04:03:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id D826C19C71; Thu, 4 Apr 2019 08:03:46 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2E9919C69 for ; Thu, 4 Apr 2019 08:03:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5994307E054 for ; Thu, 4 Apr 2019 08:03:43 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347sfL5090226 for ; Thu, 4 Apr 2019 04:03:43 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rnc9s627x-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:03:42 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:52 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:50 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481nwt46989382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:49 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D3C2AAE058; Thu, 4 Apr 2019 08:01:48 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B85EAAE057; Thu, 4 Apr 2019 08:01:48 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:48 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:33 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0012-0000-0000-0000030B2179 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0013-0000-0000-000021432F19 Message-Id: <20190404080134.4897-7-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 04 Apr 2019 08:03:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 04 Apr 2019 08:03:44 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 6/7] virsh: domstate: report detailed state if available X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 04 Apr 2019 08:06:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add a new parameter to virsh domstate, --info, to report additional information for the domain state, e.g. for a QEMU guest running a S390 domain: virsh # domstate --info guest-1 crashed (panicked) s390.core =3D 0 s390.psw-mask =3D 0x0002000180000000 s390.psw-addr =3D 0x000000000010f146 s390.reason =3D disabled-wait When the --info parameter is specified and the new API virDomainGetStateParams is not available for the server or not supported by the hypervisor driver an error is reported. The --info parameter implies the --reason parameter and if additional information is not available, the output is identical. Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- tools/virsh-domain-monitor.c | 94 +++++++++++++++++++++++++++++++++--- tools/virsh.pod | 5 +- 2 files changed, 90 insertions(+), 9 deletions(-) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index ad739a9d..a26f7371 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1391,35 +1391,115 @@ static const vshCmdOptDef opts_domstate[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("also print reason for the state") }, + {.name =3D "info", + .type =3D VSH_OT_BOOL, + .help =3D N_("also print reason and information for the state") + }, {.name =3D NULL} }; =20 +static void +vshStateInfoMsgPrint(vshControl *ctl, + virTypedParameterPtr params, + int nparams) +{ + int type; + + if (virTypedParamsGetInt(params, nparams, + VIR_DOMAIN_STATE_PARAM_TYPE, &type) < 0) { + return; + } + + switch (type) { + case VIR_DOMAIN_STATE_PARAM_TYPE_QEMU_HYPERV: { + unsigned long long arg1, arg2, arg3, arg4, arg5; + + if (virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_HYPERV_ARG1, &arg1) < 0 || + virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_HYPERV_ARG2, &arg2) < 0 || + virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_HYPERV_ARG3, &arg3) < 0 || + virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_HYPERV_ARG4, &arg4) < 0 || + virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_HYPERV_ARG5, &arg5) < 0) { + return; + } + + vshPrint(ctl, _("hyperv.arg1 =3D 0x%llx\n"), arg1); + vshPrint(ctl, _("hyperv.arg2 =3D 0x%llx\n"), arg2); + vshPrint(ctl, _("hyperv.arg3 =3D 0x%llx\n"), arg3); + vshPrint(ctl, _("hyperv.arg4 =3D 0x%llx\n"), arg4); + vshPrint(ctl, _("hyperv.arg5 =3D 0x%llx\n"), arg5); + + break; + } + case VIR_DOMAIN_STATE_PARAM_TYPE_QEMU_S390: { + int core; + unsigned long long psw_mask; + unsigned long long psw_addr; + const char *reason; + + if (virTypedParamsGetInt(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKED_S= 390_CORE, &core) < 0 || + virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_S390_PSW_MASK, &psw_mask) < 0 || + virTypedParamsGetULLong(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_S390_PSW_ADDR, &psw_addr) < 0 || + virTypedParamsGetString(params, nparams, + VIR_DOMAIN_STATE_PARAM_CRASHED_PANICKE= D_S390_REASON, &reason) < 0) { + return; + } + + vshPrint(ctl, _("s390.core =3D %d\n"), core); + vshPrint(ctl, _("s390.psw-mask =3D 0x%016llx\n"), psw_mask); + vshPrint(ctl, _("s390.psw-addr =3D 0x%016llx\n"), psw_addr); + vshPrint(ctl, _("s390.reason =3D %s\n"), reason); + + break; + } + case VIR_DOMAIN_STATE_PARAM_TYPE_NONE: + case VIR_DOMAIN_STATE_PARAM_TYPE_LAST: + break; + } +} + static bool cmdDomstate(vshControl *ctl, const vshCmd *cmd) { virDomainPtr dom; bool ret =3D true; bool showReason =3D vshCommandOptBool(cmd, "reason"); + bool showInfo =3D vshCommandOptBool(cmd, "info"); + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; int state, reason; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; =20 - if ((state =3D virshDomainState(ctl, dom, &reason)) < 0) { + if ((showInfo && + virDomainGetStateParams(dom, &state, &reason, ¶ms, &nparams, = 0) < 0) || + (!showInfo && (state =3D virshDomainState(ctl, dom, &reason)) < 0)= ) { + vshError(ctl, _("Unable to get state of domain %s"), virDomainGetN= ame(dom)); ret =3D false; goto cleanup; } =20 - if (showReason) { - vshPrint(ctl, "%s (%s)\n", - virshDomainStateToString(state), - virshDomainStateReasonToString(state, reason)); + vshPrint(ctl, "%s", virshDomainStateToString(state)); + + if (showReason || showInfo) { + vshPrint(ctl, " (%s)\n", virshDomainStateReasonToString(state, rea= son)); + + if (showInfo) + vshStateInfoMsgPrint(ctl, params, nparams); } else { - vshPrint(ctl, "%s\n", - virshDomainStateToString(state)); + vshPrint(ctl, "\n"); } =20 cleanup: + virTypedParamsFree(params, nparams); virshDomainFree(dom); return ret; } diff --git a/tools/virsh.pod b/tools/virsh.pod index b7ceba8d..d7a06dc9 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1572,10 +1572,11 @@ specified in the second argument. =20 B: Domain must be inactive and without snapshots. =20 -=3Ditem B I [I<--reason>] +=3Ditem B I [I<--reason>] [I<--info>] =20 Returns state about a domain. I<--reason> tells virsh to also print -reason for the state. +reason for the state. I<--info> prints additional state information if +available, I<--info> implies I<--reason>. =20 =3Ditem B I =20 --=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 21:10:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554365179471315.55210112970474; Thu, 4 Apr 2019 01:06:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 506FE8666F; Thu, 4 Apr 2019 08:06:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2595617CED; Thu, 4 Apr 2019 08:06:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DAA14181AC46; Thu, 4 Apr 2019 08:06:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x34825d2022082 for ; Thu, 4 Apr 2019 04:02:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id C42916C750; Thu, 4 Apr 2019 08:02:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE3DB60C4E for ; Thu, 4 Apr 2019 08:02:05 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D83E258599 for ; Thu, 4 Apr 2019 08:02:04 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x347sd54077338 for ; Thu, 4 Apr 2019 04:02:04 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rnc9qx4gx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 04:02:03 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 Apr 2019 09:01:52 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 4 Apr 2019 09:01:51 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3481ofe44433410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 08:01:50 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25E42AE055; Thu, 4 Apr 2019 08:01:50 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA13BAE045; Thu, 4 Apr 2019 08:01:49 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 4 Apr 2019 08:01:49 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Thu, 4 Apr 2019 10:01:34 +0200 In-Reply-To: <20190404080134.4897-1-bwalk@linux.ibm.com> References: <20190404080134.4897-1-bwalk@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19040408-0020-0000-0000-0000032C20FE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040408-0021-0000-0000-0000217E306C Message-Id: <20190404080134.4897-8-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-04_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040057 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 04 Apr 2019 08:02:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 04 Apr 2019 08:02:05 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.662 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Bjoern Walk Subject: [libvirt] [PATCH v3 7/7] news: add entry for virDomainGetStateParams X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 04 Apr 2019 08:06:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Reviewed-by: Boris Fiuczynski Signed-off-by: Bjoern Walk --- docs/news.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 0729e0ba..6a7394c7 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,17 @@
+ + + Ability to set/get additional state information + + + Add the ability to set/get additional state information, e.g. gu= est + CPU state for crashed guests. Introduce a new extensible API + function, virDomainGetStateParams, and add new argument --info to + the virsh domstate command. + +
--=20 2.19.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list