2009-09-22 18:48:40 +01:00
|
|
|
/*
|
|
|
|
* qemu_monitor_text.h: interaction with QEMU monitor console
|
|
|
|
*
|
2012-02-17 14:55:35 -07:00
|
|
|
* Copyright (C) 2006-2009, 2011-2012 Red Hat, Inc.
|
2009-09-22 18:48:40 +01:00
|
|
|
* 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
|
2012-09-20 16:30:55 -06:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 18:06:23 +08:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2009-09-22 18:48:40 +01:00
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef QEMU_MONITOR_TEXT_H
|
2010-03-09 19:22:22 +01:00
|
|
|
# define QEMU_MONITOR_TEXT_H
|
2009-09-22 18:48:40 +01:00
|
|
|
|
2010-03-09 19:22:22 +01:00
|
|
|
# include "internal.h"
|
2009-09-22 18:48:40 +01:00
|
|
|
|
2010-03-09 19:22:22 +01:00
|
|
|
# include "qemu_monitor.h"
|
2009-10-09 21:13:06 +01:00
|
|
|
|
Fully asynchronous monitor I/O processing
Change the QEMU monitor file handle watch to poll for both
read & write events, as well as EOF. All I/O to/from the
QEMU monitor FD is now done in the event callback thread.
When the QEMU driver needs to send a command, it puts the
data to be sent into a qemuMonitorMessagePtr object instance,
queues it for dispatch, and then goes to sleep on a condition
variable. The event thread sends all the data, and then waits
for the reply to arrive, putting the response / error data
back into the qemuMonitorMessagePtr and notifying the condition
variable.
There is a temporary hack in the disk passphrase callback to
avoid acquiring the domain lock. This avoids a deadlock in
the command processing, since the domain lock is still held
when running monitor commands. The next commit will remove
the locking when running commands & thus allow re-introduction
of locking the disk passphrase callback
* src/qemu/qemu_driver.c: Temporarily don't acquire lock in
disk passphrase callback. To be reverted in next commit
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Remove
raw I/O functions, and a generic qemuMonitorSend() for
invoking a command
* src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
Remove all low level I/O, and use the new qemuMonitorSend()
API. Provide a qemuMonitorTextIOProcess() method for detecting
command/reply/prompt boundaries in the monitor data stream
2009-10-14 18:40:51 +01:00
|
|
|
int qemuMonitorTextIOProcess(qemuMonitorPtr mon,
|
|
|
|
const char *data,
|
|
|
|
size_t len,
|
|
|
|
qemuMonitorMessagePtr msg);
|
|
|
|
|
2011-03-09 21:24:04 +01:00
|
|
|
int qemuMonitorTextCommandWithFd(qemuMonitorPtr mon,
|
|
|
|
const char *cmd,
|
|
|
|
int scm_fd,
|
|
|
|
char **reply);
|
|
|
|
|
2009-10-09 21:13:06 +01:00
|
|
|
int qemuMonitorTextStartCPUs(qemuMonitorPtr mon,
|
|
|
|
virConnectPtr conn);
|
|
|
|
int qemuMonitorTextStopCPUs(qemuMonitorPtr mon);
|
2011-09-27 11:42:04 +02:00
|
|
|
int qemuMonitorTextGetStatus(qemuMonitorPtr mon,
|
|
|
|
bool *running,
|
|
|
|
virDomainPausedReason *reason);
|
2009-10-09 21:13:06 +01:00
|
|
|
|
|
|
|
int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon);
|
2011-06-15 17:49:58 +01:00
|
|
|
int qemuMonitorTextSystemReset(qemuMonitorPtr mon);
|
2009-10-09 21:13:06 +01:00
|
|
|
|
2016-07-08 15:36:27 +02:00
|
|
|
int qemuMonitorTextQueryCPUs(qemuMonitorPtr mon,
|
|
|
|
int **pids);
|
2011-06-17 15:31:45 +01:00
|
|
|
int qemuMonitorTextGetVirtType(qemuMonitorPtr mon,
|
2015-09-17 14:16:56 +05:30
|
|
|
virDomainVirtType *virtType);
|
2009-10-09 21:13:06 +01:00
|
|
|
int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
|
2012-03-02 13:27:39 -07:00
|
|
|
unsigned long long *currmem);
|
2009-12-20 13:36:28 +01:00
|
|
|
int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
|
|
|
|
virDomainMemoryStatPtr stats,
|
|
|
|
unsigned int nr_stats);
|
2011-09-13 15:49:50 +02:00
|
|
|
int qemuMonitorTextGetBlockInfo(qemuMonitorPtr mon,
|
2012-01-18 22:01:30 +01:00
|
|
|
virHashTablePtr table);
|
2015-03-09 17:23:49 +01:00
|
|
|
|
|
|
|
int qemuMonitorTextGetAllBlockStatsInfo(qemuMonitorPtr mon,
|
|
|
|
virHashTablePtr hash);
|
2011-11-29 15:34:53 +08:00
|
|
|
int qemuMonitorTextBlockResize(qemuMonitorPtr mon,
|
|
|
|
const char *device,
|
|
|
|
unsigned long long size);
|
2009-10-09 21:13:06 +01:00
|
|
|
int qemuMonitorTextSetVNCPassword(qemuMonitorPtr mon,
|
|
|
|
const char *password);
|
2011-01-10 12:12:32 +01:00
|
|
|
int qemuMonitorTextSetPassword(qemuMonitorPtr mon,
|
|
|
|
const char *protocol,
|
|
|
|
const char *password,
|
|
|
|
const char *action_if_connected);
|
|
|
|
int qemuMonitorTextExpirePassword(qemuMonitorPtr mon,
|
|
|
|
const char *protocol,
|
|
|
|
const char *expire_time);
|
2009-10-09 21:13:06 +01:00
|
|
|
int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
|
2015-05-27 14:03:17 +02:00
|
|
|
unsigned long long newmem);
|
2013-05-27 15:35:35 +02:00
|
|
|
int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, bool online);
|
2009-10-09 21:13:06 +01:00
|
|
|
|
|
|
|
int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
2011-09-16 14:05:58 +02:00
|
|
|
const char *dev_name,
|
2010-11-08 12:52:48 -05:00
|
|
|
bool force);
|
2009-10-09 21:13:06 +01:00
|
|
|
int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
2011-09-16 14:05:58 +02:00
|
|
|
const char *dev_name,
|
2009-11-26 13:48:17 +00:00
|
|
|
const char *newmedia,
|
|
|
|
const char *format);
|
2009-10-09 21:13:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
int qemuMonitorTextSaveVirtualMemory(qemuMonitorPtr mon,
|
|
|
|
unsigned long long offset,
|
|
|
|
size_t length,
|
|
|
|
const char *path);
|
|
|
|
int qemuMonitorTextSavePhysicalMemory(qemuMonitorPtr mon,
|
|
|
|
unsigned long long offset,
|
|
|
|
size_t length,
|
|
|
|
const char *path);
|
|
|
|
|
|
|
|
int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
|
|
|
|
unsigned long bandwidth);
|
|
|
|
|
2010-03-17 16:53:14 +01:00
|
|
|
int qemuMonitorTextSetMigrationDowntime(qemuMonitorPtr mon,
|
|
|
|
unsigned long long downtime);
|
|
|
|
|
2015-11-26 13:23:08 +01:00
|
|
|
int qemuMonitorTextGetMigrationStats(qemuMonitorPtr mon,
|
|
|
|
qemuMonitorMigrationStatsPtr stats);
|
2009-10-09 21:13:06 +01:00
|
|
|
|
2011-03-04 11:51:48 -07:00
|
|
|
int qemuMonitorTextMigrate(qemuMonitorPtr mon,
|
|
|
|
unsigned int flags,
|
|
|
|
const char *uri);
|
2009-10-09 21:13:06 +01:00
|
|
|
|
|
|
|
int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon);
|
|
|
|
|
2011-02-17 13:39:36 +00:00
|
|
|
int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon,
|
|
|
|
int type,
|
|
|
|
const char *hostname,
|
|
|
|
int port,
|
|
|
|
int tlsPort,
|
|
|
|
const char *tlsSubject);
|
|
|
|
|
2009-10-09 21:13:06 +01:00
|
|
|
int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
|
|
|
|
const char *fdname,
|
|
|
|
int fd);
|
|
|
|
|
|
|
|
int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
|
|
|
|
const char *fdname);
|
|
|
|
|
|
|
|
int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
|
|
|
|
const char *netstr);
|
|
|
|
|
|
|
|
int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
|
|
|
|
int vlan,
|
|
|
|
const char *netname);
|
2009-09-23 17:32:50 +01:00
|
|
|
|
2010-04-15 14:52:03 +01:00
|
|
|
int qemuMonitorTextAddNetdev(qemuMonitorPtr mon,
|
|
|
|
const char *netdevstr);
|
|
|
|
|
|
|
|
int qemuMonitorTextRemoveNetdev(qemuMonitorPtr mon,
|
|
|
|
const char *alias);
|
|
|
|
|
2014-11-13 16:17:21 +01:00
|
|
|
int qemuMonitorTextGetChardevInfo(qemuMonitorPtr mon,
|
|
|
|
virHashTablePtr info);
|
2009-12-14 10:50:01 +01:00
|
|
|
|
2010-01-26 15:34:46 +00:00
|
|
|
int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
|
|
|
|
const char *devicestr);
|
|
|
|
|
2010-03-02 09:40:51 +01:00
|
|
|
int qemuMonitorTextDelDevice(qemuMonitorPtr mon,
|
2010-04-14 15:36:42 +01:00
|
|
|
const char *devalias);
|
2010-03-02 09:40:51 +01:00
|
|
|
|
2010-01-26 15:34:46 +00:00
|
|
|
int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
|
|
|
|
const char *drivestr);
|
|
|
|
|
2010-12-08 14:30:12 -07:00
|
|
|
int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
|
2010-10-22 09:14:22 -05:00
|
|
|
const char *drivestr);
|
|
|
|
|
2010-02-11 14:28:16 +00:00
|
|
|
int qemuMonitorTextSetDrivePassphrase(qemuMonitorPtr mon,
|
|
|
|
const char *alias,
|
|
|
|
const char *passphrase);
|
|
|
|
|
2010-04-02 10:10:37 -04:00
|
|
|
int qemuMonitorTextCreateSnapshot(qemuMonitorPtr mon, const char *name);
|
|
|
|
int qemuMonitorTextLoadSnapshot(qemuMonitorPtr mon, const char *name);
|
|
|
|
int qemuMonitorTextDeleteSnapshot(qemuMonitorPtr mon, const char *name);
|
|
|
|
|
2010-04-16 22:12:45 -04:00
|
|
|
int qemuMonitorTextArbitraryCommand(qemuMonitorPtr mon, const char *cmd,
|
|
|
|
char **reply);
|
|
|
|
|
2011-05-10 16:26:06 +08:00
|
|
|
int qemuMonitorTextInjectNMI(qemuMonitorPtr mon);
|
2011-04-01 08:23:58 +02:00
|
|
|
|
2011-07-21 15:55:56 +08:00
|
|
|
int qemuMonitorTextSendKey(qemuMonitorPtr mon,
|
|
|
|
unsigned int holdtime,
|
|
|
|
unsigned int *keycodes,
|
|
|
|
unsigned int nkeycodes);
|
|
|
|
|
2011-04-01 08:23:58 +02:00
|
|
|
int qemuMonitorTextScreendump(qemuMonitorPtr mon, const char *file);
|
|
|
|
|
2011-09-06 16:18:57 +08:00
|
|
|
int qemuMonitorTextSetLink(qemuMonitorPtr mon,
|
|
|
|
const char *name,
|
2014-05-31 21:22:30 -03:00
|
|
|
virDomainNetInterfaceLinkState state);
|
2011-09-06 16:18:57 +08:00
|
|
|
|
2011-10-21 09:00:13 +01:00
|
|
|
int qemuMonitorTextOpenGraphics(qemuMonitorPtr mon,
|
|
|
|
const char *protocol,
|
|
|
|
const char *fdname,
|
|
|
|
bool skipauth);
|
|
|
|
|
2011-11-15 17:02:45 +08:00
|
|
|
int qemuMonitorTextSetBlockIoThrottle(qemuMonitorPtr mon,
|
|
|
|
const char *device,
|
|
|
|
virDomainBlockIoTuneInfoPtr info);
|
|
|
|
|
|
|
|
int qemuMonitorTextGetBlockIoThrottle(qemuMonitorPtr mon,
|
|
|
|
const char *device,
|
|
|
|
virDomainBlockIoTuneInfoPtr reply);
|
|
|
|
|
2009-09-23 11:49:14 +01:00
|
|
|
#endif /* QEMU_MONITOR_TEXT_H */
|