Skip to content

Commit

Permalink
Merge remote-tracking branch 'mdroth/qga-pull-4-27-12' into staging
Browse files Browse the repository at this point in the history
* mdroth/qga-pull-4-27-12:
  qemu-ga: persist tracking of fsfreeze state via filesystem
  qemu-ga: add a whitelist for fsfreeze-safe commands
  qemu-ga: improve recovery options for fsfreeze
  • Loading branch information
Anthony Liguori committed May 1, 2012
2 parents 6507470 + f789aa7 commit 75e4e84
Show file tree
Hide file tree
Showing 6 changed files with 409 additions and 138 deletions.
25 changes: 15 additions & 10 deletions qapi-schema-guest.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,10 @@
#
# @frozen: all non-network guest filesystems frozen
#
# @error: failure to thaw 1 or more
# previously frozen filesystems, or failure to open a previously
# cached filesytem (filesystem unmounted/directory changes, etc).
#
# Since: 0.15.0
##
{ 'enum': 'GuestFsfreezeStatus',
'data': [ 'thawed', 'frozen', 'error' ] }
'data': [ 'thawed', 'frozen' ] }

##
# @guest-fsfreeze-status:
Expand All @@ -312,6 +308,9 @@
#
# Returns: GuestFsfreezeStatus ("thawed", "frozen", etc., as defined below)
#
# Note: This may fail to properly report the current state as a result of
# some other guest processes having issued an fs freeze/thaw.
#
# Since: 0.15.0
##
{ 'command': 'guest-fsfreeze-status',
Expand All @@ -320,9 +319,10 @@
##
# @guest-fsfreeze-freeze:
#
# Sync and freeze all non-network guest filesystems
# Sync and freeze all freezable, local guest filesystems
#
# Returns: Number of file systems frozen on success
# Returns: Number of file systems currently frozen. On error, all filesystems
# will be thawed.
#
# Since: 0.15.0
##
Expand All @@ -332,10 +332,15 @@
##
# @guest-fsfreeze-thaw:
#
# Unfreeze frozen guest fileystems
# Unfreeze all frozen guest filesystems
#
# Returns: Number of file systems thawed by this call
#
# Returns: Number of file systems thawed
# If error, -1 (unknown error) or -errno
# Note: if return value does not match the previous call to
# guest-fsfreeze-freeze, this likely means some freezable
# filesystems were unfrozen before this call, and that the
# filesystem state may have changed before issuing this
# command.
#
# Since: 0.15.0
##
Expand Down
1 change: 1 addition & 0 deletions qapi/qmp-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void qmp_register_command(const char *name, QmpCommandFunc *fn);
QmpCommand *qmp_find_command(const char *name);
QObject *qmp_dispatch(QObject *request);
void qmp_disable_command(const char *name);
void qmp_enable_command(const char *name);
bool qmp_command_is_enabled(const char *name);
char **qmp_get_command_list(void);

Expand Down
14 changes: 12 additions & 2 deletions qapi/qmp-registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,28 @@ QmpCommand *qmp_find_command(const char *name)
return NULL;
}

void qmp_disable_command(const char *name)
static void qmp_toggle_command(const char *name, bool enabled)
{
QmpCommand *cmd;

QTAILQ_FOREACH(cmd, &qmp_commands, node) {
if (strcmp(cmd->name, name) == 0) {
cmd->enabled = false;
cmd->enabled = enabled;
return;
}
}
}

void qmp_disable_command(const char *name)
{
qmp_toggle_command(name, false);
}

void qmp_enable_command(const char *name)
{
qmp_toggle_command(name, true);
}

bool qmp_command_is_enabled(const char *name)
{
QmpCommand *cmd;
Expand Down
Loading

0 comments on commit 75e4e84

Please sign in to comment.