14 Commits

Author SHA1 Message Date
Lai Jiangshan 08ffc82ad5 kvm tools: Check the state before pause/resume
Let the user know what happened

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:50 +01:00
Asias He 2fa65af316 kvm tools: Improve 'lkvm {pause,resume}'s output
lkvm {pause,resume} do not give any feedback to user who uses these
commands in the console where the command run.

This patch makes the command output in the command console instead of
guest console.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:50 +01:00
Lai Jiangshan 5aa502e4b0 kvm tools: carefully send and handle pause/resume ipc
Remove struct pause_cmd/resume_cmd and use kvm_ipc__send().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:50 +01:00
Lai Jiangshan 0b235f6b59 kvm tools: cleanup kvm_cmd_pause()
Use stack variable.
Remove unneeded branch.
Close opened file.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:50 +01:00
Wanlong Gao 8d2ff5da21 kvm tools: change the binary name from kvm to lkvm for commands' usage
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>
2015-06-01 16:39:50 +01:00
Sasha Levin 4b1addaeed kvm tools: Switch to using UNIX sockets instead of signals
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>
2015-06-01 16:39:48 +01:00
Sasha Levin 66ce4f5eec kvm tools: Use correct data type for pid
This patch fixes an error where pids used u64 instead of pid_t, causing them
to never be negative.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Sasha Levin 7a6144aa71 kvm tools: Fix wrong kill() PID in commands
There was a mixup in the balloon usage string and some of the commands were
retrieving the instance name from the wrong place. This will cause the commands
to issue kill() with negative PIDs (which sends the signal to every process in
the system). Without this patch, 'kvm command instance' will do crazy things
like restart whole Gnome session.

Tested-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Sasha Levin 477db183e8 kvm tools: Improve 'kvm pause' parameters
kvm pause now uses the git option parser to parse parameters.

Added option to pause instance by PID and pause all instances.

Improved usage message.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Sasha Levin 0725673ad3 kvm tools: Connect existing command helpers to 'kvm help'
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>
2015-06-01 16:39:47 +01:00
Pekka Enberg c9cba7910f kvm tool: Fix builtin command usage printouts
This patch fixes builtin commands to use usage_with_options() instead of die().
The latter prefixes messages with "Fatal" which makes the usage text ugly.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Liming Wang 886af5f228 kvm tools: convert callback to int and deal with the return value
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>
2015-06-01 16:39:46 +01:00
Sasha Levin 02317b74e8 kvm tools: Split 'kvm pause' and add 'kvm resume'
This patch seperates 'kvm pause' into 'kvm pause' and 'kvm resume',
'kvm pause' no longer acts as a switch between running and paused state but
instead just switches the instance into paused and reume is handled by
the new 'kvm resume'.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:46 +01:00
Sasha Levin 2a24f96d64 kvm tools: Rename command source files
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>
2015-06-01 16:39:46 +01:00