qemu_monitor.h 44.3 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;
};

J
Jiri Denemark 已提交
73 74

typedef void (*qemuMonitorDestroyCallback)(qemuMonitorPtr mon,
75 76
                                           virDomainObjPtr vm,
                                           void *opaque);
J
Jiri Denemark 已提交
77
typedef void (*qemuMonitorEofNotifyCallback)(qemuMonitorPtr mon,
78 79
                                             virDomainObjPtr vm,
                                             void *opaque);
J
Jiri Denemark 已提交
80
typedef void (*qemuMonitorErrorNotifyCallback)(qemuMonitorPtr mon,
81 82
                                               virDomainObjPtr vm,
                                               void *opaque);
J
Jiri Denemark 已提交
83 84 85 86 87 88 89 90 91 92
/* 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,
93 94
                                                   size_t *secretLen,
                                                   void *opaque);
95 96 97 98 99 100 101
typedef int (*qemuMonitorDomainEventCallback)(qemuMonitorPtr mon,
                                              virDomainObjPtr vm,
                                              const char *event,
                                              long long seconds,
                                              unsigned int micros,
                                              const char *details,
                                              void *opaque);
J
Jiri Denemark 已提交
102
typedef int (*qemuMonitorDomainShutdownCallback)(qemuMonitorPtr mon,
103 104
                                                 virDomainObjPtr vm,
                                                 void *opaque);
J
Jiri Denemark 已提交
105
typedef int (*qemuMonitorDomainResetCallback)(qemuMonitorPtr mon,
106 107
                                              virDomainObjPtr vm,
                                              void *opaque);
J
Jiri Denemark 已提交
108
typedef int (*qemuMonitorDomainPowerdownCallback)(qemuMonitorPtr mon,
109 110
                                                  virDomainObjPtr vm,
                                                  void *opaque);
J
Jiri Denemark 已提交
111
typedef int (*qemuMonitorDomainStopCallback)(qemuMonitorPtr mon,
112 113
                                             virDomainObjPtr vm,
                                             void *opaque);
J
Jiri Denemark 已提交
114
typedef int (*qemuMonitorDomainResumeCallback)(qemuMonitorPtr mon,
115 116
                                               virDomainObjPtr vm,
                                               void *opaque);
J
Jiri Denemark 已提交
117 118
typedef int (*qemuMonitorDomainRTCChangeCallback)(qemuMonitorPtr mon,
                                                  virDomainObjPtr vm,
119 120
                                                  long long offset,
                                                  void *opaque);
J
Jiri Denemark 已提交
121 122
typedef int (*qemuMonitorDomainWatchdogCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
123 124
                                                 int action,
                                                 void *opaque);
J
Jiri Denemark 已提交
125 126 127 128
typedef int (*qemuMonitorDomainIOErrorCallback)(qemuMonitorPtr mon,
                                                virDomainObjPtr vm,
                                                const char *diskAlias,
                                                int action,
129 130
                                                const char *reason,
                                                void *opaque);
J
Jiri Denemark 已提交
131 132 133 134 135 136 137 138 139 140 141
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,
142 143
                                                 const char *saslUsername,
                                                 void *opaque);
J
Jiri Denemark 已提交
144 145 146 147
typedef int (*qemuMonitorDomainBlockJobCallback)(qemuMonitorPtr mon,
                                                 virDomainObjPtr vm,
                                                 const char *diskAlias,
                                                 int type,
148 149
                                                 int status,
                                                 void *opaque);
J
Jiri Denemark 已提交
150 151 152
typedef int (*qemuMonitorDomainTrayChangeCallback)(qemuMonitorPtr mon,
                                                   virDomainObjPtr vm,
                                                   const char *devAlias,
153 154
                                                   int reason,
                                                   void *opaque);
J
Jiri Denemark 已提交
155
typedef int (*qemuMonitorDomainPMWakeupCallback)(qemuMonitorPtr mon,
156 157
                                                 virDomainObjPtr vm,
                                                 void *opaque);
J
Jiri Denemark 已提交
158
typedef int (*qemuMonitorDomainPMSuspendCallback)(qemuMonitorPtr mon,
159 160
                                                  virDomainObjPtr vm,
                                                  void *opaque);
J
Jiri Denemark 已提交
161 162
typedef int (*qemuMonitorDomainBalloonChangeCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
163 164
                                                      unsigned long long actual,
                                                      void *opaque);
J
Jiri Denemark 已提交
165
typedef int (*qemuMonitorDomainPMSuspendDiskCallback)(qemuMonitorPtr mon,
166 167
                                                      virDomainObjPtr vm,
                                                      void *opaque);
J
Jiri Denemark 已提交
168
typedef int (*qemuMonitorDomainGuestPanicCallback)(qemuMonitorPtr mon,
169 170
                                                   virDomainObjPtr vm,
                                                   void *opaque);
J
Jiri Denemark 已提交
171 172
typedef int (*qemuMonitorDomainDeviceDeletedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
173 174
                                                      const char *devAlias,
                                                      void *opaque);
175 176 177 178
typedef int (*qemuMonitorDomainNicRxFilterChangedCallback)(qemuMonitorPtr mon,
                                                           virDomainObjPtr vm,
                                                           const char *devAlias,
                                                           void *opaque);
J
Jiri Denemark 已提交
179

180 181 182 183 184 185
typedef int (*qemuMonitorDomainSerialChangeCallback)(qemuMonitorPtr mon,
                                                     virDomainObjPtr vm,
                                                     const char *devAlias,
                                                     bool connected,
                                                     void *opaque);

186 187 188 189
typedef int (*qemuMonitorDomainSpiceMigratedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      void *opaque);

190 191 192 193 194
typedef int (*qemuMonitorDomainMigrationStatusCallback)(qemuMonitorPtr mon,
                                                        virDomainObjPtr vm,
                                                        int status,
                                                        void *opaque);

195 196 197 198 199
typedef int (*qemuMonitorDomainMigrationPassCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      int pass,
                                                      void *opaque);

200 201 202 203 204 205 206 207 208 209
typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qemuMonitorPtr mon,
                                                    virDomainObjPtr vm,
                                                    const char *alias,
                                                    const char *slotType,
                                                    const char *slot,
                                                    unsigned int source,
                                                    unsigned int status,
                                                    void *opaque);


210 211 212 213 214 215 216 217
typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon,
                                                       virDomainObjPtr vm,
                                                       const char *nodename,
                                                       unsigned long long threshold,
                                                       unsigned long long excess,
                                                       void *opaque);


218 219 220
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
J
Jiri Denemark 已提交
221 222 223 224
    qemuMonitorDestroyCallback destroy;
    qemuMonitorEofNotifyCallback eofNotify;
    qemuMonitorErrorNotifyCallback errorNotify;
    qemuMonitorDiskSecretLookupCallback diskSecretLookup;
225
    qemuMonitorDomainEventCallback domainEvent;
J
Jiri Denemark 已提交
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
    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;
243
    qemuMonitorDomainNicRxFilterChangedCallback domainNicRxFilterChanged;
244
    qemuMonitorDomainSerialChangeCallback domainSerialChange;
245
    qemuMonitorDomainSpiceMigratedCallback domainSpiceMigrated;
246
    qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
247
    qemuMonitorDomainMigrationPassCallback domainMigrationPass;
248
    qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
249
    qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
250 251
};

252
char *qemuMonitorEscapeArg(const char *in);
253
char *qemuMonitorUnescapeArg(const char *in);
254

255
qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm,
256
                               virDomainChrSourceDefPtr config,
E
Eric Blake 已提交
257
                               bool json,
258
                               unsigned long long timeout,
259 260
                               qemuMonitorCallbacksPtr cb,
                               void *opaque)
261
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
262 263
qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm,
                                 int sockfd,
E
Eric Blake 已提交
264
                                 bool json,
265 266
                                 qemuMonitorCallbacksPtr cb,
                                 void *opaque)
267
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);
268

269 270
void qemuMonitorUnregister(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
271
void qemuMonitorClose(qemuMonitorPtr mon);
272

273 274
virErrorPtr qemuMonitorLastError(qemuMonitorPtr mon);

275
int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
276

277 278
int qemuMonitorSetLink(qemuMonitorPtr mon,
                       const char *name,
279 280
                       virDomainNetInterfaceLinkState state)
    ATTRIBUTE_NONNULL(2);
281

282
/* These APIs are for use by the internal Text/JSON monitor impl code only */
283
char *qemuMonitorNextCommandID(qemuMonitorPtr mon);
284 285
int qemuMonitorSend(qemuMonitorPtr mon,
                    qemuMonitorMessagePtr msg);
286 287 288 289
virJSONValuePtr qemuMonitorGetOptions(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
void qemuMonitorSetOptions(qemuMonitorPtr mon, virJSONValuePtr options)
    ATTRIBUTE_NONNULL(1);
290 291
int qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon,
                                     virDomainVideoDefPtr video,
C
Cao jin 已提交
292
                                     const char *videoName)
293
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
294 295 296
int qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
                                     virDomainVideoDefPtr video,
                                     const char *videoName)
297
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
298 299 300 301 302 303
int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon,
                                const char *cmd,
                                int scm_fd,
                                char **reply);
# define qemuMonitorHMPCommand(mon, cmd, reply) \
    qemuMonitorHMPCommandWithFd(mon, cmd, -1, reply)
304

305
/* XXX same comment about virConnectPtr as above */
306 307 308 309 310
int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
                             virConnectPtr conn,
                             const char *path,
                             char **secret,
                             size_t *secretLen);
311

312 313 314
int qemuMonitorEmitEvent(qemuMonitorPtr mon, const char *event,
                         long long seconds, unsigned int micros,
                         const char *details);
315 316 317 318
int qemuMonitorEmitShutdown(qemuMonitorPtr mon);
int qemuMonitorEmitReset(qemuMonitorPtr mon);
int qemuMonitorEmitPowerdown(qemuMonitorPtr mon);
int qemuMonitorEmitStop(qemuMonitorPtr mon);
319
int qemuMonitorEmitResume(qemuMonitorPtr mon);
320
int qemuMonitorEmitRTCChange(qemuMonitorPtr mon, long long offset);
321
int qemuMonitorEmitWatchdog(qemuMonitorPtr mon, int action);
322 323
int qemuMonitorEmitIOError(qemuMonitorPtr mon,
                           const char *diskAlias,
324 325
                           int action,
                           const char *reason);
326 327 328 329 330 331 332 333 334 335 336
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);
337 338 339
int qemuMonitorEmitTrayChange(qemuMonitorPtr mon,
                              const char *devAlias,
                              int reason);
O
Osier Yang 已提交
340
int qemuMonitorEmitPMWakeup(qemuMonitorPtr mon);
O
Osier Yang 已提交
341
int qemuMonitorEmitPMSuspend(qemuMonitorPtr mon);
342 343 344 345
int qemuMonitorEmitBlockJob(qemuMonitorPtr mon,
                            const char *diskAlias,
                            int type,
                            int status);
346 347
int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon,
                                 unsigned long long actual);
348
int qemuMonitorEmitPMSuspendDisk(qemuMonitorPtr mon);
349
int qemuMonitorEmitGuestPanic(qemuMonitorPtr mon);
350 351
int qemuMonitorEmitDeviceDeleted(qemuMonitorPtr mon,
                                 const char *devAlias);
352 353
int qemuMonitorEmitNicRxFilterChanged(qemuMonitorPtr mon,
                                      const char *devAlias);
354 355 356
int qemuMonitorEmitSerialChange(qemuMonitorPtr mon,
                                const char *devAlias,
                                bool connected);
357
int qemuMonitorEmitSpiceMigrated(qemuMonitorPtr mon);
358 359
int qemuMonitorEmitMigrationStatus(qemuMonitorPtr mon,
                                   int status);
360 361
int qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
                                 int pass);
362

363 364 365 366 367 368 369
int qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
                               const char *alias,
                               const char *slotType,
                               const char *slot,
                               unsigned int source,
                               unsigned int status);

370 371 372 373 374
int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
                                  const char *nodename,
                                  unsigned long long threshold,
                                  unsigned long long excess);

375 376 377
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
                         virConnectPtr conn);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392

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,
393
    QEMU_MONITOR_VM_STATUS_GUEST_PANICKED,
394 395 396 397 398 399

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

400
int qemuMonitorCheck(qemuMonitorPtr mon);
401 402
int qemuMonitorGetStatus(qemuMonitorPtr mon,
                         bool *running,
403 404
                         virDomainPausedReason *reason)
    ATTRIBUTE_NONNULL(2);
405

406
int qemuMonitorSystemReset(qemuMonitorPtr mon);
407 408
int qemuMonitorSystemPowerdown(qemuMonitorPtr mon);

409
struct qemuMonitorQueryCpusEntry {
410
    int qemu_id; /* id of the cpu as reported by qemu */
411
    pid_t tid;
412
    char *qom_path;
413
    bool halted;
414 415 416 417
};
void qemuMonitorQueryCpusFree(struct qemuMonitorQueryCpusEntry *entries,
                              size_t nentries);

418

419 420 421 422 423 424 425 426 427 428 429
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;
430 431 432

    /* internal data */
    int enable_id;
433 434 435 436 437
};
void qemuMonitorQueryHotpluggableCpusFree(struct qemuMonitorQueryHotpluggableCpusEntry *entries,
                                          size_t nentries);


438 439
struct _qemuMonitorCPUInfo {
    pid_t tid;
440
    int id; /* order of enabling of the given cpu */
441
    int qemu_id; /* identifier of the cpu as reported by query-cpus */
442

443 444 445 446
    /* state data */
    bool online;
    bool hotpluggable;

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

    bool halted;
464 465 466 467 468 469
};
typedef struct _qemuMonitorCPUInfo qemuMonitorCPUInfo;
typedef qemuMonitorCPUInfo *qemuMonitorCPUInfoPtr;

void qemuMonitorCPUInfoFree(qemuMonitorCPUInfoPtr list,
                            size_t nitems);
470
int qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
471
                          qemuMonitorCPUInfoPtr *vcpus,
472 473
                          size_t maxvcpus,
                          bool hotplug);
474
virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, size_t maxvcpus);
475

476
int qemuMonitorGetVirtType(qemuMonitorPtr mon,
477
                           virDomainVirtType *virtType);
478
int qemuMonitorGetBalloonInfo(qemuMonitorPtr mon,
479
                              unsigned long long *currmem);
480
int qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
481
                              virDomainMemballoonDefPtr balloon,
482 483
                              virDomainMemoryStatPtr stats,
                              unsigned int nr_stats);
484
int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
485
                                    virDomainMemballoonDefPtr balloon,
486
                                    int period);
487

488
int qemuMonitorBlockIOStatusToError(const char *status);
489 490
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);

491 492 493 494 495 496 497 498 499 500 501
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;
502 503
    unsigned long long capacity;
    unsigned long long physical;
504 505 506

    /* value of wr_highest_offset is valid if it's non 0 or
     * if wr_highest_offset_valid is true */
507
    unsigned long long wr_highest_offset;
508
    bool wr_highest_offset_valid;
509 510 511
};

int qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
512 513
                                    virHashTablePtr *ret_stats,
                                    bool backingChain)
514
    ATTRIBUTE_NONNULL(2);
515

516
int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
517 518
                                        virHashTablePtr stats,
                                        bool backingChain)
519
    ATTRIBUTE_NONNULL(2);
520

521
int qemuMonitorBlockResize(qemuMonitorPtr mon,
522
                           const char *dev_name,
523
                           unsigned long long size);
524 525
int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
                              const char *password);
526 527 528 529 530 531 532
int qemuMonitorSetPassword(qemuMonitorPtr mon,
                           int type,
                           const char *password,
                           const char *action_if_connected);
int qemuMonitorExpirePassword(qemuMonitorPtr mon,
                              int type,
                              const char *expire_time);
533
int qemuMonitorSetBalloon(qemuMonitorPtr mon,
534
                          unsigned long long newmem);
535
int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
536

537 538

/* XXX should we pass the virDomainDiskDefPtr instead
539
 * and hide dev_name details inside monitor. Reconsider
540 541 542
 * this when doing the QMP implementation
 */
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
543
                          const char *dev_name,
544
                          bool force);
545
int qemuMonitorChangeMedia(qemuMonitorPtr mon,
546
                           const char *dev_name,
547 548
                           const char *newmedia,
                           const char *format);
549 550 551 552 553 554 555 556 557 558 559 560 561 562


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

563 564 565
int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon,
                                    unsigned long long downtime);

566 567 568 569 570
int qemuMonitorGetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long *cacheSize);
int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long cacheSize);

571 572 573 574 575 576 577 578 579 580 581
typedef struct _qemuMonitorMigrationParams qemuMonitorMigrationParams;
typedef qemuMonitorMigrationParams *qemuMonitorMigrationParamsPtr;
struct _qemuMonitorMigrationParams {
    bool compressLevel_set;
    int compressLevel;

    bool compressThreads_set;
    int compressThreads;

    bool decompressThreads_set;
    int decompressThreads;
582 583 584 585 586 587

    bool cpuThrottleInitial_set;
    int cpuThrottleInitial;

    bool cpuThrottleIncrement_set;
    int cpuThrottleIncrement;
588 589 590 591 592

    /* 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;
593 594
};

595 596 597 598
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
                                  qemuMonitorMigrationParamsPtr params);
int qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
                                  qemuMonitorMigrationParamsPtr params);
599

600
typedef enum {
601
    QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
602
    QEMU_MONITOR_MIGRATION_STATUS_SETUP,
603
    QEMU_MONITOR_MIGRATION_STATUS_ACTIVE,
604
    QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
605 606
    QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
    QEMU_MONITOR_MIGRATION_STATUS_ERROR,
607
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,
608 609 610
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,

    QEMU_MONITOR_MIGRATION_STATUS_LAST
611
} qemuMonitorMigrationStatus;
612

613 614
VIR_ENUM_DECL(qemuMonitorMigrationStatus)

615 616 617
typedef struct _qemuMonitorMigrationStats qemuMonitorMigrationStats;
typedef qemuMonitorMigrationStats *qemuMonitorMigrationStatsPtr;
struct _qemuMonitorMigrationStats {
618
    int status; /* qemuMonitorMigrationStatus */
619 620 621 622
    unsigned long long total_time;
    /* total or expected depending on status */
    bool downtime_set;
    unsigned long long downtime;
623 624 625 626 627 628 629
    /*
     * 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;
630 631 632 633

    unsigned long long ram_transferred;
    unsigned long long ram_remaining;
    unsigned long long ram_total;
634
    unsigned long long ram_bps;
635 636 637 638
    bool ram_duplicate_set;
    unsigned long long ram_duplicate;
    unsigned long long ram_normal;
    unsigned long long ram_normal_bytes;
639 640
    unsigned long long ram_dirty_rate;
    unsigned long long ram_iteration;
641 642 643 644

    unsigned long long disk_transferred;
    unsigned long long disk_remaining;
    unsigned long long disk_total;
645
    unsigned long long disk_bps;
646 647 648 649 650 651 652

    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;
653 654

    int cpu_throttle_percentage;
655 656
};

657 658
int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
                                 qemuMonitorMigrationStatsPtr stats);
659

660 661
typedef enum {
    QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
662
    QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
663
    QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
664
    QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
665
    QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY,
666
    QEMU_MONITOR_MIGRATION_CAPS_COMPRESS,
667 668 669 670 671 672

    QEMU_MONITOR_MIGRATION_CAPS_LAST
} qemuMonitorMigrationCaps;

VIR_ENUM_DECL(qemuMonitorMigrationCaps);

673 674
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
                                        char ***capabilities);
675 676 677
int qemuMonitorGetMigrationCapability(qemuMonitorPtr mon,
                                      qemuMonitorMigrationCaps capability);
int qemuMonitorSetMigrationCapability(qemuMonitorPtr mon,
678 679
                                      qemuMonitorMigrationCaps capability,
                                      bool state);
680

A
Andrea Bolognani 已提交
681 682 683
int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon,
                                  virGICCapability **capabilities);

684
typedef enum {
E
Eric Blake 已提交
685
  QEMU_MONITOR_MIGRATE_BACKGROUND	= 1 << 0,
686 687 688 689 690
  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 已提交
691 692 693 694
int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
                           unsigned int flags,
                           int fd);

695
int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
696
                             unsigned int flags,
697
                             const char *protocol,
698 699 700 701
                             const char *hostname,
                             int port);

int qemuMonitorMigrateToCommand(qemuMonitorPtr mon,
702
                                unsigned int flags,
703 704
                                const char * const *argv);

705 706
int qemuMonitorMigrateCancel(qemuMonitorPtr mon);

707 708 709
int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
                                            const char *capability);

710
int qemuMonitorDumpToFd(qemuMonitorPtr mon,
711 712
                        int fd,
                        const char *dumpformat);
713

714 715 716 717 718 719
int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
                                int type,
                                const char *hostname,
                                int port,
                                int tlsPort,
                                const char *tlsSubject);
720 721 722 723

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

726 727
/* These two functions preserve previous error and only set their own
 * error if no error was set before.
728
 */
729 730
int qemuMonitorCloseFileHandle(qemuMonitorPtr mon,
                               const char *fdname);
731
int qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd);
732 733 734 735 736

/* XXX do we really want to hardcode 'netstr' as the
 * sendable item here
 */
int qemuMonitorAddHostNetwork(qemuMonitorPtr mon,
737
                              const char *netstr,
738 739
                              int *tapfd, char **tapfdName, int tapfdSize,
                              int *vhostfd, char **vhostfdName, int vhostfdSize);
740 741 742 743 744

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

745
int qemuMonitorAddNetdev(qemuMonitorPtr mon,
746
                         const char *netdevstr,
747 748
                         int *tapfd, char **tapfdName, int tapfdSize,
                         int *vhostfd, char **vhostfdName, int vhostfdSize);
749 750 751 752

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

753 754 755
int qemuMonitorQueryRxFilter(qemuMonitorPtr mon, const char *alias,
                             virNetDevRxFilterPtr *filter);

756 757 758 759 760 761
typedef struct _qemuMonitorChardevInfo qemuMonitorChardevInfo;
typedef qemuMonitorChardevInfo *qemuMonitorChardevInfoPtr;
struct _qemuMonitorChardevInfo {
    char *ptyPath;
    virDomainChrDeviceState state;
};
762
void qemuMonitorChardevInfoFree(void *data, const void *name);
763 764
int qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
                              virHashTablePtr *retinfo);
765

766 767
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
                                       const char *bus,
768
                                       virPCIDeviceAddress *guestAddr);
769

770 771
int qemuMonitorAddDeviceArgs(qemuMonitorPtr mon,
                             virJSONValuePtr args);
772 773 774
int qemuMonitorAddDevice(qemuMonitorPtr mon,
                         const char *devicestr);

775 776 777 778 779
int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
                               const char *devicestr,
                               int fd,
                               const char *fdname);

780
int qemuMonitorDelDevice(qemuMonitorPtr mon,
781
                         const char *devalias);
782

783 784 785 786 787 788 789 790
int qemuMonitorAddObject(qemuMonitorPtr mon,
                         const char *type,
                         const char *objalias,
                         virJSONValuePtr props);

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

791 792 793
int qemuMonitorAddDrive(qemuMonitorPtr mon,
                        const char *drivestr);

794
int qemuMonitorDriveDel(qemuMonitorPtr mon,
795 796
                        const char *drivestr);

797 798 799 800
int qemuMonitorSetDrivePassphrase(qemuMonitorPtr mon,
                                  const char *alias,
                                  const char *passphrase);

C
Chris Lalancette 已提交
801 802 803 804
int qemuMonitorCreateSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorLoadSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const char *name);

805
int qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
806
                            virJSONValuePtr actions,
807
                            const char *device,
808 809 810
                            const char *file,
                            const char *format,
                            bool reuse);
811
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
812
    ATTRIBUTE_NONNULL(2);
813 814 815 816
int qemuMonitorDriveMirror(qemuMonitorPtr mon,
                           const char *device,
                           const char *file,
                           const char *format,
817
                           unsigned long long bandwidth,
818 819
                           unsigned int granularity,
                           unsigned long long buf_size,
820
                           unsigned int flags)
821
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
822
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
823
                          const char *device)
824
    ATTRIBUTE_NONNULL(2);
825

826 827 828 829
int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                           const char *device,
                           const char *top,
                           const char *base,
830
                           const char *backingName,
831
                           unsigned long long bandwidth)
832
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
833
bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
834 835 836 837
char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
                                const char *device,
                                virStorageSourcePtr top,
                                virStorageSourcePtr target)
838
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
839

840 841 842 843
int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
                                const char *cmd,
                                char **reply,
                                bool hmp);
844

845 846
int qemuMonitorInjectNMI(qemuMonitorPtr mon);

847 848 849
int qemuMonitorScreendump(qemuMonitorPtr mon,
                          const char *file);

850 851 852 853 854
int qemuMonitorSendKey(qemuMonitorPtr mon,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       unsigned int nkeycodes);

855 856 857 858 859 860
int qemuMonitorBlockStream(qemuMonitorPtr mon,
                           const char *device,
                           const char *base,
                           const char *backingName,
                           unsigned long long bandwidth,
                           bool modern)
861
    ATTRIBUTE_NONNULL(2);
862

863 864 865
int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
                              const char *device,
                              bool modern)
866
    ATTRIBUTE_NONNULL(2);
867

868 869 870 871 872
int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
                                const char *device,
                                unsigned long long bandwidth,
                                bool modern);

873 874 875 876 877 878 879
typedef struct _qemuMonitorBlockJobInfo qemuMonitorBlockJobInfo;
typedef qemuMonitorBlockJobInfo *qemuMonitorBlockJobInfoPtr;
struct _qemuMonitorBlockJobInfo {
    int type; /* virDomainBlockJobType */
    unsigned long long bandwidth; /* in bytes/s */
    virDomainBlockJobCursor cur;
    virDomainBlockJobCursor end;
880
    int ready; /* -1 if unknown, 0 if not ready, 1 if ready */
881 882 883 884 885 886
};

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

889 890 891 892 893 894
int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
                            const char *protocol,
                            int fd,
                            const char *fdname,
                            bool skipauth);

895 896
int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
                                  const char *device,
897
                                  virDomainBlockIoTuneInfoPtr info,
898
                                  bool supportMaxOptions,
899
                                  bool supportGroupNameOption,
900
                                  bool supportMaxLengthOptions);
901 902 903

int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
                                  const char *device,
904
                                  virDomainBlockIoTuneInfoPtr reply);
905

906 907
int qemuMonitorSystemWakeup(qemuMonitorPtr mon);

908 909 910 911 912 913 914
int qemuMonitorGetVersion(qemuMonitorPtr mon,
                          int *major,
                          int *minor,
                          int *micro,
                          char **package)
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);

915 916 917 918 919 920 921 922

typedef struct _qemuMonitorMachineInfo qemuMonitorMachineInfo;
typedef qemuMonitorMachineInfo *qemuMonitorMachineInfoPtr;

struct _qemuMonitorMachineInfo {
    char *name;
    bool isDefault;
    char *alias;
923
    unsigned int maxCpus;
924
    bool hotplugCpus;
925 926 927 928 929 930 931
};

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

void qemuMonitorMachineInfoFree(qemuMonitorMachineInfoPtr machine);

932 933 934 935
typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo;
typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;

struct _qemuMonitorCPUDefInfo {
936
    virTristateBool usable;
937 938 939
    char *name;
};

940
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
941 942
                                 qemuMonitorCPUDefInfoPtr **cpus);
void qemuMonitorCPUDefInfoFree(qemuMonitorCPUDefInfoPtr cpu);
943

944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965
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;
};

966 967 968 969 970 971
typedef struct _qemuMonitorCPUModelInfo qemuMonitorCPUModelInfo;
typedef qemuMonitorCPUModelInfo *qemuMonitorCPUModelInfoPtr;

struct _qemuMonitorCPUModelInfo {
    char *name;
    size_t nprops;
972
    qemuMonitorCPUPropertyPtr props;
973 974
};

975 976
typedef enum {
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC,
977 978
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL,
    QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
979 980
} qemuMonitorCPUModelExpansionType;

981
int qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon,
982
                                    qemuMonitorCPUModelExpansionType type,
983 984 985 986 987 988 989 990
                                    const char *model_name,
                                    qemuMonitorCPUModelInfoPtr *model_info);

void qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfoPtr model_info);

qemuMonitorCPUModelInfoPtr
qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig);

991 992
int qemuMonitorGetCommands(qemuMonitorPtr mon,
                           char ***commands);
993 994
int qemuMonitorGetEvents(qemuMonitorPtr mon,
                         char ***events);
995 996
int qemuMonitorGetCommandLineOptionParameters(qemuMonitorPtr mon,
                                              const char *option,
997 998
                                              char ***params,
                                              bool *found);
999

1000 1001 1002 1003
int qemuMonitorGetKVMState(qemuMonitorPtr mon,
                           bool *enabled,
                           bool *present);

1004 1005
int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
                              char ***types);
1006 1007 1008
int qemuMonitorGetObjectProps(qemuMonitorPtr mon,
                              const char *type,
                              char ***props);
1009
char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
1010

1011 1012 1013
int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
                              const char *host,
                              unsigned int port);
1014 1015 1016
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
                            const char *deviceID,
                            bool writable);
1017
int qemuMonitorNBDServerStop(qemuMonitorPtr);
S
Stefan Berger 已提交
1018 1019 1020 1021 1022 1023
int qemuMonitorGetTPMModels(qemuMonitorPtr mon,
                            char ***tpmmodels);

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

1024 1025 1026
int qemuMonitorAttachCharDev(qemuMonitorPtr mon,
                             const char *chrID,
                             virDomainChrSourceDefPtr chr);
1027 1028
int qemuMonitorDetachCharDev(qemuMonitorPtr mon,
                             const char *chrID);
1029 1030 1031 1032

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

1033 1034 1035 1036 1037 1038 1039
typedef void (*qemuMonitorReportDomainLogError)(qemuMonitorPtr mon,
                                                const char *msg,
                                                void *opaque);
void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
                             qemuMonitorReportDomainLogError func,
                             void *opaque,
                             virFreeCallback destroy);
1040

1041 1042
int qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
                           virArch arch,
1043 1044
                           virCPUDataPtr *data,
                           virCPUDataPtr *disabled);
1045

1046 1047
int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);

1048 1049
typedef struct _qemuMonitorIOThreadInfo qemuMonitorIOThreadInfo;
typedef qemuMonitorIOThreadInfo *qemuMonitorIOThreadInfoPtr;
1050

1051
struct _qemuMonitorIOThreadInfo {
1052
    unsigned int iothread_id;
1053 1054 1055
    int thread_id;
};
int qemuMonitorGetIOThreads(qemuMonitorPtr mon,
1056
                            qemuMonitorIOThreadInfoPtr **iothreads);
1057

1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071
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);

1072 1073 1074
int qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
                               const char *uri);

1075 1076
int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon);

1077 1078 1079
int qemuMonitorGetRTCTime(qemuMonitorPtr mon,
                          struct tm *tm);

1080 1081
virHashTablePtr qemuMonitorQueryQMPSchema(qemuMonitorPtr mon);

1082 1083 1084 1085
int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon,
                                 const char *nodename,
                                 unsigned long long threshold);

1086
virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon);
1087

1088
#endif /* QEMU_MONITOR_H */