The event is emitted on ACPI OSPM Status Indication events.
ACPI standard documentation describes the method as:
This object is an optional control method that is invoked by OSPM to
indicate processing status to the platform. During device ejection,
device hot add, or other event processing, OSPM may need to perform
specific handshaking with the platform. OSPM may also need to indicate
to the platform its inability to complete a requested operation; for
example, when a user presses an ejection button for a device that is
currently in use or is otherwise currently incapable of being ejected.
In this case, the processing of the ACPI Eject Request notification by
OSPM fails. OSPM may indicate this failure to the platform through the
invocation of the _OST control method. As a result of the status
notification indicating ejection failure, the platform may take certain
action including reissuing the notification or perhaps turning on an
appropriate indicator light to signal the failure to the user.
---
src/qemu/qemu_monitor.c | 19 +++++++++++++++++++
src/qemu/qemu_monitor.h | 18 ++++++++++++++++++
src/qemu/qemu_monitor_json.c | 39 +++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 10a6713..b7e4fa9 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1549,6 +1549,25 @@ qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
int
+qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
+ const char *alias,
+ const char *slotType,
+ const char *slot,
+ unsigned int source,
+ unsigned int status)
+{
+ int ret = -1;
+ VIR_DEBUG("mon=%p, alias='%s', slotType='%s', slot='%s',
source='%u' status=%u",
+ mon, NULLSTR(alias), slotType, slot, source, status);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainAcpiOstInfo, mon->vm,
+ alias, slotType, slot, source, status);
+
+ return ret;
+}
+
+
+int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
QEMU_CHECK_MONITOR(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 7906361..bb74917 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -196,6 +196,16 @@ typedef int (*qemuMonitorDomainMigrationPassCallback)(qemuMonitorPtr
mon,
int pass,
void *opaque);
+typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ const char *alias,
+ const char *slotType,
+ const char *slot,
+ unsigned int source,
+ unsigned int status,
+ void *opaque);
+
+
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
@@ -226,6 +236,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainSpiceMigratedCallback domainSpiceMigrated;
qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
qemuMonitorDomainMigrationPassCallback domainMigrationPass;
+ qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -338,6 +349,13 @@ int qemuMonitorEmitMigrationStatus(qemuMonitorPtr mon,
int qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
int pass);
+int qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
+ const char *alias,
+ const char *slotType,
+ const char *slot,
+ unsigned int source,
+ unsigned int status);
+
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e140d0e..78af83e 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -88,6 +88,7 @@ static void qemuMonitorJSONHandleSerialChange(qemuMonitorPtr mon,
virJSONValuePt
static void qemuMonitorJSONHandleSpiceMigrated(qemuMonitorPtr mon, virJSONValuePtr
data);
static void qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon, virJSONValuePtr
data);
static void qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon, virJSONValuePtr
data);
+static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr data);
typedef struct {
const char *type;
@@ -95,6 +96,7 @@ typedef struct {
} qemuEventHandler;
static qemuEventHandler eventHandlers[] = {
+ { "ACPI_DEVICE_OST", qemuMonitorJSONHandleAcpiOstInfo, },
{ "BALLOON_CHANGE", qemuMonitorJSONHandleBalloonChange, },
{ "BLOCK_IO_ERROR", qemuMonitorJSONHandleIOError, },
{ "BLOCK_JOB_CANCELLED", qemuMonitorJSONHandleBlockJobCanceled, },
@@ -1026,6 +1028,43 @@ qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon,
}
+static void
+qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr data)
+{
+ virJSONValuePtr info;
+ const char *alias;
+ const char *slotType;
+ const char *slot;
+ unsigned int source;
+ unsigned int status;
+
+ if (!(info = virJSONValueObjectGetObject(data, "info")))
+ goto error;
+
+ /* optional */
+ alias = virJSONValueObjectGetString(info, "device");
+
+ if (!(slotType = virJSONValueObjectGetString(info, "slot-type")))
+ goto error;
+
+ if (!(slot = virJSONValueObjectGetString(info, "slot")))
+ goto error;
+
+ if (virJSONValueObjectGetNumberUint(info, "source", &source) < 0)
+ goto error;
+
+ if (virJSONValueObjectGetNumberUint(info, "status", &status) < 0)
+ goto error;
+
+ qemuMonitorEmitAcpiOstInfo(mon, alias, slotType, slot, source, status);
+ return;
+
+ error:
+ VIR_WARN("malformed ACPI_DEVICE_OST event");
+ return;
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
--
2.8.0