From f70349716af7f1dc5cbbfb16a62a3108a6ca4435 Mon Sep 17 00:00:00 2001 From: ge Date: Thu, 9 Nov 2023 02:21:42 +0300 Subject: [PATCH] various improvements --- README.md | 2 -- compute/cli/control.py | 14 +++++++------- compute/instance/instance.py | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3485089..6c98cd8 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ Compute-instance management library and tools. -Currently supports only QEMU/KVM based virtual machines. - ## Docs Run `make serve-docs`. See [Development](#development) below. diff --git a/compute/cli/control.py b/compute/cli/control.py index a49a856..6e4c2c5 100644 --- a/compute/cli/control.py +++ b/compute/cli/control.py @@ -89,16 +89,16 @@ def _exec_guest_agent_command( instance = session.get_instance(args.instance) ga = GuestAgent(instance.domain, timeout=args.timeout) arguments = args.arguments.copy() - if len(arguments) > 1: + if len(arguments) > 1 and not args.no_join_args: arguments = [shlex.join(arguments)] - if not args.no_cmd_string: + if not args.no_join_args: arguments.insert(0, '-c') stdin = None if not sys.stdin.isatty(): stdin = sys.stdin.read() try: output = ga.guest_exec( - path=args.shell, + path=args.executable, args=arguments, env=args.env, stdin=stdin, @@ -296,8 +296,8 @@ def cli() -> None: # noqa: PLR0915 ), ) execute.add_argument( - '-s', - '--shell', + '-x', + '--executable', default='/bin/sh', help='path to executable in guest, /bin/sh by default', ) @@ -311,11 +311,11 @@ def cli() -> None: # noqa: PLR0915 ) execute.add_argument( '-n', - '--no-cmd-string', + '--no-join-args', action='store_true', default=False, help=( - "do not append '-c' option to arguments list, suitable " + "do not join arguments list and add '-c' option, suitable " 'for non-shell executables and other specific cases.' ), ) diff --git a/compute/instance/instance.py b/compute/instance/instance.py index 3f33325..bcb3927 100644 --- a/compute/instance/instance.py +++ b/compute/instance/instance.py @@ -409,7 +409,7 @@ class Instance: raise InstanceError( f'Cannot set zero vCPUs for instance={self.name}' ) - if nvcpus == self.info.nproc: + if nvcpus == self.get_info().nproc: log.warning( 'Instance instance=%s already have %s vCPUs, nothing to do', self.name,