2009-11-03 18:59:18 +00:00
|
|
|
/*
|
|
|
|
* qemu_monitor_json.h: interaction with QEMU monitor console
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006-2009 Red Hat, Inc.
|
|
|
|
* 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
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef QEMU_MONITOR_JSON_H
|
2010-03-09 18:22:22 +00:00
|
|
|
# define QEMU_MONITOR_JSON_H
|
2009-11-03 18:59:18 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2009-11-03 18:59:18 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "qemu_monitor.h"
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONIOProcess(qemuMonitorPtr mon,
|
|
|
|
const char *data,
|
|
|
|
size_t len,
|
|
|
|
qemuMonitorMessagePtr msg);
|
|
|
|
|
2010-02-12 13:45:20 +00:00
|
|
|
int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon);
|
|
|
|
|
2009-11-03 18:59:18 +00:00
|
|
|
int qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
|
|
|
|
virConnectPtr conn);
|
|
|
|
int qemuMonitorJSONStopCPUs(qemuMonitorPtr mon);
|
|
|
|
|
|
|
|
int qemuMonitorJSONSystemPowerdown(qemuMonitorPtr mon);
|
|
|
|
|
|
|
|
int qemuMonitorJSONGetCPUInfo(qemuMonitorPtr mon,
|
|
|
|
int **pids);
|
|
|
|
int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon,
|
|
|
|
unsigned long *currmem);
|
2010-04-12 11:31:15 +00:00
|
|
|
int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
|
|
|
|
virDomainMemoryStatPtr stats,
|
|
|
|
unsigned int nr_stats);
|
2009-11-03 18:59:18 +00:00
|
|
|
int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
|
|
|
const char *devname,
|
|
|
|
long long *rd_req,
|
|
|
|
long long *rd_bytes,
|
|
|
|
long long *wr_req,
|
|
|
|
long long *wr_bytes,
|
|
|
|
long long *errs);
|
2010-05-14 13:10:01 +00:00
|
|
|
int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
|
|
|
|
const char *devname,
|
|
|
|
unsigned long long *extent);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
int qemuMonitorJSONSetVNCPassword(qemuMonitorPtr mon,
|
|
|
|
const char *password);
|
|
|
|
int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
|
|
|
|
unsigned long newmem);
|
2010-02-08 16:37:17 +00:00
|
|
|
int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, int online);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon,
|
|
|
|
const char *devname);
|
|
|
|
int qemuMonitorJSONChangeMedia(qemuMonitorPtr mon,
|
|
|
|
const char *devname,
|
|
|
|
const char *newmedia,
|
|
|
|
const char *format);
|
|
|
|
|
|
|
|
|
|
|
|
int qemuMonitorJSONSaveVirtualMemory(qemuMonitorPtr mon,
|
|
|
|
unsigned long long offset,
|
|
|
|
size_t length,
|
|
|
|
const char *path);
|
|
|
|
int qemuMonitorJSONSavePhysicalMemory(qemuMonitorPtr mon,
|
|
|
|
unsigned long long offset,
|
|
|
|
size_t length,
|
|
|
|
const char *path);
|
|
|
|
|
|
|
|
int qemuMonitorJSONSetMigrationSpeed(qemuMonitorPtr mon,
|
|
|
|
unsigned long bandwidth);
|
|
|
|
|
2010-03-17 15:53:14 +00:00
|
|
|
int qemuMonitorJSONSetMigrationDowntime(qemuMonitorPtr mon,
|
|
|
|
unsigned long long downtime);
|
|
|
|
|
2009-11-03 18:59:18 +00:00
|
|
|
int qemuMonitorJSONGetMigrationStatus(qemuMonitorPtr mon,
|
|
|
|
int *status,
|
|
|
|
unsigned long long *transferred,
|
|
|
|
unsigned long long *remaining,
|
|
|
|
unsigned long long *total);
|
|
|
|
|
|
|
|
int qemuMonitorJSONMigrateToHost(qemuMonitorPtr mon,
|
2010-06-24 18:58:36 +00:00
|
|
|
unsigned int flags,
|
2009-11-03 18:59:18 +00:00
|
|
|
const char *hostname,
|
|
|
|
int port);
|
|
|
|
|
|
|
|
int qemuMonitorJSONMigrateToCommand(qemuMonitorPtr mon,
|
2010-06-24 18:58:36 +00:00
|
|
|
unsigned int flags,
|
2010-04-21 13:06:37 +00:00
|
|
|
const char * const *argv);
|
|
|
|
|
|
|
|
int qemuMonitorJSONMigrateToFile(qemuMonitorPtr mon,
|
2010-06-24 18:58:36 +00:00
|
|
|
unsigned int flags,
|
2010-04-21 13:06:37 +00:00
|
|
|
const char * const *argv,
|
|
|
|
const char *target,
|
|
|
|
unsigned long long offset);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONMigrateToUnix(qemuMonitorPtr mon,
|
2010-06-24 18:58:36 +00:00
|
|
|
unsigned int flags,
|
2009-11-03 18:59:18 +00:00
|
|
|
const char *unixfile);
|
|
|
|
|
|
|
|
int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon);
|
|
|
|
|
|
|
|
int qemuMonitorJSONAddUSBDisk(qemuMonitorPtr mon,
|
|
|
|
const char *path);
|
|
|
|
|
|
|
|
int qemuMonitorJSONAddUSBDeviceExact(qemuMonitorPtr mon,
|
|
|
|
int bus,
|
|
|
|
int dev);
|
|
|
|
int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon,
|
|
|
|
int vendor,
|
|
|
|
int product);
|
|
|
|
|
|
|
|
|
|
|
|
int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon,
|
2009-12-07 19:07:39 +00:00
|
|
|
virDomainDevicePCIAddress *hostAddr,
|
|
|
|
virDomainDevicePCIAddress *guestAddr);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon,
|
|
|
|
const char *path,
|
|
|
|
const char *bus,
|
2009-12-07 19:07:39 +00:00
|
|
|
virDomainDevicePCIAddress *guestAddr);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon,
|
|
|
|
const char *nicstr,
|
2009-12-07 19:07:39 +00:00
|
|
|
virDomainDevicePCIAddress *guestAddr);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon,
|
2009-12-07 19:07:39 +00:00
|
|
|
virDomainDevicePCIAddress *guestAddr);
|
2009-11-03 18:59:18 +00:00
|
|
|
|
|
|
|
int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
|
|
|
|
const char *fdname,
|
|
|
|
int fd);
|
|
|
|
|
|
|
|
int qemuMonitorJSONCloseFileHandle(qemuMonitorPtr mon,
|
|
|
|
const char *fdname);
|
|
|
|
|
|
|
|
int qemuMonitorJSONAddHostNetwork(qemuMonitorPtr mon,
|
|
|
|
const char *netstr);
|
|
|
|
|
|
|
|
int qemuMonitorJSONRemoveHostNetwork(qemuMonitorPtr mon,
|
|
|
|
int vlan,
|
|
|
|
const char *netname);
|
|
|
|
|
2010-04-15 13:52:03 +00:00
|
|
|
int qemuMonitorJSONAddNetdev(qemuMonitorPtr mon,
|
|
|
|
const char *netdevstr);
|
|
|
|
|
|
|
|
int qemuMonitorJSONRemoveNetdev(qemuMonitorPtr mon,
|
|
|
|
const char *alias);
|
|
|
|
|
2010-01-22 13:22:53 +00:00
|
|
|
int qemuMonitorJSONGetPtyPaths(qemuMonitorPtr mon,
|
|
|
|
virHashTablePtr paths);
|
|
|
|
|
2009-12-07 19:28:05 +00:00
|
|
|
int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon,
|
|
|
|
const char *bus,
|
|
|
|
virDomainDevicePCIAddress *guestAddr);
|
|
|
|
|
Properly support SCSI drive hotplug
The current SCSI hotplug support attaches a brand new SCSI controller
for every disk. This is broken because the semantics differ from those
used when starting the VM initially. In the latter case, each SCSI
controller is filled before a new one is added.
If the user specifies an high drive index (sdazz) then at initial
startup, many intermediate SCSI controllers may be added with no
drives.
This patch changes SCSI hotplug so that it exactly matches the
behaviour of initial startup. First the SCSI controller number is
determined for the drive to be hotplugged. If any controller upto
and including that controller number is not yet present, it is
attached. Then finally the drive is attached to the last controller.
NB, this breaks SCSI hotunplug, because there is no 'drive_del'
command in current QEMU. Previous SCSI hotunplug was broken in
any case because it was unplugging the entire controller, not
just the drive in question.
A future QEMU will allow proper SCSI hotunplug of a drive.
This patch is derived from work done by Wolfgang Mauerer on disk
controllers.
* src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to
the correct controller, instead of just attaching a new
controller.
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
support for 'drive_add' command
2009-12-09 17:57:09 +00:00
|
|
|
int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
|
|
|
|
const char *drivestr,
|
|
|
|
virDomainDevicePCIAddress *controllerAddr,
|
|
|
|
virDomainDeviceDriveAddress *driveAddr);
|
|
|
|
|
Detect PCI addresses at QEMU startup
Hotunplug of devices requires that we know their PCI address. Even
hotplug of SCSI drives, required that we know the PCI address of
the SCSI controller to attach the drive to. We can find this out
by running 'info pci' and then correlating the vendor/product IDs
with the devices we booted with.
Although this approach is somewhat fragile, it is the only viable
option with QEMU < 0.12, since there is no way for libvirto set
explicit PCI addresses when creating devices in the first place.
For QEMU > 0.12, this code will not be used.
* src/qemu/qemu_driver.c: Assign all dynamic PCI addresses on
startup of QEMU VM, matching vendor/product IDs
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
API for fetching PCI device address mapping
2009-12-09 21:59:04 +00:00
|
|
|
int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon,
|
|
|
|
qemuMonitorPCIAddress **addrs);
|
|
|
|
|
2010-01-26 15:34:46 +00:00
|
|
|
int qemuMonitorJSONAddDevice(qemuMonitorPtr mon,
|
|
|
|
const char *devicestr);
|
|
|
|
|
2010-03-02 08:40:51 +00:00
|
|
|
int qemuMonitorJSONDelDevice(qemuMonitorPtr mon,
|
2010-04-14 14:36:42 +00:00
|
|
|
const char *devalias);
|
2010-03-02 08:40:51 +00:00
|
|
|
|
2010-01-26 15:34:46 +00:00
|
|
|
int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
|
|
|
|
const char *drivestr);
|
|
|
|
|
2010-02-11 14:28:16 +00:00
|
|
|
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
|
|
|
|
const char *alias,
|
|
|
|
const char *passphrase);
|
|
|
|
|
2010-04-02 14:10:37 +00:00
|
|
|
int qemuMonitorJSONCreateSnapshot(qemuMonitorPtr mon, const char *name);
|
|
|
|
int qemuMonitorJSONLoadSnapshot(qemuMonitorPtr mon, const char *name);
|
|
|
|
int qemuMonitorJSONDeleteSnapshot(qemuMonitorPtr mon, const char *name);
|
|
|
|
|
2010-04-17 02:12:45 +00:00
|
|
|
int qemuMonitorJSONArbitraryCommand(qemuMonitorPtr mon,
|
|
|
|
const char *cmd_str,
|
|
|
|
char **reply_str);
|
|
|
|
|
2009-11-03 18:59:18 +00:00
|
|
|
#endif /* QEMU_MONITOR_JSON_H */
|