qemu_monitor.h 46.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
typedef enum {
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_NONE = 0,
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_HYPERV,
76
    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_S390,
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

    QEMU_MONITOR_EVENT_PANIC_INFO_TYPE_LAST
} qemuMonitorEventPanicInfoType;

typedef struct _qemuMonitorEventPanicInfoHyperv qemuMonitorEventPanicInfoHyperv;
typedef qemuMonitorEventPanicInfoHyperv *qemuMonitorEventPanicInfoHypervPtr;
struct _qemuMonitorEventPanicInfoHyperv {
    /* Hyper-V specific guest panic information (HV crash MSRs) */
    unsigned long long arg1;
    unsigned long long arg2;
    unsigned long long arg3;
    unsigned long long arg4;
    unsigned long long arg5;
};

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

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

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

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

218 219 220 221 222 223
typedef int (*qemuMonitorDomainSerialChangeCallback)(qemuMonitorPtr mon,
                                                     virDomainObjPtr vm,
                                                     const char *devAlias,
                                                     bool connected,
                                                     void *opaque);

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

228 229 230 231 232
typedef int (*qemuMonitorDomainMigrationStatusCallback)(qemuMonitorPtr mon,
                                                        virDomainObjPtr vm,
                                                        int status,
                                                        void *opaque);

233 234 235 236 237
typedef int (*qemuMonitorDomainMigrationPassCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      int pass,
                                                      void *opaque);

238 239 240 241 242 243 244 245 246 247
typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qemuMonitorPtr mon,
                                                    virDomainObjPtr vm,
                                                    const char *alias,
                                                    const char *slotType,
                                                    const char *slot,
                                                    unsigned int source,
                                                    unsigned int status,
                                                    void *opaque);


248 249 250 251 252 253 254 255
typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon,
                                                       virDomainObjPtr vm,
                                                       const char *nodename,
                                                       unsigned long long threshold,
                                                       unsigned long long excess,
                                                       void *opaque);


256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
typedef enum {
    QEMU_MONITOR_DUMP_STATUS_NONE,
    QEMU_MONITOR_DUMP_STATUS_ACTIVE,
    QEMU_MONITOR_DUMP_STATUS_COMPLETED,
    QEMU_MONITOR_DUMP_STATUS_FAILED,

    QEMU_MONITOR_DUMP_STATUS_LAST,
} qemuMonitorDumpStatus;

VIR_ENUM_DECL(qemuMonitorDumpStatus)

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

275 276 277 278 279 280 281
typedef int (*qemuMonitorDomainDumpCompletedCallback)(qemuMonitorPtr mon,
                                                      virDomainObjPtr vm,
                                                      int status,
                                                      qemuMonitorDumpStatsPtr stats,
                                                      const char *error,
                                                      void *opaque);

282 283 284
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
J
Jiri Denemark 已提交
285 286 287 288
    qemuMonitorDestroyCallback destroy;
    qemuMonitorEofNotifyCallback eofNotify;
    qemuMonitorErrorNotifyCallback errorNotify;
    qemuMonitorDiskSecretLookupCallback diskSecretLookup;
289
    qemuMonitorDomainEventCallback domainEvent;
J
Jiri Denemark 已提交
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
    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;
307
    qemuMonitorDomainNicRxFilterChangedCallback domainNicRxFilterChanged;
308
    qemuMonitorDomainSerialChangeCallback domainSerialChange;
309
    qemuMonitorDomainSpiceMigratedCallback domainSpiceMigrated;
310
    qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
311
    qemuMonitorDomainMigrationPassCallback domainMigrationPass;
312
    qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
313
    qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
314
    qemuMonitorDomainDumpCompletedCallback domainDumpCompleted;
315 316
};

317
char *qemuMonitorEscapeArg(const char *in);
318
char *qemuMonitorUnescapeArg(const char *in);
319

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

334 335
bool qemuMonitorRegister(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
336 337
void qemuMonitorUnregister(qemuMonitorPtr mon)
    ATTRIBUTE_NONNULL(1);
338
void qemuMonitorClose(qemuMonitorPtr mon);
339

340 341
virErrorPtr qemuMonitorLastError(qemuMonitorPtr mon);

342
int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
343

344 345
int qemuMonitorSetLink(qemuMonitorPtr mon,
                       const char *name,
346 347
                       virDomainNetInterfaceLinkState state)
    ATTRIBUTE_NONNULL(2);
348

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

372 373 374 375
int qemuMonitorGetDiskSecret(qemuMonitorPtr mon,
                             const char *path,
                             char **secret,
                             size_t *secretLen);
376

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

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

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

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

447
int qemuMonitorStartCPUs(qemuMonitorPtr mon);
448
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463

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,
464
    QEMU_MONITOR_VM_STATUS_GUEST_PANICKED,
465 466 467 468 469 470

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

471
int qemuMonitorCheck(qemuMonitorPtr mon);
472 473
int qemuMonitorGetStatus(qemuMonitorPtr mon,
                         bool *running,
474 475
                         virDomainPausedReason *reason)
    ATTRIBUTE_NONNULL(2);
476

477
int qemuMonitorSystemReset(qemuMonitorPtr mon);
478 479
int qemuMonitorSystemPowerdown(qemuMonitorPtr mon);

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

489

490 491 492 493 494 495 496 497 498 499 500
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;
501 502 503

    /* internal data */
    int enable_id;
504 505 506 507 508
};
void qemuMonitorQueryHotpluggableCpusFree(struct qemuMonitorQueryHotpluggableCpusEntry *entries,
                                          size_t nentries);


509 510
struct _qemuMonitorCPUInfo {
    pid_t tid;
511
    int id; /* order of enabling of the given cpu */
512
    int qemu_id; /* identifier of the cpu as reported by query-cpus */
513

514 515 516 517
    /* state data */
    bool online;
    bool hotpluggable;

518 519 520 521 522
    /* topology info for hotplug purposes. Hotplug of given vcpu impossible if
     * all entries are -1 */
    int socket_id;
    int core_id;
    int thread_id;
523
    int node_id;
524 525 526 527 528 529 530 531 532 533
    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;
534 535

    bool halted;
536 537 538 539 540 541
};
typedef struct _qemuMonitorCPUInfo qemuMonitorCPUInfo;
typedef qemuMonitorCPUInfo *qemuMonitorCPUInfoPtr;

void qemuMonitorCPUInfoFree(qemuMonitorCPUInfoPtr list,
                            size_t nitems);
542
int qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
543
                          qemuMonitorCPUInfoPtr *vcpus,
544 545
                          size_t maxvcpus,
                          bool hotplug);
546
virBitmapPtr qemuMonitorGetCpuHalted(qemuMonitorPtr mon, size_t maxvcpus);
547

548
int qemuMonitorGetVirtType(qemuMonitorPtr mon,
549
                           virDomainVirtType *virtType);
550
int qemuMonitorGetBalloonInfo(qemuMonitorPtr mon,
551
                              unsigned long long *currmem);
552
int qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
553
                              virDomainMemballoonDefPtr balloon,
554 555
                              virDomainMemoryStatPtr stats,
                              unsigned int nr_stats);
556
int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
557
                                    virDomainMemballoonDefPtr balloon,
558
                                    int period);
559

560
int qemuMonitorBlockIOStatusToError(const char *status);
561 562
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);

563 564
virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon);

565 566 567 568 569 570 571 572 573 574 575
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;
576 577
    unsigned long long capacity;
    unsigned long long physical;
578 579 580

    /* value of wr_highest_offset is valid if it's non 0 or
     * if wr_highest_offset_valid is true */
581
    unsigned long long wr_highest_offset;
582
    bool wr_highest_offset_valid;
583 584 585
};

int qemuMonitorGetAllBlockStatsInfo(qemuMonitorPtr mon,
586 587
                                    virHashTablePtr *ret_stats,
                                    bool backingChain)
588
    ATTRIBUTE_NONNULL(2);
589

590
int qemuMonitorBlockStatsUpdateCapacity(qemuMonitorPtr mon,
591 592
                                        virHashTablePtr stats,
                                        bool backingChain)
593
    ATTRIBUTE_NONNULL(2);
594

595
int qemuMonitorBlockResize(qemuMonitorPtr mon,
596
                           const char *dev_name,
597
                           unsigned long long size);
598 599
int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
                              const char *password);
600 601 602 603 604 605 606
int qemuMonitorSetPassword(qemuMonitorPtr mon,
                           int type,
                           const char *password,
                           const char *action_if_connected);
int qemuMonitorExpirePassword(qemuMonitorPtr mon,
                              int type,
                              const char *expire_time);
607
int qemuMonitorSetBalloon(qemuMonitorPtr mon,
608
                          unsigned long long newmem);
609
int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
610

611 612

/* XXX should we pass the virDomainDiskDefPtr instead
613
 * and hide dev_name details inside monitor. Reconsider
614 615 616
 * this when doing the QMP implementation
 */
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
617
                          const char *dev_name,
618
                          bool force);
619
int qemuMonitorChangeMedia(qemuMonitorPtr mon,
620
                           const char *dev_name,
621 622
                           const char *newmedia,
                           const char *format);
623 624 625 626 627 628 629 630 631 632 633 634 635 636


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

637 638 639
int qemuMonitorSetMigrationDowntime(qemuMonitorPtr mon,
                                    unsigned long long downtime);

640 641 642 643 644
int qemuMonitorGetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long *cacheSize);
int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon,
                                     unsigned long long cacheSize);

645
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
646
                                  virJSONValuePtr *params);
647
int qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
648
                                  virJSONValuePtr params);
649

650
typedef enum {
651
    QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
652
    QEMU_MONITOR_MIGRATION_STATUS_SETUP,
653
    QEMU_MONITOR_MIGRATION_STATUS_ACTIVE,
654 655
    QEMU_MONITOR_MIGRATION_STATUS_PRE_SWITCHOVER,
    QEMU_MONITOR_MIGRATION_STATUS_DEVICE,
656
    QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY,
657 658
    QEMU_MONITOR_MIGRATION_STATUS_COMPLETED,
    QEMU_MONITOR_MIGRATION_STATUS_ERROR,
659
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLING,
660 661 662
    QEMU_MONITOR_MIGRATION_STATUS_CANCELLED,

    QEMU_MONITOR_MIGRATION_STATUS_LAST
663
} qemuMonitorMigrationStatus;
664

665 666
VIR_ENUM_DECL(qemuMonitorMigrationStatus)

667 668 669
typedef struct _qemuMonitorMigrationStats qemuMonitorMigrationStats;
typedef qemuMonitorMigrationStats *qemuMonitorMigrationStatsPtr;
struct _qemuMonitorMigrationStats {
670
    int status; /* qemuMonitorMigrationStatus */
671 672 673 674
    unsigned long long total_time;
    /* total or expected depending on status */
    bool downtime_set;
    unsigned long long downtime;
675 676 677 678 679 680 681
    /*
     * 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;
682 683 684 685

    unsigned long long ram_transferred;
    unsigned long long ram_remaining;
    unsigned long long ram_total;
686
    unsigned long long ram_bps;
687 688 689 690
    bool ram_duplicate_set;
    unsigned long long ram_duplicate;
    unsigned long long ram_normal;
    unsigned long long ram_normal_bytes;
691
    unsigned long long ram_dirty_rate;
692
    unsigned long long ram_page_size;
693
    unsigned long long ram_iteration;
694 695 696 697

    unsigned long long disk_transferred;
    unsigned long long disk_remaining;
    unsigned long long disk_total;
698
    unsigned long long disk_bps;
699 700 701 702 703 704 705

    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;
706 707

    int cpu_throttle_percentage;
708 709
};

710
int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
711 712
                                 qemuMonitorMigrationStatsPtr stats,
                                 char **error);
713

714 715
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
                                        char ***capabilities);
716
int qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon,
717
                                        virJSONValuePtr caps);
718

A
Andrea Bolognani 已提交
719 720 721
int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon,
                                  virGICCapability **capabilities);

722
typedef enum {
723
  QEMU_MONITOR_MIGRATE_BACKGROUND       = 1 << 0,
724 725 726 727 728
  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 已提交
729 730 731 732
int qemuMonitorMigrateToFd(qemuMonitorPtr mon,
                           unsigned int flags,
                           int fd);

733
int qemuMonitorMigrateToHost(qemuMonitorPtr mon,
734
                             unsigned int flags,
735
                             const char *protocol,
736 737 738 739 740
                             const char *hostname,
                             int port);

int qemuMonitorMigrateCancel(qemuMonitorPtr mon);

741 742 743
int qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
                                            const char *capability);

744 745 746
int qemuMonitorQueryDump(qemuMonitorPtr mon,
                         qemuMonitorDumpStatsPtr stats);

747
int qemuMonitorDumpToFd(qemuMonitorPtr mon,
748
                        int fd,
749 750
                        const char *dumpformat,
                        bool detach);
751

752 753 754 755 756 757
int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
                                int type,
                                const char *hostname,
                                int port,
                                int tlsPort,
                                const char *tlsSubject);
758 759 760 761

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

764 765
/* These two functions preserve previous error and only set their own
 * error if no error was set before.
766
 */
767 768
int qemuMonitorCloseFileHandle(qemuMonitorPtr mon,
                               const char *fdname);
769
int qemuMonitorRemoveFd(qemuMonitorPtr mon, int fdset, int fd);
770 771 772 773 774

/* XXX do we really want to hardcode 'netstr' as the
 * sendable item here
 */
int qemuMonitorAddHostNetwork(qemuMonitorPtr mon,
775
                              const char *netstr,
776 777
                              int *tapfd, char **tapfdName, int tapfdSize,
                              int *vhostfd, char **vhostfdName, int vhostfdSize);
778 779 780 781 782

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

783
int qemuMonitorAddNetdev(qemuMonitorPtr mon,
784
                         const char *netdevstr,
785 786
                         int *tapfd, char **tapfdName, int tapfdSize,
                         int *vhostfd, char **vhostfdName, int vhostfdSize);
787 788 789 790

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

791 792 793
int qemuMonitorQueryRxFilter(qemuMonitorPtr mon, const char *alias,
                             virNetDevRxFilterPtr *filter);

794 795 796 797 798 799
typedef struct _qemuMonitorChardevInfo qemuMonitorChardevInfo;
typedef qemuMonitorChardevInfo *qemuMonitorChardevInfoPtr;
struct _qemuMonitorChardevInfo {
    char *ptyPath;
    virDomainChrDeviceState state;
};
800
void qemuMonitorChardevInfoFree(void *data, const void *name);
801 802
int qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
                              virHashTablePtr *retinfo);
803

804 805
int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
                                       const char *bus,
806
                                       virPCIDeviceAddress *guestAddr);
807

808 809
int qemuMonitorAddDeviceArgs(qemuMonitorPtr mon,
                             virJSONValuePtr args);
810 811 812
int qemuMonitorAddDevice(qemuMonitorPtr mon,
                         const char *devicestr);

813 814 815 816 817
int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
                               const char *devicestr,
                               int fd,
                               const char *fdname);

818
int qemuMonitorDelDevice(qemuMonitorPtr mon,
819
                         const char *devalias);
820

821 822 823 824 825 826 827 828
int qemuMonitorAddObject(qemuMonitorPtr mon,
                         const char *type,
                         const char *objalias,
                         virJSONValuePtr props);

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

829 830 831
int qemuMonitorAddDrive(qemuMonitorPtr mon,
                        const char *drivestr);

832
int qemuMonitorDriveDel(qemuMonitorPtr mon,
833 834
                        const char *drivestr);

835 836 837 838
int qemuMonitorSetDrivePassphrase(qemuMonitorPtr mon,
                                  const char *alias,
                                  const char *passphrase);

C
Chris Lalancette 已提交
839 840 841 842
int qemuMonitorCreateSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorLoadSnapshot(qemuMonitorPtr mon, const char *name);
int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const char *name);

843
int qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
844
                            virJSONValuePtr actions,
845
                            const char *device,
846 847 848
                            const char *file,
                            const char *format,
                            bool reuse);
849
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
850
    ATTRIBUTE_NONNULL(2);
851 852 853 854
int qemuMonitorDriveMirror(qemuMonitorPtr mon,
                           const char *device,
                           const char *file,
                           const char *format,
855
                           unsigned long long bandwidth,
856 857
                           unsigned int granularity,
                           unsigned long long buf_size,
858
                           unsigned int flags)
859
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
860
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
861
                          const char *device)
862
    ATTRIBUTE_NONNULL(2);
863

864 865 866 867
int qemuMonitorBlockCommit(qemuMonitorPtr mon,
                           const char *device,
                           const char *top,
                           const char *base,
868
                           const char *backingName,
869
                           unsigned long long bandwidth)
870
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
871
bool qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon);
872 873 874 875
char *qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
                                const char *device,
                                virStorageSourcePtr top,
                                virStorageSourcePtr target)
876
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
877

878 879 880 881
int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
                                const char *cmd,
                                char **reply,
                                bool hmp);
882

883 884
int qemuMonitorInjectNMI(qemuMonitorPtr mon);

885 886 887
int qemuMonitorScreendump(qemuMonitorPtr mon,
                          const char *file);

888 889 890 891 892
int qemuMonitorSendKey(qemuMonitorPtr mon,
                       unsigned int holdtime,
                       unsigned int *keycodes,
                       unsigned int nkeycodes);

893 894 895 896
int qemuMonitorBlockStream(qemuMonitorPtr mon,
                           const char *device,
                           const char *base,
                           const char *backingName,
897
                           unsigned long long bandwidth)
898
    ATTRIBUTE_NONNULL(2);
899

900
int qemuMonitorBlockJobCancel(qemuMonitorPtr mon,
901
                              const char *device)
902
    ATTRIBUTE_NONNULL(2);
903

904 905
int qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon,
                                const char *device,
906
                                unsigned long long bandwidth);
907

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

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

924 925 926 927 928 929
int qemuMonitorOpenGraphics(qemuMonitorPtr mon,
                            const char *protocol,
                            int fd,
                            const char *fdname,
                            bool skipauth);

930 931
int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
                                  const char *device,
932
                                  virDomainBlockIoTuneInfoPtr info,
933
                                  bool supportMaxOptions,
934
                                  bool supportGroupNameOption,
935
                                  bool supportMaxLengthOptions);
936 937 938

int qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
                                  const char *device,
939
                                  virDomainBlockIoTuneInfoPtr reply);
940

941 942
int qemuMonitorSystemWakeup(qemuMonitorPtr mon);

943 944 945 946 947 948 949
int qemuMonitorGetVersion(qemuMonitorPtr mon,
                          int *major,
                          int *minor,
                          int *micro,
                          char **package)
    ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);

950 951 952 953 954 955 956 957

typedef struct _qemuMonitorMachineInfo qemuMonitorMachineInfo;
typedef qemuMonitorMachineInfo *qemuMonitorMachineInfoPtr;

struct _qemuMonitorMachineInfo {
    char *name;
    bool isDefault;
    char *alias;
958
    unsigned int maxCpus;
959
    bool hotplugCpus;
960 961 962 963 964 965 966
};

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

void qemuMonitorMachineInfoFree(qemuMonitorMachineInfoPtr machine);

967 968 969 970
typedef struct _qemuMonitorCPUDefInfo qemuMonitorCPUDefInfo;
typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;

struct _qemuMonitorCPUDefInfo {
971
    virTristateBool usable;
972
    char *name;
973
    char **blockers; /* NULL-terminated string list */
974 975
};

976
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
977 978
                                 qemuMonitorCPUDefInfoPtr **cpus);
void qemuMonitorCPUDefInfoFree(qemuMonitorCPUDefInfoPtr cpu);
979

980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
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;
1000
    virTristateBool migratable;
1001 1002
};

1003 1004 1005 1006 1007 1008
typedef struct _qemuMonitorCPUModelInfo qemuMonitorCPUModelInfo;
typedef qemuMonitorCPUModelInfo *qemuMonitorCPUModelInfoPtr;

struct _qemuMonitorCPUModelInfo {
    char *name;
    size_t nprops;
1009
    qemuMonitorCPUPropertyPtr props;
1010
    bool migratability;
1011 1012
};

1013 1014
typedef enum {
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC,
1015 1016
    QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL,
    QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
1017 1018
} qemuMonitorCPUModelExpansionType;

1019
int qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon,
1020
                                    qemuMonitorCPUModelExpansionType type,
1021
                                    const char *model_name,
1022
                                    bool migratable,
1023 1024 1025 1026 1027 1028 1029
                                    qemuMonitorCPUModelInfoPtr *model_info);

void qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfoPtr model_info);

qemuMonitorCPUModelInfoPtr
qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig);

1030 1031
int qemuMonitorGetCommands(qemuMonitorPtr mon,
                           char ***commands);
1032 1033
int qemuMonitorGetEvents(qemuMonitorPtr mon,
                         char ***events);
1034 1035
int qemuMonitorGetCommandLineOptionParameters(qemuMonitorPtr mon,
                                              const char *option,
1036 1037
                                              char ***params,
                                              bool *found);
1038

1039 1040 1041 1042
int qemuMonitorGetKVMState(qemuMonitorPtr mon,
                           bool *enabled,
                           bool *present);

1043 1044
int qemuMonitorGetObjectTypes(qemuMonitorPtr mon,
                              char ***types);
1045 1046
int qemuMonitorGetDeviceProps(qemuMonitorPtr mon,
                              const char *device,
1047
                              char ***props);
1048
char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
1049

1050 1051 1052
int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
                              const char *host,
                              unsigned int port);
1053 1054 1055
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
                            const char *deviceID,
                            bool writable);
1056
int qemuMonitorNBDServerStop(qemuMonitorPtr);
S
Stefan Berger 已提交
1057 1058 1059 1060 1061 1062
int qemuMonitorGetTPMModels(qemuMonitorPtr mon,
                            char ***tpmmodels);

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

1063 1064 1065
int qemuMonitorAttachCharDev(qemuMonitorPtr mon,
                             const char *chrID,
                             virDomainChrSourceDefPtr chr);
1066 1067
int qemuMonitorDetachCharDev(qemuMonitorPtr mon,
                             const char *chrID);
1068 1069 1070 1071

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

1072 1073 1074
typedef void (*qemuMonitorReportDomainLogError)(qemuMonitorPtr mon,
                                                const char *msg,
                                                void *opaque);
1075 1076 1077 1078
void qemuMonitorSetDomainLogLocked(qemuMonitorPtr mon,
                                   qemuMonitorReportDomainLogError func,
                                   void *opaque,
                                   virFreeCallback destroy);
1079 1080 1081 1082
void qemuMonitorSetDomainLog(qemuMonitorPtr mon,
                             qemuMonitorReportDomainLogError func,
                             void *opaque,
                             virFreeCallback destroy);
1083

1084 1085
int qemuMonitorGetGuestCPU(qemuMonitorPtr mon,
                           virArch arch,
1086 1087
                           virCPUDataPtr *data,
                           virCPUDataPtr *disabled);
1088

1089 1090
int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon);

1091 1092
typedef struct _qemuMonitorIOThreadInfo qemuMonitorIOThreadInfo;
typedef qemuMonitorIOThreadInfo *qemuMonitorIOThreadInfoPtr;
1093

1094
struct _qemuMonitorIOThreadInfo {
1095
    unsigned int iothread_id;
1096 1097 1098
    int thread_id;
};
int qemuMonitorGetIOThreads(qemuMonitorPtr mon,
1099
                            qemuMonitorIOThreadInfoPtr **iothreads);
1100

1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114
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);

1115 1116 1117
int qemuMonitorMigrateIncoming(qemuMonitorPtr mon,
                               const char *uri);

1118 1119
int qemuMonitorMigrateStartPostCopy(qemuMonitorPtr mon);

1120 1121 1122
int qemuMonitorMigrateContinue(qemuMonitorPtr mon,
                               qemuMonitorMigrationStatus status);

1123 1124 1125
int qemuMonitorGetRTCTime(qemuMonitorPtr mon,
                          struct tm *tm);

1126
virJSONValuePtr qemuMonitorQueryQMPSchema(qemuMonitorPtr mon);
1127

1128 1129 1130 1131
int qemuMonitorSetBlockThreshold(qemuMonitorPtr mon,
                                 const char *nodename,
                                 unsigned long long threshold);

1132
virJSONValuePtr qemuMonitorQueryNamedBlockNodes(qemuMonitorPtr mon);
1133

M
Michal Privoznik 已提交
1134 1135
int qemuMonitorSetWatchdogAction(qemuMonitorPtr mon,
                                 const char *action);
1136
#endif /* QEMU_MONITOR_H */