Detaching a device

You can unplug devices from a running virtual server, remove devices from the persistent virtual server configuration, or both.

Before you begin

You need a device configuration-XML file to detach a device from a virtual server. If the device has previously been attached to the virtual server, use the device configuration-XML file that was used to attach the device.

Procedure

  1. Detach the device using the virsh detach-device command (see detach-device):
    # virsh detach-device <VS> <device-configuration-XML-filename> <scope>
    <device-configuration-XML-filename>
    Is the name of the device configuration-XML file.
    <VS>
    Is the name of the virtual server as defined in the domain configuration-XML file.
    <scope>
    Specifies the scope of the command:
    --live
    Unplugs the device from a running virtual server. This configuration change does not persist across stopping and starting the virtual server.
    --config
    Removes the device from the persistent virtual server configuration. The device becomes unavailable when the virtual server is next started. This configuration change persists across stopping and starting the virtual server.
    --persistent
    Removes the device from the persistent virtual server configuration and unplugs it if the virtual server is running. This configuration change persists across stopping and starting the virtual server. This option is equivalent to specifying both --live and --config.
  2. Optional: If removing a virtual block device leaves an unused I/O thread, remove the thread along with the device.

    The virsh iothreadinfo command displays the I/O threads that are available for a virtual server.

    Use the virsh iothreaddel command to remove an I/O thread:
    # virsh iothreaddel <VS> <IOthread-ID>
    <VS>
    Is the name of the virtual server as defined in the domain configuration-XML file.
    <IOthread-ID>
    Is the ID of the I/O thread to be deleted from the virtual server.