Re: How to connect to console of domain on PowerPC?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

Thanks for your comments.
So far there's no device in QEMU to align with chardev on FSL PowerPC platforms like spapr-pty for IBM PSeries.
Maybe it needs patches to QEMU. I'll take deeper investigation on it.

Anyway for LXC instance, it doesn't depend on the syntax.
I can connect to the console if connect a domain with simple shell.
# vi vm1.xml
<domain type='lxc'>
  <name>vm1</name>
  <memory>32768</memory>
  <os>
    <type>exe</type>
    <init>/bin/sh</init>
  </os>
  <vcpu>1</vcpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <console type='pty' tty='/dev/pts/3'>
      <source path='/dev/pts/3'/>
      <target port='0'/>
    </console>
  </devices>
</domain>

# virsh -c lxc:/// define vm1.xml
# virsh -c lxc:/// start vm1
Domain vm1 started

# virsh -c lxc:/// console vm1
Connected to domain vm1
Escape character is ^]
sh-4.2# pwd
/
sh-4.2# ps
  PID TTY          TIME CMD
    1 pts/2    00:00:00 sh
    3 pts/2    00:00:00 ps


But can't get any output when connecting domain with a simple private root filesystem.
# vi vm2.xml
<domain type='lxc'>
  <name>vm2</name>
  <memory>25536</memory>
  <os>
    <type>exe</type>
    <init>/sbin/init</init>
  </os>
  <vcpu>1</vcpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount'>
      <source dir='/media/ram/vm1-root'/>
      <target dir='/var/lib/libvirt/lxc/rootfs'/>
    </filesystem>
    <interface type='network'>
      <source network='default'/>
    </interface>
    <console type='pty' />
  </devices>
</domain>

# virsh -c lxc:/// define vm2.xml
# virsh -c lxc:/// start vm2
Domain vm2 started

# virsh -c lxc:/// console vm2
Connected to domain vm2
Escape character is ^]


Do you have any suggestion? 

Best Regards,
Olivia

-----Original Message-----
From: Daniel P. Berrange [mailto:berrange@xxxxxxxxxx] 
Sent: Monday, February 04, 2013 6:19 PM
To: Yin Olivia-R63875
Cc: libvir-list@xxxxxxxxxx
Subject: Re:  How to connect to console of domain on PowerPC?

On Mon, Feb 04, 2013 at 02:22:03AM +0000, Yin Olivia-R63875 wrote:
> For instance,
> /usr/bin/qemu-system-ppc -name demo -M ppce500v2 -enable-kvm -m 256 
> -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk 
> -append "root=/dev/ram rw console=ttyS0,115200" -serial 
> tcp::4445,server
> 
> Then to run 'telnet 10.193.20.xxx 4445' could connect the guest.
> 
> 
> The temporary workaround is not add '-device' string after '-serial' option.

This is wrong. -serial is legacy command line syntax that libvirt should never use for any QEMU released in the last 2 years. New syntax is uses a combination of -device + -chardev.

> diff -Nur libvirt-0.10.1.orig/src/qemu/qemu_command.c 
> libvirt-0.10.1/src/qemu/qemu_command.c
> --- libvirt-0.10.1.orig/src/qemu/qemu_command.c 2012-08-30 
> 15:35:18.000000000 +0530
> +++ libvirt-0.10.1/src/qemu/qemu_command.c      2012-10-05 17:19:32.060368755 +0530
> @@ -5501,13 +5501,15 @@
>                  virCommandAddArg(cmd, devstr);
>                  VIR_FREE(devstr);
> 
> -                virCommandAddArg(cmd, "-device");
> -                if (!(devstr = qemuBuildChrDeviceStr(serial, qemuCaps,
> +                if (!STREQ(def->os.arch, "ppc")) {
> +                    virCommandAddArg(cmd, "-device");
> +                    if (!(devstr = qemuBuildChrDeviceStr(serial, 
> + qemuCaps,
>                                                       def->os.arch,
>                                                       def->os.machine)))
> -                   goto error;
> -                virCommandAddArg(cmd, devstr);
> -                VIR_FREE(devstr);
> +                    goto error;
> +                    virCommandAddArg(cmd, devstr);
> +                    VIR_FREE(devstr);
> +                }
>              } else {
>                  virCommandAddArg(cmd, "-serial");
>                  if (!(devstr = qemuBuildChrArgStr(&serial->source, 
> NULL)))
> 
> Applying the above patch to libvirt, all the other domain control commands could work except 'virsh console domain'.
> 
> # cat >demo.args <<EOF
> > /usr/bin/qemu-system-ppc -name demo -M ppce500v2 -enable-kvm -m 256 
> > -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk 
> > -append "root=/dev/ram rw console=ttyS0,115200" -serial 
> > tcp::4445,server -net nic EOF
> 
> # vi demo.args
> /usr/bin/qemu-system-ppc -name demo -M ppce500v2 -enable-kvm -m 256 
> -nographic -kernel /media/ram/uImage -initrd /media/ram/ramdisk 
> -append "root=/dev/ram rw console=ttyS0,115200" -serial 
> tcp::4445,server -net nic

If you think libvirt has a problem generating command line args, then rather than telling us about some random command line args you've created yourself, please provide the actual args that libvirt has generated. See /var/log/libvirt/qemu/$GUESTNAME.log for those.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]