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-2015-07-06-v3-tag' into staging
tag for qga-pull-2015-07-06-v3
v3:
- fix missing <windows.h> in configure test program.
v2:
- added configure check for guest-get-fs-info to avoid breakage on older
MinGWs
- removed extraneous include of ws2ipdef.h in w32
guest-network-get-interfaces. ws2tcpip.h already provides those
definitions, and older MinGWs don't have it.
- rebased on latest master
# gpg: Signature made Wed Jul 8 03:01:18 2015 BST using RSA key ID F108B584
# 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>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg: It is not certain that the signature belongs to the owner.
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D 3FA0 3353 C9CE F108 B584
* remotes/mdroth/tags/qga-pull-2015-07-06-v3-tag:
qga: added GuestPCIAddress information
qga: added bus type and disk location path
configure: add configure check for ntdddisk.h
qga: added mountpoint and filesystem type for single volume
qga: added empty qmp_quest_get_fsinfo functionality.
qga: fail early for invalid time
qga: win32 qmp_guest_network_get_interfaces implementation
qga: add win32 library iphlpapi
Revert "guest agent: remove g_strcmp0 usage"
qga/qmp_guest_fstrim: Return per path fstrim result
qga/commands-posix: Fix bug in guest-fstrim
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -315,6 +315,7 @@ snappy=""
|
||||
bzip2=""
|
||||
guest_agent=""
|
||||
guest_agent_with_vss="no"
|
||||
guest_agent_ntddscsi="no"
|
||||
guest_agent_msi=""
|
||||
vss_win32_sdk=""
|
||||
win_sdk="no"
|
||||
@@ -732,7 +733,7 @@ if test "$mingw32" = "yes" ; then
|
||||
sysconfdir="\${prefix}"
|
||||
local_statedir=
|
||||
confsuffix=""
|
||||
libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
|
||||
libs_qga="-lws2_32 -lwinmm -lpowrprof -liphlpapi $libs_qga"
|
||||
fi
|
||||
|
||||
werror=""
|
||||
@@ -3819,6 +3820,26 @@ if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# check if mingw environment provides a recent ntddscsi.h
|
||||
if test "$mingw32" = "yes" -a "$guest_agent" != "no"; then
|
||||
cat > $TMPC << EOF
|
||||
#include <windows.h>
|
||||
#include <ntddscsi.h>
|
||||
int main(void) {
|
||||
#if !defined(IOCTL_SCSI_GET_ADDRESS)
|
||||
#error Missing required ioctl definitions
|
||||
#endif
|
||||
SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
|
||||
return addr.Lun;
|
||||
}
|
||||
EOF
|
||||
if compile_prog "" "" ; then
|
||||
guest_agent_ntddscsi=yes
|
||||
libs_qga="-lsetupapi $libs_qga"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# Guest agent Window MSI package
|
||||
|
||||
@@ -4489,6 +4510,7 @@ echo "libiscsi support $libiscsi"
|
||||
echo "libnfs support $libnfs"
|
||||
echo "build guest agent $guest_agent"
|
||||
echo "QGA VSS support $guest_agent_with_vss"
|
||||
echo "QGA w32 disk info $guest_agent_ntddscsi"
|
||||
echo "seccomp support $seccomp"
|
||||
echo "coroutine backend $coroutine"
|
||||
echo "coroutine pool $coroutine_pool"
|
||||
@@ -4566,6 +4588,9 @@ if test "$mingw32" = "yes" ; then
|
||||
echo "CONFIG_QGA_VSS=y" >> $config_host_mak
|
||||
echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
|
||||
fi
|
||||
if test "$guest_agent_ntddscsi" = "yes" ; then
|
||||
echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$guest_agent_msi" != "no"; then
|
||||
echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
|
||||
echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
|
||||
|
||||
+51
-19
@@ -154,6 +154,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
|
||||
|
||||
/* If user has passed a time, validate and set it. */
|
||||
if (has_time) {
|
||||
GDate date = { 0, };
|
||||
|
||||
/* year-2038 will overflow in case time_t is 32bit */
|
||||
if (time_ns / 1000000000 != (time_t)(time_ns / 1000000000)) {
|
||||
error_setg(errp, "Time %" PRId64 " is too large", time_ns);
|
||||
@@ -162,6 +164,11 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
|
||||
|
||||
tv.tv_sec = time_ns / 1000000000;
|
||||
tv.tv_usec = (time_ns % 1000000000) / 1000;
|
||||
g_date_set_time_t(&date, tv.tv_sec);
|
||||
if (date.year < 1970 || date.year >= 2070) {
|
||||
error_setg_errno(errp, errno, "Invalid time");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = settimeofday(&tv, NULL);
|
||||
if (ret < 0) {
|
||||
@@ -1325,18 +1332,18 @@ static void guest_fsfreeze_cleanup(void)
|
||||
/*
|
||||
* Walk list of mounted file systems in the guest, and trim them.
|
||||
*/
|
||||
void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
GuestFilesystemTrimResponse *
|
||||
qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
{
|
||||
GuestFilesystemTrimResponse *response;
|
||||
GuestFilesystemTrimResultList *list;
|
||||
GuestFilesystemTrimResult *result;
|
||||
int ret = 0;
|
||||
FsMountList mounts;
|
||||
struct FsMount *mount;
|
||||
int fd;
|
||||
Error *local_err = NULL;
|
||||
struct fstrim_range r = {
|
||||
.start = 0,
|
||||
.len = -1,
|
||||
.minlen = has_minimum ? minimum : 0,
|
||||
};
|
||||
struct fstrim_range r;
|
||||
|
||||
slog("guest-fstrim called");
|
||||
|
||||
@@ -1344,36 +1351,59 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
build_fs_mount_list(&mounts, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
response = g_malloc0(sizeof(*response));
|
||||
|
||||
QTAILQ_FOREACH(mount, &mounts, next) {
|
||||
result = g_malloc0(sizeof(*result));
|
||||
result->path = g_strdup(mount->dirname);
|
||||
|
||||
list = g_malloc0(sizeof(*list));
|
||||
list->value = result;
|
||||
list->next = response->paths;
|
||||
response->paths = list;
|
||||
|
||||
fd = qemu_open(mount->dirname, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
error_setg_errno(errp, errno, "failed to open %s", mount->dirname);
|
||||
goto error;
|
||||
result->error = g_strdup_printf("failed to open: %s",
|
||||
strerror(errno));
|
||||
result->has_error = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We try to cull filesytems we know won't work in advance, but other
|
||||
* filesytems may not implement fstrim for less obvious reasons. These
|
||||
* will report EOPNOTSUPP; we simply ignore these errors. Any other
|
||||
* error means an unexpected error, so return it in those cases. In
|
||||
* some other cases ENOTTY will be reported (e.g. CD-ROMs).
|
||||
* will report EOPNOTSUPP; while in some other cases ENOTTY will be
|
||||
* reported (e.g. CD-ROMs).
|
||||
* Any other error means an unexpected error.
|
||||
*/
|
||||
r.start = 0;
|
||||
r.len = -1;
|
||||
r.minlen = has_minimum ? minimum : 0;
|
||||
ret = ioctl(fd, FITRIM, &r);
|
||||
if (ret == -1) {
|
||||
if (errno != ENOTTY && errno != EOPNOTSUPP) {
|
||||
error_setg_errno(errp, errno, "failed to trim %s",
|
||||
mount->dirname);
|
||||
close(fd);
|
||||
goto error;
|
||||
result->has_error = true;
|
||||
if (errno == ENOTTY || errno == EOPNOTSUPP) {
|
||||
result->error = g_strdup("trim not supported");
|
||||
} else {
|
||||
result->error = g_strdup_printf("failed to trim: %s",
|
||||
strerror(errno));
|
||||
}
|
||||
close(fd);
|
||||
continue;
|
||||
}
|
||||
|
||||
result->has_minimum = true;
|
||||
result->minimum = r.minlen;
|
||||
result->has_trimmed = true;
|
||||
result->trimmed = r.len;
|
||||
close(fd);
|
||||
}
|
||||
|
||||
error:
|
||||
free_fs_mount_list(&mounts);
|
||||
return response;
|
||||
}
|
||||
#endif /* CONFIG_FSTRIM */
|
||||
|
||||
@@ -2402,9 +2432,11 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)
|
||||
#endif /* CONFIG_FSFREEZE */
|
||||
|
||||
#if !defined(CONFIG_FSTRIM)
|
||||
void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
GuestFilesystemTrimResponse *
|
||||
qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
{
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+523
-7
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -274,7 +274,7 @@ static void ga_log(const gchar *domain, GLogLevelFlags level,
|
||||
|
||||
level &= G_LOG_LEVEL_MASK;
|
||||
#ifndef _WIN32
|
||||
if (domain && strcmp(domain, "syslog") == 0) {
|
||||
if (g_strcmp0(domain, "syslog") == 0) {
|
||||
syslog(LOG_INFO, "%s: %s", level_str, msg);
|
||||
} else if (level & s->log_level) {
|
||||
#else
|
||||
|
||||
+41
-3
@@ -424,6 +424,30 @@
|
||||
{ 'command': 'guest-fsfreeze-thaw',
|
||||
'returns': 'int' }
|
||||
|
||||
##
|
||||
# @GuestFilesystemTrimResult
|
||||
#
|
||||
# @path: path that was trimmed
|
||||
# @error: an error message when trim failed
|
||||
# @trimmed: bytes trimmed for this path
|
||||
# @minimum: reported effective minimum for this path
|
||||
#
|
||||
# Since: 2.4
|
||||
##
|
||||
{ 'struct': 'GuestFilesystemTrimResult',
|
||||
'data': {'path': 'str',
|
||||
'*trimmed': 'int', '*minimum': 'int', '*error': 'str'} }
|
||||
|
||||
##
|
||||
# @GuestFilesystemTrimResponse
|
||||
#
|
||||
# @paths: list of @GuestFilesystemTrimResult per path that was trimmed
|
||||
#
|
||||
# Since: 2.4
|
||||
##
|
||||
{ 'struct': 'GuestFilesystemTrimResponse',
|
||||
'data': {'paths': ['GuestFilesystemTrimResult']} }
|
||||
|
||||
##
|
||||
# @guest-fstrim:
|
||||
#
|
||||
@@ -437,12 +461,14 @@
|
||||
# fragmented free space, although not all blocks will be discarded.
|
||||
# The default value is zero, meaning "discard every free block".
|
||||
#
|
||||
# Returns: Nothing.
|
||||
# Returns: A @GuestFilesystemTrimResponse which contains the
|
||||
# status of all trimmed paths. (since 2.4)
|
||||
#
|
||||
# Since: 1.2
|
||||
##
|
||||
{ 'command': 'guest-fstrim',
|
||||
'data': { '*minimum': 'int' } }
|
||||
'data': { '*minimum': 'int' },
|
||||
'returns': 'GuestFilesystemTrimResponse' }
|
||||
|
||||
##
|
||||
# @guest-suspend-disk
|
||||
@@ -677,12 +703,24 @@
|
||||
# @uml: UML disks
|
||||
# @sata: SATA disks
|
||||
# @sd: SD cards
|
||||
# @unknown: Unknown bus type
|
||||
# @ieee1394: Win IEEE 1394 bus type
|
||||
# @ssa: Win SSA bus type
|
||||
# @fibre: Win fiber channel bus type
|
||||
# @raid: Win RAID bus type
|
||||
# @iscsi: Win iScsi bus type
|
||||
# @sas: Win serial-attaches SCSI bus type
|
||||
# @mmc: Win multimedia card (MMC) bus type
|
||||
# @virtual: Win virtual bus type
|
||||
# @file-backed virtual: Win file-backed bus type
|
||||
#
|
||||
# Since: 2.2
|
||||
##
|
||||
{ 'enum': 'GuestDiskBusType',
|
||||
'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata',
|
||||
'sd' ] }
|
||||
'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi',
|
||||
'sas', 'mmc', 'virtual', 'file-backed-virtual' ] }
|
||||
|
||||
|
||||
##
|
||||
# @GuestPCIAddress:
|
||||
|
||||
Reference in New Issue
Block a user