Information Technology Reference
In-Depth Information
In the preceding lines, ZFS compression is turned on to save disk space. The
option to mkfile creates an empty file: No disk blocks are allocated until data is
written to them. The file takes up no disk space, even though it is apparently 10
GB in size:
# ls -l /ldoms/ldom1/disk0.img
-rw------T 1 root root 10737418240 2009-10-12 19:32 /ldoms/ldom1/disk0.img
# zfs list rpool/ldoms/ldom1
NAME USED AVAIL REFER MOUNTPOINT
rpool/ldoms/ldom1 19K 21.4G 19K /ldoms/ldom1
The virtual disk can also be allocated from other back-ends, such as a physical
disk, but ZFS provides operational flexibility.
The following commands create the domain. Lines 2 and 3 set the number of
CPUs and cryptographic accelerators. Line 4 sets the amount of RAM assigned
to the domain. Line 5 creates the virtual network device using the virtual Layer
2 switch defined previously. Additional network devices could be defined if we
wanted the domain to reside on separate networks. Line 6 exports the empty disk
image as a virtual volume vol10@primary-vds0 from the virtual disk service.
Line 7 imports this volume as a virtual disk vdisk10 into the guest domain. The
commands for adding a virtual disk are a bit more complicated than the others;
they can be interpreted as first defining a resource exported by the virtual disk
server and then importing that resource into the domain that uses it. Finally, lines
8 and 9 do the same for a file containing the ISO format image of an Oracle Solaris
installation DVD.
1 # ldm add-domain ldom1
2 # ldm set-vcpu 4 ldom1
3 # ldm set-mau 0 ldom1
4 # ldm set-mem 4g ldom1
5 # ldm add-vnet vnet1 primary-vsw0 ldom1
6 # ldm add-vdsdev /ldoms/ldom1/disk0.img vol10@primary-vds0
7 # ldm add-vdisk vdisk10 vol10@primary-vds0 ldom1
8 # ldm add-vdsdev /DVD/S10u7/solarisdvd.iso s10u7iso@primary-vds0
9 # ldm add-vdisk vdisk_iso s10u7iso@primary-vds0 ldom1
At this point, the domain's definition is complete. We set OpenBoot Prom
(OBP) variables to force the domain to come to the ok prompt instead of booting
an OS by setting the autoboot? property so as to demonstrate OBP commands.
The “ \ ” in the command line is an escape character, so we can enter the “ ?
character as a literal value. Then we bind the domain, which assigns the speci-
fied resources to the domain. This includes assigning the port used by the virtual
 
Search WWH ::




Custom Search