---------- Forwarded message ----------
        From: 
Gizmo Chicken <gizmochicken@xxxxxxxxx>
        Date: Fri, Dec 7, 2012 at 10:00 AM
        Subject: Re: [Xen-API] Attach CD or Removable Devices
        To: Paul Pridt <
p.pridt@xxxxxxxxx>
        Cc: 
xen-api@xxxxxxxxxxxxx
        
        
        Paul,
        
        I suspect that what you want to do could be accomplished via PCI
        passthrough to an HVM guest, which is the subject of a thread
        having the subject "[Xen-API] XCP PCI Passthrough on HVM how
        to?" that was started a few weeks ago.  So you might want to
        follow (and perhaps join in) that thread.
        
        Without repeating the entirety of the above mentioned thread,
        I'll note that the original poster referenced a tutorial found
        at 
http://wiki.xen.org/wiki/XCP_Ubuntu_PCIPassthrough
        addressing PCI passthrough to a PV guest in XCP.  However, the
        original poster wasn't able to adapt that tutorial to his goal
        of configuring PCI passthrough to an HVM guest in XCP, and so
        sought help from the group.
        
        Unlike the situation with the XAPI toolstack, the procedure for
        configuring PCI passthrough to an HVM guest is relatively
        straightforward with Xen when using the default toolstack.  For
        a discussion of both VGA and PCI passthrough in Xen when using
        the default toolstack, see 
http://forums.linuxmint.com/viewtopic.php?f=42&t=112013. 
        
        
        So if you don't mind leaving behind the comforts of XenCenter
        for something like Virtual Machine Manager (virt-manager), maybe
        Xen and its default toolstack is a better option for you.
        
        I wish that I could be of more help.
        
        Best regards,
        GizmoChicken
        
        P.S. I'm currently using Xen (and Virtual Machine Manager), but
        I would switch to XCP (and XenCenter) if I could get PCI
        passthough working in XCP.  In such a case, I would passthrough
        nearly all of my USB controllers, along with a second PCI video
        card, to an HVM guest running Ubuntu desktop.  That way I could
        have, on a single machine, both a stable XCP server (which I
        could leave up 24/7 to host my virtual servers) and also local
        access to virtual machine having fully functional desktop (which
        I could shut down when not in use).  I imagine that many would
        apprciate such functionality in XCP, so let's hope that the
        developers consider adding such a feature to future releases of
        XCP if not already possible via xe command line.
        
        
        
          
          
            
              
                
                  On Fri, Dec 7, 2012 at 3:18 AM, Paul Pridt 
<p.pridt@xxxxxxxxx>
                    wrote:
                    
                      Hi,
                      I am looking for a way to attach a physical CD
                      drive or a USB-attached hard drive to a VM.
                      I know that Citrix Xenserver does that through
                      special udev-SRs. There you even can attach an
                      internal hard drive with the help of an udev rule
                      that creates the vdi.
                      Has anybody a running solution?
                      My system is Ubuntu 12.04 with xcp-xapi.
                          
                          -- 
                          Regards,
                          Paul
                        
                    
                    
                  What is it exactly you're trying to accomplish?
                    I'd start by checking
                    /etc/udev/rules.d/58-xapi.rules for events and check
                    the scripts that it runs. 
                  
                    
                  
                  58-xapi.rules
                  
                    # Skip devices which fail the local sharing
                      check (to filter out root/mounted devices)
                    ACTION=""
                      PROGRAM!="/opt/xensource/libexec/check-device-sharing
                      %k", GOTO="end_xapi"
                    
                    
                    ACTION="" SYMLINK+="xapi/block/%k"
                    
                    
                    ACTION="" RUN+="/bin/sh -c
                      '/opt/xensource/libexec/local-device-change %k
                      2>&1 >/dev/null&'"
                    ACTION="" RUN+="/bin/sh -c
                      '/opt/xensource/libexec/local-device-change %k
                      2>&1 >/dev/null&'"
                   
                  
                  
                  
                  
                  Part of
                      /opt/xensource/libexec/local-device-change
                  
                  
                  
                     for SR in `xe sr-list type=udev
                      sm-config:type=block uuid=${LOCAL_SR} params=uuid
                      --minimal`
                          do
                            xe vdi-introduce uuid=`uuidgen`
                      sr-uuid=${SR} type=user
                      location=/dev/xapi/block/${DEVICE}
                     done
                   
                  
                  
                  
                  
                  Read the whole scripts of course but this might
                    get you started.