Merge remote-tracking branch 'remotes/mdroth/qga-pull-2014-08-08' into staging

* remotes/mdroth/qga-pull-2014-08-08:
  qga: Disable unsupported commands by default
  qga: Add guest-get-fsinfo command
  qga: Add guest-fsfreeze-freeze-list command

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2014-08-08 14:16:05 +01:00
5 changed files with 650 additions and 3 deletions
+506 -2
View File
File diff suppressed because it is too large Load Diff
+46 -1
View File
@@ -152,6 +152,12 @@ void qmp_guest_file_flush(int64_t handle, Error **errp)
error_set(errp, QERR_UNSUPPORTED);
}
GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
{
error_set(errp, QERR_UNSUPPORTED);
return NULL;
}
/*
* Return status of freeze/thaw
*/
@@ -206,6 +212,15 @@ error:
return 0;
}
int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
strList *mountpoints,
Error **errp)
{
error_set(errp, QERR_UNSUPPORTED);
return 0;
}
/*
* Thaw local file systems using Volume Shadow-copy Service.
*/
@@ -431,10 +446,40 @@ int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
return -1;
}
/* add unsupported commands to the blacklist */
GList *ga_command_blacklist_init(GList *blacklist)
{
const char *list_unsupported[] = {
"guest-file-open", "guest-file-close", "guest-file-read",
"guest-file-write", "guest-file-seek", "guest-file-flush",
"guest-suspend-hybrid", "guest-network-get-interfaces",
"guest-get-vcpus", "guest-set-vcpus",
"guest-fsfreeze-freeze-list", "guest-get-fsinfo",
"guest-fstrim", NULL};
char **p = (char **)list_unsupported;
while (*p) {
blacklist = g_list_append(blacklist, *p++);
}
if (!vss_init(true)) {
const char *list[] = {
"guest-get-fsinfo", "guest-fsfreeze-status",
"guest-fsfreeze-freeze", "guest-fsfreeze-thaw", NULL};
p = (char **)list;
while (*p) {
blacklist = g_list_append(blacklist, *p++);
}
}
return blacklist;
}
/* register init/cleanup routines for stateful command groups */
void ga_command_state_init(GAState *s, GACommandState *cs)
{
if (vss_init(true)) {
if (!vss_initialized()) {
ga_command_state_add(cs, NULL, guest_fsfreeze_cleanup);
}
}
+1
View File
@@ -19,6 +19,7 @@ typedef struct GAState GAState;
typedef struct GACommandState GACommandState;
extern GAState *ga_state;
GList *ga_command_blacklist_init(GList *blacklist);
void ga_command_state_init(GAState *s, GACommandState *cs);
void ga_command_state_add(GACommandState *cs,
void (*init)(void),
+1
View File
@@ -1144,6 +1144,7 @@ int main(int argc, char **argv)
goto out_bad;
}
blacklist = ga_command_blacklist_init(blacklist);
if (blacklist) {
s->blacklist = blacklist;
do {
+96
View File
@@ -386,6 +386,23 @@
{ 'command': 'guest-fsfreeze-freeze',
'returns': 'int' }
##
# @guest-fsfreeze-freeze-list:
#
# Sync and freeze specified guest filesystems
#
# @mountpoints: #optional an array of mountpoints of filesystems to be frozen.
# If omitted, every mounted filesystem is frozen.
#
# Returns: Number of file systems currently frozen. On error, all filesystems
# will be thawed.
#
# Since: 2.2
##
{ 'command': 'guest-fsfreeze-freeze-list',
'data': { '*mountpoints': ['str'] },
'returns': 'int' }
##
# @guest-fsfreeze-thaw:
#
@@ -642,3 +659,82 @@
{ 'command': 'guest-set-vcpus',
'data': {'vcpus': ['GuestLogicalProcessor'] },
'returns': 'int' }
##
# @GuestDiskBusType
#
# An enumeration of bus type of disks
#
# @ide: IDE disks
# @fdc: floppy disks
# @scsi: SCSI disks
# @virtio: virtio disks
# @xen: Xen disks
# @usb: USB disks
# @uml: UML disks
# @sata: SATA disks
# @sd: SD cards
#
# Since: 2.2
##
{ 'enum': 'GuestDiskBusType',
'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
'sd' ] }
##
# @GuestPCIAddress:
#
# @domain: domain id
# @bus: bus id
# @slot: slot id
# @function: function id
#
# Since: 2.2
##
{ 'type': 'GuestPCIAddress',
'data': {'domain': 'int', 'bus': 'int',
'slot': 'int', 'function': 'int'} }
##
# @GuestDiskAddress:
#
# @pci-controller: controller's PCI address
# @type: bus type
# @bus: bus id
# @target: target id
# @unit: unit id
#
# Since: 2.2
##
{ 'type': 'GuestDiskAddress',
'data': {'pci-controller': 'GuestPCIAddress',
'bus-type': 'GuestDiskBusType',
'bus': 'int', 'target': 'int', 'unit': 'int'} }
##
# @GuestFilesystemInfo
#
# @name: disk name
# @mountpoint: mount point path
# @type: file system type string
# @disk: an array of disk hardware information that the volume lies on,
# which may be empty if the disk type is not supported
#
# Since: 2.2
##
{ 'type': 'GuestFilesystemInfo',
'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
'disk': ['GuestDiskAddress']} }
##
# @guest-get-fsinfo:
#
# Returns: The list of filesystems information mounted in the guest.
# The returned mountpoints may be specified to
# @guest-fsfreeze-freeze-list.
# Network filesystems (such as CIFS and NFS) are not listed.
#
# Since: 2.2
##
{ 'command': 'guest-get-fsinfo',
'returns': ['GuestFilesystemInfo'] }