olopez32 / ganeti

Automatically exported from code.google.com/p/ganeti
0 stars 0 forks source link

xen-hvm GNU/Linux instances: vif type of ioemu breaks netboot and PVHVM compatibility #636

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What software version are you running? Please provide the output of "gnt-
cluster --version", "gnt-cluster version", and "hspace --version".

root@ganeti1:~# gnt-cluster --version 
gnt-cluster (ganeti v2.9.1) 2.9.1

root@ganeti1:~# gnt-cluster version 
Software version: 2.9.1
Internode protocol: 2090000
Configuration format: 2090000
OS api version: 20
Export interface: 0
VCS version: v2.9.1

root@ganeti1:~# hspace --version
hspace (ganeti) version v2.9.1
compiled with ghc 7.4
running on linux x86_64

What distribution are you using?
Debian GNU/Linux 7.2 (wheezy) x86_64
What steps will reproduce the problem?
1. Setup TFTP/PXE server to provide boot images based on IP. (Or use a Debian 
netboot iso.)

2. Create a xen-hvm instance with default vNIC (rtl8139), empty vif_type, and 
set to network boot: 

root@ganeti1:~# gnt-instance add -B memory=1024 -H 
xen-hvm:boot_order=ndc,vif_type= --no-install --no-start -o debootstrap+default 
-t drbd -s 10G -n ganeti1.example.com:ganeti2.example.com 
ganetitestl.example.com

root@ganeti1:~# gnt-instance info ganetitestl.example.com
- Instance name: ganetitestl.example.com
  UUID: d83e9a6f-4a01-4f5e-bfc7-d3d3fa81caa7
  Serial number: 1
  Creation time: 2013-12-09 16:31:55
  Modification time: 2013-12-09 16:31:55
  State: configured to be down, actual state is down
  Nodes: 
    - primary: ganeti1.example.com
      group: default (UUID 7c2116d1-2c07-4f2f-995f-b251324edfa2)
    - secondaries: ganeti2.example.com (group default, group UUID 7c2116d1-2c07-4f2f-995f-b251324edfa2)
  Operating system: debootstrap+default
  Operating system parameters: 
  Allocated network port: 11006
  Hypervisor: xen-hvm
  console connection: vnc to ganeti1.example.com:11006 (display 5106)
  Hypervisor parameters: 
    acpi: default (True)
    blockdev_prefix: default (hd)
    boot_order: ndc
    cdrom_image_path: default ()
    cpu_cap: default (0)
    cpu_mask: default (all)
    cpu_weight: default (256)
    device_model: default (/usr/lib/xen/bin/qemu-dm)
    disk_type: default (paravirtual)
    kernel_path: default (/usr/lib/xen/boot/hvmloader)
    nic_type: default (rtl8139)
    pae: default (True)
    pci_pass: default ()
    reboot_behavior: default (reboot)
    use_localtime: default (False)
    vif_script: default ()
    vif_type: 
    viridian: default (False)
    vnc_bind_address: default (0.0.0.0)
    vnc_password_file: default (/etc/ganeti/vnc-cluster-password)
  Back-end parameters: 
    always_failover: default (False)
    auto_balance: default (True)
    maxmem: 1024
    memory: default (1024)
    minmem: 1024
    spindle_use: default (1)
    vcpus: default (1)
  NICs: 
    - nic/0: 
      MAC: aa:00:00:e2:91:01
      IP: None
      mode: bridged
      link: xenbr0
      network: None
      UUID: cd937b7f-b0a1-4016-aecc-372fd01b8172
      name: None
  Disk template: drbd
  Disks: 
    - disk/0: drbd, size 10.0G
      access mode: rw
      nodeA: ganeti1.example.com, minor=0
      nodeB: ganeti2.example.com, minor=0
      port: 11007
      auth key: 7ae78d2592fad27ca8dd7ce8df01214a44f95366
      on primary: /dev/drbd0 (147:0) in sync, status ok
      on secondary: /dev/drbd0 (147:0) in sync, status ok
      name: None
      UUID: 2f03faef-25df-4539-8bb7-e74497e9632e
      child devices: 
        - child 0: plain, size 10.0G
          logical_id: xenvg/30a513d4-0ff4-4648-b329-81df57364781.disk0_data
          on primary: /dev/xenvg/30a513d4-0ff4-4648-b329-81df57364781.disk0_data (254:1)
          on secondary: /dev/xenvg/30a513d4-0ff4-4648-b329-81df57364781.disk0_data (254:4)
          name: None
          UUID: 6c9c99e5-4927-4223-8665-8133d3426c2e
        - child 1: plain, size 128M
          logical_id: xenvg/30a513d4-0ff4-4648-b329-81df57364781.disk0_meta
          on primary: /dev/xenvg/30a513d4-0ff4-4648-b329-81df57364781.disk0_meta (254:2)
          on secondary: /dev/xenvg/30a513d4-0ff4-4648-b329-81df57364781.disk0_meta (254:5)
          name: None
          UUID: 816bc03d-abc0-4c0a-acfe-cc3feccecb1e

root@ganeti1:~# gnt-instance start ganetitestl.example.com

root@ganeti1:~# cat /etc/xen/ganetitestl.example.com
# Automatically generated by Ganeti. Do not edit!

kernel = '/usr/lib/xen/boot/hvmloader'
builder = 'hvm'
memory = 1024
maxmem = 1024
vcpus = 1
cpu_weight=256
name = 'ganetitestl.example.com'
pae = 1
acpi = 1
viridian = 0
apic = 1
device_model = '/usr/lib/xen/bin/qemu-dm'
boot = 'ndc'
sdl = 0
usb = 1
usbdevice = 'tablet'
vnc = 1
vnclisten = '0.0.0.0'
vncdisplay = 5106
vncunused = 0
vncpasswd = '123456'
serial = 'pty'
vif = ['mac=aa:00:00:e2:91:01, model=rtl8139, type=ioemu, bridge=xenbr0']
disk = ['phy:/var/run/ganeti/instance-disks/ganetitestl.example.com:0,hda,w']
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'

root@ganeti1:~# xm list --long ganetitestl.example.com
(domain
    (domid 54)
    (cpu_weight 256)
    (cpu_cap 0)
    (pool_name Pool-0)
    (bootloader '')
    (vcpus 1)
    (cpus (()))
    (on_poweroff destroy)
    (description '')
    (on_crash restart)
    (uuid 19bcd508-218f-7386-71e7-58abeafcea83)
    (bootloader_args '')
    (name ganetitestl.example.com)
    (on_reboot restart)
    (maxmem 1024)
    (memory 1024)
    (shadow_memory 9)
    (features '')
    (on_xend_start ignore)
    (on_xend_stop ignore)
    (start_time 1386626490.71)
    (cpu_time 7.180245058)
    (online_vcpus 1)
    (image
        (hvm
            (kernel '')
            (superpages 0)
            (videoram 4)
            (hpet 0)
            (stdvga 0)
            (vnclisten 0.0.0.0)
            (loader /usr/lib/xen/boot/hvmloader)
            (xen_platform_pci 1)
            (rtc_timeoffset 0)
            (pci ())
            (hap 1)
            (localtime 0)
            (timer_mode 1)
            (vncdisplay 5106)
            (pci_msitranslate 1)
            (oos 1)
            (apic 1)
            (sdl 0)
            (usbdevice tablet)
            (vpt_align 1)
            (serial pty)
            (vncunused 0)
            (boot ndc)
            (vncpasswd 123456)
            (pae 1)
            (viridian 0)
            (acpi 1)
            (vnc 1)
            (nographic 0)
            (nomigrate 0)
            (usb 1)
            (tsc_mode 0)
            (guest_os_type default)
            (device_model /usr/lib/xen/bin/qemu-dm)
            (pci_power_mgmt 0)
            (xauthority /root/.Xauthority)
            (isa 0)
            (notes (SUSPEND_CANCEL 1))
        )
    )
    (status 2)
    (state -b----)
    (store_mfn 1044476)
    (device
        (vif
            (bridge xenbr0)
            (uuid 38f1f128-7663-ff8a-97d6-e72d25069b2e)
            (script /etc/xen/scripts/vif-bridge)
            (mac aa:00:00:e2:91:01)
            (model rtl8139)
            (type ioemu)
            (backend 0)
        )
    )
    (device
        (console
            (protocol vt100)
            (location 3)
            (uuid d075586f-f376-0858-f96b-5b68eaa1f623)
        )
    )
    (device
        (vbd
            (protocol x86_64-abi)
            (uuid d05e17db-15bc-5667-22bf-81f121478779)
            (bootable 1)
            (dev hda:disk)
            (uname
                phy:/var/run/ganeti/instance-disks/ganetitestl.example.com:0
            )
            (mode w)
            (backend 0)
            (VDI '')
        )
    )
    (device
        (vfb
            (vncunused 0)
            (vnc 1)
            (uuid 455f48ab-13ed-80a6-1b9a-9c2479efe8cd)
            (vnclisten 0.0.0.0)
            (vncdisplay 5106)
            (vncpasswd 123456)
            (location 0.0.0.0:11006)
        )
    )
)

3. Connect via VNC, check that instance is unable to acquire ip address from 
dhcp
  - Instance can dhcp and has correct MAC when it netboots.
  - MAC address is listed as all zeros once instance kernel loads.

4. Copy the xen instance config file to /root/.
root@ganeti1:~# cp /etc/xen/ganetitestl.example.com 
/root/ganetitestl.example.com

5. Shutdown the instance
gnt-instance shutdown ganetitestl.example.com

6. Create a temporary LV and file for testing without Ganeti:
root@ganeti1:~# lvcreate -L20G -ntemp xenvg
root@ganeti1:~# mkfs.ext4 /dev/mapper/xeng-temp
root@ganeti1:~# mkdir /mnt/foo
root@ganeti1:~# mount /dev/mapper/xeng-temp /foo/bar

Edit the config and remove the ioemu vif_type. Set to disk to file so we can 
test without invoking Ganeti.

vif = ['mac=aa:00:00:e2:91:01, model=rtl8139, bridge=xenbr0']
disk = ['file:/mnt/foo/bar,hda,w']

7. Start the xen instance without ganeti, using the modified config file:

root@ganeti1:~# xm create /root/ganetitestl.example.com

8. Connect via VNC, instance gets dhcp at boot for netboot, maintains MAC once 
instance kernel loads and dhcps successfully.
  - vif_type is not ioemu in output of "xm list --long ganetitestl.example.com"
       (vif
            (bridge xenbr0)
            (uuid 38f1f128-7663-ff8a-97d6-e72d25069b2e)
            (script /etc/xen/scripts/vif-bridge)
            (mac aa:00:00:e2:91:01)
            (model rtl8139)
            (backend 0)
        )

What is the expected output? What do you see instead?
Not setting vif_type in Ganeti should not set it in Xen, even if nic_type is 
not paravirtual, in order to enable PXE/netboot. Instead Ganeti only sets 
vif_type as empty if nic_type is paravirtual.

Suspect that kernel PVHVM components being loaded at boot is part of the issue. 
Emulated NIC works for netboot, but then dies once kernel loads because 
vif_type is set to ioemu.

Please provide any additional information below.
 - This issue is an extension of Resolved bug #247: http://code.google.com/p/ganeti/issues/detail?id=247
 - This issue alluded to in disscussion: https://groups.google.com/forum/#!searchin/ganeti/vif|sort:date/ganeti/2L16z5zz4XE/rpDadL5L51kJ
 - Official Xen documentation example allows for model type without vif type of ioemu: http://wiki.xen.org/wiki/Xen_Linux_PV_on_HVM_drivers#Xen_PVHVM_drivers_configuration_example
 - Inability to set xen_platform_pci=0 prevents ability to force HVM guest to use emulated NIC: http://code.google.com/p/ganeti/issues/detail?id=199
 - Official Xen documentation specifies default vif_type of netfront: http://wiki.xen.org/wiki/Xen_Configuration_File_Options#Networking
 - Official Xen documentation indicating that netfront is used for PVHVM: http://wiki.xen.org/wiki/Xen_Networking#Paravirtualised_Network_Devices 
 - Related xen-devel list post: http://lists.xen.org/archives/html/xen-devel/2011-10/msg02157.html

Original issue reported on code.google.com by sma...@lehigh.edu on 10 Dec 2013 at 2:41

GoogleCodeExporter commented 9 years ago
still happens in 2.11. please fix it 

my Workaround:

--- ganeti-2.11.5.orig/lib/hypervisor/hv_xen.py
+++ ganeti-2.11.5/lib/hypervisor/hv_xen.py
@@ -1381,8 +1381,8 @@ class XenHvmHypervisor(XenHypervisor):
       nic_type_str = ", type=paravirtualized"
     else:
       # parameter 'model' is only valid with type 'ioemu'
-      nic_type_str = ", model=%s, type=%s" % \
-        (nic_type, constants.HT_HVM_VIF_IOEMU)
+      # thats not true!!!!!!! remove type= if PVHVM 
+      nic_type_str = ", model=%s" % nic_type
     for idx, nic in enumerate(instance.nics):
       nic_str = "mac=%s%s" % (nic.mac, nic_type_str)
       ip = getattr(nic, "ip", None)

Original comment by stephan....@gmail.com on 27 May 2015 at 12:59