Currently list always returns 0, even if there was an error. Instead
have it accumulate any errors and return that.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
It is user's or other program's reponsibility, not the current program.
Just try best to let the user know what happen.
Also make print_guest() keep the same behavior as do_debug()
do_pause() ...etc. when it failed.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
comm is unused ==> fscanf() is unused ==> fd is unused
==> proc_name is unused.
so all this code can be removed.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
'./lkvm list' does not give the correct vm status if the vm is paused
currently.
This patch fixes this by using KVM_IPC_VMSTATE IPC cmd to query the vm
status.
Suppose the guest is paused by ./lkvm pause:
Before:
asias@hj$ ./lkvm list
PID NAME STATE
------------------------------------
3036 guest-3036 running
default shut off
After:
asias@hj$ ./lkvm list
PID NAME STATE
------------------------------------
3036 guest-3036 paused
default shut off
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Commands' usage : Change the binary name from *kvm* to *lkvm*,
since commit ad3efb18 has done it.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
because the program name is changed, "./lkvm list -i" can't work now.
This fix just remove the test:
1) this test is not reliable.
2) the target process can respond for "get_pid()", it must be
kvm-tool. (at least it is more reliable)
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
With the patch, output of "kvm list" will be:
% ./kvm list
PID NAME STATE
------------------------------------
5270 test running
test shut off
default shut off
"not running" is changed into "shut off", as it might
be other states which are "not running" in future? such
as "paused".
Signed-off-by: Osier Yang <jyang@redhat.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch changes the IPC method to use UNIX sockets instead of
signals.
This allows for more flexibility in moving data between processes, for example
it would allow avoid printing output in the terminal of the guest.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Previously we would only list running instances, now that we create
rootfs instances it's appropriate to add a method to list them as
well.
Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch connects usage helpers to 'kvm help' callbacks, allowing
to see help about a command by doing 'kvm help [command]'.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch improves 'kvm list' output to look more like 'ps':
$ ./kvm list
PID GUEST
2820 guest-2820
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
callback function maybe fail, so we should deal with the return value.
Signed-off-by: Liming Wang <walimisdev@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch changes './kvm list' to retrieve process name from
'/proc/<pid>/stat' instead of '/proc/<pid>/comm' as it appears the latter
does not exist by default on several systems.
Reported-by: Pradeep Kumar Surisetty <psuriset@linux.vnet.ibm.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Rename kvm-[command] into builtin-[command] to prevent
clashes with non-command files such as kvm-cpu.h
Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>