mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2018-07-03-tag' into staging
qemu-ga patch queue for soft-freeze * add systemd suspend support * add used/total space stats for guest-get-fsinfo * fixes for guest-get-fsinfo over PCI bridges * MSI installer and schema doc fixes * guard against unbounded allocations in guest-file-read * add some additional qga test cases # gpg: Signature made Tue 03 Jul 2018 21:45:32 BST # gpg: using RSA key 3353C9CEF108B584 # gpg: Good signature from "Michael Roth <flukshun@gmail.com>" # gpg: aka "Michael Roth <mdroth@utexas.edu>" # gpg: aka "Michael Roth <mdroth@linux.vnet.ibm.com>" # Primary key fingerprint: CEAC C9E1 5534 EBAB B82D 3FA0 3353 C9CE F108 B584 * remotes/mdroth/tags/qga-pull-2018-07-03-tag: qga: removing bios_supports_mode qga: systemd hibernate/suspend/hybrid-sleep support qga: removing switch statements, adding run_process_child qga: guest_suspend: decoupling pm-utils and sys logic qga: bios_supports_mode: decoupling pm-utils and sys logic qga: refactoring qmp_guest_suspend_* functions qemu-ga: make get-fsinfo work over pci bridges qga-win: Fixing msi upgrade disallow in WiX file qga/schema: fix documentation for GuestOSInfo test-qga: add trivial tests for some commands qga-win: add driver path usage to GuestFilesystemInfo qga: add mountpoint usage info to GuestFilesystemInfo qga: check bytes count read by guest-file-read qga: unset frozen state if no mount points are frozen Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+280
-144
File diff suppressed because it is too large
Load Diff
+13
-1
@@ -318,7 +318,7 @@ GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count,
|
||||
}
|
||||
if (!has_count) {
|
||||
count = QGA_READ_COUNT_DEFAULT;
|
||||
} else if (count < 0) {
|
||||
} else if (count < 0 || count >= UINT32_MAX) {
|
||||
error_setg(errp, "value '%" PRId64
|
||||
"' is invalid for argument count", count);
|
||||
return NULL;
|
||||
@@ -670,6 +670,7 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
|
||||
char fs_name[32];
|
||||
char vol_info[MAX_PATH+1];
|
||||
size_t len;
|
||||
uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
|
||||
GuestFilesystemInfo *fs = NULL;
|
||||
|
||||
GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size);
|
||||
@@ -699,10 +700,21 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
|
||||
fs_name[sizeof(fs_name) - 1] = 0;
|
||||
fs = g_malloc(sizeof(*fs));
|
||||
fs->name = g_strdup(guid);
|
||||
fs->has_total_bytes = false;
|
||||
fs->has_used_bytes = false;
|
||||
if (len == 0) {
|
||||
fs->mountpoint = g_strdup("System Reserved");
|
||||
} else {
|
||||
fs->mountpoint = g_strndup(mnt_point, len);
|
||||
if (GetDiskFreeSpaceEx(fs->mountpoint,
|
||||
(PULARGE_INTEGER) & i64FreeBytesToCaller,
|
||||
(PULARGE_INTEGER) & i64TotalBytes,
|
||||
(PULARGE_INTEGER) & i64FreeBytes)) {
|
||||
fs->used_bytes = i64TotalBytes - i64FreeBytes;
|
||||
fs->total_bytes = i64TotalBytes;
|
||||
fs->has_total_bytes = true;
|
||||
fs->has_used_bytes = true;
|
||||
}
|
||||
}
|
||||
fs->type = g_strdup(fs_name);
|
||||
fs->disk = build_guest_disk_info(guid, errp);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
<Product
|
||||
Name="QEMU guest agent"
|
||||
Id="{DF9974AD-E41A-4304-81AD-69AA8F299766}"
|
||||
Id="*"
|
||||
UpgradeCode="{EB6B8302-C06E-4BEC-ADAC-932C68A3A98D}"
|
||||
Manufacturer="$(env.QEMU_GA_MANUFACTURER)"
|
||||
Version="$(env.QEMU_GA_VERSION)"
|
||||
|
||||
@@ -435,7 +435,9 @@
|
||||
# for up to 10 seconds by VSS.
|
||||
#
|
||||
# Returns: Number of file systems currently frozen. On error, all filesystems
|
||||
# will be thawed.
|
||||
# will be thawed. If no filesystems are frozen as a result of this call,
|
||||
# then @guest-fsfreeze-status will remain "thawed" and calling
|
||||
# @guest-fsfreeze-thaw is not necessary.
|
||||
#
|
||||
# Since: 0.15.0
|
||||
##
|
||||
@@ -846,6 +848,8 @@
|
||||
# @name: disk name
|
||||
# @mountpoint: mount point path
|
||||
# @type: file system type string
|
||||
# @used-bytes: file system used bytes (since 3.0)
|
||||
# @total-bytes: non-root file system total bytes (since 3.0)
|
||||
# @disk: an array of disk hardware information that the volume lies on,
|
||||
# which may be empty if the disk type is not supported
|
||||
#
|
||||
@@ -853,6 +857,7 @@
|
||||
##
|
||||
{ 'struct': 'GuestFilesystemInfo',
|
||||
'data': {'name': 'str', 'mountpoint': 'str', 'type': 'str',
|
||||
'*used-bytes': 'uint64', '*total-bytes': 'uint64',
|
||||
'disk': ['GuestDiskAddress']} }
|
||||
|
||||
##
|
||||
@@ -1168,10 +1173,10 @@
|
||||
#
|
||||
# @kernel-release:
|
||||
# * POSIX: release field returned by uname(2)
|
||||
# * Windows: version number of the OS
|
||||
# * Windows: build number of the OS
|
||||
# @kernel-version:
|
||||
# * POSIX: version field returned by uname(2)
|
||||
# * Windows: build number of the OS
|
||||
# * Windows: version number of the OS
|
||||
# @machine:
|
||||
# * POSIX: machine field returned by uname(2)
|
||||
# * Windows: one of x86, x86_64, arm, ia64
|
||||
|
||||
@@ -854,6 +854,54 @@ static void test_qga_guest_exec_invalid(gconstpointer fix)
|
||||
qobject_unref(ret);
|
||||
}
|
||||
|
||||
static void test_qga_guest_get_host_name(gconstpointer fix)
|
||||
{
|
||||
const TestFixture *fixture = fix;
|
||||
QDict *ret, *val;
|
||||
|
||||
ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-host-name'}");
|
||||
g_assert_nonnull(ret);
|
||||
qmp_assert_no_error(ret);
|
||||
|
||||
val = qdict_get_qdict(ret, "return");
|
||||
g_assert(qdict_haskey(val, "host-name"));
|
||||
|
||||
qobject_unref(ret);
|
||||
}
|
||||
|
||||
static void test_qga_guest_get_timezone(gconstpointer fix)
|
||||
{
|
||||
const TestFixture *fixture = fix;
|
||||
QDict *ret, *val;
|
||||
|
||||
ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-timezone'}");
|
||||
g_assert_nonnull(ret);
|
||||
qmp_assert_no_error(ret);
|
||||
|
||||
/* Make sure there's at least offset */
|
||||
val = qdict_get_qdict(ret, "return");
|
||||
g_assert(qdict_haskey(val, "offset"));
|
||||
|
||||
qobject_unref(ret);
|
||||
}
|
||||
|
||||
static void test_qga_guest_get_users(gconstpointer fix)
|
||||
{
|
||||
const TestFixture *fixture = fix;
|
||||
QDict *ret;
|
||||
QList *val;
|
||||
|
||||
ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-users'}");
|
||||
g_assert_nonnull(ret);
|
||||
qmp_assert_no_error(ret);
|
||||
|
||||
/* There is not much to test here */
|
||||
val = qdict_get_qlist(ret, "return");
|
||||
g_assert_nonnull(val);
|
||||
|
||||
qobject_unref(ret);
|
||||
}
|
||||
|
||||
static void test_qga_guest_get_osinfo(gconstpointer data)
|
||||
{
|
||||
TestFixture fixture;
|
||||
@@ -946,6 +994,12 @@ int main(int argc, char **argv)
|
||||
test_qga_guest_exec_invalid);
|
||||
g_test_add_data_func("/qga/guest-get-osinfo", &fix,
|
||||
test_qga_guest_get_osinfo);
|
||||
g_test_add_data_func("/qga/guest-get-host-name", &fix,
|
||||
test_qga_guest_get_host_name);
|
||||
g_test_add_data_func("/qga/guest-get-timezone", &fix,
|
||||
test_qga_guest_get_timezone);
|
||||
g_test_add_data_func("/qga/guest-get-users", &fix,
|
||||
test_qga_guest_get_users);
|
||||
|
||||
ret = g_test_run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user