Bug 957077

Summary: Convert guest domain XML config to a native guest configuration format occur an unknown error.
Product: Red Hat Enterprise Linux 7 Reporter: zzhong <zzhong>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, cwei, dyuan, jtomko, mzhan, xuzhang, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.0.5-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 09:39:42 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 zzhong@redhat.com 2013-04-26 10:13:58 UTC
Description of problem:

 Convert guest domain XML config to a native guest configuration format occur an unknown error.


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

 libvirt-1.0.4-1.1.el7.x86_64
 qemu-kvm-1.4.0-2.1.el7.x86_64
 kernel-3.8.0-0.43.el7.x86_64


How reproducible:
100%



Steps to Reproduce:

1: config qemu.conf to support tls
  1.1 uncomment the following settings in qemu.conf
    spice_listen = "0.0.0.0"
    spice_tls = 1
    spice_tls_x509_cert_dir = "/etc/pki/libvirt-spice"
  1.2 erform the following script, to generate the cert files for ssl , and then copy *.pem file info /etc/pkil/libvirt-spice directory
#!/bin/bash

SERVER_KEY=server-key.pem

# creating a key for our ca
if [ ! -e ca-key.pem ]; then
    openssl genrsa -des3 -out ca-key.pem 1024
fi
# creating a ca
if [ ! -e ca-cert.pem ]; then
    openssl req -new -x509 -days 1095 -key ca-key.pem -out ca-cert.pem  -subj "/C=IL/L=Raanana/O=Red Hat/CN=my CA"
fi
# create server key
if [ ! -e $SERVER_KEY ]; then
    openssl genrsa -out $SERVER_KEY 1024
fi
# create a certificate signing request (csr)
if [ ! -e server-key.csr ]; then
    openssl req -new -key $SERVER_KEY -out server-key.csr -subj "/C=IL/L=Raanana/O=Red Hat/CN=my server"
fi
# signing our server certificate with this ca
if [ ! -e server-cert.pem ]; then
    openssl x509 -req -days 1095 -in server-key.csr -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem
fi

# now create a key that doesn't require a passphrase
openssl rsa -in $SERVER_KEY -out $SERVER_KEY.insecure
mv $SERVER_KEY $SERVER_KEY.secure
mv $SERVER_KEY.insecure $SERVER_KEY

# show the results (no other effect)
openssl rsa -noout -text -in $SERVER_KEY
openssl rsa -noout -text -in ca-key.pem
openssl req -noout -text -in server-key.csr
openssl x509 -noout -text -in server-cert.pem
openssl x509 -noout -text -in ca-cert.pem

# copy *.pem file to /etc/pki/libvirt-spice
if [[ -d "/etc/pki/libvirt-spice" ]] 
then
    cp ./*.pem /etc/pki/libvirt-spice
else
    mkdir /etc/pki/libvirt-spice
        cp ./*.pem /etc/pki/libvirt-spice
fi

# echo --host-subject
echo "your --host-subject is" \" `openssl x509 -noout -text -in server-cert.pem | grep Subject: | cut -f 10- -d " "` \"
2:
echo '<?xml version="1.0"?>
<domain type="kvm">
  <name>tls-only</name>
  <memory>32768</memory>
  <os>
    <type arch="x86_64" machine="pc">hvm</type>
  </os>
  <devices>
    <graphics type="spice" tlsPort="5800" passwd="123" >
      <listen type="address" address="::" />
    </graphics>
    <video>
      <model type="qxl" vram="32768" heads="1"/>
    </video>
  </devices>
</domain>' | virsh domxml-to-native qemu-argv /dev/stdin
  
Actual results:
    error: An error occurred, but the cause is unknown

Expected results:
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name tls-only -S -M pc -enable-kvm -m 32 -smp 1,sockets=1,cores=1,threads=1 -uuid 74377671-f095-aa5b-031b-2c5037b81977 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/tls-only.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -no-acpi -device piix3-usb-uhci,id=usb -spice tls-port=5800,addr=::,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on -vga qxl -global qxl-vga.vram_size=33554432 -device virtio-balloon-pci,id=balloon0

Additional info:

Comment 2 Ján Tomko 2013-04-26 11:57:59 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2013-April/msg01910.html

Comment 3 Ján Tomko 2013-04-30 08:49:16 UTC
Fixed upstream by:
commit 11fc1beab6e018a88182f80056d35217c150b3de
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-04-29 19:54:07 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-04-30 10:23:44 +0200

    qemu: assign addresses when converting xml to native
    
    This adds addresses to domxml-to-native output and chooses
    the correct virtio devices for ccw and s390 machines.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=957077

Comment 4 zzhong@redhat.com 2013-05-08 01:00:48 UTC
verify with build:
libvirt-1.0.5-1.el7.x86_64
qemu-kvm-1.4.0-4.el7.x86_64
3.8.0-0.43.el7.x86_64

step is same with the description.

[root@zzhong test20130425]#echo '
<domain type="kvm">
<name>tls-only</name>
<memory>32768</memory>
<os>
<type arch="x86_64" machine="pc">hvm</type>
</os>
<devices>
<graphics type="spice" tlsPort="5800" passwd="123" >
<listen type="address" address="::" />
</graphics>
<video>
<model type="qxl" vram="32768" heads="1"/>
</video>
</devices>
</domain>' | virsh domxml-to-native qemu-argv /dev/stdin
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name tls-only -S -machine pc,accel=kvm,usb=off -m 32 -smp 1,sockets=1,cores=1,threads=1 -uuid 30c6c8cb-f6d2-4aea-9f0c-05deccd6c45f -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/tls-only.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -no-acpi -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -spice tls-port=5800,addr=::,x509-dir=/etc/pki/libvirt-spice,seamless-migration=on -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=33554432 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

not occur an unknown error.verification passed.

Comment 6 Ludek Smid 2014-06-13 09:39:42 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.