719b663 libxl: channels support

4 files Authored by Joao Martins 7 years ago, Committed by Jim Fehlig 7 years ago,
    libxl: channels support
    
    And allow libxl to handle channel element which creates a Xen
    console visible to the guest as a low-bandwitdh communication
    channel. If type is PTY we also fetch the tty after boot using
    libxl_channel_getinfo to fetch the tty path. On socket case,
    we autogenerate a path if not specified in the XML. Path autogenerated
    is slightly different from qemu driver: qemu stores also on
    "channels/target" but it creates then a directory per domain with
    each channel target name. libxl doesn't appear to have a clear
    definition of private files associated with each domain, so for
    simplicity we do it slightly different. On qemu each autogenerated
    channel goes like:
    
    channels/target/<domain-name>/<target name>
    
    Whereas for libxl:
    
    channels/target/<domain-name>-<target name>
    
    Should note that if path is not specified it won't persist,
    existing only on live XML, unless user had initially specified it.
    Since support for libxl channels only came on Xen >= 4.5 we therefore
    need to conditionally compile it with LIBXL_HAVE_DEVICE_CHANNEL.
    
    After this patch and having a qemu guest agent:
     $ cat domain.xml | grep -a1 channel | head -n 5 | tail -n 4
     <channel type='unix'>
       <source mode='bind' path='/tmp/channel'/>
       <target type='xen' name='org.qemu.guest_agent.0'/>
     </channel>
    
     $ virsh create domain.xml
     $ echo '{"execute":"guest-network-get-interfaces"}' | socat
     stdio,ignoreeof  unix-connect:/tmp/channel
    
     {"execute":"guest-network-get-interfaces"}
     {"return": [{"name": "lo", "ip-addresses": [{"ip-address-type": "ipv4",
     "ip-address": "127.0.0.1", "prefix": 8}, {"ip-address-type": "ipv6",
     "ip-address": "::1", "prefix": 128}], "hardware-address":
     "00:00:00:00:00:00"}, {"name": "eth0", "ip-addresses":
     [{"ip-address-type": "ipv4", "ip-address": "10.100.0.6", "prefix": 24},
     {"ip-address-type": "ipv6", "ip-address": "fe80::216:3eff:fe40:88eb",
     "prefix": 64}], "hardware-address": "00:16:3e:40:88:eb"}, {"name":
     "sit0"}]}
    
    Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
    Signed-off-by: Jim Fehlig <jfehlig@suse.com>
    
        
file modified
+110 -0
file modified
+8 -0
file modified
+42 -1
file modified
+7 -0