[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] update documentation for command detach-disk



---
 source/detach-disk.xml |  233 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 229 insertions(+), 4 deletions(-)

diff --git a/source/detach-disk.xml b/source/detach-disk.xml
index 53f71e4..16d282c 100644
--- a/source/detach-disk.xml
+++ b/source/detach-disk.xml
@@ -9,16 +9,241 @@
     </text>
   </description>
 
-  <options />
+  <options>
+    <parameter requirement="required">
+      <value type="string" requirement="required">domain</value>
+      <description>
+        The name of the domain from which a disk device is detached.
+      </description>
+    </parameter>
+    <parameter requirement="required">
+      <keyword requirement="optional">--target</keyword>
+      <value type="string" requirement="required">target</value>
+      <description>
+        the disk device to be detached. "--target" itself is optional.
+      </description>
+    </parameter>
+    <parameter requirement="optional">
+      <keyword requirement="required">--persistent</keyword>
+      <description>
+        with this option, the domain xml file is updated to remove the
+        element for the detached disk.
+      </description>
+    </parameter>
+  </options>
 
   <availability from="0.3.0" />
  
   <notes />
  
-  <examples type="usage" />
+  <examples type="usage">
+    <example>
+      <terminal>virsh # <bold>detach-disk</bold> <value>example-domain</value>  <italic>--target</italic> <value>sdb</value></terminal>
+      <text>
+        Detaches <value>sdb</value> from <value>example-domain</value>.
+      </text>
+    </example>
+  </examples>
 
-  <examples type="fullcontext" />
 
-  <reference type="seealso" />
+  <examples type="fullcontext">
+    <example>
+      <text>
+        We are running a domain which is defined as:
+      </text>
+      <terminal>&lt;domain type='kvm' id='2'&gt;
+  &lt;name&gt;example-domain&lt;/name&gt;
+  &lt;uuid&gt;6853c36f-af03-4968-a31d-1f3a9c3f699a&lt;/uuid&gt;
+  &lt;memory&gt;1048576&lt;/memory&gt;
+  &lt;currentMemory&gt;1048576&lt;/currentMemory&gt;
+  &lt;blkiotune&gt;
+    &lt;weight&gt;800&lt;/weight&gt;
+  &lt;/blkiotune&gt;
+  &lt;vcpu&gt;2&lt;/vcpu&gt;
+  &lt;cputune&gt;
+    &lt;vcpupin vcpu='0' cpuset='1'/&gt;
+  &lt;/cputune&gt;
+  &lt;os&gt;
+    &lt;type arch='x86_64' machine='pc-0.12'&gt;hvm&lt;/type&gt;
+    &lt;boot dev='hd'/&gt;
+  &lt;/os&gt;
+  &lt;features&gt;
+    &lt;acpi/&gt;
+    &lt;apic/&gt;
+    &lt;pae/&gt;
+  &lt;/features&gt;
+  &lt;clock offset='utc'/&gt;
+  &lt;on_poweroff&gt;destroy&lt;/on_poweroff&gt;
+  &lt;on_reboot&gt;restart&lt;/on_reboot&gt;
+  &lt;on_crash&gt;restart&lt;/on_crash&gt;
+  &lt;devices&gt;
+    &lt;emulator&gt;/usr/local/bin/qemu-system-x86_64&lt;/emulator&gt;
+    &lt;disk type='file' device='disk'&gt;
+      &lt;driver name='qemu' type='raw' cache='writeback'/&gt;
+      &lt;source file='/mnt/data/libvirt-images/vm2.img'/&gt;
+      &lt;target dev='vda' bus='virtio'/&gt;
+      &lt;alias name='virtio-disk0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/&gt;
+    &lt;/disk&gt;
+    &lt;disk type='block' device='disk'&gt;
+      &lt;driver name='qemu' type='qcow2'/&gt;
+      &lt;source dev='/mnt/data/libvirt-images/example-vm.img'/&gt;
+      &lt;target dev='vdb' bus='virtio'/&gt;
+      &lt;alias name='virtio-disk1'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/&gt;
+    &lt;/disk&gt;
+    &lt;controller type='ide' index='0'&gt;
+      &lt;alias name='ide0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/&gt;
+    &lt;/controller&gt;
+    &lt;interface type='network'&gt;
+      &lt;mac address='52:54:00:9a:88:73'/&gt;
+      &lt;source network='default'/&gt;
+      &lt;target dev='vnet0'/&gt;
+      &lt;alias name='net0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/&gt;
+    &lt;/interface&gt;
+    &lt;serial type='tcp'&gt;
+      &lt;source mode='bind' host='127.0.0.1' service='4555'/&gt;
+      &lt;protocol type='telnet'/&gt;
+      &lt;target port='0'/&gt;
+      &lt;alias name='serial0'/&gt;
+    &lt;/serial&gt;
+    &lt;console type='tcp'&gt;
+      &lt;source mode='bind' host='127.0.0.1' service='4555'/&gt;
+      &lt;protocol type='telnet'/&gt;
+      &lt;target type='serial' port='0'/&gt;
+      &lt;alias name='serial0'/&gt;
+    &lt;/console&gt;
+    &lt;input type='tablet' bus='usb'&gt;
+      &lt;alias name='input0'/&gt;
+    &lt;/input&gt;
+    &lt;input type='mouse' bus='ps2'/&gt;
+    &lt;graphics type='vnc' port='5900' autoport='yes'/&gt;
+    &lt;sound model='ac97'&gt;
+      &lt;alias name='sound0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/&gt;
+    &lt;/sound&gt;
+    &lt;video&gt;
+      &lt;model type='cirrus' vram='9216' heads='1'/&gt;
+      &lt;alias name='video0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/&gt;
+    &lt;/video&gt;
+    &lt;watchdog model='i6300esb' action='dump'&gt;
+      &lt;alias name='watchdog0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/&gt;
+    &lt;/watchdog&gt;
+    &lt;memballoon model='virtio'&gt;
+      &lt;alias name='balloon0'/&gt;
+      &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/&gt;
+    &lt;/memballoon&gt;
+  &lt;/devices&gt;
+&lt;/domain&gt;</terminal>
+      <text>
+        There are two disks defined: vda and vdb.
+      </text>
+      <terminal># fdisk -l
+
+Disk /dev/vdb doesn't contain a valid partition table
+
+Disk /dev/vda: 8589 MB, 8589934592 bytes
+16 heads, 63 sectors/track, 16644 cylinders
+Units = cylinders of 1008 * 512 = 516096 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x00057a9e
+
+   Device Boot      Start         End      Blocks   Id  System
+/dev/vda1   *           3       15604     7863296   83  Linux
+Partition 1 does not end on cylinder boundary.
+/dev/vda2           15604       16645      524288   82  Linux swap / Solaris
+Partition 2 does not end on cylinder boundary.
+
+Disk /dev/vdb: 8589 MB, 8589934592 bytes
+16 heads, 63 sectors/track, 16644 cylinders
+Units = cylinders of 1008 * 512 = 516096 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x00000000
+
+# lspci
+
+00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
+00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
+00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
+00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
+00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
+00:02.0 VGA compatible controller: Cirrus Logic GD 5446
+00:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)
+00:04.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01)
+00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
+00:06.0 RAM memory: Red Hat, Inc Virtio memory balloon
+00:07.0 System peripheral: Intel Corporation 6300ESB Watchdog Timer
+00:08.0 SCSI storage controller: Red Hat, Inc Virtio block device </terminal>
+      <text>
+        To detach disk vdb, we run the command:
+      </text>
+      <terminal>virsh # detach-disk example-domain vdb
+Disk detached successfully</terminal>
+      <text>
+        To verify that vdb is detached, we check it out from guest OS:
+      </text>
+      <terminal># fdisk -l
+
+Disk /dev/vda: 8589 MB, 8589934592 bytes
+16 heads, 63 sectors/track, 16644 cylinders
+Units = cylinders of 1008 * 512 = 516096 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x00057a9e
+
+   Device Boot      Start         End      Blocks   Id  System
+/dev/vda1   *           3       15604     7863296   83  Linux
+Partition 1 does not end on cylinder boundary.
+/dev/vda2           15604       16645      524288   82  Linux swap / Solaris
+Partition 2 does not end on cylinder boundary.
+
+# lspci
+
+00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
+00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
+00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
+00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
+00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
+00:02.0 VGA compatible controller: Cirrus Logic GD 5446
+00:03.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)
+00:04.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01)
+00:06.0 RAM memory: Red Hat, Inc Virtio memory balloon
+00:07.0 System peripheral: Intel Corporation 6300ESB Watchdog Timer
+00:08.0 SCSI storage controller: Red Hat, Inc Virtio block device</terminal>
+      <text>
+        We can see that vdb and <italic>00:05.0 SCSI storage controller</italic> to which vdb was connected are gone.
+      </text>
+    </example>
+  </examples>
+
+  <reference type="seealso">
+    <item>
+      <link type="internal" href="attach-disk" />
+      <name>attach-disk</name>
+      <description>
+        attach a disk device to a domain
+      </description>
+    </item>
+    <item>
+      <link type="internal" href="attach-device" />
+      <name>attach-device</name>
+      <description>
+        attach device from an XML file
+      </description>
+    </item>
+    <item>
+      <link type="internal" href="detach-device" />
+      <name>detach-device</name>
+      <description>
+        detach device from an XML file
+      </description>
+    </item>
+  </reference>
 
 </command>
-- 
1.7.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]