VMware, Inc [Sat, 28 May 2011 19:46:07 +0000 (12:46 -0700)]
Internalize the old "guest dict" code.
It's currently only used when translating old config files. Internalize
it to the vmtools library, and trim some unused features of the code in
the process.
VMware, Inc [Sat, 28 May 2011 19:39:19 +0000 (12:39 -0700)]
vm_basic_defs: Windows usleep incorrect
The POSIX/BSD usleep is an int function that returns 0 upon
success and -1 (with errno set) on error. The Windows Sleep()
primitive is "void" so always return success.
VMware, Inc [Sat, 28 May 2011 19:38:50 +0000 (12:38 -0700)]
Fixing setting hidden attribute for readonly files.
Setting hidden attribute is translated into updating
extended attributes on Mac OS which requires write access
to the file. Changing temporarily file permissions to
allow such access and restore permissions back after updating
attribute.
VMware, Inc [Sat, 28 May 2011 19:38:28 +0000 (12:38 -0700)]
Internal branch sync. Included in this change:
. Split the disk shrink toolbox command workflow into 2 separate steps,
one for wiping the disk and another for performing the disk shrink
operation only.
. changes in shared code that don't affect open-vm-tools functionality.
VMware, Inc [Sat, 28 May 2011 19:32:57 +0000 (12:32 -0700)]
Fix Posix's function for converting O_* open
flags to FILEIO_OPEN_* counterpart: O_RDONLY/O_WRONLY/O_RDWR
are not bits: O_RDONLY is 0, O_WRONLY is 1, and O_RDWR
is 2. So O_RDONLY was always converted to nothing rather
than FILEIO_OPEN_READ.
VMware, Inc [Sat, 28 May 2011 19:31:42 +0000 (12:31 -0700)]
BSD vsnprintf: POSIX compliance
BSD printf doesn't comply with the POSIX specification for "%e" output.
There should only be two digits of exponent until the exponent is
larger than 99.
VMware, Inc [Sat, 28 May 2011 19:30:48 +0000 (12:30 -0700)]
VMCI device needs a limit on the datagram queue
It turns out that we've never put a limit on the number of
datagrams that can be queued in the device. The perf test
keeps pushing datagrams, and with nobody reading them, the
queue in the VMX just keeps growing until we exhaust the
pagefile.
Added a limit in VMCI_QueueDatagram(). We use the same
limit we use elsewhere, which is 2 x DG_MAX, or ~128K, for
normal datagrams, and a higher limit for events (datagrams
sent from the VMX/event resource ID).
VMware, Inc [Sat, 28 May 2011 19:27:44 +0000 (12:27 -0700)]
Fix ASSERT in string.cc:80
The reason for the bug is that we assume that there should be ending
NULL for any text clipboard, but for clipboard data from old guest
(win95/98), the text may be not NULL terminated, and caused problem.
The fix is to always attach NULL for any clipboard buffer.
VMware, Inc [Sat, 28 May 2011 19:24:18 +0000 (12:24 -0700)]
lib/file: make robust mkdir more general
Make the robust mkdir internal routine behave like the POSIX
system call. Later changes will pass other values for the mask.
The Windows code ignores it for now.
VMware, Inc [Sat, 28 May 2011 19:11:32 +0000 (12:11 -0700)]
lib/guestapp: spring cleaning.
Clean up more stuff we don't use or don't need in lib/guestapp.
. OpenUrl goes the way of the dodo, along with the POSIX "find program" and
"set spawn env" functions. (The gtk toolbox is just dead code walking, so
it's changed to not call those functions.)
. that allows the platform-specific implementations to be removed, since
they're not needed.
. we don't support pre-2k Windows anymore in this code, so we can use the
bora/lib implementation of GuestApp_GetConfPath().
. other unreferenced functions are also removed.
VMware, Inc [Sat, 28 May 2011 19:10:45 +0000 (12:10 -0700)]
Make vsock Linux module not have unused but set variables.
Fedora 15 compiles modules with the -Wunused-but-set-variable
flag. This exposed some cases, where the vsock code would set
variables without using them. Fix those.
VMware, Inc [Sat, 28 May 2011 19:08:29 +0000 (12:08 -0700)]
Make vmci linux module not have unused but set variables.
Fedora 15 compiles modules with the -Wunused-but-set-variable
flag. This exposed some cases, where the VMCI code would set
variables without using them. Fix those. Note that the unused
annotation only means potentially unused.
VMware, Inc [Sat, 28 May 2011 19:06:42 +0000 (12:06 -0700)]
Fix VMCI doorbell index allocation
With the merging of the guest and host code, the code that
allocates a doorbell got shuffled around. This introduced a
bug, where a guest personality allocation of a doorbell will
register the index of a doorbell handle with the VMCI backend
before allocating it. This change moves the allocation of the
index up before it is registered with the backend. To avoid
generating callbacks before we know for sure that a given
doorbell has been successfully created (this can happen due to
index sharing), an active flag has been added to the doorbell
entry. This flag is set to true only after the creation of the
doorbell has been successfully completed.
VMware, Inc [Sat, 28 May 2011 19:02:01 +0000 (12:02 -0700)]
Don't try to dump service state when main loop is not running.
There is a race during service startup, where some thread (e.g., the Win32
service control manager thread) may trigger the "dump service state" code
before all service state has been initialized.
Avoid that by only allowing state to be dumped while the service's main
loop is running, so that we know the state data is in a known state.
Move the "make temp" functions from file.c to fileTemp.c.
Once properly collected and under the same roof, further
considation, simplification and a fix can be done
The "make temp" functions currently live in file.c and should
live in fileTemp.c. In order to move them, remove the Msg_*
stuff - this should be Log and Warning - and include the
work-around just added to ESX50. After this change and moving
the code to its proper place, a full fix for the worked-around
problem will be done.
DGRAM shutdown() on Linux has a bug where if the socket
is unconnected, it skips waking up the socket. DGRAM sockets
are hardly ever connected, so this has been fixed.
Call g_clear_error(&err) after g_locale_from_utf8() fails.
After catching an error from g_locale_from_utf8() the error structure
is not freed. This results in a warning from GLib when we later call
g_spawn_async() with the same (now populated) error parameter.
While we're in here copy the debug message from the Windows version of
PowerOpsScriptCallback() so that the exit code of the power script is
logged.
On running queuepairAllocTest24_l test on Ubuntu9 guest, the guest goes unresponsive
We try to allocate the queuepair pages before we make the hypercall (which would
eventually hit the restriction in the device). On Windows and Mac OS, we can't
allocate a single contiguous block this big, so the allocation fails immediately.
On Linux, we allocate each page separately, so what happens is that the system
starts thrashing and becomes unresponsive.
lib/string: BSD printf flubbs floating point output
The BSD printf flubbs floating, especially when the number ends
with all zeros. The root problem is that one digit is printed
explicitly; any remaining digits need to be printed too - but
only if they aren't zero since the zero fill will take care of
them.
If there is only one digit, to print (e.g. 1.000) the calculation
handling the remaining digits comes up with -1 and, well, one gets
what they deserve.
The fix is easy - don't try to output a negative number of digits.
Fix ordering of HGFS opcode for search read V4 backwards compatibiliy
Since change notification is released as of Beta 1 the previous change
of inserting the search read opcode ahead of this will lead to
incompatibily for Beta 2 servers against Beta 1 tools.
Make the continuity seamless by keeping the change notification
opcode ahead of the search read V4. This means the HGFS server dispatch
handler must check for a NULL entry in its handler dispatch table now.
(Or we could put a dummy dispatch handler which always returns protocol
error, but I think NULL is okay.)
The change notification opcode is only for requests sent by the server
to the guest clients in response to a directory change event.
The get data packet routine would always do a copy of the guest
data into the memory allocated buffer even if the request was
for a writable memory buffer. So for V4 read and directory read
requests there was an unnecessary memcpy.
The reason for this was that the meta packet uses the same routine
but does need to read in the guest memory (for the request) but
needs to write the reply into the same memory. So instead I have
now added a third buffer access option to the READ and WRITE existing
ones: READ-WRITE. So now meta packets use the READ-WRITE and the
V4 read and directory read will use the WRITE option. The memcpy
to read the guest data is only performed for READ or READ-WRITE
buffer requests.
To ensure we get at least some logging by default, enable a default logger
that writes to syslog in vmtoolsd. The default log level ("message" on beta
builds, "warning" on release builds) is unchanged.
The change also makes "syslog" the default log handler for everybody,
in case a handler is not specified in the config data. (Previously, it
would be "stdout" on POSIX, or "outputdebugstring" on Win32.)
Also:
. reset the logging system after reading the command line args, so that
syslog can pick up the change in the container name.
. fix an issue in the POSIX syslogger; openlog() doesn't seem to make its
own copy of the "ident" argument, so it could end up referencing freed
memory as we reconfigure the log system. Keep a copy in the log data.
We need to make sure we clean up the GSource on the error path too, so
that the main loop doesn't try to re-run the loop after an error (in
which case the channel will be NULL).
. clean up indentation
. make it /bin/sh-friendly
. make it support FreeBSD and Solaris too
. stop packaging up /proc, which takes a long time and doesn't necessarily
help.
. don't follow symlinks (so that we don't package ICU data or plugins under
/etc/vmware-tools).
. package syslogs too.
. get rid of the spinning thing (progress "report") since it doesn't play
well with FreeBSD's/Solaris's /bin/echo.
Increase the scope of a previous fix to also cover long OS names, so
that guest info and vix have enough buffer space to cover the max
size supported by the hostinfo library.
VMCF asked for a way to determine the version of
the VMCISockets driver so that they can blacklist versions
that have issues. This change introduces such an API.
The version is platform-dependent, like the VMCI
driver version, and uses the same format, A.B.C.D,
where A is an epoch, B the major version (incremented
per release branch), C the minor version (incremented
per change) and D is unused. It is embedded in the
file vsock_version.h for each platform.
The API is exposed through a new call in vmci_sockets.h,
VMCISock_Version(), as an unsigned integer. New macros
are provided to extract the A, B and C component parts
of the version.
When guest mappings were being released the start index for the IOV
array was not correct it started from zero instead of the startIndex.
For meta packet the start index is zero, but for data packets it
is 16.
Before the merging of the two VMCI drivers, the guest version
would return VMCI_ERROR_ALREADY_EXISTS when creating a
doorbell with a handle that already exists. The host code
actually returned VMCI_ERROR_DUPLICATE_ENTRY, which is the
hash table error code for duplicate entries. After the merge,
we always return VMCI_ERROR_DUPLICATE_ENTRY, but
VMCI_ERROR_ALREADY_EXISTS is slightly more descriptive so
return that instead.
An ASSERT could be hit where we were trying to read in a datagram
from the device but the device was not started (and so the
guest personality was not active). It's actually okay to read
in at that time, so stop ASSERTING on the personality being
active.
The vmxnet driver always requests irq with name of 'vmxnet' which is
incorrect. It causes multiple entries in /proc/interrupts and confuses
scripts like irqbalance that try and manage smp affinity on network
cards.
The fix is simple, just use the standard convention of putting device
name in the irq name. This applies to all kernel versions.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com> Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>