<chapter id="devconfig2-1"><title>Dynamically Configuring Devices
(Tasks)</title><highlights><para>This chapter provides instructions for dynamically configuring devices
in the Solaris OS. You can add, remove, or replace devices in the Solaris
OS while the system is still running, if the system components support hot-plugging.
If the system components do not support hot-plugging, you can reboot the system
to reconfigure the devices.</para><para>For information on the procedures associated with dynamically configuring
devices, see the following:</para><itemizedlist><listitem><para><olink targetptr="devconfig2-120" remap="internal">SCSI Hot-Plugging With the
cfgadm Command (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devconfig2-121" remap="internal">PCI or PCIe Hot-Plugging
With the cfgadm Command (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devconfig2-34" remap="internal">Application Developer RCM
Script (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devconfig2-35" remap="internal">System Administrator RCM
Script (Task Map)</olink></para>
</listitem>
</itemizedlist><para>For information on hot-plugging USB devices with the <command>cfgadm</command> command,
see <olink targetptr="devusbtasks-94" remap="internal">Hot-Plugging USB Devices With the cfgadm
Command</olink>.</para><para>For information about accessing devices, see <olink targetptr="devaccess-90138" remap="internal">Accessing Devices</olink>.</para>
</highlights><sect1 id="devconfig2-6"><title>Dynamic Reconfiguration and Hot-Plugging</title><para><emphasis>Hot-plugging</emphasis> is the ability to physically add,
remove, or replace system components while the system is running. <emphasis>Dynamic
reconfiguration</emphasis> refers to the ability to hot-plug system components.
This term also refers to the general ability to move system resources (both
hardware and software) around in the system or to disable them in some way
without physically removing them from the system.</para><para>Generally, you can hot-plug the following bus types:</para><itemizedlist><listitem><para>USB</para>
</listitem><listitem><para>Fibre Channel</para>
</listitem><listitem><para>1394</para>
</listitem><listitem><para>ATA</para>
</listitem><listitem><para>SCSI</para>
</listitem>
</itemizedlist><para>In addition, you can hot-plug the following devices with the <command>cfgadm</command> command:</para><itemizedlist><listitem><para>USB devices on SPARC and x86 platforms</para>
</listitem><listitem><para>SCSI devices on SPARC and x86 platforms</para>
</listitem><listitem><para>PCI devices on SPARC and x86 platforms</para>
</listitem><listitem><para>PCIe devices on SPARC or x86 platforms</para>
</listitem>
</itemizedlist><para>Features of the <command>cfgadm</command> command include the following:</para><itemizedlist><listitem><para>Displaying system component status</para>
</listitem><listitem><para>Testing system components</para>
</listitem><listitem><para>Changing component configurations</para>
</listitem><listitem><para>Displaying configuration help messages</para>
</listitem>
</itemizedlist><para>The benefit of using the <command>cfgadm</command> command to reconfigure
systems components is that you can add, remove, or replace components while
the system is running. An added benefit is that the <command>cfgadm</command> command
guides you through the steps needed to add, remove, or replace system components.</para><para>For step-by-step instructions on hot-plugging components, see the following:</para><itemizedlist><listitem><para><olink targetptr="devconfig2-8" remap="internal">SCSI Hot-Plugging With the
cfgadm Command</olink></para>
</listitem><listitem><para><olink targetptr="devconfig2-49" remap="internal">PCI or PCIe Hot-Plugging
With the cfgadm Command</olink></para>
</listitem><listitem><para><olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</listitem>
</itemizedlist><note><para>Not all SCSI and PCI controllers support hot-plugging with the <command>cfgadm</command> command. </para>
</note><para>As part of Sun's high availability strategy, dynamic reconfiguration
is expected to be used in conjunction with additional layered products, such
as alternate pathing or fail over software. Both products provide fault tolerance
in the event of a device failure. </para><para>Without any high availability software, you can replace a failed device
by manually stopping the appropriate applications, unmounting noncritical
file systems, and then proceeding with the add or remove operations.</para><note><para>Some systems have slots that hot-pluggable and slots that are
not hot-pluggable. For information about hot-plugging devices on your specific
hardware configuration, such as on enterprise-level systems, refer to your
hardware configuration documentation.</para>
</note><sect2 id="devconfig2-7"><title>Attachment Points</title><para>The <command>cfgadm</command> command displays information about <emphasis>attachment points</emphasis>, which are locations in the system where dynamic
reconfiguration operations can occur. </para><para>An attachment point consists of the following:</para><itemizedlist><listitem><para>An <emphasis>occupant</emphasis>, which represents a hardware
component that can be configured into the system</para>
</listitem><listitem><para>A <emphasis>receptacle</emphasis>, which is the location that
accepts the occupant</para>
</listitem>
</itemizedlist><para>Attachment points are represented by logical and physical attachment
point IDs (<literal>Ap_Id</literal>s). The physical <literal>Ap_Id</literal> is
the physical path name of the attachment point. The logical <literal>Ap_Id</literal> is
a user-friendly alternative for the physical <literal>Ap_Id</literal>. For
more information on <literal>Ap_Id</literal>s, refer to <olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>The logical <literal>Ap_Id</literal> for a SCSI Host Bus Adapter (HBA),
or SCSI controller, is usually represented by the controller number, such
as <literal>c0</literal>.</para><para>In cases where no controller number has been assigned to a SCSI HBA,
then an internally generated unique identifier is provided. An example of
a unique identifier for a SCSI controller is the following:</para><para><literal>fas1:scsi</literal></para><para>The logical <literal>Ap_Id</literal> for a SCSI device usually has this
format:</para><para><replaceable>HBA-logical-apid::device-identifier</replaceable></para><para>In the following example, <literal>c0</literal> is the logical <literal>Ap_Id</literal> for the SCSI HBA:</para><para><literal>c0::dsk/c0t3d0</literal></para><para>The device identifier is typically derived from the logical device name
for the device in the <filename>/dev</filename> directory. For example, a
tape device with logical device name, <filename>/dev/rmt/1</filename>, has
the following logical <literal>Ap_Id</literal>:</para><para><literal>c0::rmt/1</literal></para><para>If a logical <literal>Ap_Id</literal> of a SCSI device cannot be derived
from the logical name in the <filename>/dev</filename> directory, then an
internally generated unique identifier is provided. An example of an identifier
for the <filename>/dev/rmt/1</filename> tape device is the following:</para><para><literal>c0::st4</literal></para><para>For more information on SCSI <literal>Ap_Id</literal>s, refer to <olink targetdoc="refman1m" targetptr="cfgadm-scsi-1m" remap="external"><citerefentry><refentrytitle>cfgadm_scsi</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>The <command>cfgadm</command> command represents all resources and dynamic
reconfiguration operations in terms of a common set of states (such as configured
and unconfigured) and operations (such as connect, configure, unconfigure,
and so on). For more information on these common states and operations, see <olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>The following table shows the receptacle and occupant states for the
SCSI HBA attachment points.</para><informaltable frame="all"><tgroup cols="4" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="99*"/><colspec colwidth="99*"/><colspec colname="colspec1" colwidth="99*"/><colspec colwidth="99*"/><thead><row><entry><para>Receptacle State</para>
</entry><entry><para>Description</para>
</entry><entry><para>Occupant State</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>empty</literal></para>
</entry><entry><para>N/A for SCSI HBA</para>
</entry><entry><para><literal>configured</literal></para>
</entry><entry><para>One or more devices is configured on the bus</para>
</entry>
</row><row><entry><para><literal>disconnected</literal></para>
</entry><entry><para>Bus quiesced</para>
</entry><entry><para><literal>unconfigured</literal></para>
</entry><entry><para>No devices are configured</para>
</entry>
</row><row><entry><para><literal>connected</literal></para>
</entry><entry><para>Bus active</para>
</entry><entry><para></para>
</entry><entry><para></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>The following table shows the receptacle and occupant states for SCSI
device attachment points.</para><informaltable frame="all"><tgroup cols="4" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="99*"/><colspec colwidth="99*"/><colspec colname="colspec1" colwidth="99*"/><colspec colwidth="99*"/><thead><row><entry><para>Receptacle State</para>
</entry><entry><para>Description</para>
</entry><entry><para>Occupant State</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>empty</literal></para>
</entry><entry><para>N/A for SCSI devices</para>
</entry><entry><para><literal>configured</literal></para>
</entry><entry><para>Device is configured</para>
</entry>
</row><row><entry><para><literal>disconnected</literal></para>
</entry><entry><para>Bus quiesced</para>
</entry><entry><para><literal>unconfigured</literal></para>
</entry><entry><para>Device is not configured</para>
</entry>
</row><row><entry><para><literal>connected</literal></para>
</entry><entry><para>Bus active</para>
</entry><entry><para></para>
</entry><entry><para></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>The state of SCSI attachment points is unknown unless special hardware
indicates otherwise. For instructions on displaying SCSI component information,
see <olink targetptr="devconfig2-9" remap="internal">How to Display Information About SCSI
Devices</olink>.</para>
</sect2><sect2 id="devconfig2-48"><title>Detaching PCI or PCIe Adapter Cards</title><para>A PCI adapter card that is hosting nonvital system resources can be
removed if the device driver supports hot-plugging. A PCI adapter card is
not detachable if it is a vital system resource. For a PCI adapter card to
be detachable, the following conditions must be met:</para><itemizedlist><listitem><para>The device driver must support hot-plugging.</para>
</listitem><listitem><para>Critical resources must be accessible through an alternate
pathway.</para>
</listitem>
</itemizedlist><para>For example, if a system has only one Ethernet card installed in it,
the Ethernet card cannot be detached without losing the network connection.
This detachment requires additional layered software support to keep the network
connection active.</para>
</sect2><sect2 id="devconfig2-50"><title>Attaching PCI or PCIe Adapter Cards</title><para>A PCI adapter card can be added to the system as long as the following
conditions are met:</para><itemizedlist><listitem><para>There are slots available.</para>
</listitem><listitem><para>The device driver supports hot-plugging for this adapter card.</para>
</listitem>
</itemizedlist><para>For step-by-step instructions on adding or removing a PCI adapter card,
see <olink targetptr="devconfig2-49" remap="internal">PCI or PCIe Hot-Plugging With the cfgadm
Command</olink>.</para>
</sect2>
</sect1><sect1 id="devconfig2-120"><title>SCSI Hot-Plugging With the <command>cfgadm</command> Command
(Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Display information about SCSI devices.</para>
</entry><entry><para>Display information about SCSI controllers and devices.</para>
</entry><entry><para><olink targetptr="devconfig2-9" remap="internal">How to Display Information About SCSI
Devices</olink></para>
</entry>
</row><row><entry><para>Unconfigure a SCSI controller.</para>
</entry><entry><para>Unconfigure a SCSI controller.</para>
</entry><entry><para><olink targetptr="devconfig2-10" remap="internal">How to Unconfigure a SCSI Controller</olink></para>
</entry>
</row><row><entry><para>Configure a SCSI controller.</para>
</entry><entry><para>Configure a SCSI controller that was previously unconfigured.</para>
</entry><entry><para><olink targetptr="devconfig2-11" remap="internal">How to Configure a SCSI Controller</olink></para>
</entry>
</row><row><entry><para>Configure a SCSI device.</para>
</entry><entry><para>Configure a specific SCSI device.</para>
</entry><entry><para><olink targetptr="devconfig2-12" remap="internal">How to Configure a SCSI Device</olink></para>
</entry>
</row><row><entry><para>Disconnect a SCSI controller.</para>
</entry><entry><para>Disconnect a specific SCSI controller.</para>
</entry><entry><para><olink targetptr="devconfig2-13" remap="internal">How to Disconnect a SCSI Controller</olink></para>
</entry>
</row><row><entry><para>Connect a SCSI controller.</para>
</entry><entry><para>Connect a specific SCSI controller that was previously disconnected.</para>
</entry><entry><para><olink targetptr="devconfig2-14" remap="internal">How to Connect a SCSI Controller</olink></para>
</entry>
</row><row><entry><para>Add a SCSI device to a SCSI bus.</para>
</entry><entry><para>Add a specific SCSI device to a SCSI bus.</para>
</entry><entry><para><olink targetptr="devconfig2-15" remap="internal">How to Add a SCSI Device to a SCSI
Bus</olink></para>
</entry>
</row><row><entry><para>Replace an identical device on a SCSI controller.</para>
</entry><entry><para>Replace a device on the SCSI bus with another device of the same type.</para>
</entry><entry><para><olink targetptr="devconfig2-57" remap="internal">How to Replace an Identical Device
on a SCSI Controller</olink></para>
</entry>
</row><row><entry><para>Remove a SCSI device.</para>
</entry><entry><para>Remove a SCSI device from the system.</para>
</entry><entry><para><olink targetptr="devconfig2-58" remap="internal">How to Remove a SCSI Device</olink></para>
</entry>
</row><row><entry><para>Troubleshoot SCSI configuration problems.</para>
</entry><entry><para>Resolve a failed SCSI unconfigure operation.</para>
</entry><entry><para><olink targetptr="devconfig2-90" remap="internal">How to Resolve a Failed SCSI Unconfigure
Operation</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devconfig2-8"><title>SCSI Hot-Plugging With the <command>cfgadm</command> Command</title><para>This section describes various SCSI hot-plugging procedures that you
can perform with the <command>cfgadm</command> command.</para><note><para>The SCSI framework generally supports hot-plugging of SCSI devices.
However, you should consult your hardware documentation to confirm whether
hot-plugging is supported for your SCSI devices.</para>
</note><para>These procedures use specific devices as examples to illustrate how
to use the <command>cfgadm</command> command to hot-plug SCSI components.
The device information that you supply, and that the <command>cfgadm</command> command
displays, depends on your system configuration.</para><task id="devconfig2-9"><title>How to Display Information About SCSI Devices</title><tasksummary><para>The following procedure uses SCSI controllers <literal>c0</literal> and <literal>c1</literal> and the devices that are attached to them in the examples of
the type of device configuration information that you can display with the <command>cfgadm</command> command.</para><note><para>If the SCSI device is not supported by the <command>cfgadm</command> command,
the device does not display in the <command>cfgadm</command> command output.</para>
</note>
</tasksummary><procedure><step id="devconfig2-step-20"><para>Become superuser.</para>
</step><step id="devconfig2-step-21"><para>Display information about attachment points
on the system.</para><screen># <userinput>cfgadm -l</userinput>
Ap_Id                Type         Receptacle   Occupant     Condition
c0                   scsi-bus     connected    configured   unknown
c1                   scsi-bus     connected    configured   unknown</screen><para>In this example, <literal>c0</literal> and <literal>c1</literal> represent
two SCSI controllers.</para>
</step><step id="devconfig2-step-22"><para>Display information about a system's SCSI
controllers and their attached devices.  </para><screen># <userinput>cfgadm -al</userinput> 
Ap_Id                Type         Receptacle   Occupant     Condition
c0                   scsi-bus     connected    configured   unknown
c0::dsk/c0t0d0       disk         connected    configured   unknown
c0::rmt/0            tape         connected    configured   unknown
c1                   scsi-bus     connected    configured   unknown
c1::dsk/c1t3d0       disk         connected    configured   unknown
c1::dsk/c1t4d0       unavailable  connected    unconfigured unknown</screen><note><para>The <command>cfgadm -l</command> commands displays information
about SCSI HBAs but not SCSI devices. Use the <command>cfgadm -al</command> command
to display information about SCSI devices such as disk and tapes.</para>
</note>
</step>
</procedure>
</task><task id="devconfig2-10"><title>How to Unconfigure a SCSI Controller</title><tasksummary><para>The following procedure uses SCSI controller <literal>c1</literal> in
the example of unconfiguring a SCSI controller.</para>
</tasksummary><procedure><step id="devconfig2-step-23"><para>Become superuser.</para>
</step><step id="devconfig2-step-24"><para>Unconfigure a SCSI controller.</para><screen># <userinput>cfgadm -c unconfigure c1</userinput></screen>
</step><step id="devconfig2-step-25"><para>Verify that the SCSI controller is unconfigured.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                 Type         Receptacle   Occupant     Condition
c0                    scsi-bus     connected    configured   unknown
c0::dsk/c0t0d0        disk         connected    configured   unknown
c0::rmt/0             tape         connected    configured   unknown
c1                    scsi-bus     connected    unconfigured unknown</screen><para>Notice that the <literal>Occupant</literal> column for <literal>c1</literal> specifies <literal>unconfigured</literal>, indicating that the SCSI bus has no configured occupants.</para><para>If the unconfigure operation fails, see <olink targetptr="devconfig2-90" remap="internal">How to Resolve a Failed SCSI Unconfigure Operation</olink>.</para>
</step>
</procedure>
</task><task id="devconfig2-11"><title>How to Configure a SCSI Controller</title><tasksummary><para>The following procedure uses SCSI controller <literal>c1</literal> in
the example of configuring a SCSI controller.</para>
</tasksummary><procedure><step id="devconfig2-step-26"><para>Become superuser.</para>
</step><step id="devconfig2-step-27"><para>Configure a SCSI controller.</para><screen># <userinput>cfgadm -c configure c1</userinput></screen>
</step><step id="devconfig2-step-28"><para>Verify that the SCSI controller is configured.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type         Receptacle   Occupant     Condition
c0                   scsi-bus     connected    configured   unknown
c0::dsk/c0t0d0       disk         connected    configured   unknown
c0::rmt/0            tape         connected    configured   unknown
c1                   scsi-bus     connected    configured   unknown
c1::dsk/c1t3d0       disk         connected    configured   unknown
c1::dsk/c1t4d0       unavailable  connected    unconfigured unknown</screen><para>The previous unconfigure procedure removed all devices on the SCSI bus.
Now all the devices are configured back into the system.</para>
</step>
</procedure>
</task><task id="devconfig2-12"><title>How to Configure a SCSI Device</title><tasksummary><para>The following procedure uses SCSI disk <literal>c1t4d0</literal> in
the example of configuring a SCSI device.</para>
</tasksummary><procedure><step id="devconfig2-step-29"><para>Become superuser.</para>
</step><step id="devconfig2-step-30"><para>Identify the device to be configured.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       unavailable   connected    unconfigured unknown</screen>
</step><step id="devconfig2-step-31"><para>Configure the SCSI device.</para><screen># <userinput>cfgadm -c configure c1::dsk/c1t4d0</userinput></screen>
</step><step id="devconfig2-step-32"><para>Verify that the SCSI device is configured.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen>
</step>
</procedure>
</task><task id="devconfig2-13"><title>How to Disconnect a SCSI Controller</title><tasksummary><caution><para>Disconnecting a SCSI device must be done with caution, particularly
when you are dealing with controllers for disks that contain critical file
systems such as root (<filename>/</filename>), <filename>usr</filename>, <filename>var</filename>, and the <filename>swap</filename> partition. The dynamic reconfiguration
software cannot detect all cases where a system hang might result. Use this
procedure with caution.</para>
</caution><para>The following procedure uses SCSI controller <literal>c1</literal> in
the example of disconnecting a SCSI device.</para>
</tasksummary><procedure><step id="devconfig2-step-33"><para>Become superuser.</para>
</step><step id="devconfig2-step-34"><para>Verify that the device is connected before
you disconnect it.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen>
</step><step id="devconfig2-step-35"><para>Disconnect the SCSI controller.</para><screen># <userinput>cfgadm -c disconnect c1</userinput>
WARNING: Disconnecting critical partitions may cause system hang.
Continue (yes/no)? <userinput>y</userinput></screen><caution><para>This command suspends all I/O activity on the SCSI bus until
the <command>cfgadm -c connect</command> command is used. The <command>cfgadm</command> command
does some basic checking to prevent critical partitions from being disconnected,
but it cannot detect all cases. Inappropriate use of this command can result
in a system hang and could require a system reboot. </para>
</caution>
</step><step id="devconfig2-step-36"><para>Verify that the SCSI bus is disconnected.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   unavailable   disconnected configured   unknown
c1::dsk/c1t3d0       unavailable   disconnected configured   unknown
c1::dsk/c1t4d0       unavailable   disconnected configured   unknown</screen><para>The controller and all the devices that are attached to it are disconnected
from the system.</para>
</step>
</procedure>
</task><task id="devconfig2-14" arch="sparc"><title>How to Connect a SCSI Controller</title><tasksummary><para>The following procedure uses SCSI controller <literal>c1</literal> in
the example of connecting a SCSI controller.</para>
</tasksummary><procedure><step id="devconfig2-step-37"><para>Become superuser.</para>
</step><step id="devconfig2-step-38"><para>Verify that the device is disconnected
before you connect it.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   unavailable   disconnected configured   unknown
c1::dsk/c1t3d0       unavailable   disconnected configured   unknown
c1::dsk/c1t4d0       unavailable   disconnected configured   unknown</screen>
</step><step id="devconfig2-step-39"><para>Connect the SCSI controller.</para><screen># <userinput>cfgadm -c connect c1</userinput></screen>
</step><step id="devconfig2-step-40"><para>Verify that the SCSI controller is connected.</para><screen># <userinput>cfgadm -al</userinput> 
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen>
</step>
</procedure>
</task><task id="devconfig2-15" arch="sparc"><title>How to Add a SCSI Device to a
SCSI Bus</title><tasksummary><para>SCSI controller <literal>c1</literal> is used in the example of how
to add a SCSI device to a SCSI bus.</para><note><para>When you add devices, you specify the <literal>Ap_Id</literal> of
the SCSI HBA (controller) to which the device is attached, not the <literal>Ap_Id</literal> of the device itself.</para>
</note>
</tasksummary><procedure><step id="devconfig2-step-41"><para>Become superuser.</para>
</step><step id="devconfig2-step-42"><para>Identify the current SCSI configuration.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown</screen>
</step><step id="devconfig2-step-43"><para>Add the SCSI device to the SCSI bus.</para><substeps><step><para>Type the following <command>cfgadm</command> command.</para><para>For
example:</para><screen># <userinput>cfgadm -x insert_device c1</userinput>
Adding device to SCSI HBA: /devices/sbus@1f,0/SUNW,fas@1,8800000
This operation will suspend activity on SCSI bus: c1</screen>
</step><step id="devconfig2-step-60"><para>Type <userinput>y</userinput> at the <literal>Continue (yes/no)?</literal> prompt to proceed.</para><screen>Continue (yes/no)? <userinput>y</userinput>
SCSI bus quiesced successfully.
It is now safe to proceed with hotplug operation.</screen><para>I/O activity on the SCSI bus is suspended while the hot-plug operation
is in progress.</para>
</step><step id="devconfig2-step-61"><para>Connect the device and then power it on.</para>
</step><step id="devconfig2-step-62"><para>Type <userinput>y</userinput> at the <literal>Enter y if operation is complete or n to abort (yes/no)?</literal> prompt.</para><screen>Enter y if operation is complete or n to abort (yes/no)? <userinput>y</userinput></screen>
</step>
</substeps>
</step><step id="devconfig2-step-45"><para>Verify that the device has been added.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen><para>A new disk has been added to controller <literal>c1</literal>.</para>
</step>
</procedure>
</task><task id="devconfig2-57" arch="sparc"><title>How to Replace an Identical Device
on a SCSI Controller</title><tasksummary><para>The following procedure uses SCSI disk <literal>c1t4d0</literal> in
the example of replacing an identical device on a SCSI controller.</para>
</tasksummary><procedure><step id="devconfig2-step-46"><para>Become superuser.</para>
</step><step id="devconfig2-step-54"><para>Identify the current SCSI configuration.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen>
</step><step id="devconfig2-step-57"><para>Replace a device on the SCSI bus with
another device of the same type.</para><substeps><step><para>Type the following <command>cfgadm</command> command.</para><para>For
example:</para><screen># <userinput>cfgadm -x replace_device c1::dsk/c1t4d0</userinput>
Replacing SCSI device: /devices/sbus@1f,0/SUNW,fas@1,8800000/sd@4,0
This operation will suspend activity on SCSI bus: c1</screen>
</step><step id="devconfig2-step-63"><para>Type <userinput>y</userinput> at the <literal>Continue (yes/no)?</literal> prompt to proceed.</para><para>I/O activity on
the SCSI bus is suspended while the hot-plug operation is in progress.</para><screen>Continue (yes/no)? <userinput>y</userinput>
SCSI bus quiesced successfully.
It is now safe to proceed with hotplug operation.</screen>
</step><step id="devconfig2-step-64"><para>Power off the device to be removed and
remove it. </para>
</step><step id="devconfig2-step-122"><para>Add the replacement device. Then, power
it on.</para><para>The replacement device should be of the same type and at
the same address (target and lun) as the device to be removed.</para>
</step><step id="devconfig2-step-65"><para>Type <userinput>y</userinput> at the <literal>Enter y if operation is complete or n to abort (yes/no)?</literal> prompt.</para><screen>Enter y if operation is complete or n to abort (yes/no)? <userinput>y</userinput></screen>
</step>
</substeps>
</step><step id="devconfig2-step-50"><para>Verify that the device has been replaced.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen>
</step>
</procedure>
</task><task id="devconfig2-58" arch="sparc"><title>How to Remove a SCSI Device</title><tasksummary><para>The following procedure uses SCSI disk <literal>c1t4d0</literal> in
the example of removing a device on a SCSI controller.</para>
</tasksummary><procedure><step id="devconfig2-step-51"><para>Become superuser.</para>
</step><step id="devconfig2-step-52"><para>Identify the current SCSI configuration.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown
c1::dsk/c1t4d0       disk          connected    configured   unknown</screen>
</step><step id="devconfig2-step-53"><para>Remove the SCSI device from the system.</para><substeps><step><para>Type the following <command>cfgadm</command> command.</para><para>For
example:</para><screen># <userinput>cfgadm -x remove_device c1::dsk/c1t4d0</userinput>
Removing SCSI device: /devices/sbus@1f,0/SUNW,fas@1,8800000/sd@4,0
This operation will suspend activity on SCSI bus: c1</screen>
</step><step id="devconfig2-step-66"><para>Type <userinput>y</userinput> at the <literal>Continue (yes/no)?</literal> prompt to proceed.</para><screen>Continue (yes/no)? <userinput>y</userinput>
SCSI bus quiesced successfully.
It is now safe to proceed with hotplug operation.</screen><para>I/O activity on the SCSI bus is suspended while the hot-plug operation
is in progress.</para>
</step><step id="devconfig2-step-67"><para>Power off the device to be removed and
remove it.</para>
</step><step id="devconfig2-step-68"><para>Type <userinput>y</userinput> at the <literal>Enter y if operation is complete or n to abort (yes/no)?</literal> prompt.</para><screen>Enter y if operation is complete or n to abort (yes/no)? <userinput>y</userinput></screen>
</step>
</substeps><note><para>Note: This step must be performed if you are removing a SCSI RAID
device from a SCSI RAID array.</para>
</note>
</step><step id="devconfig2-step-55"><para>Verify that the device has been removed
from the system.</para><screen># <userinput>cfgadm -al</userinput>
Ap_Id                Type          Receptacle   Occupant     Condition
c0                   scsi-bus      connected    configured   unknown
c0::dsk/c0t0d0       disk          connected    configured   unknown
c0::rmt/0            tape          connected    configured   unknown
c1                   scsi-bus      connected    configured   unknown
c1::dsk/c1t3d0       disk          connected    configured   unknown</screen>
</step>
</procedure>
</task><sect2 id="devconfig2-89"><title>Troubleshooting SCSI Configuration Problems</title><para>This
section provides error messages and possible solutions for troubleshooting
SCSI configuration problems. For more information on troubleshooting SCSI
configuration problems, see <olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><variablelist termlength="wholeline"><varlistentry><term>Error Message</term><listitem><screen>cfgadm: Component system is busy, try again: failed to offline:
     <replaceable>device-path</replaceable>
          Resource              Information
     ------------------  --------------------------
     /dev/dsk/c1t0d0s0   mounted filesystem "/<replaceable>file-system</replaceable>"</screen>
</listitem>
</varlistentry><varlistentry><term>Cause</term><listitem><para>You attempted to remove or replace a device with a mounted
file system.</para>
</listitem>
</varlistentry><varlistentry><term>Solution</term><listitem><para>Unmount the file system that is listed in the error message
and retry the <command>cfgadm</command> operation.</para>
</listitem>
</varlistentry>
</variablelist><variablelist termlength="wholeline"><varlistentry><term>Error Message</term><listitem><screen>cfgadm: Component system is busy, try again: failed to offline:
     <replaceable>device-path</replaceable>
          Resource              Information
     ------------------  --------------------------
     /dev/dsk/<replaceable>device-name</replaceable>   swap area</screen>
</listitem>
</varlistentry><varlistentry><term>Cause</term><listitem><para>If you use the <command>cfgadm</command> command to remove
a system resource, such as a swap device or a dedicated dump device, a similar
error message is displayed if the system resource is still active.</para>
</listitem>
</varlistentry><varlistentry><term>Solution</term><listitem><para>Unconfigure the swap areas on the device that is specified
and retry the <command>cfgadm</command> operation.</para>
</listitem>
</varlistentry><varlistentry><term>Error Message</term><listitem><screen>cfgadm: Component system is busy, try again: failed to offline:
     <replaceable>device-path</replaceable>
          Resource              Information
     ------------------  --------------------------
     /dev/dsk/<replaceable>device-name</replaceable>   dump device (swap)</screen>
</listitem>
</varlistentry><varlistentry><term>Cause</term><listitem><para>You attempted to remove or replace a dump device that is configured
on a swap area.</para>
</listitem>
</varlistentry><varlistentry><term>Solution</term><listitem><para>Unconfigure the dump device that is configured on the swap
area and retry the <command>cfgadm</command> operation.</para>
</listitem>
</varlistentry><varlistentry><term>Error Message</term><listitem><screen>cfgadm: Component system is busy, try again: failed to offline:
     <replaceable>device-path</replaceable>
          Resource              Information
     ------------------  --------------------------
     /dev/dsk/<replaceable>device-name</replaceable>   dump device (dedicated)</screen>
</listitem>
</varlistentry><varlistentry><term>Cause</term><listitem><para>You attempted to remove or replace a dedicated dump device.</para>
</listitem>
</varlistentry><varlistentry><term>Solution</term><listitem><para>Unconfigure the dedicate dump device and retry the <command>cfgadm</command> operation.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2><task id="devconfig2-90"><title>How to Resolve a Failed SCSI Unconfigure Operation</title><tasksummary><para>Use this procedure if one or more target devices are busy and the SCSI
unconfigure operation fails.  Otherwise, future dynamic reconfiguration operations
on this controller and target devices will fail with a <literal>dr in progress</literal> message.</para>
</tasksummary><procedure><step id="devconfig2-step-92"><para>Become superuser.</para>
</step><step id="devconfig2-step-93"><para>Reconfigure the controller.</para><screen># <userinput>cfgadm -c configure</userinput> <replaceable>device-name</replaceable></screen>
</step>
</procedure>
</task>
</sect1><sect1 id="devconfig2-121"><title>PCI or PCIe Hot-Plugging With the <command>cfgadm</command> Command (Task Map)</title><para>The following task map describes the tasks for managing PCI or PCIe
devices on your system.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Display PCI slot configuration information.</para>
</entry><entry><para>Display the status of PCI hot-pluggable devices and slots on the system.</para>
</entry><entry><para><olink targetptr="devconfig2-51" remap="internal">How to Display PCI Slot Configuration
Information</olink></para>
</entry>
</row><row><entry><para>Remove a PCI adapter card.</para>
</entry><entry><para>Unconfigure the card, disconnect power from the slot, and remove the
card from the system.</para>
</entry><entry><para><olink targetptr="devconfig2-54" remap="internal">How to Remove a PCI Adapter Card</olink></para>
</entry>
</row><row><entry><para>Add a PCI adapter card.</para>
</entry><entry><para>Insert the adapter card into a hot-pluggable slot, connect power to
the slot, and configure the card.</para>
</entry><entry><para><olink targetptr="devconfig2-55" remap="internal">How to Add a PCI Adapter Card</olink></para>
</entry>
</row><row><entry><para>Troubleshoot PCI configuration problems.</para>
</entry><entry><para>Identify error message and possible solutions to resolve PCI configuration
problems.</para>
</entry><entry><para><olink targetptr="devconfig2-56" remap="internal">Troubleshooting PCI Configuration Problems</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devconfig2-49"><title>PCI or PCIe Hot-Plugging With the <command>cfgadm</command> Command</title><para>This section provides step-by-step instructions for hot-plugging PCI
or PCIe adapter cards on SPARC and x86 systems.</para><para>In addition to the <command>cfgadm</command> command, the <command>prtconf</command> command
is helpful during hot-plug operations. The <command>prtconf</command> command
displays additional configuration information that pertains to the hardware. </para><para>After adding hardware, you can use the <command>prtconf</command> command
to verify that the hardware is configured correctly. For example, after a
configure operation, use the <command>prtconf</command> <option>D</option> command
 to verify that the driver is attached to the newly installed hardware device.
If the device driver has not been added to the system prior to hardware configuration,
it may be manually added by using the <command>add_drv</command> command.</para><para>For more information, see <olink targetdoc="refman1m" targetptr="prtconf-1m" remap="external"><citerefentry><refentrytitle>prtconf</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="refman1m" targetptr="add-drv-1m" remap="external"><citerefentry><refentrytitle>add_drv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>In the examples, only PCI attachment points are listed,
for brevity. The attachment points that are displayed on your system depend
on your system configuration.</para><sect2 id="gbsdb"><title>PCIe Led Indicator Behavior</title><para>You might observe the LED indicators on the system to get a visual indication
about the status of the slot's hot-plug operation. The LED behavior, in case
of PCI Express, matches that defined in the PCI Express specification or the
behavior might otherwise be platform dependent.</para><para>Please refer to your platform guide for specific details. In case of
PCI Express, when the Attention Button is pressed, the power indicator blinks,
which indicates the beginning of a state transition. The blinking ends when
the state transition has ended.</para>
</sect2><task id="devconfig2-51"><title>How to Display PCI Slot Configuration Information</title><tasksummary><para>This procedure has been updated to include PCIe configuration information.</para><para>The <command>cfgadm</command> command displays the status of PCI hot-pluggable
devices and slots on a system. For more information, see <olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</tasksummary><procedure><step id="devconfig2-step-69"><para>Become superuser.</para>
</step><step id="devconfig2-step-56"><para>Display PCI configuration information.</para><itemizedlist><listitem><para>Display PCI slot configuration information.</para><para>For
example:</para><screen># <userinput>cfgadm</userinput>
Ap_Id                Type         Receptacle   Occupant     Condition
pci1:hpc0_slot0      unknown      empty        unconfigured unknown
pci1:hpc0_slot1      unknown      empty        unconfigured unknown
pci1:hpc0_slot2      unknown      empty        unconfigured unknown
pci1:hpc0_slot3      ethernet/hp  connected    configured   ok
pci1:hpc0_slot4      unknown      empty        unconfigured unknown</screen>
</listitem><listitem><para>Display specific PCI device information.</para><para>For example:</para><screen># <userinput>cfgadm -s "cols=ap_id:type:info" pci</userinput>
Ap_Id                Type         Information
pci1:hpc0_slot0      unknown      Slot 7
pci1:hpc0_slot1      unknown      Slot 8
pci1:hpc0_slot2      unknown      Slot 9
pci1:hpc0_slot3      ethernet/hp  Slot 10
pci1:hpc0_slot4      unknown      Slot 11</screen><para>The logical <literal>Ap_Id</literal>, <literal>pci1:hpc0_slot0</literal>,
is the logical <literal>Ap_Id</literal> for hot-pluggable slot, <literal>Slot
7</literal>. The component <literal>hpc0</literal> indicates the hot-pluggable
adapter card for this slot, and <literal>pci1</literal> indicates the PCI
bus instance. The <literal>Type</literal> field indicates the type of PCI
adapter card that is present in the slot.</para>
</listitem><listitem><para>Display PCIe slot configuration information.</para><para>For
example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      empty        unconfigured unknown
pcie4                          etherne/hp   connected    configured   ok
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown</screen>
</listitem><listitem><para>Display specific PCIe device information.</para><para>For
example:</para><screen># <userinput>cfgadm -s "cols=ap_id:busy:o_state" pci</userinput>
Ap_Id                          Busy     Occupant
pcie1                          n        unconfigured
pcie2                          n        unconfigured
pcie3                          n        unconfigured
pcie4                          n        configured
pcie5                          n        configured
pcie6                          n        configured</screen><note><para>The logical <literal>Ap_Id</literal> in most cases should match
the slot label that is silk-screened on the system chassis. Refer to your
platform guide for the <command>cfgadm</command> output of the hot-pluggable
slots. The <literal>Busy</literal> field can be displayed to ensure that the <literal>Ap_Id</literal> is not transitioning to another state before a hot-plug operation
is attempted.</para>
</note>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="devconfig2-54"><title>How to Remove a PCI Adapter Card</title><tasksummary><para>The following procedure has been updated for removing a PCIe adapter
card. However, the procedure to remove an adapter card is the same whether
you are using PCI or PCIe.</para>
</tasksummary><procedure><step id="devconfig2-step-71"><para>Become superuser.</para>
</step><step id="devconfig2-step-72"><para>Determine which slot the PCI adapter card
is in.</para><para>For example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      empty        unconfigured unknown
pcie4                          etherne/hp   connected    configured   ok
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown</screen>
</step><step id="devconfig2-step-73"><para>Stop the application that has the device
open. </para><para>For example, if the device is an Ethernet card, use the <command>ifconfig</command> command to bring down the interface and unplumb the interface. </para>
</step><step id="devconfig2-step-74"><para>Unconfigure the device manually by using
the cfgadm(1M) command as shown below. Or, if you have a PCIe adapter card,
use the auto-configuration method, such as pressing the slot's   Attention
Button as defined by your platform guide.</para><screen># <userinput>cfgadm -c unconfigure pcie4</userinput></screen>
</step><step id="devconfig2-step-75"><para>Confirm that the device has been unconfigured.</para><para>For example:</para><screen># cfgadm pci
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      empty        unconfigured unknown
pcie4                          unknown      connected    unconfigured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown</screen><note><para>The <literal>Type</literal> and <literal>Condition</literal> also
become unknown when the device is unconfigured.</para>
</note>
</step><step id="devconfig2-step-76"><para>Disconnect the power to the slot manually.
If the auto-configuration method is used, this step is not necessary. Refer
to your platform guide for more information.</para><screen># <userinput>cfgadm -c disconnect pcie4</userinput></screen>
</step><step id="devconfig2-step-77"><para>Confirm that the device has been disconnected.</para><para>For example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      empty        unconfigured unknown
pcie4                          unknown      disconnected unconfigured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown </screen>
</step><step id="devconfig2-step-78"><para>Follow appropriate instructions in your
platform guide to remove the PCI adapter card. After the card is removed,
the Receptacle state is empty.</para><para>For example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      empty        unconfigured unknown
pcie4                          unknown      empty        unconfigured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown</screen><note><para>The auto-configuration method can be enabled or disabled at boot,
depending on the platform implementation. Set the auto-configuration method
as appropriate for your environment.</para>
</note>
</step>
</procedure>
</task><task id="devconfig2-55"><title>How to Add a PCI Adapter Card</title><tasksummary><para>The following procedure has been updated for adding a PCIe adapter card.
However, the procedure to add an adapter card is the same whether you are
using PCI or PCIe.</para>
</tasksummary><procedure><step id="devconfig2-step-80"><para>Become superuser.</para>
</step><step id="devconfig2-step-81"><para>Identify the hot-pluggable slot
and open latches.</para><para>For example, pcie3.</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      empty        unconfigured unknown
pcie4                          unknown      empty        unconfigured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown </screen>
</step><step id="devconfig2-step-82"><para>Follow the appropriate instructions in
your platform guide to insert a PCI adapter card into the slot.</para>
</step><step id="devconfig2-step-83"><para>Determine which slot the PCI adapter card
is in after it is inserted.</para><para>For example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      disconnected unconfigured unknown
pcie4                          unknown      empty        unconfigured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown </screen>
</step><step id="devconfig2-step-84"><para>Connect the power to the slot manually
using the <command>cfgadm</command> command. Or, if you have a PCIe adapter
card, use the auto-configuration method, such as pressing the slot's Attention
Button as defined by your platform guide.</para><para>For example:</para><screen># <userinput>cfgadm -c connect pcie3</userinput></screen>
</step><step id="devconfig2-step-85"><para>Confirm that the attachment point is connected.</para><para>For example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          unknown      connected    unconfigured unknown
pcie4                          unknown      empty        unconfigured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown</screen>
</step><step id="devconfig2-step-86"><para>Configure the PCI adapter card manually
by using the <command>cfgadm</command> command as shown below. If using the
auto-configuration method, this step should not be necessary. Refer to your
platform guide for more information.</para><para>For example:</para><screen># <userinput>cfgadm -c configure pcie3</userinput></screen>
</step><step id="devconfig2-step-87"><para>Verify the configuration of the PCI adapter
card in the slot.</para><para>For example:</para><screen># <userinput>cfgadm pci</userinput>
Ap_Id                          Type         Receptacle   Occupant     Condition
pcie1                          unknown      empty        unconfigured unknown
pcie2                          unknown      empty        unconfigured unknown
pcie3                          etherne/hp   connected    configured unknown
pcie5                          pci-pci/hp   connected    configured   ok
pcie6                          unknown      disconnected unconfigured unknown</screen>
</step><step id="devconfig2-step-88"><para>Configure any supporting software if this
device is a new device.</para><para>For example, if this device is an Ethernet
card, use the <command>ifconfig</command> command to set up the interface.</para><note><para>The auto-configuration method can be enabled or disabled at boot,
depending on the platform implementation. Set the auto-configuration method
as appropriate for your environment.</para>
</note>
</step>
</procedure>
</task><sect2 id="devconfig2-56"><title>Troubleshooting PCI Configuration Problems</title><variablelist termlength="wholeline"><varlistentry><term>Error Message</term><listitem><screen>cfgadm: Configuration operation invalid: invalid transition</screen>
</listitem>
</varlistentry><varlistentry><term>Cause</term><listitem><para>An invalid transition was attempted.</para>
</listitem>
</varlistentry><varlistentry><term>Solution</term><listitem><para>Check whether the <command>cfgadm -c</command> command was
issued appropriately. Use the <command>cfgadm</command> command to check the
current receptacle and occupant state and to make sure that the <literal>Ap_Id</literal> is
correct.</para>
</listitem>
</varlistentry>
</variablelist><variablelist termlength="wholeline"><varlistentry><term>Error Message</term><listitem><screen>cfgadm: Attachment point not found</screen>
</listitem>
</varlistentry><varlistentry><term>Cause</term><listitem><para>The specified attachment point was not found.</para>
</listitem>
</varlistentry><varlistentry><term>Solution</term><listitem><para>Check whether the attachment point is correct. Use the <command>cfgadm</command> command to display a list of available attachment points. Also
check the physical path to see if the attachment point is still there.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1><sect1 id="devconfig2-2"><title>Reconfiguration Coordination Manager (RCM)
Script Overview</title><para>The Reconfiguration Coordination Manager (RCM) is the framework that
manages the dynamic removal of system components. By using RCM, you can register
and release system resources in an orderly manner.</para><para>You can use the new RCM script feature to write your own scripts to
shut down your applications, or to cleanly release the devices from your applications
during dynamic reconfiguration. The RCM framework launches a script automatically
in response to a reconfiguration request, if the request impacts the resources
that are registered by the script.</para><para>You can also release resources from applications manually before you
dynamically remove the resource. Or, you can use the <command>cfgadm</command> command
with the <option>f</option> option to force a reconfiguration operation. However,
this option might leave your applications in an unknown state. Also, the manual
release of resources from applications commonly causes errors.</para><para>The RCM script feature simplifies and better controls the dynamic reconfiguration
process. By creating an RCM script, you can do the following:</para><itemizedlist><listitem><para>Automatically release a device when you dynamically remove
a device. This process also closes the device if the device is opened by an
application.</para>
</listitem><listitem><para>Run site-specific tasks when you dynamically remove a device
from the system.</para>
</listitem>
</itemizedlist><sect2 id="devconfig2-4"><title>What Is an RCM Script?</title><itemizedlist><listitem><para>An executable shell script (Perl, <command>sh</command>, <command>csh</command>, or <command>ksh</command>) or binary program that the RCM daemon
runs. Perl is the recommended language. </para>
</listitem><listitem><para>A script that runs in its own address space by using the user
ID of the script file owner.</para>
</listitem><listitem><para>A script that is run by the RCM daemon when you use the <command>cfgadm</command> command to dynamically reconfigure a system resource.</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="devconfig2-16"><title>What Can an RCM Script Do?</title><para>You can use an RCM script to release a device from an application when
you dynamically remove a device. If the device is currently open, the RCM
script also closes the device.</para><para>For example, an RCM script for a tape backup application can inform
the tape backup application to close the tape drive or shut down the tape
backup application.</para>
</sect2><sect2 id="devconfig2-17"><title>How Does the RCM Script Process Work?</title><para>You can invoke an RCM script as follows:</para><screen>$ <replaceable>script-name</replaceable> <replaceable>command</replaceable> [<replaceable>args</replaceable> ...]</screen><para>An RCM script performs the following basic steps:</para><orderedlist><listitem><para>Takes the RCM command from command-line arguments.</para>
</listitem><listitem><para>Executes the command.</para>
</listitem><listitem><para>Writes the results to <literal>stdout</literal> as name-value
pairs.</para>
</listitem><listitem><para>Exits with the appropriate exit status.</para>
</listitem>
</orderedlist><para>The RCM daemon runs one instance of a script at a time. For example,
if a script is running, the RCM daemon does not run the same script until
the first script exits.</para><sect3 id="devconfig2-32"><title>RCM Script Commands</title><para>You must include the following RCM commands in an RCM script:</para><itemizedlist><listitem><para><literal>scriptinfo</literal> &ndash; Gathers script information</para>
</listitem><listitem><para><literal>register</literal> &ndash; Registers interest in
resources</para>
</listitem><listitem><para><literal>resourceinfo</literal> &ndash; Gathers resource information</para>
</listitem>
</itemizedlist><para>You might include some or all of the following RCM commands:</para><itemizedlist><listitem><para><literal>queryremove</literal> &ndash; Queries whether the
resource can be released</para>
</listitem><listitem><para><literal>preremove</literal> &ndash; Releases the resource</para>
</listitem><listitem><para><literal>postremove</literal> &ndash; Provides post-resource
removal notification</para>
</listitem><listitem><para><literal>undoremove</literal> &ndash; Undoes the actions done
in <literal>preremove</literal></para>
</listitem>
</itemizedlist><para>For a complete description of these RCM commands, see <olink targetdoc="refman4" targetptr="rcmscript-4" remap="external"><citerefentry><refentrytitle>rcmscript</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para>
</sect3><sect3 id="devconfig2-20"><title>RCM Script Processing Environment</title><para>When you dynamically remove a device, the RCM daemon runs the following:</para><itemizedlist><listitem><para>The script's <literal>register</literal> command to gather
the list of resources (device names) that are identified in the script.</para>
</listitem><listitem><para>The script's <literal>queryremove</literal> and <literal>preremove</literal> commands prior to removing the resource if the script's registered
resources are affected by the dynamic remove operation.</para>
</listitem><listitem><para>The script's <literal>postremove</literal> command if the
remove operation succeeds. However, if the remove operation fails, the RCM
daemon runs the script's <command>undoremove</command> command.</para>
</listitem>
</itemizedlist>
</sect3>
</sect2>
</sect1><sect1 id="devconfig2-19"><title>RCM Script Tasks</title><para>The following sections describe the RCM script tasks for application
developers and system administrators.</para><sect2 id="devconfig2-34"><title>Application Developer RCM Script (Task Map)</title><para>The following task map describes the tasks for an application developer
who is creating an RCM script.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><colspec colname="colspec3" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. Identify the resources your application uses.</para>
</entry><entry><para>Identify the resources (device names) your application uses that you
could potentially dynamically remove.</para>
</entry><entry><para><olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para>2. Identify the commands to release the resource.</para>
</entry><entry><para>Identify the commands for notifying the application to cleanly release
the resource from the application.</para>
</entry><entry><para>Application documentation</para>
</entry>
</row><row><entry><para>3. Identify the commands for post-removal of the resource.</para>
</entry><entry><para>Include the commands for notifying the application of the resource removal.</para>
</entry><entry><para><olink targetdoc="refman4" targetptr="rcmscript-4" remap="external"><citerefentry><refentrytitle>rcmscript</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para>4. Identify the commands if the resource removal fails.</para>
</entry><entry><para>Include the commands for notifying the application of the available
resource. </para>
</entry><entry><para><olink targetdoc="refman4" targetptr="rcmscript-4" remap="external"><citerefentry><refentrytitle>rcmscript</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para>5. Write the RCM script.</para>
</entry><entry><para>Write the RCM script based on the information identified in tasks 1-4.</para>
</entry><entry><para><olink targetptr="devconfig2-22" remap="internal">Tape Backup RCM Script Example</olink></para>
</entry>
</row><row><entry><para>6. Install the RCM script.</para>
</entry><entry><para>Add the script to the appropriate script directory.</para>
</entry><entry><para><olink targetptr="devconfig2-37" remap="internal">How to Install an RCM Script</olink></para>
</entry>
</row><row><entry><para>7. Test the RCM script</para>
</entry><entry><para>Test the script by running the script commands manually and by initiating
a dynamic reconfiguration operation.</para>
</entry><entry><para><olink targetptr="devconfig2-43" remap="internal">How to Test an RCM Script</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2><sect2 id="devconfig2-35"><title>System Administrator RCM Script (Task Map)</title><para>The following task map describes the tasks for a system administrator
who is creating an RCM script to do site customization.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><colspec colname="colspec3" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. Identify the resources to be dynamically removed.</para>
</entry><entry><para>Identify the resources (device names) to be potentially removed by using
the <command>cfgadm</command> <option>l</option> command.</para>
</entry><entry><para><olink targetdoc="refman1m" targetptr="cfgadm-1m" remap="external"><citerefentry><refentrytitle>cfgadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para>2. Identify the applications to be stopped.</para>
</entry><entry><para>Identify the commands for stopping the applications cleanly.</para>
</entry><entry><para>Application documentation</para>
</entry>
</row><row><entry><para>3. Identify the commands for pre-removal and post-removal of the resource.</para>
</entry><entry><para>Identify the actions to be taken before and after the resource is removed.</para>
</entry><entry><para><olink targetdoc="refman4" targetptr="rcmscript-4" remap="external"><citerefentry><refentrytitle>rcmscript</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para>4. Write the RCM script.</para>
</entry><entry><para>Write the RCM script based on the information identified in tasks 1-3.</para>
</entry><entry><para><olink targetptr="devconfig2-22" remap="internal">Tape Backup RCM Script Example</olink></para>
</entry>
</row><row><entry><para>5. Install the RCM script.</para>
</entry><entry><para>Add the script to the appropriate script directory.</para>
</entry><entry><para><olink targetptr="devconfig2-37" remap="internal">How to Install an RCM Script</olink></para>
</entry>
</row><row><entry><para>6. Test the RCM script.</para>
</entry><entry><para>Test the script by running the script commands manually and by initiating
a dynamic reconfiguration operation.</para>
</entry><entry><para><olink targetptr="devconfig2-43" remap="internal">How to Test an RCM Script</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2><sect2 id="devconfig2-36"><title>Naming an RCM Script</title><para>A script must be named as <replaceable>vendor</replaceable>,<replaceable>service</replaceable> where the following applies:</para><variablelist><varlistentry><term><replaceable>vendor</replaceable></term><listitem><para>Is the stock symbol of the vendor that provides the script,
or any distinct name that identifies the vendor.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>service</replaceable></term><listitem><para>Is the name of the service that the script represents.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2><sect2 id="devconfig2-30"><title>Installing or Removing an RCM Script</title><para>You must be superuser (root) to install or remove an RCM script. Use
this table to determine where you should install your RCM script.</para><table frame="topbot" id="devconfig2-tbl-29"><title>RCM Script Directories</title><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="198*"/><colspec colname="colspec1" colwidth="198*"/><thead><row rowsep="1"><entry><para>Directory Location</para>
</entry><entry><para>Script Type</para>
</entry>
</row>
</thead><tbody><row><entry><para><filename>/etc/rcm/scripts</filename></para>
</entry><entry><para>Scripts for specific systems</para>
</entry>
</row><row><entry><para><filename>/usr/platform/`uname -i`/lib/rcm/scripts</filename></para>
</entry><entry><para>Scripts for a specific hardware implementation</para>
</entry>
</row><row><entry><para><filename>/usr/platform/`uname -m`/lib/rcm/scripts</filename></para>
</entry><entry><para>Scripts for a specific hardware class</para>
</entry>
</row><row><entry><para><filename>/usr/lib/rcm/scripts</filename></para>
</entry><entry><para>Scripts for any hardware</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2><task id="devconfig2-37"><title>How to Install an RCM Script</title><procedure><step id="devconfig2-step-17"><para>Become superuser.</para>
</step><step id="devconfig2-step-58"><para>Copy the script to the appropriate directory. </para><para>See <olink targetptr="devconfig2-tbl-29" remap="internal">Table&nbsp;6&ndash;1</olink>.</para><para>For example:</para><screen># <userinput>cp SUNW,sample.pl /usr/lib/rcm/scripts</userinput></screen>
</step><step id="devconfig2-step-16"><para>Change the user ID and the group ID of
the script to the desired values.</para><screen># <userinput>chown</userinput> <replaceable>user:group</replaceable> <userinput>/usr/lib/rcm/scripts/SUNW,sample.pl</userinput></screen>
</step><step id="devconfig2-step-44"><para>Send <literal>SIGHUP</literal> to the
RCM daemon.</para><screen># <userinput>pkill -HUP -x -u root rcm_daemon</userinput></screen>
</step>
</procedure>
</task><task id="devconfig2-42"><title>How to Remove an RCM Script</title><procedure><step id="devconfig2-step-15"><para>Become superuser.</para>
</step><step id="devconfig2-step-6"><para>Remove the script from the RCM script directory.</para><para>For example:</para><screen># <userinput>rm /usr/lib/rcm/scripts/SUNW,sample.pl</userinput></screen>
</step><step id="devconfig2-step-18"><para>Send <literal>SIGHUP</literal> to the
RCM daemon.</para><screen># <userinput>pkill -HUP -x -u root rcm_daemon</userinput></screen>
</step>
</procedure>
</task><task id="devconfig2-43"><title>How to Test an RCM Script</title><procedure><step id="devconfig2-step-47"><para>Set environment variables, such as <literal>RCM_ENV_FORCE</literal>, in the command-line shell before running your script.</para><para>For
example, in the Korn shell, use the following:</para><screen>$ <userinput>export RCM_ENV_FORCE=TRUE</userinput></screen>
</step><step id="devconfig2-step-59"><para>Test the script by running the script
commands manually from the command line.</para><para>For example:</para><screen>$ <replaceable>script-name</replaceable> <command>scriptinfo</command>
$ <replaceable>script-name</replaceable> <command>register</command>
$ <replaceable>script-name</replaceable> <command>preremove</command> <replaceable>resource-name</replaceable>
$ <replaceable>script-name</replaceable> <command>postremove</command> <replaceable>resource-name</replaceable></screen>
</step><step id="devconfig2-step-19"><para>Make sure that each RCM script command
in your script prints appropriate output to <literal>stdout</literal>.</para>
</step><step id="devconfig2-step-48"><para>Install the script in the appropriate
script directory.</para><para>For more information, see <olink targetptr="devconfig2-37" remap="internal">How to Install an RCM Script</olink>.</para>
</step><step id="devconfig2-step-49"><para>Test the script by initiating a dynamic
remove operation.</para><para>For example, assume your script registers the
device, <filename>/dev/dsk/c1t0d0s0</filename>. Try these commands.</para><screen>$ <userinput>cfgadm -c unconfigure c1::dsk/c1t0d0</userinput>
$ <userinput>cfgadm -f -c unconfigure c1::dsk/c1t0d0</userinput>
$ <userinput>cfgadm -c configure c1::dsk/c1t0d0</userinput></screen><caution><para>Make sure that you are familiar with these commands because
they can alter the state of the system and cause system failures.</para>
</caution>
</step>
</procedure>
</task><sect2 id="devconfig2-22"><title>Tape Backup RCM Script Example</title><para>This example illustrates how to use an RCM script for tape backups.</para><sect3 id="devconfig2-23"><title>What the Tape Backup RCM Script Does</title><para>The tape backup RCM script performs the following steps:</para><orderedlist><listitem><para>Sets up a dispatch table of RCM commands.</para>
</listitem><listitem><para>Calls the dispatch routine that corresponds to the specified
RCM command and exits with status 2 for unimplemented RCM commands.</para>
</listitem><listitem><para>Sets up the <literal>scriptinfo</literal> section.</para><screen>rcm_script_func_info=Tape backup appl script for DR</screen>
</listitem><listitem><para>Registers all tape drives in the system by printing all tape
drive device names to <literal>stdout</literal>.</para><screen>rcm_resource_name=/dev/rmt/$f</screen><para>If an error occurs, the script prints the error information to <literal>stdout</literal>.</para><screen>rcm_failure_reason=$errmsg</screen>
</listitem><listitem><para>Sets up the resource information for the tape device. </para><screen>rcm_resource_usage_info=Backup Tape Unit Number $unit</screen>
</listitem><listitem><para>Sets up the <literal>preremove</literal> information by checking
if the backup application is using the device. If the backup application is
not using the device, the dynamic reconfiguration operation continues. If
the backup application is using the device, the script checks <literal>RCM_ENV_FORCE</literal>. If <literal>RCM_ENV_FORCE</literal> is set to <literal>FALSE</literal>,
the script denies the dynamic reconfiguration operation and prints the following
message:</para><screen>rcm_failure_reason=tape backup in progress pid=...</screen><para>If <literal>RCM_ENV_FORCE</literal> is set to <literal>TRUE</literal>,
the backup application is stopped, and the reconfiguration operation proceeds.</para>
</listitem>
</orderedlist>
</sect3><sect3 id="devconfig2-24"><title>Outcomes of the Tape Backup Reconfiguration
Scenarios</title><para>Here are the various outcomes if you use the <command>cfgadm</command> command
to remove a tape device without the RCM script.</para><itemizedlist><listitem><para>If you use the <command>cfgadm</command> command and the backup
application is not using the tape device, the operation succeeds.</para>
</listitem><listitem><para>If you use the <command>cfgadm</command> command and the backup
application is using the tape device, the operation fails.</para>
</listitem>
</itemizedlist><para>Here are the various outcomes if you use the <command>cfgadm</command> command
to remove a tape device with the RCM script.</para><itemizedlist><listitem><para>If you use the <command>cfgadm</command> command and the backup
application is not using the tape device, the operation succeeds.</para>
</listitem><listitem><para>If you use the <command>cfgadm</command> command without the <option>f</option> option and the backup application is  using the tape device, the
operation fails with an error message similar to the following:</para><screen>tape backup in progress pid=...</screen>
</listitem><listitem><para>If you use the <command>cfgadm</command> <option>f</option> command
and the backup application is using the tape device, the script stops the
backup application and the <command>cfgadm</command> operation succeeds.</para>
</listitem>
</itemizedlist>
</sect3><sect3 id="devconfig2-28"><title>Example&mdash;Tape Backup RCM Script</title><screen>#! /usr/bin/perl -w
   #
   # A sample site customization RCM script.
   #
   # When RCM_ENV_FORCE is FALSE this script indicates to RCM that it cannot
   # release the tape drive when the tape drive is being used for backup.
   #
   # When RCM_ENV_FORCE is TRUE this script allows DR removing a tape drive
   # when the tape drive is being used for backup by killing the tape
   # backup application.
   #
    
    use strict;
    
    my ($cmd, %dispatch);
    $cmd = shift(@ARGV);
# dispatch table for RCM commands
    %dispatch = (
            "scriptinfo"    =>      \&amp;do_scriptinfo,
            "register"      =>      \&amp;do_register,
            "resourceinfo"  =>      \&amp;do_resourceinfo,
            "queryremove"   =>      \&amp;do_preremove,
            "preremove"     =>      \&amp;do_preremove
    );
    
    
    if (defined($dispatch{$cmd})) {
            &amp;{$dispatch{$cmd}};
    } else {
            exit (2);
    }
    
    sub do_scriptinfo
    {
            print "rcm_script_version=1\n";
            print "rcm_script_func_info=Tape backup appl script for DR\n";
            exit (0);
    }
    
    sub do_register
{
            my ($dir, $f, $errmsg);
    
            $dir = opendir(RMT, "/dev/rmt");
            if (!$dir) {
                 $errmsg = "Unable to open /dev/rmt directory: $!";
                 print "rcm_failure_reason=$errmsg\n";
                 exit (1);
            }
    
            while ($f = readdir(RMT)) {
                # ignore hidden files and multiple names for the same device
                if (($f !~ /^\./) &amp;&amp; ($f =~ /^[0-9]+$/)) {
                        print "rcm_resource_name=/dev/rmt/$f\n";
                    }
                    
            }
    
            closedir(RMT);
            exit (0);
    }
sub do_resourceinfo
    {
      my ($rsrc, $unit);
    
      $rsrc = shift(@ARGV);
      if ($rsrc =~ /^\/dev\/rmt\/([0-9]+)$/) {
           $unit = $1;
           print "rcm_resource_usage_info=Backup Tape Unit Number $unit\n";
           exit (0);
       } else {
           print "rcm_failure_reason=Unknown tape device!\n";
            exit (1);
        }
    }
    
    sub do_preremove
    {
            my ($rsrc);
    
            $rsrc = shift(@ARGV);
    
            # check if backup application is using this resource
            #if (the backup application is not running on $rsrc) {
                    # allow the DR to continue
            #        exit (0);
            #}
            #
            # If RCM_ENV_FORCE is FALSE deny the operation.
            # If RCM_ENV_FORCE is TRUE kill the backup application in order
            # to allow the DR operation to proceed
            #
            if ($ENV{RCM_ENV_FORCE} eq 'TRUE') {
                 if ($cmd eq 'preremove') {
                         # kill the tape backup application
                 }
                 exit (0);
            } else {
               #
               # indicate that the tape drive can not be released
               # since the device is being used for backup by the
               # tape backup application
               #
               print "rcm_failure_reason=tape backup in progress pid=...\n"
;
               exit (3);
            }
    }</screen>
</sect3>
</sect2>
</sect1>
</chapter>