RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1357363 - Some environment variables don't take effect for virt-admin
Summary: Some environment variables don't take effect for virt-admin
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-18 05:08 UTC by Fangge Jin
Modified: 2016-11-03 18:50 UTC (History)
7 users (show)

Fixed In Version: libvirt-2.0.0-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:50:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Fangge Jin 2016-07-18 05:08:25 UTC
Description of problem:
Set environment variables  VIRT_ADMIN_DEBUG and  VIRT_ADMIN_LOG_FILE, then execute virt-admin commands, no debug log produced and no log file created.

Set environment variable VIRT_ADMIN_HISTSIZE, then execute virt-admin command in interactive mode, it also doesn't take effect.

Version-Release number of selected component:
libvirt-2.0.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Open a terminal and set environment variables:
# export VIRT_ADMIN_DEBUG=0
# export VIRT_ADMIN_LOG_FILE="/tmp/virt-admin.log"
# export VIRT_ADMIN_HISTSIZE=2

2.In the same terminal:
# virt-admin uri
libvirtd:///system

3.Check file /tmp/virt-admin.log
# cat /tmp/virt-admin.log
cat: /tmp/virt-admin.log: No such file or directory

4.Enter interactive mode:
# virt-admin
Welcome to virt-admin, the administrating virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virt-admin #


5. Execute three different commands:
virt-admin # pwd
/root/libvirt

virt-admin # cd /

virt-admin # srv-list
 Id    Name           
---------------
 0     libvirtd       
 1     admin          


6. Press "UP" key continually for three times and press enter:
virt-admin # pwd
/


Actual results:
As step 2&3&6

Expected results:
Step2:
# virt-admin uri
commands: "uri"  ===> outputs debug log
libvirtd:///system

Step3:
And the debug log is written into log file:
# cat /tmp/virt-admin.log
[2016.07.15 23:19:11 virt-admin 17544] INFO commands: "uri"

Step6:
The oldest history command should be "cd /" instead of "pwd"

Comment 2 Erik Skultety 2016-07-28 12:06:15 UTC
Fixed in upstream by:

commit d02ef33451a0d84692f32fe0877d621bfe243f50
Author:     Erik Skultety <eskultet>
AuthorDate: Thu Jul 28 12:54:16 2016 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Thu Jul 28 13:54:06 2016 +0200

    tools: Make use of the correct environment variables
    
    Since commit 834c5720 which extracted the generic functionality out of virsh
    and made it available for other clients like virt-admin to make use of it, it
    also introduced a bug when it renamed the original VIRSH_ environment variables
    to VSH_ variables. Virt-admin of course suffers from the same bug, so this
    patch modifies the generic module vsh.c to construct the correct name for
    environment variables of each client from information it has.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1357363
    
    Signed-off-by: Erik Skultety <eskultet>

v2.1.0-rc1-9-gd02ef33

Comment 6 Yanqiu Zhang 2016-08-09 09:36:36 UTC
Reproduce this bug on libvirt-2.0.0-2.el7.x86_64.

Steps to reproduce:
(A)For virt-admin: the steps and results are same as comment 0.

(B)For virsh client:
1.Open a terminal and set environment variables:
# export VIRSH_DEBUG=0
# export VIRSH_LOG_FILE="/tmp/virsh.log"
# export HISTSIZE=3

2.In the same terminal:
# virsh uri
qemu:///system

3.Check file /tmp/virsh.log
# cat /tmp/virsh.log
cat: /tmp/virsh.log: No such file or directory

4.4.Enter interactive mode and execute 4 different commands:
# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # pwd
/root

virsh # list
 Id    Name                           State
----------------------------------------------------

virsh # cd /

virsh # hostname
hostB

5. Press "UP" key continually for 4 times and press enter:
virsh # pwd
/


Verify this bug on libvirt-2.0.0-4.el7.x86_64.

Steps to Verify:
(A)For virt-admin: 
1.Open a terminal and set environment variables:
# export VIRT_ADMIN_DEBUG=0
# export VIRT_ADMIN_LOG_FILE="/tmp/virt-admin.log"
# export VIRT_ADMIN_HISTSIZE=3

2.In the same terminal:
# virt-admin uri
commands: "uri"
libvirtd:///system

3.Check file /tmp/virt-admin.log
# cat /tmp/virt-admin.log
[2016.08.09 13:57:48 virt-admin 7760] INFO commands: "uri"

4.Enter interactive mode, and execute 4 different commands:
# virt-admin
Welcome to virt-admin, the administrating virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virt-admin # pwd
/root

virt-admin # version
Compiled against library: libvirt 2.0.0
Using library: libvirt 2.0.0
Running against daemon: 2.0.0

virt-admin # cd /
cd: dir(optdata): /

virt-admin # srv-list
 Id    Name           
---------------
 0     admin          
 1     libvirtd 
     

5. Press "UP" key continually for 4 times and press enter:
virt-admin # version
Compiled against library: libvirt 2.0.0
Using library: libvirt 2.0.0
Running against daemon: 2.0.0

(B)For virsh client:
1.Open a terminal and set environment variables:
#  export VIRSH_DEBUG=0
# export VIRSH_LOG_FILE="/tmp/virsh.log"
# export VIRSH_HISTSIZE=3

2.In the same terminal:
# virsh uri
commands: "uri"
qemu:///system

3.Check file /tmp/virsh.log
# cat /tmp/virsh.log
[2016.08.09 14:47:53 virsh 8158] INFO commands: "uri"

4.Enter interactive mode, and execute 4 different commands:
# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # pwd
/root

virsh # list
 Id    Name                           State
----------------------------------------------------
 124   test1                          paused
 149   vmnode2                        running

virsh # cd /
cd: dir(optdata): /

virsh # hostname
hostA

5. Press "UP" key continually for 4 times and press enter:
virsh # list
 Id    Name                           State
----------------------------------------------------
 124   test1                          paused
 149   vmnode2                        running

Since the result is as expected, mark this bug as verified.

Comment 8 errata-xmlrpc 2016-11-03 18:50:19 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, 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://rhn.redhat.com/errata/RHSA-2016-2577.html


Note You need to log in before you can comment on or make changes to this bug.