qemu_monitor.h 45.5 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
typedef enum {
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE = 0,
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV,

    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;
};

typedef struct _qemuMonitorEventPanicInfo qemuMonitorEventPanicInfo;
typedef qemuMonitorEventPanicInfo *qemuMonitorEventPanicInfoPtr;
struct _qemuMonitorEventPanicInfo {
    qemuMonitorEventPanicInfoType type;
    union {
        qemuMonitorEventPanicInfoHyperv hyperv;
    } data;
};

100
char *qemuMonitorGuestPanicEventInfoFormatMsg(qemuMonitorEventPanicInfoPtr info);
101
void qemuMonitorEventPanicInfoFree(qemuMonitorEventPanicInfoPtr info);
J
Jiri Denemark 已提交
102 103

typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
104 105
                                           virDomainObjPtr vm,
                                           void *opaque);
J
Jiri Denemark 已提交
106
typedef void (*qemuMonitorEofNotifyCallback)(qemuMonitorPtr mon,
107 108
                                             virDomainObjPtr vm,
                                             void *opaque);
J
Jiri Denemark 已提交
109
typedef void (*qemuMonitorErrorNotifyCallback)(qemuMonitorPtr mon,
110 111
                                               virDomainObjPtr vm,
                                               void *opaque);
J
Jiri Denemark 已提交
112 113 114 115 116 117 118 119 120 121
/* XXX we'd really like to avoid virConnectPtr here
 * It is required so the callback can find the active
 * secret driver. Need to change this to work like the
 * security drivers do, to avoid this
 */
typedef int (*qemuMonitorDiskSecretLookupCallback)(qemuMonitorPtr mon,
                                                   virConnectPtr conn,
                                                   virDomainObjPtr vm,
                                                   const char *path,
                                                   char **secret,
122 123
                                                   size_t *secretLen,
                                                   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 133
                                                 virDomainObjPtr vm,
                                                 void *opaque);
J
Jiri Denemark 已提交
134
typedef int (*qemuMonitorDomainResetCallback)(qemuMonitorPtr mon,
135 136
                                              virDomainObjPtr vm,
                                              void *opaque);
J
Jiri Denemark 已提交
137
typedef int (*qemuMonitorDomainPowerdownCallback)(qemuMonitorPtr mon,
138 139
                                                  virDomainObjPtr vm,
                                                  void *opaque);
J
Jiri Denemark 已提交
140
typedef int (*qemuMonitorDomainStopCallback)(qemuMonitorPtr mon,
141 142
                                             virDomainObjPtr vm,
                                             void *opaque);
J
Jiri Denemark 已提交
143
typedef int (*qemuMonitorDomainResumeCallback)(qemuMonitorPtr mon,
144 145
                                               virDomainObjPtr vm,
                                               void *opaque);
J
Jiri Denemark 已提交
146 147
typedef int (*qemuMonitorDomainRTCChangeCallback)(qemuMonitorPtr mon,
                                                  virDomainObjPtr vm,
148 149
                                                  long long offset,
                                                  void *opaque);
J
Jiri Denemark 已提交
150 151
typedef int (*qemuMonitorDomainWatchdogCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
152 153
                                                 int action,
                                                 void *opaque);
J
Jiri Denemark 已提交
154 155 156 157
typedef int (*qemuMonitorDomainIOErrorCallback)(qemuMonitorPtr mon,
                                                virDomainObjPtr vm,
                                                const char *diskAlias,
                                                int action,
158 159
                                                const char *reason,
                                                void *opaque);
J
Jiri Denemark 已提交
160 161 162 163 164 165 166 167 168 169 170
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,
171 172
                                                 const char *saslUsername,
                                                 void *opaque);
J
Jiri Denemark 已提交
173 174 175 176
typedef int (*qemuMonitorDomainBlockJobCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
                                                 const char *diskAlias,
                                                 int type,
177 178
                                                 int status,
                                                 void *opaque);
J
Jiri Denemark 已提交
179 180 181
typedef int (*qemuMonitorDomainTrayChangeCallback)(qemuMonitorPtr mon,
                                                   virDomainObjPtr vm,
                                                   const char *devAlias,
182 183
                                                   int reason,
                                                   void *opaque);
J
Jiri Denemark 已提交
184
typedef int (*qemuMonitorDomainPMWakeupCallback)(qemuMonitorPtr mon,
185 186
                                                 virDomainObjPtr vm,
                                                 void *opaque);
J
Jiri Denemark 已提交
187
typedef int (*qemuMonitorDomainPMSuspendCallback)(qemuMonitorPtr mon,
188 189
                                                  virDomainObjPtr vm,
                                                  void *opaque);
J
Jiri Denemark 已提交
190 191
typedef int (*qemuMonitorDomainBalloonChangeCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
192 193
                                                      unsigned long long actual,
                                                      void *opaque);
J
Jiri Denemark 已提交
194
typedef int (*qemuMonitorDomainPMSuspendDiskCallback)(qemuMonitorPtr mon,
195 196
                                                      virDomainObjPtr vm,
                                                      void *opaque);
J
Jiri Denemark 已提交
197
typedef int (*qemuMonitorDomainGuestPanicCallback)(qemuMonitorPtr mon,
198
                                                   virDomainObjPtr vm,
199
                                                   qemuMonitorEventPanicInfoPtr info,
200
                                                   void *opaque);
J
Jiri Denemark 已提交
201 202
typedef int (*qemuMonitorDomainDeviceDeletedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
203 204
                                                      const char *devAlias,
                                                      void *opaque);
205 206 207 208
typedef int (*qemuMonitorDomainNicRxFilterChangedCallback)(qemuMonitorPtr mon,
                                                           virDomainObjPtr vm,
                                                           const char *devAlias,
                                                           void *opaque);
J
Jiri Denemark 已提交
209

210 211 212 213 214 215
typedef int (*qemuMonitorDomainSerialChangeCallback)(qemuMonitorPtr mon,
                                                     virDomainObjPtr vm,
                                                     const char *devAlias,
                                                     bool connected,
                                                     void *opaque);

216 217 218 219
typedef int (*qemuMonitorDomainSpiceMigratedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      void *opaque);

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

225 226 227 228 229
typedef int (*qemuMonitorDomainMigrationPassCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      int pass,
                                                      void *opaque);

230 231 232 233 234 235 236 237 238 239
typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qemuMonitorPtr mon,
                                                    virDomainObjPtr vm,
                                                    const char *alias,
                                                    const char *slotType,
                                                    const char *slot,
                                                    unsigned int source,
                                                    unsigned int status,
                                                    void *opaque);


240 241 242 243 244 245 246 247
typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon,
                                                       virDomainObjPtr vm,
                                                       const char *nodename,
                                                       unsigned long long threshold,
                                                       unsigned long long excess,
                                                       void *opaque);


248 249 250
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
J
Jiri Denemark 已提交
251 252 253 254
    qemuMonitorDestroyCallback destroy;
    qemuMonitorEofNotifyCallback eofNotify;
    qemuMonitorErrorNotifyCallback errorNotify;
    qemuMonitorDiskSecretLookupCallback diskSecretLookup;
255
    qemuMonitorDomainEventCallback domainEvent;
J
Jiri Denemark 已提交
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
    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;
273
    qemuMonitorDomainNicRxFilterChangedCallback domainNicRxFilterChanged;
274
    qemuMonitorDomainSerialChangeCallback domainSerialChange;
275
    qemuMonitorDomainSpiceMigratedCallback domainSpiceMigrated;
276
    qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
277
    qemuMonitorDomainMigrationPassCallback domainMigrationPass;
278
    qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
279
    qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
280 281
};

282
char *qemuMonitorEscapeArg(const char *in);
283
char *qemuMonitorUnescapeArg(const char *in);
284

285
qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm,
286
                               virDomainChrSourceDefPtr config,
E
Eric Blake 已提交
287
                               bool json,
288
                               unsigned long long timeout,
289 290
                               qemuMonitorCallbacksPtr cb,
                               void *opaque)
291
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
292 293
qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm,
                                 int sockfd,
E
Eric Blake 已提交
294
                                 bool json,
295 296
                                 qemuMonitorCallbacksPtr cb,
                                 void *opaque)
297
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
298

299 300
void qemuMonitorUnregister(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
301
void qemuMonitorClose(qemuMonitorPtr mon);
302

303 304
virErrorPtr qemuMonitorLastError(qemuMonitorPtr mon);

305
int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
306

307 308
int qemuMonitorSetLink(qemuMonitorPtr mon,
                       const char *name,
309 310
                       virDomainNetInterfaceLinkState state)
    ATTRIBUTE_NONNULL(2);
311

312
/* These APIs are for use by the internal Text/JSON monitor impl code only */
313
char *qemuMonitorNextCommandID(qemuMonitorPtr mon);
314 315
int qemuMonitorSend(qemuMonitorPtr mon,
                    qemuMonitorMessagePtr msg);
316 317 318 319
virJSONValuePtr qemuMonitorGetOptions(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
void qemuMonitorSetOptions(qemuMonitorPtr mon, virJSONValuePtr options)
    ATTRIBUTE_NONNULL(1);
320 321
int qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon,
                                     virDomainVideoDefPtr video,
C
Cao jin 已提交
322
                                     const char *videoName)
323
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
324 325 326
int qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
                                     virDomainVideoDefPtr video,
                                     const char *videoName)
327
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
328 329 330 331 332 333
int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
                                const char *cmd,
                                int scm_fd,
                                char **reply);
# define qemuMonitorHMPCommand(mon, cmd, reply) \
    qemuMonitorHMPCommandWithFd(mon, cmd, -1, reply)
334

335
/* XXX same comment about virConnectPtr as above */
336 337 338 339 340
int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
                             virConnectPtr conn,
                             const char *path,
                             char **secret,
                             size_t *secretLen);
341

342 343 344
int qemuMonitorEmitEvent(qemuMonitorPtr mon, const char *event,
                         long long seconds, unsigned int micros,
                         const char *details);
345 346 347 348
int qemuMonitorEmitShutdown(qemuMonitorPtr mon);
int qemuMonitorEmitReset(qemuMonitorPtr mon);
int qemuMonitorEmitPowerdown(qemuMonitorPtr mon);
int qemuMonitorEmitStop(qemuMonitorPtr mon);
349
int qemuMonitorEmitResume(qemuMonitorPtr mon);
350
int qemuMonitorEmitRTCChange(qemuMonitorPtr mon, long long offset);
351
int qemuMonitorEmitWatchdog(qemuMonitorPtr mon, int action);
352 353
int qemuMonitorEmitIOError(qemuMonitorPtr mon,
                           const char *diskAlias,
354 355
                           int action,
                           const char *reason);
356 357 358 359 360 361 362 363 364 365 366
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);
367 368 369
int qemuMonitorEmitTrayChange(qemuMonitorPtr mon,
                              const char *devAlias,
                              int reason);
O
Osier Yang 已提交
370
int qemuMonitorEmitPMWakeup(qemuMonitorPtr mon);
O
Osier Yang 已提交
371
int qemuMonitorEmitPMSuspend(qemuMonitorPtr mon);
372 373 374 375
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
                            const char *diskAlias,
                            int type,
                            int status);
376 377
int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon,
                                 unsigned long long actual);
378
int qemuMonitorEmitPMSuspendDisk(qemuMonitorPtr mon);
379 380
int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon,
                              qemuMonitorEventPanicInfoPtr info);
381 382
int qemuMonitorEmitDeviceDeleted(qemuMonitorPtr mon,
                                 const char *devAlias);
383 384
int qemuMonitorEmitNicRxFilterChanged(qemuMonitorPtr mon,
                                      const char *devAlias);
385 386 387
int qemuMonitorEmitSerialChange(qemuMonitorPtr mon,
                                const char *devAlias,
                                bool connected);
388
int qemuMonitorEmitSpiceMigrated(qemuMonitorPtr mon);
389 390
int qemuMonitorEmitMigrationStatus(qemuMonitorPtr mon,
                                   int status);
391 392
int qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
                                 int pass);
393

394 395 396 397 398 399 400
int qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
                               const char *alias,
                               const char *slotType,
                               const char *slot,
                               unsigned int source,
                               unsigned int status);

401 402 403 404 405
int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
                                  const char *nodename,
                                  unsigned long long threshold,
                                  unsigned long long excess);

406 407 408
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
                         virConnectPtr conn);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423

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,
424
    QEMU_MONITOR_VM_STATUS_GUEST_PANICKED,
425 426 427 428 429 430

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

431
int qemuMonitorCheck(qemuMonitorPtr mon);
432 433
int qemuMonitorGetStatus(qemuMonitorPtr mon,
                         bool *running,
434 435
                         virDomainPausedReason *reason)
    ATTRIBUTE_NONNULL(2);
436

437
int qemuMonitorSystemReset(qemuMonitorPtr mon);
438 439
int qemuMonitorSystemPowerdown(qemuMonitorPtr mon);

440
struct qemuMonitorQueryCpusEntry {
441
    int qemu_id; /* id of the cpu as reported by qemu */
442
    pid_t tid;
443
    char *qom_path;
444
    bool halted;
445 446 447 448
};
void qemuMonitorQueryCpusFree(struct qemuMonitorQueryCpusEntry *entries,
                              size_t nentries);

449

450 451 452 453 454 455 456 457 458 459 460
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;
461 462 463

    /* internal data */
    int enable_id;
464 465 466 467 468
};
void qemuMonitorQueryHotpluggableCpusFree(struct qemuMonitorQueryHotpluggableCpusEntry *entries,
                                          size_t nentries);


469 470
struct _qemuMonitorCPUInfo {
    pid_t tid;
471
    int id; /* order of enabling of the given cpu */
472
    int qemu_id; /* identifier of the cpu as reported by query-cpus */
473

474 475 476 477
    /* state data */
    bool online;
    bool hotpluggable;

478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
    /* topology info for hotplug purposes. Hotplug of given vcpu impossible if
     * all entries are -1 */
    int socket_id;
    int core_id;
    int thread_id;
    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;
493 494

    bool halted;
495 496 497 498 499 500
};
typedef struct _qemuMonitorCPUInfo qemuMonitorCPUInfo;
typedef qemuMonitorCPUInfo *qemuMonitorCPUInfoPtr;

void qemuMonitorCPUInfoFree(qemuMonitorCPUInfoPtr list,
                            size_t nitems);
501
int qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
502
                          qemuMonitorCPUInfoPtr *vcpus,
503 504
                          size_t maxvcpus,
                          bool hotplug);
505
virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, size_t maxvcpus);
506

507
int qemuMonitorGetVirtType(qemuMonitorPtr mon,
508
                           virDomainVirtType *virtType);
509
int qemuMonitorGetBalloonInfo(qemuMonitorPtr mon,
510
                              unsigned long long *currmem);
511
int qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
512
                              virDomainMemballoonDefPtr balloon,
513 514
                              virDomainMemoryStatPtr stats,
                              unsigned int nr_stats);
515
int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
516
                                    virDomainMemballoonDefPtr balloon,
517
                                    int period);
518

519
int qemuMonitorBlockIOStatusToError(const char *status);
520 521
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);

522 523 524 525 526 527 528 529 530 531 532
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;
533 534
    unsigned long long capacity;
    unsigned long long physical;
535 536 537

    /* value of wr_highest_offset is valid if it's non 0 or
     * if wr_highest_offset_valid is true */
538
    unsigned long long wr_highest_offset;
539
    bool wr_highest_offset_valid;
540 541 542
};

int qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
543 544
                                    virHashTablePtr *ret_stats,
                                    bool backingChain)
545
    ATTRIBUTE_NONNULL(2);
546

547
int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
548 549
                                        virHashTablePtr stats,
                                        bool backingChain)
550
    ATTRIBUTE_NONNULL(2);
551

552
int qemuMonitorBlockResize(qemuMonitorPtr mon,
553
                           const char *dev_name,
554
                           unsigned long long size);
555 556
int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
                              const char *password);
557 558 559 560 561 562 563
int qemuMonitorSetPassword(qemuMonitorPtr mon,
                           int type,
                           const char *password,
                           const char *action_if_connected);
int qemuMonitorExpirePassword(qemuMonitorPtr mon,
                              int type,
                              const char *expire_time);
564
int qemuMonitorSetBalloon(qemuMonitorPtr mon,
565
                          unsigned long long newmem);
566
int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
567

568 569

/* XXX should we pass the virDomainDiskDefPtr instead
570
 * and hide dev_name details inside monitor. Reconsider
571 572 573
 * this when doing the QMP implementation
 */
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
574
                          const char *dev_name,
575
                          bool force);
576
int qemuMonitorChangeMedia(qemuMonitorPtr mon,
577
                           const char *dev_name,
578 579
                           const char *newmedia,
                           const char *format);
580 581 582 583 584 585 586 587 588 589 590 591 592 593


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);

594 595 596
int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon,
                                    unsigned long long downtime);

597 598 599 600 601
int qemuMonitorGetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long *cacheSize);
int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long cacheSize);

602 603 604 605 606 607 608 609 610 611 612
typedef struct _qemuMonitorMigrationParams qemuMonitorMigrationParams;
typedef qemuMonitorMigrationParams *qemuMonitorMigrationParamsPtr;
struct _qemuMonitorMigrationParams {
    bool compressLevel_set;
    int compressLevel;

    bool compressThreads_set;
    int compressThreads;

    bool decompressThreads_set;
    int decompressThreads;
613 614 615 616 617 618

    bool cpuThrottleInitial_set;
    int cpuThrottleInitial;

    bool cpuThrottleIncrement_set;
    int cpuThrottleIncrement;
619 620 621 622 623

    /* Value is either NULL, "", or some string. NULL indicates no support;
     * whereas, some string value indicates we can support setting/clearing */
    char *migrateTLSAlias;
    char *migrateTLSHostname;
624 625
};

626 627 628 629
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
                                  qemuMonitorMigrationParamsPtr params);
int qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
                                  qemuMonitorMigrationParamsPtr params);
630

631
typedef enum {
632
    QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
633
    QEMU_MONITOR_MIGRATION_STATUS_SETUP,
634
    QEMU_MONITOR_MIGRATION_STATUS_ACTIVE,
635
    QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
636 637
    QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
    QEMU_MONITOR_MIGRATION_STATUS_ERROR,
638
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,
639 640 641
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,

    QEMU_MONITOR_MIGRATION_STATUS_LAST
642
} qemuMonitorMigrationStatus;
643

644 645
VIR_ENUM_DECL(qemuMonitorMigrationStatus)

646 647 648
typedef struct _qemuMonitorMigrationStats qemuMonitorMigrationStats;
typedef qemuMonitorMigrationStats *qemuMonitorMigrationStatsPtr;
struct _qemuMonitorMigrationStats {
649
    int status; /* qemuMonitorMigrationStatus */
650 651 652 653
    unsigned long long total_time;
    /* total or expected depending on status */
    bool downtime_set;
    unsigned long long downtime;
654 655 656 657 658 659 660
    /*
     * 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;
661 662 663 664

    unsigned long long ram_transferred;
    unsigned long long ram_remaining;
    unsigned long long ram_total;
665
    unsigned long long ram_bps;
666 667 668 669
    bool ram_duplicate_set;
    unsigned long long ram_duplicate;
    unsigned long long ram_normal;
    unsigned long long ram_normal_bytes;
670 671
    unsigned long long ram_dirty_rate;
    unsigned long long ram_iteration;
672 673 674 675

    unsigned long long disk_transferred;
    unsigned long long disk_remaining;
    unsigned long long disk_total;
676
    unsigned long long disk_bps;
677 678 679 680 681 682 683

    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;
684 685

    int cpu_throttle_percentage;
686 687
};

688 689
int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
                                 qemuMonitorMigrationStatsPtr stats);
690

691 692
typedef enum {
    QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
693
    QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
694
    QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
695
    QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
696
    QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY,
697
    QEMU_MONITOR_MIGRATION_CAPS_COMPRESS,
698 699 700 701 702 703

    QEMU_MONITOR_MIGRATION_CAPS_LAST
} qemuMonitorMigrationCaps;

VIR_ENUM_DECL(qemuMonitorMigrationCaps);

704 705
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
                                        char ***capabilities);
706 707 708
int qemuMonitorGetMigrationCapability(qemuMonitorPtr mon,
                                      qemuMonitorMigrationCaps capability);
int qemuMonitorSetMigrationCapability(qemuMonitorPtr mon,
709 710
                                      qemuMonitorMigrationCaps capability,
                                      bool state);
711

A
Andrea Bolognani 已提交
712 713 714
int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon,
                                  virGICCapability **capabilities);

715
typedef enum {
E
Eric Blake 已提交
716
  QEMU_MONITOR_MIGRATE_BACKGROUND	= 1 << 0,
717 718 719 720 721
  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 已提交
722 723 724 725
int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
                           unsigned int flags,
                           int fd);

726
int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
727
                             unsigned int flags,
728
                             const char *protocol,
729 730 731 732
                             const char *hostname,
                             int port);

int qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
733
                                unsigned int flags,
734 735
                                const char * const *argv);

736 737
int qemuMonitorMigrateCancel(qemuMonitorPtr mon);

738 739 740
int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
                                            const char *capability);

741
int qemuMonitorDumpToFd(qemuMonitorPtr mon,
742 743
                        int fd,
                        const char *dumpformat);
744

745 746 747 748 749 750
int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
                                int type,
                                const char *hostname,
                                int port,
                                int tlsPort,
                                const char *tlsSubject);
751 752 753 754

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

757 758
/* These two functions preserve previous error and only set their own
 * error if no error was set before.
759
 */
760 761
int qemuMonitorCloseFileHandle(qemuMonitorPtr mon,
                               const char *fdname);
762
int qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd);
763 764 765 766 767

/* XXX do we really want to hardcode 'netstr' as the
 * sendable item here
 */
int qemuMonitorAddHostNetwork(qemuMonitorPtr mon,
768
                              const char *netstr,
769 770
                              int *tapfd, char **tapfdName, int tapfdSize,
                              int *vhostfd, char **vhostfdName, int vhostfdSize);
771 772 773 774 775

int qemuMonitorRemoveHostNetwork(qemuMonitorPtr mon,
                                 int vlan,
                                 const char *netname);

776
int qemuMonitorAddNetdev(qemuMonitorPtr mon,
777
                         const char *netdevstr,
778 779
                         int *tapfd, char **tapfdName, int tapfdSize,
                         int *vhostfd, char **vhostfdName, int vhostfdSize);
780 781 782 783

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

784 785 786
int qemuMonitorQueryRxFilter(qemuMonitorPtr mon, const char *alias,
                             virNetDevRxFilterPtr *filter);

787 788 789 790 791 792
typedef struct _qemuMonitorChardevInfo qemuMonitorChardevInfo;
typedef qemuMonitorChardevInfo *qemuMonitorChardevInfoPtr;
struct _qemuMonitorChardevInfo {
    char *ptyPath;
    virDomainChrDeviceState state;
};
793
void qemuMonitorChardevInfoFree(void *data, const void *name);
794 795
int qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
                              virHashTablePtr *retinfo);
796

797 798
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
                                       const char *bus,
799
                                       virPCIDeviceAddress *guestAddr);
800

801 802
int qemuMonitorAddDeviceArgs(qemuMonitorPtr mon,
                             virJSONValuePtr args);
803 804 805
int qemuMonitorAddDevice(qemuMonitorPtr mon,
                         const char *devicestr);

806 807 808 809 810
int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
                               const char *devicestr,
                               int fd,
                               const char *fdname);

811
int qemuMonitorDelDevice(qemuMonitorPtr mon,
812
                         const char *devalias);
813

814 815 816 817 818 819 820 821
int qemuMonitorAddObject(qemuMonitorPtr mon,
                         const char *type,
                         const char *objalias,
                         virJSONValuePtr props);

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

822 823 824
int qemuMonitorAddDrive(qemuMonitorPtr mon,
                        const char *drivestr);

825
int qemuMonitorDriveDel(qemuMonitorPtr mon,
826 827
                        const char *drivestr);

828 829 830 831
int qemuMonitorSetDrivePassphrase(qemuMonitorPtr mon,
                                  const char *alias,
                                  const char *passphrase);

C
Chris Lalancette 已提交
832 833 834 835
int qemuMonitorCreateSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorLoadSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const char *name);

836
int qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
837
                            virJSONValuePtr actions,
838
                            const char *device,
839 840 841
                            const char *file,
                            const char *format,
                            bool reuse);
842
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
843
    ATTRIBUTE_NONNULL(2);
844 845 846 847
int qemuMonitorDriveMirror(qemuMonitorPtr mon,
                           const char *device,
                           const char *file,
                           const char *format,
848
                           unsigned long long bandwidth,
849 850
                           unsigned int granularity,
                           unsigned long long buf_size,
851
                           unsigned int flags)
852
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
853
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
854
                          const char *device)
855
    ATTRIBUTE_NONNULL(2);
856

857 858 859 860
int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                           const char *device,
                           const char *top,
                           const char *base,
861
                           const char *backingName,
862
                           unsigned long long bandwidth)
863
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
864
bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
865 866 867 868
char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
                                const char *device,
                                virStorageSourcePtr top,
                                virStorageSourcePtr target)
869
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
870

871 872 873 874
int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
                                const char *cmd,
                                char **reply,
                                bool hmp);
875

876 877
int qemuMonitorInjectNMI(qemuMonitorPtr mon);

878 879 880
int qemuMonitorScreendump(qemuMonitorPtr mon,
                          const char *file);

881 882 883 884 885
int qemuMonitorSendKey(qemuMonitorPtr mon,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       unsigned int nkeycodes);

886 887 888 889 890 891
int qemuMonitorBlockStream(qemuMonitorPtr mon,
                           const char *device,
                           const char *base,
                           const char *backingName,
                           unsigned long long bandwidth,
                           bool modern)
892
    ATTRIBUTE_NONNULL(2);
893

894 895 896
int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
                              const char *device,
                              bool modern)
897
    ATTRIBUTE_NONNULL(2);
898

899 900 901 902 903
int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
                                const char *device,
                                unsigned long long bandwidth,
                                bool modern);

904 905 906 907 908 909 910
typedef struct _qemuMonitorBlockJobInfo qemuMonitorBlockJobInfo;
typedef qemuMonitorBlockJobInfo *qemuMonitorBlockJobInfoPtr;
struct _qemuMonitorBlockJobInfo {
    int type; /* virDomainBlockJobType */
    unsigned long long bandwidth; /* in bytes/s */
    virDomainBlockJobCursor cur;
    virDomainBlockJobCursor end;
911
    int ready; /* -1 if unknown, 0 if not ready, 1 if ready */
912 913 914 915 916 917
};

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

920 921 922 923 924 925
int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
                            const char *protocol,
                            int fd,
                            const char *fdname,
                            bool skipauth);

926 927
int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
                                  const char *device,
928
                                  virDomainBlockIoTuneInfoPtr info,
929
                                  bool supportMaxOptions,
930
                                  bool supportGroupNameOption,
931
                                  bool supportMaxLengthOptions);
932 933 934

int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
                                  const char *device,
935
                                  virDomainBlockIoTuneInfoPtr reply);
936

937 938
int qemuMonitorSystemWakeup(qemuMonitorPtr mon);

939 940 941 942 943 944 945
int qemuMonitorGetVersion(qemuMonitorPtr mon,
                          int *major,
                          int *minor,
                          int *micro,
                          char **package)
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);

946 947 948 949 950 951 952 953

typedef struct _qemuMonitorMachineInfo qemuMonitorMachineInfo;
typedef qemuMonitorMachineInfo *qemuMonitorMachineInfoPtr;

struct _qemuMonitorMachineInfo {
    char *name;
    bool isDefault;
    char *alias;
954
    unsigned int maxCpus;
955
    bool hotplugCpus;
956 957 958 959 960 961 962
};

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

void qemuMonitorMachineInfoFree(qemuMonitorMachineInfoPtr machine);

963 964 965 966
typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo;
typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;

struct _qemuMonitorCPUDefInfo {
967
    virTristateBool usable;
968 969 970
    char *name;
};

971
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
972 973
                                 qemuMonitorCPUDefInfoPtr **cpus);
void qemuMonitorCPUDefInfoFree(qemuMonitorCPUDefInfoPtr cpu);
974

975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994
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;
995
    virTristateBool migratable;
996 997
};

998 999 1000 1001 1002 1003
typedef struct _qemuMonitorCPUModelInfo qemuMonitorCPUModelInfo;
typedef qemuMonitorCPUModelInfo *qemuMonitorCPUModelInfoPtr;

struct _qemuMonitorCPUModelInfo {
    char *name;
    size_t nprops;
1004
    qemuMonitorCPUPropertyPtr props;
1005
    bool migratability;
1006 1007
};

1008 1009
typedef enum {
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC,
1010 1011
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL,
    QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
1012 1013
} qemuMonitorCPUModelExpansionType;

1014
int qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon,
1015
                                    qemuMonitorCPUModelExpansionType type,
1016 1017 1018 1019 1020 1021 1022 1023
                                    const char *model_name,
                                    qemuMonitorCPUModelInfoPtr *model_info);

void qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfoPtr model_info);

qemuMonitorCPUModelInfoPtr
qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig);

1024 1025
int qemuMonitorGetCommands(qemuMonitorPtr mon,
                           char ***commands);
1026 1027
int qemuMonitorGetEvents(qemuMonitorPtr mon,
                         char ***events);
1028 1029
int qemuMonitorGetCommandLineOptionParameters(qemuMonitorPtr mon,
                                              const char *option,
1030 1031
                                              char ***params,
                                              bool *found);
1032

1033 1034 1035 1036
int qemuMonitorGetKVMState(qemuMonitorPtr mon,
                           bool *enabled,
                           bool *present);

1037 1038
int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
                              char ***types);
1039 1040 1041
int qemuMonitorGetObjectProps(qemuMonitorPtr mon,
                              const char *type,
                              char ***props);
1042
char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
1043

1044 1045 1046
int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
                              const char *host,
                              unsigned int port);
1047 1048 1049
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
                            const char *deviceID,
                            bool writable);
1050
int qemuMonitorNBDServerStop(qemuMonitorPtr);
S
Stefan Berger 已提交
1051 1052 1053 1054 1055 1056
int qemuMonitorGetTPMModels(qemuMonitorPtr mon,
                            char ***tpmmodels);

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

1057 1058 1059
int qemuMonitorAttachCharDev(qemuMonitorPtr mon,
                             const char *chrID,
                             virDomainChrSourceDefPtr chr);
1060 1061
int qemuMonitorDetachCharDev(qemuMonitorPtr mon,
                             const char *chrID);
1062 1063 1064 1065

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

1066 1067 1068 1069 1070 1071 1072
typedef void (*qemuMonitorReportDomainLogError)(qemuMonitorPtr mon,
                                                const char *msg,
                                                void *opaque);
void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
                             qemuMonitorReportDomainLogError func,
                             void *opaque,
                             virFreeCallback destroy);
1073

1074 1075
int qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
                           virArch arch,
1076 1077
                           virCPUDataPtr *data,
                           virCPUDataPtr *disabled);
1078

1079 1080
int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);

1081 1082
typedef struct _qemuMonitorIOThreadInfo qemuMonitorIOThreadInfo;
typedef qemuMonitorIOThreadInfo *qemuMonitorIOThreadInfoPtr;
1083

1084
struct _qemuMonitorIOThreadInfo {
1085
    unsigned int iothread_id;
1086 1087 1088
    int thread_id;
};
int qemuMonitorGetIOThreads(qemuMonitorPtr mon,
1089
                            qemuMonitorIOThreadInfoPtr **iothreads);
1090

1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104
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);

1105 1106 1107
int qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
                               const char *uri);

1108 1109
int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon);

1110 1111 1112
int qemuMonitorGetRTCTime(qemuMonitorPtr mon,
                          struct tm *tm);

1113 1114
virHashTablePtr qemuMonitorQueryQMPSchema(qemuMonitorPtr mon);

1115 1116 1117 1118
int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon,
                                 const char *nodename,
                                 unsigned long long threshold);

1119
virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon);
1120

1121
#endif /* QEMU_MONITOR_H */