Wind River Support Network

HomeDefectsOVP-329
Fixed

OVP-329 : OVP: instructions for KVM Guest "hostfwd" do not work as documented

Created: May 14, 2013    Updated: Mar 11, 2016
Resolved Date: Oct 27, 2013
Found In Version: 5.0.1
Fix Version: 5.0.1.9
Severity: Standard
Applicable for: Wind River Linux 5
Component/s: Kernel

Description

1) I attempted to make a simple network connect to a KVM Guest as per this document. Specifically, I used " -net nic -net user,hostfwd=tcp::5555-:22".

   http://git/cgi-bin/cgit.cgi/layers/wr-kernel/tree/Documentation/kvm_networking_options.txt?h=WRLINUX_5_0_1_HEAD

However, the "scp" examples in the document did not work. 

2) In the main OVP README, the step to discover the KVM Guest IP address is not described in any detail.

  http://git/cgi-bin/cgit.cgi/layers/ovp/tree/Documentation/00-README?h=WRLINUX_5_0_1_HEAD 

223:  - obtain guest IP address

Workaround

add "ip=dhcp" in kernel parameter 

Steps to Reproduce

1) Configure the Guest OS

  $ /folk/tux-installs/ovp-5011/wrlinux-5/wrlinux/configure \
       --enable-board=x86-64-kvm-guest \
       --enable-rootfs=ovp-guest+initramfs+kvm \
       --enable-addons=wr-ovp
     --with-template=feature/debug,feature/oprofile \
     --enable-jobs=4


2) Change the preemption level and re-enable oprofile

  $ make -C build linux-windriver.menuconfig

  (a) Set preempt level (PREEMPT__LL)

     Processor type and features  ---> 
       Preemption Model (xxx)
         * "Preemptible Kernel (Low-Latency Desktop)" 

  (b) Re-enable oprofile (OPROFILE)
  
    General setup  ---> 
       [*] Profiling support 
       <*> OProfile system profiling 


3) Build the project and USB image

  $ make -C build linux-windriver.rebuild
  $ make fs
  $ make usb-image
  

4) Configure your KVM Host project

  $ /folk/tux-installs/ovp-5011/wrlinux-5/wrlinux/configure \
     --enable-board=intel-xeon-core \
     --enable-rootfs=ovp-kvm \
     --enable-addons=wr-ovp \
     --with-template=feature/debug,feature/oprofile \
     --enable-jobs=4


5) Update the kernel as per step #2, rebuild the kernel and file system

  $ make -C build linux-windriver.menuconfig
  $ make -C build linux-windriver.rebuild


6) Add the KVM Guest kernel and root fs into the KVM Host file system root, for example using the File System Layout feature of Workbench. 

Here is an example resulting "layers/local/conf/image_final/changelist.xml" file:

  $ cat layers/local/conf/image_final/changelist.xml 
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <layout_change_list version="1">
    <change_list>
        <cl action="addfile" gid="users" name="/bzImage-3.4-r0-x86-64-kvm-guest-20130513212419.bin" size="4588240" source="/wrs/workdir/ovp-lx501/drop1/kvm_guest/bitbake_build/tmp/deploy/images/bzImage-3.4-r0-x86-64-kvm-guest-20130513212419.bin" uid="dreyna" umode="644"/>
        <cl action="addfile" gid="users" name="/start_guest.sh" size="450" source="/wrs/workdir/ovp-lx501/drop1/xeon_ovp/start_guest.sh" uid="dreyna" umode="644"/>
        <cl action="addfile" gid="users" name="/usb.img" size="551093760" source="/wrs/workdir/ovp-lx501/drop1/kvm_guest/export/usb.img" uid="dreyna" umode="644"/>
    </change_list>
  </layout_change_list>


7) Boot the KVM Host on a physical target


8) Start a separate SSH session to the KVM Host, so that you can have access to both the host and guest consoles. The KVM Host IP can be found via "ifconfig".

  $ ssh <KVM_HOST_IP>


9) Boot the KVM Guest on the KVM Host, with networking enabled, as per this document:

  http://git/cgi-bin/cgit.cgi/layers/wr-kernel/tree/Documentation/kvm_networking_options.txt?h=WRLINUX_5_0_1_HEAD

On the separate SSH session, run this command, and observe that the KVM Guest boots:

  root@qemu0:/# /usr/bin/qemu-system-x86_64  -enable-kvm   -m 512 -name rt,process=rt-kvm  -no-reboot  -nographic  -kernel kernel.bin  -append "root=/dev/hda2 rw console=ttyS0,115200 oprofile.timer=1"  -hda usb.img  -mlock  -net nic -net user,hostfwd=tcp::5555-:22

10) Attempt to transfer files over scp between the guest and host, as per "kvm_networking_options.txt".

  (a) "you can transport a file with this from host to guest"

  # scp -P 5555 file.txt root@localhost:/tmp

Observe that this command fails with a timeout.

  (b) For transferring a file from guest to host, you can simply run below commandline:
  
  # scp file.txt root@10.0.2.2:/tmp

Observe that this command fails because it cannot find a route.

Live chat
Online