qemu_monitor.h 48.8 KB
Newer Older
1 2 3
/*
 * qemu_monitor.h: interaction with QEMU monitor console
 *
4
 * Copyright (C) 2006-2015 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17
 * Copyright (C) 2006 Daniel P. Berrange
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library.  If not, see
O
Osier Yang 已提交
19
 * <http://www.gnu.org/licenses/>.
20 21 22 23 24 25
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */


#ifndef QEMU_MONITOR_H
26
# define QEMU_MONITOR_H
27

28
# include "internal.h"
29

30
# include "domain_conf.h"
31
# include "virbitmap.h"
32
# include "virhash.h"
33
# include "virjson.h"
34
# include "virnetdev.h"
35
# include "device_conf.h"
36
# include "cpu/cpu.h"
A
Andrea Bolognani 已提交
37
# include "util/virgic.h"
38

39 40
typedef struct _qemuMonitor qemuMonitor;
typedef qemuMonitor *qemuMonitorPtr;
41

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
typedef struct _qemuMonitorMessage qemuMonitorMessage;
typedef qemuMonitorMessage *qemuMonitorMessagePtr;

typedef int (*qemuMonitorPasswordHandler)(qemuMonitorPtr mon,
                                          qemuMonitorMessagePtr msg,
                                          const char *data,
                                          size_t len,
                                          void *opaque);

struct _qemuMonitorMessage {
    int txFD;

    char *txBuffer;
    int txOffset;
    int txLength;

58
    /* Used by the text monitor reply / error */
59 60
    char *rxBuffer;
    int rxLength;
61 62
    /* Used by the JSON monitor to hold reply / error */
    void *rxObject;
63

64 65 66 67
    /* True if rxBuffer / rxObject are ready, or a
     * fatal error occurred on the monitor channel
     */
    bool finished;
68 69 70 71 72

    qemuMonitorPasswordHandler passwordHandler;
    void *passwordOpaque;
};

73 74 75
typedef enum {
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE = 0,
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV,
76
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390,
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST
} qemuMonitorEventPanicInfoType;

typedef struct _qemuMonitorEventPanicInfoHyperv qemuMonitorEventPanicInfoHyperv;
typedef qemuMonitorEventPanicInfoHyperv *qemuMonitorEventPanicInfoHypervPtr;
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;
};

92 93 94 95 96 97 98 99 100 101
typedef struct _qemuMonitorEventPanicInfoS390 qemuMonitorEventPanicInfoS390;
typedef qemuMonitorEventPanicInfoS390 *qemuMonitorEventPanicInfoS390Ptr;
struct _qemuMonitorEventPanicInfoS390 {
    /* S390 specific guest panic information */
    int core;
    unsigned long long psw_mask;
    unsigned long long psw_addr;
    char *reason;
};

102 103 104 105 106 107
typedef struct _qemuMonitorEventPanicInfo qemuMonitorEventPanicInfo;
typedef qemuMonitorEventPanicInfo *qemuMonitorEventPanicInfoPtr;
struct _qemuMonitorEventPanicInfo {
    qemuMonitorEventPanicInfoType type;
    union {
        qemuMonitorEventPanicInfoHyperv hyperv;
108
        qemuMonitorEventPanicInfoS390 s390;
109 110 111
    } data;
};

112
char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info);
113
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info);
J
Jiri Denemark 已提交
114 115

typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
116 117
                                           virDomainObjPtr vm,
                                           void *opaque);
J
Jiri Denemark 已提交
118
typedef void (*qemuMonitorEofNotifyCallback)(qemuMonitorPtr mon,
119 120
                                             virDomainObjPtr vm,
                                             void *opaque);
J
Jiri Denemark 已提交
121
typedef void (*qemuMonitorErrorNotifyCallback)(qemuMonitorPtr mon,
122 123
                                               virDomainObjPtr vm,
                                               void *opaque);
124 125 126 127 128 129 130
typedef int (*qemuMonitorDomainEventCallback)(qemuMonitorPtr mon,
                                              virDomainObjPtr vm,
                                              const char *event,
                                              long long seconds,
                                              unsigned int micros,
                                              const char *details,
                                              void *opaque);
J
Jiri Denemark 已提交
131
typedef int (*qemuMonitorDomainShutdownCallback)(qemuMonitorPtr mon,
132
                                                 virDomainObjPtr vm,
133
                                                 virTristateBool guest,
134
                                                 void *opaque);
J
Jiri Denemark 已提交
135
typedef int (*qemuMonitorDomainResetCallback)(qemuMonitorPtr mon,
136 137
                                              virDomainObjPtr vm,
                                              void *opaque);
J
Jiri Denemark 已提交
138
typedef int (*qemuMonitorDomainPowerdownCallback)(qemuMonitorPtr mon,
139 140
                                                  virDomainObjPtr vm,
                                                  void *opaque);
J
Jiri Denemark 已提交
141
typedef int (*qemuMonitorDomainStopCallback)(qemuMonitorPtr mon,
142 143
                                             virDomainObjPtr vm,
                                             void *opaque);
J
Jiri Denemark 已提交
144
typedef int (*qemuMonitorDomainResumeCallback)(qemuMonitorPtr mon,
145 146
                                               virDomainObjPtr vm,
                                               void *opaque);
J
Jiri Denemark 已提交
147 148
typedef int (*qemuMonitorDomainRTCChangeCallback)(qemuMonitorPtr mon,
                                                  virDomainObjPtr vm,
149 150
                                                  long long offset,
                                                  void *opaque);
J
Jiri Denemark 已提交
151 152
typedef int (*qemuMonitorDomainWatchdogCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
153 154
                                                 int action,
                                                 void *opaque);
J
Jiri Denemark 已提交
155 156 157
typedef int (*qemuMonitorDomainIOErrorCallback)(qemuMonitorPtr mon,
                                                virDomainObjPtr vm,
                                                const char *diskAlias,
158
                                                const char *nodename,
J
Jiri Denemark 已提交
159
                                                int action,
160 161
                                                const char *reason,
                                                void *opaque);
J
Jiri Denemark 已提交
162 163 164 165 166 167 168 169 170 171 172
typedef int (*qemuMonitorDomainGraphicsCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
                                                 int phase,
                                                 int localFamily,
                                                 const char *localNode,
                                                 const char *localService,
                                                 int remoteFamily,
                                                 const char *remoteNode,
                                                 const char *remoteService,
                                                 const char *authScheme,
                                                 const char *x509dname,
173 174
                                                 const char *saslUsername,
                                                 void *opaque);
J
Jiri Denemark 已提交
175 176 177 178
typedef int (*qemuMonitorDomainBlockJobCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
                                                 const char *diskAlias,
                                                 int type,
179
                                                 int status,
180
                                                 const char *error,
181
                                                 void *opaque);
J
Jiri Denemark 已提交
182 183 184
typedef int (*qemuMonitorDomainTrayChangeCallback)(qemuMonitorPtr mon,
                                                   virDomainObjPtr vm,
                                                   const char *devAlias,
185
                                                   const char *devid,
186 187
                                                   int reason,
                                                   void *opaque);
J
Jiri Denemark 已提交
188
typedef int (*qemuMonitorDomainPMWakeupCallback)(qemuMonitorPtr mon,
189 190
                                                 virDomainObjPtr vm,
                                                 void *opaque);
J
Jiri Denemark 已提交
191
typedef int (*qemuMonitorDomainPMSuspendCallback)(qemuMonitorPtr mon,
192 193
                                                  virDomainObjPtr vm,
                                                  void *opaque);
J
Jiri Denemark 已提交
194 195
typedef int (*qemuMonitorDomainBalloonChangeCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
196 197
                                                      unsigned long long actual,
                                                      void *opaque);
J
Jiri Denemark 已提交
198
typedef int (*qemuMonitorDomainPMSuspendDiskCallback)(qemuMonitorPtr mon,
199 200
                                                      virDomainObjPtr vm,
                                                      void *opaque);
J
Jiri Denemark 已提交
201
typedef int (*qemuMonitorDomainGuestPanicCallback)(qemuMonitorPtr mon,
202
                                                   virDomainObjPtr vm,
203
                                                   qemuMonitorEventPanicInfoPtr info,
204
                                                   void *opaque);
J
Jiri Denemark 已提交
205 206
typedef int (*qemuMonitorDomainDeviceDeletedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
207 208
                                                      const char *devAlias,
                                                      void *opaque);
209 210 211 212
typedef int (*qemuMonitorDomainNicRxFilterChangedCallback)(qemuMonitorPtr mon,
                                                           virDomainObjPtr vm,
                                                           const char *devAlias,
                                                           void *opaque);
J
Jiri Denemark 已提交
213

214 215 216 217 218 219
typedef int (*qemuMonitorDomainSerialChangeCallback)(qemuMonitorPtr mon,
                                                     virDomainObjPtr vm,
                                                     const char *devAlias,
                                                     bool connected,
                                                     void *opaque);

220 221 222 223
typedef int (*qemuMonitorDomainSpiceMigratedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      void *opaque);

224 225 226 227 228
typedef int (*qemuMonitorDomainMigrationStatusCallback)(qemuMonitorPtr mon,
                                                        virDomainObjPtr vm,
                                                        int status,
                                                        void *opaque);

229 230 231 232 233
typedef int (*qemuMonitorDomainMigrationPassCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      int pass,
                                                      void *opaque);

234 235 236 237 238 239 240 241 242 243
typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qemuMonitorPtr mon,
                                                    virDomainObjPtr vm,
                                                    const char *alias,
                                                    const char *slotType,
                                                    const char *slot,
                                                    unsigned int source,
                                                    unsigned int status,
                                                    void *opaque);


244 245 246 247 248 249 250 251
typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon,
                                                       virDomainObjPtr vm,
                                                       const char *nodename,
                                                       unsigned long long threshold,
                                                       unsigned long long excess,
                                                       void *opaque);


252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
typedef enum {
    QEMU_MONITOR_DUMP_STATUS_NONE,
    QEMU_MONITOR_DUMP_STATUS_ACTIVE,
    QEMU_MONITOR_DUMP_STATUS_COMPLETED,
    QEMU_MONITOR_DUMP_STATUS_FAILED,

    QEMU_MONITOR_DUMP_STATUS_LAST,
} qemuMonitorDumpStatus;

VIR_ENUM_DECL(qemuMonitorDumpStatus)

typedef struct _qemuMonitorDumpStats qemuMonitorDumpStats;
typedef qemuMonitorDumpStats *qemuMonitorDumpStatsPtr;
struct _qemuMonitorDumpStats {
    int status; /* qemuMonitorDumpStatus */
    unsigned long long completed; /* bytes written */
    unsigned long long total; /* total bytes to be written */
};

271 272 273 274 275 276 277
typedef int (*qemuMonitorDomainDumpCompletedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      int status,
                                                      qemuMonitorDumpStatsPtr stats,
                                                      const char *error,
                                                      void *opaque);

278 279 280 281 282 283
typedef int (*qemuMonitorDomainPRManagerStatusChangedCallback)(qemuMonitorPtr mon,
                                                               virDomainObjPtr vm,
                                                               const char *prManager,
                                                               bool connected,
                                                               void *opaque);

284 285 286
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
J
Jiri Denemark 已提交
287 288 289
    qemuMonitorDestroyCallback destroy;
    qemuMonitorEofNotifyCallback eofNotify;
    qemuMonitorErrorNotifyCallback errorNotify;
290
    qemuMonitorDomainEventCallback domainEvent;
J
Jiri Denemark 已提交
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
    qemuMonitorDomainShutdownCallback domainShutdown;
    qemuMonitorDomainResetCallback domainReset;
    qemuMonitorDomainPowerdownCallback domainPowerdown;
    qemuMonitorDomainStopCallback domainStop;
    qemuMonitorDomainResumeCallback domainResume;
    qemuMonitorDomainRTCChangeCallback domainRTCChange;
    qemuMonitorDomainWatchdogCallback domainWatchdog;
    qemuMonitorDomainIOErrorCallback domainIOError;
    qemuMonitorDomainGraphicsCallback domainGraphics;
    qemuMonitorDomainBlockJobCallback domainBlockJob;
    qemuMonitorDomainTrayChangeCallback domainTrayChange;
    qemuMonitorDomainPMWakeupCallback domainPMWakeup;
    qemuMonitorDomainPMSuspendCallback domainPMSuspend;
    qemuMonitorDomainBalloonChangeCallback domainBalloonChange;
    qemuMonitorDomainPMSuspendDiskCallback domainPMSuspendDisk;
    qemuMonitorDomainGuestPanicCallback domainGuestPanic;
    qemuMonitorDomainDeviceDeletedCallback domainDeviceDeleted;
308
    qemuMonitorDomainNicRxFilterChangedCallback domainNicRxFilterChanged;
309
    qemuMonitorDomainSerialChangeCallback domainSerialChange;
310
    qemuMonitorDomainSpiceMigratedCallback domainSpiceMigrated;
311
    qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
312
    qemuMonitorDomainMigrationPassCallback domainMigrationPass;
313
    qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
314
    qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
315
    qemuMonitorDomainDumpCompletedCallback domainDumpCompleted;
316
    qemuMonitorDomainPRManagerStatusChangedCallback domainPRManagerStatusChanged;
317 318
};

319
char *qemuMonitorEscapeArg(const char *in);
320
char *qemuMonitorUnescapeArg(const char *in);
321

322
qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm,
323
                               virDomainChrSourceDefPtr config,
E
Eric Blake 已提交
324
                               bool json,
325
                               bool retry,
326
                               unsigned long long timeout,
327 328
                               qemuMonitorCallbacksPtr cb,
                               void *opaque)
329
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(6);
330 331
qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm,
                                 int sockfd,
E
Eric Blake 已提交
332
                                 bool json,
333 334
                                 qemuMonitorCallbacksPtr cb,
                                 void *opaque)
335
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
336

337 338
bool qemuMonitorRegister(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
339 340
void qemuMonitorUnregister(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
341
void qemuMonitorClose(qemuMonitorPtr mon);
342

343 344
virErrorPtr qemuMonitorLastError(qemuMonitorPtr mon);

345
int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
346

347 348
int qemuMonitorSetLink(qemuMonitorPtr mon,
                       const char *name,
349 350
                       virDomainNetInterfaceLinkState state)
    ATTRIBUTE_NONNULL(2);
351

352
/* These APIs are for use by the internal Text/JSON monitor impl code only */
353
char *qemuMonitorNextCommandID(qemuMonitorPtr mon);
354 355
int qemuMonitorSend(qemuMonitorPtr mon,
                    qemuMonitorMessagePtr msg);
356 357 358 359
virJSONValuePtr qemuMonitorGetOptions(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
void qemuMonitorSetOptions(qemuMonitorPtr mon, virJSONValuePtr options)
    ATTRIBUTE_NONNULL(1);
360 361
int qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon,
                                     virDomainVideoDefPtr video,
C
Cao jin 已提交
362
                                     const char *videoName)
363
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
364 365 366
int qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
                                     virDomainVideoDefPtr video,
                                     const char *videoName)
367
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
368 369 370 371 372 373
int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
                                const char *cmd,
                                int scm_fd,
                                char **reply);
# define qemuMonitorHMPCommand(mon, cmd, reply) \
    qemuMonitorHMPCommandWithFd(mon, cmd, -1, reply)
374

375 376 377
int qemuMonitorEmitEvent(qemuMonitorPtr mon, const char *event,
                         long long seconds, unsigned int micros,
                         const char *details);
378
int qemuMonitorEmitShutdown(qemuMonitorPtr mon, virTristateBool guest);
379 380 381
int qemuMonitorEmitReset(qemuMonitorPtr mon);
int qemuMonitorEmitPowerdown(qemuMonitorPtr mon);
int qemuMonitorEmitStop(qemuMonitorPtr mon);
382
int qemuMonitorEmitResume(qemuMonitorPtr mon);
383
int qemuMonitorEmitRTCChange(qemuMonitorPtr mon, long long offset);
384
int qemuMonitorEmitWatchdog(qemuMonitorPtr mon, int action);
385 386
int qemuMonitorEmitIOError(qemuMonitorPtr mon,
                           const char *diskAlias,
387
                           const char *nodename,
388 389
                           int action,
                           const char *reason);
390 391 392 393 394 395 396 397 398 399 400
int qemuMonitorEmitGraphics(qemuMonitorPtr mon,
                            int phase,
                            int localFamily,
                            const char *localNode,
                            const char *localService,
                            int remoteFamily,
                            const char *remoteNode,
                            const char *remoteService,
                            const char *authScheme,
                            const char *x509dname,
                            const char *saslUsername);
401 402
int qemuMonitorEmitTrayChange(qemuMonitorPtr mon,
                              const char *devAlias,
403
                              const char *devid,
404
                              int reason);
O
Osier Yang 已提交
405
int qemuMonitorEmitPMWakeup(qemuMonitorPtr mon);
O
Osier Yang 已提交
406
int qemuMonitorEmitPMSuspend(qemuMonitorPtr mon);
407 408 409
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
                            const char *diskAlias,
                            int type,
410 411
                            int status,
                            const char *error);
412 413
int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon,
                                 unsigned long long actual);
414
int qemuMonitorEmitPMSuspendDisk(qemuMonitorPtr mon);
415 416
int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon,
                              qemuMonitorEventPanicInfoPtr info);
417 418
int qemuMonitorEmitDeviceDeleted(qemuMonitorPtr mon,
                                 const char *devAlias);
419 420
int qemuMonitorEmitNicRxFilterChanged(qemuMonitorPtr mon,
                                      const char *devAlias);
421 422 423
int qemuMonitorEmitSerialChange(qemuMonitorPtr mon,
                                const char *devAlias,
                                bool connected);
424
int qemuMonitorEmitSpiceMigrated(qemuMonitorPtr mon);
425 426
int qemuMonitorEmitMigrationStatus(qemuMonitorPtr mon,
                                   int status);
427 428
int qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
                                 int pass);
429

430 431 432 433 434 435 436
int qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
                               const char *alias,
                               const char *slotType,
                               const char *slot,
                               unsigned int source,
                               unsigned int status);

437 438 439 440 441
int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
                                  const char *nodename,
                                  unsigned long long threshold,
                                  unsigned long long excess);

442 443 444 445 446
int qemuMonitorEmitDumpCompleted(qemuMonitorPtr mon,
                                 int status,
                                 qemuMonitorDumpStatsPtr stats,
                                 const char *error);

447 448 449 450
int qemuMonitorEmitPRManagerStatusChanged(qemuMonitorPtr mon,
                                          const char *prManager,
                                          bool connected);

451
int qemuMonitorStartCPUs(qemuMonitorPtr mon);
452
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467

typedef enum {
    QEMU_MONITOR_VM_STATUS_DEBUG,
    QEMU_MONITOR_VM_STATUS_INMIGRATE,
    QEMU_MONITOR_VM_STATUS_INTERNAL_ERROR,
    QEMU_MONITOR_VM_STATUS_IO_ERROR,
    QEMU_MONITOR_VM_STATUS_PAUSED,
    QEMU_MONITOR_VM_STATUS_POSTMIGRATE,
    QEMU_MONITOR_VM_STATUS_PRELAUNCH,
    QEMU_MONITOR_VM_STATUS_FINISH_MIGRATE,
    QEMU_MONITOR_VM_STATUS_RESTORE_VM,
    QEMU_MONITOR_VM_STATUS_RUNNING,
    QEMU_MONITOR_VM_STATUS_SAVE_VM,
    QEMU_MONITOR_VM_STATUS_SHUTDOWN,
    QEMU_MONITOR_VM_STATUS_WATCHDOG,
468
    QEMU_MONITOR_VM_STATUS_GUEST_PANICKED,
469 470 471 472 473 474

    QEMU_MONITOR_VM_STATUS_LAST
} qemuMonitorVMStatus;
VIR_ENUM_DECL(qemuMonitorVMStatus)
int qemuMonitorVMStatusToPausedReason(const char *status);

475
int qemuMonitorCheck(qemuMonitorPtr mon);
476 477
int qemuMonitorGetStatus(qemuMonitorPtr mon,
                         bool *running,
478 479
                         virDomainPausedReason *reason)
    ATTRIBUTE_NONNULL(2);
480

481
int qemuMonitorSystemReset(qemuMonitorPtr mon);
482 483
int qemuMonitorSystemPowerdown(qemuMonitorPtr mon);

484
struct qemuMonitorQueryCpusEntry {
485
    int qemu_id; /* id of the cpu as reported by qemu */
486
    pid_t tid;
487
    char *qom_path;
488
    bool halted;
489 490 491 492
};
void qemuMonitorQueryCpusFree(struct qemuMonitorQueryCpusEntry *entries,
                              size_t nentries);

493

494 495 496 497 498 499 500 501 502 503 504
struct qemuMonitorQueryHotpluggableCpusEntry {
    char *type; /* name of the cpu to use with device_add */
    unsigned int vcpus; /* count of virtual cpus in the guest this entry adds */
    char *qom_path; /* full device qom path only present for online cpus */
    char *alias; /* device alias, may be NULL for non-hotpluggable entities */

    /* topology information -1 if qemu didn't report given parameter */
    int node_id;
    int socket_id;
    int core_id;
    int thread_id;
505 506 507

    /* internal data */
    int enable_id;
508 509 510 511 512
};
void qemuMonitorQueryHotpluggableCpusFree(struct qemuMonitorQueryHotpluggableCpusEntry *entries,
                                          size_t nentries);


513 514
struct _qemuMonitorCPUInfo {
    pid_t tid;
515
    int id; /* order of enabling of the given cpu */
516
    int qemu_id; /* identifier of the cpu as reported by query-cpus */
517

518 519 520 521
    /* state data */
    bool online;
    bool hotpluggable;

522 523 524 525 526
    /* topology info for hotplug purposes. Hotplug of given vcpu impossible if
     * all entries are -1 */
    int socket_id;
    int core_id;
    int thread_id;
527
    int node_id;
528 529 530 531 532 533 534 535 536 537
    unsigned int vcpus; /* number of vcpus added if given entry is hotplugged */

    /* name of the qemu type to add in case of hotplug */
    char *type;

    /* alias of an hotpluggable entry. Entries with alias can be hot-unplugged */
    char *alias;

    /* internal for use in the matching code */
    char *qom_path;
538 539

    bool halted;
540 541 542 543 544 545
};
typedef struct _qemuMonitorCPUInfo qemuMonitorCPUInfo;
typedef qemuMonitorCPUInfo *qemuMonitorCPUInfoPtr;

void qemuMonitorCPUInfoFree(qemuMonitorCPUInfoPtr list,
                            size_t nitems);
546
int qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
547
                          qemuMonitorCPUInfoPtr *vcpus,
548
                          size_t maxvcpus,
549 550 551 552 553
                          bool hotplug,
                          bool fast);
virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon,
                                     size_t maxvcpus,
                                     bool fast);
554

555
int qemuMonitorGetVirtType(qemuMonitorPtr mon,
556
                           virDomainVirtType *virtType);
557
int qemuMonitorGetBalloonInfo(qemuMonitorPtr mon,
558
                              unsigned long long *currmem);
559
int qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
560
                              virDomainMemballoonDefPtr balloon,
561 562
                              virDomainMemoryStatPtr stats,
                              unsigned int nr_stats);
563
int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
564
                                    virDomainMemballoonDefPtr balloon,
565
                                    int period);
566

567
int qemuMonitorBlockIOStatusToError(const char *status);
568 569
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);

570
virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon);
571

572 573 574 575 576 577 578 579 580 581 582
typedef struct _qemuBlockStats qemuBlockStats;
typedef qemuBlockStats *qemuBlockStatsPtr;
struct _qemuBlockStats {
    long long rd_req;
    long long rd_bytes;
    long long wr_req;
    long long wr_bytes;
    long long rd_total_times;
    long long wr_total_times;
    long long flush_req;
    long long flush_total_times;
583 584
    unsigned long long capacity;
    unsigned long long physical;
585 586 587

    /* value of wr_highest_offset is valid if it's non 0 or
     * if wr_highest_offset_valid is true */
588
    unsigned long long wr_highest_offset;
589
    bool wr_highest_offset_valid;
590 591 592

    /* write_threshold is valid only if it's non-zero, conforming to qemu semantics */
    unsigned long long write_threshold;
593 594 595
};

int qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
596 597
                                    virHashTablePtr *ret_stats,
                                    bool backingChain)
598
    ATTRIBUTE_NONNULL(2);
599

600
int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
601 602
                                        virHashTablePtr stats,
                                        bool backingChain)
603
    ATTRIBUTE_NONNULL(2);
604

605 606 607 608
int qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuMonitorPtr mon,
                                                virHashTablePtr stats)
    ATTRIBUTE_NONNULL(2);

609
int qemuMonitorBlockResize(qemuMonitorPtr mon,
610 611
                           const char *device,
                           const char *nodename,
612
                           unsigned long long size);
613 614
int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
                              const char *password);
615 616 617 618 619 620 621
int qemuMonitorSetPassword(qemuMonitorPtr mon,
                           int type,
                           const char *password,
                           const char *action_if_connected);
int qemuMonitorExpirePassword(qemuMonitorPtr mon,
                              int type,
                              const char *expire_time);
622
int qemuMonitorSetBalloon(qemuMonitorPtr mon,
623
                          unsigned long long newmem);
624
int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
625

626 627

/* XXX should we pass the virDomainDiskDefPtr instead
628
 * and hide dev_name details inside monitor. Reconsider
629 630 631
 * this when doing the QMP implementation
 */
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
632
                          const char *dev_name,
633
                          bool force);
634
int qemuMonitorChangeMedia(qemuMonitorPtr mon,
635
                           const char *dev_name,
636 637
                           const char *newmedia,
                           const char *format);
638 639 640 641 642 643 644 645 646 647 648 649 650 651


int qemuMonitorSaveVirtualMemory(qemuMonitorPtr mon,
                                 unsigned long long offset,
                                 size_t length,
                                 const char *path);
int qemuMonitorSavePhysicalMemory(qemuMonitorPtr mon,
                                  unsigned long long offset,
                                  size_t length,
                                  const char *path);

int qemuMonitorSetMigrationSpeed(qemuMonitorPtr mon,
                                 unsigned long bandwidth);

652 653 654
int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon,
                                    unsigned long long downtime);

655 656 657 658 659
int qemuMonitorGetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long *cacheSize);
int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long cacheSize);

660
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
661
                                  virJSONValuePtr *params);
662
int qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
663
                                  virJSONValuePtr params);
664

665
typedef enum {
666
    QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
667
    QEMU_MONITOR_MIGRATION_STATUS_SETUP,
668
    QEMU_MONITOR_MIGRATION_STATUS_ACTIVE,
669 670
    QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER,
    QEMU_MONITOR_MIGRATION_STATUS_DEVICE,
671
    QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
672 673
    QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
    QEMU_MONITOR_MIGRATION_STATUS_ERROR,
674
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,
675 676 677
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,

    QEMU_MONITOR_MIGRATION_STATUS_LAST
678
} qemuMonitorMigrationStatus;
679

680 681
VIR_ENUM_DECL(qemuMonitorMigrationStatus)

682 683 684
typedef struct _qemuMonitorMigrationStats qemuMonitorMigrationStats;
typedef qemuMonitorMigrationStats *qemuMonitorMigrationStatsPtr;
struct _qemuMonitorMigrationStats {
685
    int status; /* qemuMonitorMigrationStatus */
686 687 688 689
    unsigned long long total_time;
    /* total or expected depending on status */
    bool downtime_set;
    unsigned long long downtime;
690 691 692 693 694 695 696
    /*
     * Duration of the QEMU 'setup' state.
     * for RDMA, this may be on the order of several seconds
     * if pinning support is requested before the migration begins.
     */
    bool setup_time_set;
    unsigned long long setup_time;
697 698 699 700

    unsigned long long ram_transferred;
    unsigned long long ram_remaining;
    unsigned long long ram_total;
701
    unsigned long long ram_bps;
702 703 704 705
    bool ram_duplicate_set;
    unsigned long long ram_duplicate;
    unsigned long long ram_normal;
    unsigned long long ram_normal_bytes;
706
    unsigned long long ram_dirty_rate;
707
    unsigned long long ram_page_size;
708
    unsigned long long ram_iteration;
709 710 711 712

    unsigned long long disk_transferred;
    unsigned long long disk_remaining;
    unsigned long long disk_total;
713
    unsigned long long disk_bps;
714 715 716 717 718 719 720

    bool xbzrle_set;
    unsigned long long xbzrle_cache_size;
    unsigned long long xbzrle_bytes;
    unsigned long long xbzrle_pages;
    unsigned long long xbzrle_cache_miss;
    unsigned long long xbzrle_overflow;
721 722

    int cpu_throttle_percentage;
723 724
};

725
int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
726 727
                                 qemuMonitorMigrationStatsPtr stats,
                                 char **error);
728

729 730
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
                                        char ***capabilities);
731
int qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon,
732
                                        virJSONValuePtr caps);
733

A
Andrea Bolognani 已提交
734 735 736
int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon,
                                  virGICCapability **capabilities);

737 738 739
int qemuMonitorGetSEVCapabilities(qemuMonitorPtr mon,
                                  virSEVCapability **capabilities);

740
typedef enum {
741
  QEMU_MONITOR_MIGRATE_BACKGROUND       = 1 << 0,
742 743 744 745 746
  QEMU_MONITOR_MIGRATE_NON_SHARED_DISK  = 1 << 1, /* migration with non-shared storage with full disk copy */
  QEMU_MONITOR_MIGRATE_NON_SHARED_INC   = 1 << 2, /* migration with non-shared storage with incremental copy */
  QEMU_MONITOR_MIGRATION_FLAGS_LAST
} QEMU_MONITOR_MIGRATE;

E
Eric Blake 已提交
747 748 749 750
int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
                           unsigned int flags,
                           int fd);

751
int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
752
                             unsigned int flags,
753
                             const char *protocol,
754 755 756 757 758
                             const char *hostname,
                             int port);

int qemuMonitorMigrateCancel(qemuMonitorPtr mon);

759 760 761
int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
                                            const char *capability);

762 763 764
int qemuMonitorQueryDump(qemuMonitorPtr mon,
                         qemuMonitorDumpStatsPtr stats);

765
int qemuMonitorDumpToFd(qemuMonitorPtr mon,
766
                        int fd,
767 768
                        const char *dumpformat,
                        bool detach);
769

770 771 772 773 774 775
int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
                                int type,
                                const char *hostname,
                                int port,
                                int tlsPort,
                                const char *tlsSubject);
776 777 778 779

int qemuMonitorSendFileHandle(qemuMonitorPtr mon,
                              const char *fdname,
                              int fd);
780
int qemuMonitorAddFd(qemuMonitorPtr mon, int fdset, int fd, const char *name);
781

782 783
/* These two functions preserve previous error and only set their own
 * error if no error was set before.
784
 */
785 786
int qemuMonitorCloseFileHandle(qemuMonitorPtr mon,
                               const char *fdname);
787
int qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd);
788

789
int qemuMonitorAddNetdev(qemuMonitorPtr mon,
790
                         const char *netdevstr,
791 792
                         int *tapfd, char **tapfdName, int tapfdSize,
                         int *vhostfd, char **vhostfdName, int vhostfdSize);
793 794 795 796

int qemuMonitorRemoveNetdev(qemuMonitorPtr mon,
                            const char *alias);

797 798 799
int qemuMonitorQueryRxFilter(qemuMonitorPtr mon, const char *alias,
                             virNetDevRxFilterPtr *filter);

800 801 802 803 804 805
typedef struct _qemuMonitorChardevInfo qemuMonitorChardevInfo;
typedef qemuMonitorChardevInfo *qemuMonitorChardevInfoPtr;
struct _qemuMonitorChardevInfo {
    char *ptyPath;
    virDomainChrDeviceState state;
};
806
void qemuMonitorChardevInfoFree(void *data, const void *name);
807 808
int qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
                              virHashTablePtr *retinfo);
809

810 811
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
                                       const char *bus,
812
                                       virPCIDeviceAddress *guestAddr);
813

814 815
int qemuMonitorAddDeviceArgs(qemuMonitorPtr mon,
                             virJSONValuePtr args);
816 817 818
int qemuMonitorAddDevice(qemuMonitorPtr mon,
                         const char *devicestr);

819 820 821 822 823
int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
                               const char *devicestr,
                               int fd,
                               const char *fdname);

824
int qemuMonitorDelDevice(qemuMonitorPtr mon,
825
                         const char *devalias);
826

827 828 829 830 831 832 833 834 835 836 837
virJSONValuePtr qemuMonitorCreateObjectPropsWrap(const char *type,
                                                 const char *alias,
                                                 virJSONValuePtr *props);

int qemuMonitorCreateObjectProps(virJSONValuePtr *propsret,
                                 const char *type,
                                 const char *alias,
                                 ...);

int qemuMonitorAddObject(qemuMonitorPtr mon,
                         virJSONValuePtr *props,
838
                         char **alias)
839
    ATTRIBUTE_NONNULL(2);
840

841 842 843
int qemuMonitorDelObject(qemuMonitorPtr mon,
                         const char *objalias);

844 845 846
int qemuMonitorAddDrive(qemuMonitorPtr mon,
                        const char *drivestr);

847
int qemuMonitorDriveDel(qemuMonitorPtr mon,
848 849
                        const char *drivestr);

C
Chris Lalancette 已提交
850 851 852 853
int qemuMonitorCreateSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorLoadSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const char *name);

854
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
855
    ATTRIBUTE_NONNULL(2);
856 857 858 859
int qemuMonitorDriveMirror(qemuMonitorPtr mon,
                           const char *device,
                           const char *file,
                           const char *format,
860
                           unsigned long long bandwidth,
861 862
                           unsigned int granularity,
                           unsigned long long buf_size,
863
                           unsigned int flags)
864
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
865 866 867 868 869 870 871 872 873
int qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
                              const char *jobname,
                              const char *device,
                              const char *target,
                              unsigned long long bandwidth,
                              unsigned int granularity,
                              unsigned long long buf_size,
                              unsigned int flags)
    ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
874
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
875
                          const char *jobname)
876
    ATTRIBUTE_NONNULL(2);
877

878 879 880 881
int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                           const char *device,
                           const char *top,
                           const char *base,
882
                           const char *backingName,
883
                           unsigned long long bandwidth)
884
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
885
bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
886 887 888 889
char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
                                const char *device,
                                virStorageSourcePtr top,
                                virStorageSourcePtr target)
890
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
891

892 893 894 895
int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
                                const char *cmd,
                                char **reply,
                                bool hmp);
896

897 898
int qemuMonitorInjectNMI(qemuMonitorPtr mon);

899
int qemuMonitorScreendump(qemuMonitorPtr mon,
900 901
                          const char *device,
                          unsigned int head,
902 903
                          const char *file);

904 905 906 907 908
int qemuMonitorSendKey(qemuMonitorPtr mon,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       unsigned int nkeycodes);

909 910 911 912
int qemuMonitorBlockStream(qemuMonitorPtr mon,
                           const char *device,
                           const char *base,
                           const char *backingName,
913
                           unsigned long long bandwidth)
914
    ATTRIBUTE_NONNULL(2);
915

916
int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
917
                              const char *jobname)
918
    ATTRIBUTE_NONNULL(2);
919

920
int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
921
                                const char *jobname,
922
                                unsigned long long bandwidth);
923

924 925 926 927 928 929 930
typedef struct _qemuMonitorBlockJobInfo qemuMonitorBlockJobInfo;
typedef qemuMonitorBlockJobInfo *qemuMonitorBlockJobInfoPtr;
struct _qemuMonitorBlockJobInfo {
    int type; /* virDomainBlockJobType */
    unsigned long long bandwidth; /* in bytes/s */
    virDomainBlockJobCursor cur;
    virDomainBlockJobCursor end;
931
    int ready; /* -1 if unknown, 0 if not ready, 1 if ready */
932 933 934 935 936 937
};

virHashTablePtr qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon);
int qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon,
                               const char *device,
                               qemuMonitorBlockJobInfoPtr info)
938
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
939

940 941 942 943 944 945
int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
                            const char *protocol,
                            int fd,
                            const char *fdname,
                            bool skipauth);

946
int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
947 948
                                  const char *drivealias,
                                  const char *qomid,
949
                                  virDomainBlockIoTuneInfoPtr info,
950
                                  bool supportMaxOptions,
951
                                  bool supportGroupNameOption,
952
                                  bool supportMaxLengthOptions);
953 954

int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
955 956
                                  const char *drivealias,
                                  const char *qdevid,
957
                                  virDomainBlockIoTuneInfoPtr reply);
958

959 960
int qemuMonitorSystemWakeup(qemuMonitorPtr mon);

961 962 963 964 965 966 967
int qemuMonitorGetVersion(qemuMonitorPtr mon,
                          int *major,
                          int *minor,
                          int *micro,
                          char **package)
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);

968 969 970 971 972 973 974 975

typedef struct _qemuMonitorMachineInfo qemuMonitorMachineInfo;
typedef qemuMonitorMachineInfo *qemuMonitorMachineInfoPtr;

struct _qemuMonitorMachineInfo {
    char *name;
    bool isDefault;
    char *alias;
976
    unsigned int maxCpus;
977
    bool hotplugCpus;
978 979 980 981 982 983 984
};

int qemuMonitorGetMachines(qemuMonitorPtr mon,
                           qemuMonitorMachineInfoPtr **machines);

void qemuMonitorMachineInfoFree(qemuMonitorMachineInfoPtr machine);

985 986 987 988
typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo;
typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;

struct _qemuMonitorCPUDefInfo {
989
    virTristateBool usable;
990
    char *name;
991
    char **blockers; /* NULL-terminated string list */
992 993
};

994
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
995 996
                                 qemuMonitorCPUDefInfoPtr **cpus);
void qemuMonitorCPUDefInfoFree(qemuMonitorCPUDefInfoPtr cpu);
997

998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
typedef enum {
    QEMU_MONITOR_CPU_PROPERTY_BOOLEAN,
    QEMU_MONITOR_CPU_PROPERTY_STRING,
    QEMU_MONITOR_CPU_PROPERTY_NUMBER,

    QEMU_MONITOR_CPU_PROPERTY_LAST
} qemuMonitorCPUPropertyType;

VIR_ENUM_DECL(qemuMonitorCPUProperty)

typedef struct _qemuMonitorCPUProperty qemuMonitorCPUProperty;
typedef qemuMonitorCPUProperty *qemuMonitorCPUPropertyPtr;
struct _qemuMonitorCPUProperty {
    char *name;
    qemuMonitorCPUPropertyType type;
    union {
        bool boolean;
        char *string;
        long long number;
    } value;
1018
    virTristateBool migratable;
1019 1020
};

1021 1022 1023 1024 1025 1026
typedef struct _qemuMonitorCPUModelInfo qemuMonitorCPUModelInfo;
typedef qemuMonitorCPUModelInfo *qemuMonitorCPUModelInfoPtr;

struct _qemuMonitorCPUModelInfo {
    char *name;
    size_t nprops;
1027
    qemuMonitorCPUPropertyPtr props;
1028
    bool migratability;
1029 1030
};

1031 1032
typedef enum {
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC,
1033 1034
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL,
    QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
1035 1036
} qemuMonitorCPUModelExpansionType;

1037
int qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon,
1038
                                    qemuMonitorCPUModelExpansionType type,
1039
                                    const char *model_name,
1040
                                    bool migratable,
1041 1042 1043 1044 1045 1046 1047
                                    qemuMonitorCPUModelInfoPtr *model_info);

void qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfoPtr model_info);

qemuMonitorCPUModelInfoPtr
qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig);

1048 1049
int qemuMonitorGetCommands(qemuMonitorPtr mon,
                           char ***commands);
1050 1051
int qemuMonitorGetEvents(qemuMonitorPtr mon,
                         char ***events);
1052 1053
int qemuMonitorGetCommandLineOptionParameters(qemuMonitorPtr mon,
                                              const char *option,
1054 1055
                                              char ***params,
                                              bool *found);
1056

1057 1058 1059 1060
int qemuMonitorGetKVMState(qemuMonitorPtr mon,
                           bool *enabled,
                           bool *present);

1061 1062
int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
                              char ***types);
1063 1064
int qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
                              const char *device,
1065
                              char ***props);
1066 1067 1068
int qemuMonitorGetObjectProps(qemuMonitorPtr mon,
                              const char *object,
                              char ***props);
1069
char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
1070

1071 1072
int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
                              const char *host,
1073 1074
                              unsigned int port,
                              const char *tls_alias);
1075 1076 1077
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
                            const char *deviceID,
                            bool writable);
1078
int qemuMonitorNBDServerStop(qemuMonitorPtr);
S
Stefan Berger 已提交
1079 1080 1081 1082 1083 1084
int qemuMonitorGetTPMModels(qemuMonitorPtr mon,
                            char ***tpmmodels);

int qemuMonitorGetTPMTypes(qemuMonitorPtr mon,
                           char ***tpmtypes);

1085 1086 1087
int qemuMonitorAttachCharDev(qemuMonitorPtr mon,
                             const char *chrID,
                             virDomainChrSourceDefPtr chr);
1088 1089
int qemuMonitorDetachCharDev(qemuMonitorPtr mon,
                             const char *chrID);
1090 1091 1092 1093

int qemuMonitorGetDeviceAliases(qemuMonitorPtr mon,
                                char ***aliases);

1094 1095 1096
typedef void (*qemuMonitorReportDomainLogError)(qemuMonitorPtr mon,
                                                const char *msg,
                                                void *opaque);
1097 1098 1099 1100
void qemuMonitorSetDomainLogLocked(qemuMonitorPtr mon,
                                   qemuMonitorReportDomainLogError func,
                                   void *opaque,
                                   virFreeCallback destroy);
1101 1102 1103 1104
void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
                             qemuMonitorReportDomainLogError func,
                             void *opaque,
                             virFreeCallback destroy);
1105

1106 1107
int qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
                           virArch arch,
1108 1109
                           virCPUDataPtr *data,
                           virCPUDataPtr *disabled);
1110

1111 1112
int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);

1113 1114
typedef struct _qemuMonitorIOThreadInfo qemuMonitorIOThreadInfo;
typedef qemuMonitorIOThreadInfo *qemuMonitorIOThreadInfoPtr;
1115

1116
struct _qemuMonitorIOThreadInfo {
1117
    unsigned int iothread_id;
1118
    int thread_id;
1119 1120 1121 1122
    bool poll_valid;
    unsigned long long poll_max_ns;
    unsigned int poll_grow;
    unsigned int poll_shrink;
1123 1124
};
int qemuMonitorGetIOThreads(qemuMonitorPtr mon,
1125
                            qemuMonitorIOThreadInfoPtr **iothreads);
1126

1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140
typedef struct _qemuMonitorMemoryDeviceInfo qemuMonitorMemoryDeviceInfo;
typedef qemuMonitorMemoryDeviceInfo *qemuMonitorMemoryDeviceInfoPtr;

struct _qemuMonitorMemoryDeviceInfo {
    unsigned long long address;
    unsigned int slot;
    bool hotplugged;
    bool hotpluggable;
};

int qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
                                   virHashTablePtr *info)
    ATTRIBUTE_NONNULL(2);

1141 1142 1143
int qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
                               const char *uri);

1144 1145
int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon);

1146 1147 1148
int qemuMonitorMigrateContinue(qemuMonitorPtr mon,
                               qemuMonitorMigrationStatus status);

1149 1150 1151
int qemuMonitorGetRTCTime(qemuMonitorPtr mon,
                          struct tm *tm);

1152
virJSONValuePtr qemuMonitorQueryQMPSchema(qemuMonitorPtr mon);
1153

1154 1155 1156 1157
int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon,
                                 const char *nodename,
                                 unsigned long long threshold);

1158
virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon);
1159

M
Michal Privoznik 已提交
1160 1161
int qemuMonitorSetWatchdogAction(qemuMonitorPtr mon,
                                 const char *action);
1162 1163 1164 1165 1166 1167 1168

int qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
                           virJSONValuePtr props);

int qemuMonitorBlockdevDel(qemuMonitorPtr mon,
                           const char *nodename);

1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182
int qemuMonitorBlockdevTrayOpen(qemuMonitorPtr mon,
                                const char *id,
                                bool force);

int qemuMonitorBlockdevTrayClose(qemuMonitorPtr mon,
                                 const char *id);

int qemuMonitorBlockdevMediumRemove(qemuMonitorPtr mon,
                                    const char *id);

int qemuMonitorBlockdevMediumInsert(qemuMonitorPtr mon,
                                    const char *id,
                                    const char *nodename);

1183 1184 1185
char *
qemuMonitorGetSEVMeasurement(qemuMonitorPtr mon);

1186 1187 1188 1189 1190 1191 1192 1193 1194
typedef struct _qemuMonitorPRManagerInfo qemuMonitorPRManagerInfo;
typedef qemuMonitorPRManagerInfo *qemuMonitorPRManagerInfoPtr;
struct _qemuMonitorPRManagerInfo {
    bool connected;
};

int qemuMonitorGetPRManagerInfo(qemuMonitorPtr mon,
                                virHashTablePtr *retinfo);

1195
#endif /* QEMU_MONITOR_H */