[libvirt] [libvirt-virshcmdref 02/14] update documentation for command detach-device

Hu Tao hutao at cn.fujitsu.com
Thu Aug 25 08:14:55 UTC 2011


---
 source/detach-device.xml |  124 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 120 insertions(+), 4 deletions(-)

diff --git a/source/detach-device.xml b/source/detach-device.xml
index 0475e19..85ab17b 100644
--- a/source/detach-device.xml
+++ b/source/detach-device.xml
@@ -9,16 +9,132 @@
     </text>
   </description>
 
-  <options />
+  <options>
+    <parameter requirement="required">
+      <keyword requirement="optional">--domain</keyword>
+      <value type="string" requirement="required">domain</value>
+      <description>
+        <text>
+          domain name, id or uuid
+        </text>
+        <text>
+          "--domain" itself is optional
+        </text>
+      </description>
+    </parameter>
+    <parameter requirement="required">
+      <keyword requirement="optional">--file</keyword>
+      <value type="string" requirement="required">file</value>
+      <description>
+        <text>
+          the XML file describing the device to be detached
+        </text>
+        <text>
+          "--file" itself is optional
+        </text>
+      </description>
+    </parameter>
+    <parameter requirement="optional">
+      <keyword requirement="required">--persistent</keyword>
+      <description>
+        <text>
+          with this option, the XML file of domain will be updated
+        </text>
+      </description>
+    </parameter>
+  </options>
 
   <availability from="0.2.3" />
  
   <notes />
  
-  <examples type="usage" />
+  <examples type="usage">
+    <example>
+      <terminal>
+virsh # <bold>detach-device</bold> <value>example-domain</value> <value>/tmp/nic.xml</value></terminal>
+      <text>
+        Detaches a NIC which is defined by <value>/tmp/nic.xml</value> from domain <value>example-domain</value>.
+      </text>
+    </example>
+  </examples>
 
-  <examples type="fullcontext" />
+  <examples type="fullcontext">
+    <example>
+      <text>
+        In this example we will detach a NIC from a domain which is defined as:
+      </text>
+      <terminal>
+<domain type='kvm'>
+  <name>example-domain</name>
+  <uuid>6853c36f-af03-4968-a31d-1f3a9c3f699a</uuid>
+  <memory>1048576</memory>
+  <currentMemory>1048576</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-0.12'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/local/bin/qemu-system-x86_64</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' cache='writeback'/>
+      <source file='/mnt/data/libvirt-images/vm2.img'/>
+      <target dev='vda' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <interface type='network'>
+      <mac address='52:54:00:93:20:3c'/>
+      <source network='default'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
+    <video>
+      <model type='cirrus' vram='9216' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain></terminal>
+    <text>
+      To detach the NIC, we run the command:
+    </text>
+    <terminal>virsh # <bold>detach-device</bold> <value>example-domain</value> <value>/tmp/nic.xml</value></terminal>
+    <text>
+      the content of file <value>/tmp/nic.xml</value> is:
+    </text>
+    <terminal><interface type='network'>
+  <mac address='52:54:00:93:20:3c'/>
+  <source network='default'/>
+</interface></terminal>
+      <text>
+        Notice the mac address is included in the xml file. We must provide
+        enough information to identify the device to be detached.
+      </text>
+    </example>
+  </examples>
 
-  <reference type="seealso" />
+  <reference type="seealso">
+    <item>
+      <link type="internal" href="attach-device" />
+      <name>
+        attach-device
+      </name>
+      <description>
+        Attach a device from an XML file
+      </description>
+    </item>
+  </reference>
 
 </command>
-- 
1.7.3.1




More information about the libvir-list mailing list