VMware 创建虚拟机的磁盘操作
VMware的磁盘可以挂在在两种总线下:IDE,SCSI。IDE总线的速度比较慢,但是价格低廉。一般的pc机都会采用IDE总线。(感觉目前的pc都采用sata总线。和IDE的并行相比,串行通信的sata速度更快,占用更少的线路)更重要的是正版的xp,2003都只支持IDE,因为那时候还没有SCSI。SCSI的速度比较快,常用于服务器,价格比较贵。VMware的虚拟机对于两种总线还是有很多限制的。
IDE介绍对于IDE来说,VM最多有两条IDE总线。每条IDE总线可以挂载两个设备(主设备和从设备),所以一个虚拟机最多可以挂载四个IDE设备。在创建中需要注意一点:VMware自己预留了一个IDE端口。VMware将201:0(201是IDE总线编号。IDE有两个总线编号:200和201。每个总线下的两个设备编号分别为0和1。201:0就是编号为201的IDE总线的主设备)留给了光驱cdrom。所以在配置的时候一定要注意不要占用此端口。创建虚拟机需要通过VirtualDeviceConfigSpec对象来配置参数。其中的VirtualDevice描述了磁盘在此虚拟机的表示。具体参数意义参考sdk:backing*VirtualDeviceBackingInfoInformation about the backing of this virtual device presented in the context of the virtual machine's environment. Not all devices are required to have backing information.
See VirtualMachineConfigOption
connectable*VirtualDeviceConnectInfoProvides information about restrictions on removing this device while a virtual machine is running. If the device is not removable, then this property is null.controllerKey*xsd:intObject key for the controller object for this device. This property contains the key property value of the controller device object.deviceInfo*DescriptionProvides a label and summary information for the device.keyxsd:intA unique key that distinguishes this device from other devices in the same virtual machine. Keys are immutable but may be recycled; that is, a key does not change as long as the device is associated with a particular virtual machine. However, once a device is removed, its key may be used when another device is added.
This property is not read-only, but the client cannot control its value. Persistent device keys are always assigned and managed by the server, which guarantees that all devices will have non-negative key values.
When adding new devices, it may be necessary for a client to assign keys temporarily in order to associate controllers with devices in configuring a virtual machine. However, the server does not allow a client to reassign a device key, and the server may assign a different value from the one passed during configuration. Clients should ensure that existing device keys are not reused as temporary key values for the new device to be added (for example, by using unique negative integers as temporary keys).
When editing or deleting a device, clients must use the server-provided key to refer to an existing device.