Bug 1162759

Summary: Double sgabios ROM appears if you have -nographic and <bios useserial='yes'/>
Product: Red Hat Enterprise Linux 6 Reporter: Paolo Bonzini <pbonzini>
Component: libvirtAssignee: Martin Kletzander <mkletzan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.7CC: dyuan, honzhang, knoel, mkletzan, mzhan, pbonzini, rbalakri, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.10.2-49.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 05:48:12 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 Paolo Bonzini 2014-11-11 16:18:56 UTC
RHEL6 adds a "-device sga" automatically if it sees -nographic on the command line; unfortunately this did not go upstream.  RHEL7 does not.

We should try to have one XML that has the same effect on RHEL6 and RHEL7.  Would it be possible for RHEL6 Libvirt to ignore <bios useserial='yes'/> if it is also adding -nographic to the command line?

Comment 2 Martin Kletzander 2015-01-20 09:54:03 UTC
(In reply to Paolo Bonzini from comment #0)
I'm not sure I get what you mean.  You mean qemu is adding sga device if it sees '-nographic' and if libvirt adds the sga device after that, the output is doubled?  If that's the case, why don't you revert that patch that does that?

Of course we can change the:

if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES)

to:

if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES &&
    def->graphics)

I just want to make sure that's what you mean and know if there's a problem with reverting the patch that's actually broken instead of working around that.

Thanks in advance for your reply.

Comment 3 Paolo Bonzini 2015-01-27 12:32:41 UTC
> If that's the case, why don't you revert that patch that does that?

Because that would break existing RHEL6 guests, that do not have an explicit <bios useserial='yes'/>.  They have to be adjusted in order to migrate to RHEL7, but we want a migration path that allows RHEL6 and RHEL7 to coexist.

Comment 6 zhenfeng wang 2015-02-12 09:12:36 UTC
Hi Martain
I could see the "-device sga" was added automatically if I have -nographic and <bios useserial='yes'/> in the guest's xml in rhel6 without your patch. After apply your patch, the "-device sga" won't be added automatically anymore. According to palo's description in comment0, the rhel7 wont't add the sga device automatically if we do the same testing with rhel6, If I interpret his discription right. However, I find the rhel7 will also add the sga device automatically if we do the same testing with the rhel6, so there will have different handle between the rhel6 and rhel7 after apply your patch, was this your expect result, can you help check it? BTW, the following scenarios were my whole testing, you can refer it, thanks

Testing without patch with libvirt-48, then do the migration between rhel6 and rhel7
ENV:
RHEL6 HOST:
qemu-kvm-rhev-0.12.1.2-2.452.el6.x86_64
libvirt-0.10.2-48.el6.x86_64

RHEL7 HOST:
libvirt-1.2.8-16.el7.x86_64
qemu-kvm-rhev-2.1.2-23.el7.x86_64


scenario1
1.Have graphical and <bios useserial='yes'/> in the guest's xml, start the guest, coud see the sga device in the qemu command line
#virsh start rhel6
# ps aux|grep rhel6
--
-nodefconfig -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus
2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, could see the sga device 
#virsh migrate --live rhel6 qemu+ssh://$target_ip/system 
<target># ps aux|grep rhel6
--
-no-user-config -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus

scenario 2
1.Have graphical but without <bios useserial='yes'/> in the guest's xml, start the guest, coudn't see the sga device in the qemu command line

2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, couldn't see the sga device either.

scenario 3
1.Have nographical and  <bios useserial='yes'/> in the guest's xml, start the guest, coud see the sga device in the qemu command line
 #virsh start rhel6
# ps aux|grep rhel6
--
-nographic -nodefconfig -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus

2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, could see the sga device 
#virsh migrate --live rhel6 qemu+ssh://$target_ip/system 
<target># ps aux|grep rhel6
--
-nographic -no-user-config -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus

scenario 4
1.Have nographical and without <bios useserial='yes'/> in the guest's xml, start the guest, coudn't see the sga device in the qemu command line

2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, couldn't see the sga device either.



Retest the scenario 1~4 with libvirt-0.10.2-49.el6 wich include the fixed patch

1.Have graphical and <bios useserial='yes'/> in the guest's xml, start the guest, coud see the sga device in the qemu command line
#virsh start rhel6
# ps aux|grep rhel6
--
-nodefconfig -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus
2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, could see the sga device 
#virsh migrate --live rhel6 qemu+ssh://$target_ip/system 
<target># ps aux|grep rhel6
--
-no-user-config -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus

scenario 2
1.Have graphical but without <bios useserial='yes'/> in the guest's xml, start the guest, coudn't see the sga device in the qemu command line

2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, couldn't see the sga device either.

scenario 3
1.Have nographical and  <bios useserial='yes'/> in the guest's xml, start the guest, coudn't see the sga device in the qemu command line any more after apply the patch
 #virsh start rhel6
# ps aux|grep rhel6
--
-nographic -nodefconfig -nodefaults
-vnc 127.0.0.1:0 -vga cirrus

2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, however, could see the sga device in the target host
#virsh migrate --live rhel6 qemu+ssh://$target_ip/system 
<target># ps aux|grep rhel6
--
-nographic -no-user-config -nodefaults -device sga
-vnc 127.0.0.1:0 -vga cirrus

scenario 4
1.Have nographical and without <bios useserial='yes'/> in the guest's xml, start the guest, coudn't see the sga device in the qemu command line

2.Migrate the guest to rhel7 host, after finish migration, check the qemu command line in the target host, couldn't see the sga device either.

Comment 7 Martin Kletzander 2015-02-12 13:03:53 UTC
This cannot be checked by looking at the command-line.  qemu-kvm itself (internally) treats the commands differently in RHELs 6 and 7.  You have to check whether you see the serial output twice, once or not at all.  It should be twice if reproducing, but only once after the fix.

Comment 8 zhenfeng wang 2015-02-13 08:28:29 UTC
Hi paolo
I want to reproduce the issue that double sgabios ROM appears if i have --nographic and <bios useserial='yes'/> in the guest's xml, however, i can't reproduce it, can you show me how to check the serial output twice?  I do some researching according to Martin's suggestion, however didn't hit the    issue,please help have a check, thanks

reproduce packet info
libvirt-0.10.2-48.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.452.el6.x86_64
seabios-0.6.1.2-28.el6.x86_64


steps
1.Prepare a little guest's xml
#virsh dumpxml rhel6
--
 <os>
    <type arch='x86_64' machine='rhel6.6.0'>hvm</type>
    <boot dev='hd'/>
    <bios useserial='yes'/>
  </os>
--
 <serial type='file'>
      <source path='/tmp/file'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='file'>
      <source path='/tmp/file'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>

2.Start the guest 
#virsh start rhel6

3.Check the qemu command line only 1 sga device show 
#ps aux|grep qemu
--
nographic -nodefconfig -nodefaults -device sga

4.check the boot info from the serial output, didn't find duplicated sgabios ROM show
#cat /tmp/file
^[[1;256r^[[256;256H^[[6n
Google, Inc.
Serial Graphics Adapter 07/26/11
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (mockbuild.redhat.com) Tue Jul 26 15:05:08 UTC 2011
Term: 80x24
4 0
^[[2J^MSeaBIOS (version seabios-0.6.1.2-28.el6)^M
^MMachine UUID b9efd4f5-81e6-0650-bc65-5aa6f49a2595^M
^MBooting from Hard Disk...^M
^MBoot failed: could not read the boot disk^M
^M
^MBooting from Floppy...^M
^MBoot failed: could not read the boot disk^M
^M
^MNo bootable device.^M

Comment 9 zhenfeng wang 2015-02-26 07:32:32 UTC
Also try the qemu-kvm packet with the comment 8's steps , got the same result with comment8.

Comment 10 Paolo Bonzini 2015-02-26 12:55:57 UTC
You can use "info qtree" from the QEMU monitor (virsh qemu-monitor-command --hmp DOMAIN 'info qtree') and check that you only see one sga device.

Comment 11 zhenfeng wang 2015-02-27 05:31:03 UTC
Thanks Paolo's suggestion, currently, i could reproduce the issue that double sgabios ROM appears if i have --nographic and <bios useserial='yes'/> in the guest's xml and check the sga device with virsh qemu-monitor-command command.

The reproduce steps like following
1.Prepare a guest with --nographic and <bios useserial='yes'/> in the guest's xml
2.Start the guest
3.Check the sga device with the virsh qemu-monitor-command, double sgabios ROM will appears

<source># virsh qemu-monitor-command --hmp kdc 'info qtree' |grep sga
          dev: sga, id ""
          dev: sga, id ""
4.migrate the guest to the target, only 1 sgabios ROM will appears
<source>#virsh migrate --live rhel6 qemu+ssh://$target_ip/system 
<target>## virsh qemu-monitor-command --hmp kdc 'info qtree' |grep sga
          dev: sga, id ""


Verify this bug with libvirt-0.10.2-49.el6, only 1 sga device show while check it with qemu-monitor-command according to the reproduce steps.
<source># virsh qemu-monitor-command --hmp kdc 'info qtree' |grep sga
          dev: sga, id ""

However have another doubt that, the sga device will show in the qemu command line with libvirt-0.10.2-48.el6, it won't show with libvirt-0.10.2-49.el6, then retry it in rhel7 host, the sga device will always show in the qemu command line, so I doubt that whether the sga device should show in the qemu command in rhel6 and i have no idear why it appears in the qemu command line with  libvirt-0.10.2-48.el6 but didn't with  libvirt-0.10.2-49.el6, can you help me check it ? thanks

Comment 12 Martin Kletzander 2015-02-27 08:18:24 UTC
I don't quite understand your phrasing.  Anyway, whatever libvirt specifies, if there's <bios useserial='yes'/>, there should be *one* sga device in the "info tree" output.  It doesn't matter what happens between libvirt and qemu, that's only usable for debugging.

Comment 13 zhenfeng wang 2015-02-28 02:32:16 UTC
Thanks Martin's patient reply, I got my answer from your comment, qemu-kvm itself (internally) treats the commands differently in RHELs 6 and 7, so it's expect result that didn't show sga device in the qemu command line in rhel6. The following was the summary about sga device in both rhel6 and rhel7

In rhel6 host

1. while configure the <bios useserial='yes'/> and graphical in the guest's xml
we could see 1 sga device in both qemu command line and the qemu-monitor command line

2.while configure the <bios useserial='yes'/> and no graphical in the guest's xml
we could only see 1 sga device with qemu-monitor command line , couldn't see the sga device in the qemu command line


3.while didn't configure the <bios useserial='yes'/> but configure graphical in the guest's xml

we woundn't see the sga device in neither qemu command line nor the qemu-mornitor commandline

4.while didn't configure the <bios useserial='yes'/> and no graphical either in the guest's xml
we could only see 1 sga device with qemu-monitor command line, couldn't see the sga device in the qemu command line

In rhel7 host

1. while configure the <bios useserial='yes'/> and graphical in the guest's xml
we could see 1 sga device in both qemu command line and the qemu-monitor command line

2.while configure the <bios useserial='yes'/> and no graphical in the guest's xml
we could see 1 sga device in both qemu command line and the qemu-monitor command line

3.while didn't configure the <bios useserial='yes'/> but configure graphical in the guest's xml

we woundn't see the sga device in neither qemu command line nor the qemu-mornitor commandline

4.while didn't configure the <bios useserial='yes'/> and no graphical either in the guest's xml
we woundn't see the sga device in neither qemu command line nor the qemu-mornitor commandline


All the above scenarios have cover the cross migration from rhel6 to rhel7 and the guest could be migrated successfully, so mark this bug verify

Comment 15 errata-xmlrpc 2015-07-22 05:48:12 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/RHBA-2015-1252.html