Bug 1879108

Summary: Inconsistent naming of "oc virt" command in help text
Product: Container Native Virtualization (CNV) Reporter: Joel Davis <jodavis>
Component: VirtualizationAssignee: Daniel Hiller <dhiller>
Status: CLOSED ERRATA QA Contact: Israel Pinto <ipinto>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.4.1CC: cnv-qe-bugs, ncredi, sgott
Target Milestone: ---   
Target Release: 2.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hco-bundle-registry-container-v2.6.0-489 virt-operator-container-v2.6.0-100 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-10 11:18:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joel Davis 2020-09-15 13:07:15 UTC
Description of problem:
Help text produced by "oc virt" commands references itself using several variation which appear incorrect to me.

Essentially, if you run "oc virt" without arguments which kubectl-virtctl exists in the command line the last two lines are:

    Use "kubectl virt <command> --help" for more information about a given command.
    Use "kubectl virt options" for a list of global command-line options (applies to all commands).


However if you rename it to oc-virt and run "oc virt" again it becomes:

    Use "virtctl <command> --help" for more information about a given command.
    Use "virtctl options" for a list of global command-line options (applies to all commands).

Neither of which appear to be correct to me since it was invoked with "oc virt"

Version-Release number of selected component (if applicable):

[kni@worker-3 bin]$ oc virt version
Client Version: version.Info{GitVersion:"v0.26.1", GitCommit:"e40ff7965e2aadbf21131626dfa3be85524e3a2c", GitTreeState:"clean", BuildDate:"2020-02-19T16:16:36Z", GoVersion:"go1.12.8", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:


Steps to Reproduce:
1. Ensure the virtctl exists on the command line with either the name "oc-virt" or "kubectl-virt"

2. run "oc virt" without arguments to produce help text.


Actual results:
see above, command line present in help text output appears to vary. In the case of naming the executable "oc-virt" it refers to itself as "virtctl" even if an executable with that name doesn't exist:

[....snip....]
Use "virtctl <command> --help" for more information about a given command.
Use "virtctl options" for a list of global command-line options (applies to all commands).
[kni@worker-3 bin]$ which virtctl
/usr/bin/which: no virtctl in (/home/kni/.local/bin:/home/kni/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)


Expected results:
The help text includes an executable name as it was invoked instead of looking at what the executable might be named.

Comment 1 Nelly Credi 2020-09-23 16:11:40 UTC
@Stu, should this be assigned to virt?

Comment 2 sgott 2020-09-23 19:48:28 UTC
Re-assigning to Virtualization as the affected component is command line based.

Comment 3 Daniel Hiller 2020-09-25 12:15:34 UTC
How exactly is the virtctl binary delivered to the user d/s? My guess is that the binary is somehow delivered named as `oc-virt` and the kubectl/oc plugin mechanism is used to integrate it with oc binary?

Then the easiest fix would be to adjust the logic to check how the binary itself is named and in case of any form of

virtctl -> Help text uses `virtctl...`
kubectl-virt -> Help text uses `kubectl virt...`
oc-virt -> Help text uses `oc virt...`

Comment 4 Daniel Hiller 2020-09-25 13:30:24 UTC
Created u/s PR https://github.com/kubevirt/kubevirt/pull/4265 to address this.

Comment 5 Joel Davis 2020-09-30 00:33:26 UTC
Sorry I was on PTO last week. Do you still need this info?

Comment 6 Daniel Hiller 2020-09-30 08:02:47 UTC
Yes, please. We need to find out if the proposed fix would apply.

Comment 7 Joel Davis 2020-09-30 12:28:30 UTC
It's installed via the kubevirt-virtctl package:

[root@worker-3 ~]# rpm -ql kubevirt-virtctl
/usr/bin/virtctl


[root@worker-3 ~]# rpm -qi kubevirt-virtctl
Name        : kubevirt-virtctl
Version     : 0.26.1
Release     : 15.el8
Architecture: x86_64
Install Date: Tue 04 Aug 2020 04:20:43 PM EDT
Group       : Unspecified
Size        : 41798296
License     : ASL 2.0
Signature   : RSA/SHA256, Thu 20 Feb 2020 12:43:47 PM EST, Key ID 199e2f91fd431d51
Source RPM  : kubevirt-0.26.1-15.el8.src.rpm
Build Date  : Wed 19 Feb 2020 11:18:07 AM EST
Build Host  : x86-vm-08.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : https://github.com/kubevirt/kubevirt
Summary     : kubevirt - virtctl
Description :
CNV kubevirt virtctl

The documentation appears to use virtctl directly rather than through a plugin: https://docs.openshift.com/container-platform/4.5/virt/virt-using-the-cli-tools.html#virt-using-the-cli-tools

Comment 8 Israel Pinto 2021-01-23 18:28:04 UTC
$ which oc-virt
/usr/bin/oc-virt
$ oc-virt
Available Commands:
  console      Connect to a console of a virtual machine instance.
  expose       Expose a virtual machine instance, virtual machine, or virtual machine instance replica set as a new service.
  fslist       Return full list of filesystems available on the guest machine.
  guestosinfo  Return guest agent info about operating system.
  help         Help about any command
  image-upload Upload a VM image to a DataVolume/PersistentVolumeClaim.
  migrate      Migrate a virtual machine.
  pause        Pause a virtual machine
  rename       Rename a stopped virtual machine.
  restart      Restart a virtual machine.
  start        Start a virtual machine.
  stop         Stop a virtual machine.
  unpause      Unpause a virtual machine
  userlist     Return full list of logged in users on the guest machine.
  version      Print the client and server version information.
  vnc          Open a vnc connection to a virtual machine instance.

Use "virtctl <command> --help" for more information about a given command.
Use "virtctl options" for a list of global command-line options (applies to all commands).

Comment 11 errata-xmlrpc 2021-03-10 11:18:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Virtualization 2.6.0 security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:0799