Discussion:
[Crash-utility] patch to read vmware vmss file
Dyno (Hongjun) Fu
2015-01-31 00:06:36 UTC
Permalink
hi,

vmss file is VMware virtual machine snapshot file and contains all the necessary memory dump that crash requires.
there is public available parse to read the format. https://code.google.com/p/vmsnparser/
there is vmss2core (https://labs.vmware.com/flings/vmss2core) to convert it to standard core file.
and this patch just enables crash to read it directly.

rgds,
Dyno
Dave Anderson
2015-02-03 16:52:14 UTC
Permalink
----- Original Message -----
Post by Dyno (Hongjun) Fu
hi,
vmss file is VMware virtual machine snapshot file and contains all the
necessary memory dump that crash requires.
there is public available parse to read the format.
https://code.google.com/p/vmsnparser/
there is vmss2core ( https://labs.vmware.com/flings/vmss2core ) to convert it
to standard core file.
and this patch just enables crash to read it directly.
rgds,
Dyno
Hello Dyno,

Thank you very much for finally doing this. It is a welcome addition.

I cannot do much but compile-test it, so it would be helpful
if you could provide a sample VMSS vmcore available for future
testing. Can you make one available (preferably small but with
more than one cpu)?

I have two small issues that I'd like you to address. First,
please add is_vmware_vmss and vmware_vmss_init prototypes to
the others you have placed in defs.h:

$ make warn
... [ cut ] ...
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6 main.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
main.c: In function 'main':
main.c:644:4: warning: implicit declaration of function 'is_vmware_vmss' [-Wimplicit-function-declaration]
... [ cut ] ...
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6 filesys.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
filesys.c: In function 'memory_source_init':
filesys.c:249:4: warning: implicit declaration of function 'vmware_vmss_init' [-Wimplicit-function-declaration]
...

Secondly, I do not want to separate out MEMORY_SOURCES2/VMWARE_VMSS as you
have done. I understand that you did it because of the exhaustion
of pc->flags bits. However, we can simply do the same thing that was done
when the SADUMP facility was added, which is to move one of the pre-existing
pc->flags bits into pc->flags2. There are several of them that can be
safely moved.

I suggest moving GET_TIMESTAMP to pc->flags2. Looking at its use from
cscope, it is only used in these 3 places:

C symbol: GET_TIMESTAMP

File Function Line
0 defs.h <global> 207 #define GET_TIMESTAMP (0x100000ULL)
1 kernel.c kernel_init 204 if (pc->flags & GET_TIMESTAMP) {
2 main.c main 340 pc->flags |= GET_TIMESTAMP;

So please move GET_TIMESTAMP to pc->flags2, fix kernel_init() and main(),
assign 0x100000ULL to VMWARE_VMSS, and put VMWARE_VMSS in MEMORY_SOURCES.

Again, I really appreciate your effort. Can you repost this on short order?
I am planning on doing the crash-7.1.0 release by the end of the week, and
I would like to include this feature.

Thanks,
Dave
Dave Anderson
2015-02-03 17:21:35 UTC
Permalink
Hello Dyno,

A couple more items to address.

In the Makefile, the vmware_vmss.c build does not have a dependency on vmware_vmss.h:

VMWARE_HFILES=vmware_vmss.h

vmware_vmss.o: ${GENERIC_HFILES} ${REDHAT_HFILES} vmware_vmss.c
${CC} -c ${CRASH_CFLAGS} vmware_vmss.c ${WARNING_OPTIONS} ${WARNING_ERROR}

Another question -- vmware_vmss.h has just one #include:

#include <stdbool.h>

That header file is not used in any of the top-level crash sources, and the gdb configuration
has a bunch of stuff where it checks for the existence of stdbool.h.

I note that the file is not located in /usr/include/stdbool.h, but does exist on
my build system:

$ find /usr/include -name stdbool.h
/usr/include/c++/4.7.2/tr1/stdbool.h
$ rpm -qf /usr/include/c++/4.7.2/tr1/stdbool.h
libstdc++-devel-4.7.2-2.fc17.x86_64
$

I'm not sure if there's some compiler magic that's picking it up from that location?

But just to prevent introducing *any* possible build errors on other systems that do
not have the file installed, would it be possible for you to change the "bool compressed"
declaration to be an integer?

And lastly, please add a GPL header to the two source files. You could use
sadump.h/sadump.c as templates.

Thanks,
Dave



----- Original Message -----
Post by Dave Anderson
----- Original Message -----
Post by Dyno (Hongjun) Fu
hi,
vmss file is VMware virtual machine snapshot file and contains all the
necessary memory dump that crash requires.
there is public available parse to read the format.
https://code.google.com/p/vmsnparser/
there is vmss2core ( https://labs.vmware.com/flings/vmss2core ) to convert it
to standard core file.
and this patch just enables crash to read it directly.
rgds,
Dyno
Hello Dyno,
Thank you very much for finally doing this. It is a welcome addition.
I cannot do much but compile-test it, so it would be helpful
if you could provide a sample VMSS vmcore available for future
testing. Can you make one available (preferably small but with
more than one cpu)?
I have two small issues that I'd like you to address. First,
please add is_vmware_vmss and vmware_vmss_init prototypes to
$ make warn
... [ cut ] ...
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6 main.c -Wall -O2
-Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
main.c:644:4: warning: implicit declaration of function 'is_vmware_vmss'
[-Wimplicit-function-declaration]
... [ cut ] ...
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6 filesys.c -Wall -O2
-Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
filesys.c:249:4: warning: implicit declaration of function 'vmware_vmss_init'
[-Wimplicit-function-declaration]
...
Secondly, I do not want to separate out MEMORY_SOURCES2/VMWARE_VMSS as you
have done. I understand that you did it because of the exhaustion
of pc->flags bits. However, we can simply do the same thing that was done
when the SADUMP facility was added, which is to move one of the pre-existing
pc->flags bits into pc->flags2. There are several of them that can be
safely moved.
I suggest moving GET_TIMESTAMP to pc->flags2. Looking at its use from
C symbol: GET_TIMESTAMP
File Function Line
0 defs.h <global> 207 #define GET_TIMESTAMP (0x100000ULL)
1 kernel.c kernel_init 204 if (pc->flags & GET_TIMESTAMP) {
2 main.c main 340 pc->flags |= GET_TIMESTAMP;
So please move GET_TIMESTAMP to pc->flags2, fix kernel_init() and main(),
assign 0x100000ULL to VMWARE_VMSS, and put VMWARE_VMSS in MEMORY_SOURCES.
Again, I really appreciate your effort. Can you repost this on short order?
I am planning on doing the crash-7.1.0 release by the end of the week, and
I would like to include this feature.
Thanks,
Dave
Dyno (Hongjun) Fu
2015-02-04 00:04:00 UTC
Permalink
Dave,

thanks for the review and here is the new patch. changes from the last version.

* add GPL license header
* remove stdbool.h
* complete function declaration
* add header file dependency in Makefile.
* fit VMWARE_VMSS to flag.

addition to the source file change,
* vmss file samples.
for vSphere ESX, memory dump is part of the vmss file;
for VMware Workstation, memory dump stores in a companion vmem file.

https://www.dropbox.com/sh/fe8cdwxg1mw97or/AADSDfKDc8dHgh2AIBrMJE1za?dl=0
- CentOS6.5-11bd56db.vmss - CentOS6.5/vSphere 5.5
kernel-debuginfo-2.6.32-431.el6.x86_64.rpm - symbol
kernel-debuginfo-common-x86_64-2.6.32-431.el6.x86_64.rpm - source

- Ubuntu1404_64bit-65993542.vmss - Ubuntu14.04/Workstation 11
Ubuntu1404_64bit-65993542.vmem - companion memory dump
linux-image-3.13.0-39-generic-dbgsym_3.13.0-39.66_amd64.ddeb - symbol

- run_crash.sh

* vmss parser - the internal structure of a vmss file.
- https://github.com/dyno/vmss.scripts/blob/master/vmss_construct.py

rgds,
Dyno
Dave Anderson
2015-02-04 22:09:35 UTC
Permalink
----- Original Message -----
Post by Dyno (Hongjun) Fu
Dave,
thanks for the review and here is the new patch. changes from the last version.
* add GPL license header
* remove stdbool.h
* complete function declaration
* add header file dependency in Makefile.
* fit VMWARE_VMSS to flag.
OK thanks.

So far I have made a few very minor additions. First, in main():

(1) The is_vmware_vmss() check should be preceded by the same "too many
dumpfiles" check that all of other dumpfile types do.
(2) I added write_vmware_vmss to the writemem_function_name() function
(since it does exist and you make the assignment).

And in the is_vmware_vmss() function:

(1) The error message for the fopen() failure cannot happen because
a read-only check is done for all command line files in main() before
checking what they are. But nonetheless, I left the error message
in place, encompassed by CRASHDEBUG(1).
(2) The call to is_vmware_vmss() should not unconditionally print error
messages if the dumpfile is not a vmss file; the purpose of the function
is simply to confirm or deny whether it's a vmss file. So, similar to
other dumpfile types, I encompassed the hdr.id validation error message
with CRASHDEBUG(1).
Post by Dyno (Hongjun) Fu
addition to the source file change,
* vmss file samples.
for vSphere ESX, memory dump is part of the vmss file;
for VMware Workstation, memory dump stores in a companion vmem file.
https://www.dropbox.com/sh/fe8cdwxg1mw97or/AADSDfKDc8dHgh2AIBrMJE1za?dl=0
- CentOS6.5-11bd56db.vmss - CentOS6.5/vSphere 5.5
kernel-debuginfo-2.6.32-431.el6.x86_64.rpm - symbol
kernel-debuginfo-common-x86_64-2.6.32-431.el6.x86_64.rpm - source
- Ubuntu1404_64bit-65993542.vmss - Ubuntu14.04/Workstation 11
Ubuntu1404_64bit-65993542.vmem - companion memory dump
linux-image-3.13.0-39-generic-dbgsym_3.13.0-39.66_amd64.ddeb - symbol
How do I extract the vmlinux-3.13.0-39-generic file?

Dave
Dyno (Hongjun) Fu
2015-02-04 22:22:02 UTC
Permalink
Post by Dave Anderson
----- Original Message -----
Post by Dyno (Hongjun) Fu
Dave,
thanks for the review and here is the new patch. changes from the last version.
* add GPL license header
* remove stdbool.h
* complete function declaration
* add header file dependency in Makefile.
* fit VMWARE_VMSS to flag.
OK thanks.
(1) The is_vmware_vmss() check should be preceded by the same "too many
dumpfiles" check that all of other dumpfile types do.
(2) I added write_vmware_vmss to the writemem_function_name() function
(since it does exist and you make the assignment).
(1) The error message for the fopen() failure cannot happen because
a read-only check is done for all command line files in main() before
checking what they are. But nonetheless, I left the error message
in place, encompassed by CRASHDEBUG(1).
(2) The call to is_vmware_vmss() should not unconditionally print error
messages if the dumpfile is not a vmss file; the purpose of the function
is simply to confirm or deny whether it's a vmss file. So, similar to
other dumpfile types, I encompassed the hdr.id validation error message
with CRASHDEBUG(1).
Post by Dyno (Hongjun) Fu
addition to the source file change,
* vmss file samples.
for vSphere ESX, memory dump is part of the vmss file;
for VMware Workstation, memory dump stores in a companion vmem file.
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.dropbox.com_sh_fe8cdwxg1mw97or_AADSDfKDc8dHgh2AIBrMJE1za-3Fdl-3D0&d=AwICaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=g2Vka_25x09RSowRkQw8pA&m=MjQn_IM6V_E1DFTKpCOAA41_gkhCWULZYVZXOUJ11Ns&s=6bVXW_DPSP4wbGMpQ84eLgexOMj3H6ZDpxuhskw8PNI&e=
- CentOS6.5-11bd56db.vmss - CentOS6.5/vSphere 5.5
kernel-debuginfo-2.6.32-431.el6.x86_64.rpm - symbol
kernel-debuginfo-common-x86_64-2.6.32-431.el6.x86_64.rpm - source
- Ubuntu1404_64bit-65993542.vmss - Ubuntu14.04/Workstation 11
Ubuntu1404_64bit-65993542.vmem - companion memory dump
linux-image-3.13.0-39-generic-dbgsym_3.13.0-39.66_amd64.ddeb - symbol
How do I extract the vmlinux-3.13.0-39-generic file?
Dave
Thanks for the update.

You can extract the symbol with,

ar -x linux-image-3.13.0-39-generic-dbgsym_3.13.0-39.66_amd64.ddeb
tar Jxvf data.tar.xz
ls ./usr/lib/debug/boot/vmlinux-3.13.0-39-generic

rgds,
Dyno
Dave Anderson
2015-02-05 19:48:19 UTC
Permalink
----- Original Message -----
Post by Dyno (Hongjun) Fu
Dave,
thanks for the review and here is the new patch. changes from the last version.
* add GPL license header
* remove stdbool.h
* complete function declaration
* add header file dependency in Makefile.
* fit VMWARE_VMSS to flag.
addition to the source file change,
* vmss file samples.
for vSphere ESX, memory dump is part of the vmss file;
for VMware Workstation, memory dump stores in a companion vmem file.
https://www.dropbox.com/sh/fe8cdwxg1mw97or/AADSDfKDc8dHgh2AIBrMJE1za?dl=0
- CentOS6.5-11bd56db.vmss - CentOS6.5/vSphere 5.5
kernel-debuginfo-2.6.32-431.el6.x86_64.rpm - symbol
kernel-debuginfo-common-x86_64-2.6.32-431.el6.x86_64.rpm - source
- Ubuntu1404_64bit-65993542.vmss - Ubuntu14.04/Workstation 11
Ubuntu1404_64bit-65993542.vmem - companion memory dump
linux-image-3.13.0-39-generic-dbgsym_3.13.0-39.66_amd64.ddeb - symbol
- run_crash.sh
* vmss parser - the internal structure of a vmss file.
- https://github.com/dyno/vmss.scripts/blob/master/vmss_construct.py
rgds,
Dyno
Hello Dyno,

I added just one other minor change to fix up the debug fprintf's in vmware_vmss_init()
for a clean "make warn" comile on 32-bit hosts.

Queued for crash-7.1.0:

https://github.com/crash-utility/crash/commit/f7e429764056d10e0ae87921e722e4e703cfb362

Nice addition to the supported dumpfile family.

Thanks,
Dave

Loading...