SUSE Support

Here When You Need Us

Ejecting CD in Dom0 from DomU fails

This document (7007356) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11 Service Pack 1

Situation

Trying to eject a CD-ROM device medium on the virtual machine host (Dom0) from within a virtual machine (VM/DomU) fails like in the example below :

# eject /dev/xvdc
not an sg device, or old sg driver
eject: unable to eject, last error: Invalid argument

The only thing that happens is that a potentially mounted filesystem gets unmounted.
There are no error messages in any logs on Dom0.

Resolution

To use eject and other CDROM-specific commands on a device in the virtual machine host (Dom0) from within a virtual machine (DomU), use the tapdisk's cdrom driver (tap:cdrom) instead of Xen's general block driver (phy:).

Additionally ejecting Dom0 CD devices from VMs is restricted by a few (but obvious) constraints :
1) The VM should be SLES 11 SP1 (SLES 11 should work as well, but is out of general support since 15th of December 2010)
2) Other VMs must not be using the CD device at the same time..

Formats :
As argument on the vm-install command :
When defining the virtual disk for the CD, use for example :
  --disk tap:cdrom:/dev/sr0,xvdc,cdrom,r

Native domain configuration file :
For domains that have not been modified by any management utilities like virsh or virt-manager :
  disk=[ 'tap:cdrom:/dev/sr0,xvdc:cdrom,r', ]

After saving the file, activate the change with
# xm new <domain-config-file-name>
For modified, managed domains :
  1. Stop the domain
  2. Export the current domain configuration into a file in sxp format with :
    # xm list -l > <domain-name>.sxp
  3. Backup the exported configuration file
  4. Open the file for editing
  5. Locate the CD device definition similar to the following :
        (device
            (vbd
                (protocol x86_64-abi)
                (uuid c4d4d5c4-dd01-ce81-e377-d43919f3b33e)
                (bootable 0)
                (dev xvdc:cdrom)
                (uname phy:/dev/sr0)
                (mode r)
                (backend 0)
                (VDI )
            )
        )
  6. Change it to look like this instead :
        (device
            (tap
                (protocol x86_64-abi)
                (uuid c4d4d5c4-dd01-ce81-e377-d43919f3b33e)
                (bootable 0)
                (dev xvdc:cdrom)
                (uname tap:cdrom:/dev/sr0)
                (mode r)
                (backend 0)
               (VDI )
            )
        )
  7. Save and close the file
  8. Import the changes :
    # xm new -F  <domain-name>.sxp
  9. Start the domain


Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7007356
  • Creation Date: 10-Dec-2010
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.