Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 76 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
76
Dung lượng
1,54 MB
Nội dung
282 Advanced Server Virtualization vmware-cmd e vmware-cmd command is used to perform various operations with virtual machines. It uses two diff erent command syntaxes: server opera- tions and virtual machine operations. In the following list of operations supported by the vmware-cmd utility, the token, <vm-confi g>, is used to represent the absolute path to the confi guration fi le of the virtual machine to which the operation is applied. Server Operations Supported by vmware-cmd • List virtual machines on the local server # vmware-cmd -l • Register a virtual machine # vmware-cmd -s register <vm-confi g> • Unregister a virtual machine # vmware-cmd -s unregister <vm-confi g>) Virtual Machine Operations Supported by vmware-cmd • addredo Add a redo log to a running virtual machine’s disk. Once the redo log is added, all changes are written into the new redo log fi le. e redo log fi le is stored in the same VMFS volume as the parent disk specifi ed by <disk-name>. e disk can be in append, persistent, or undoable mode. If the disk already has a redo log fi le, a second-level redo log fi le is added (a .REDO.REDO log). Disks in nonpersistent mode or that already have a second-level redo log fi le cannot have a redo log fi le added. e redo log fi le added by the addredo command is automatically committed when the virtual machine is powered off unless the changes were committed previ- ously. # vmware-cmd <vm-confi g> addredo <disk-name> • answer Prompt a user to answer the question for the virtual machine waiting for input. is usually occurs when a virtual machine’s disks are in undoable mode and the virtual machine has been shut down and powered off . # vmware-cmd <vm-confi g> answer • commit Merge changes written into a running virtual machine’s disk’s redo log fi le. e <disk-name> token specifi es the name of the virtual disk to be com- mitted. e <level> token specifi es which redo log to commit. Valid values for <level> are 0 or 1, where 0 is most commonly used, and 1 is used only Marshall_AU3931_C015.indd 282Marshall_AU3931_C015.indd 282 4/13/2006 1:40:19 PM4/13/2006 1:40:19 PM Confi guring VMware ESX Server 283 when there is a second-level redo log fi le and the fi rst-level redo log fi le should be committed. e <freeze> token specifi es if the virtual machine should be temporarily “frozen” during the commit process. Valid values for the <freeze> token are 0 or 1, where 0 specifi es that the virtual ma- chine should not be frozen and 1 specifi es that the virtual machine must be frozen during the commit. If the value of <level> is 0, the virtual ma- chine is frozen and the value of the <freeze> token is ignored. e <wait> token specifi es if the command returns immediately or if it blocks during the commit process. Valid value for the <wait> token are 0 or 1, where 0 specifi es that the command should not wait and returns immediately and 1 specifi es that the command should wait and blocks until the commit has completed. # vmware-cmd <vm-confi g> commit <disk-name> <level> <freeze> <wait> • connectdevice Connect a device to a virtual machine. is only applies to connectable devices including the virtual fl oppy drive, virtual CD/DVD-ROM drives, and virtual Ethernet adapters. e virtual CPU, memory, virtual SCSI controllers, or virtual hard disks cannot be connected or disconnected. e <device-name> token is the name of the device to connect, such as fl oppy0, ide0:1, or ethernet0. # vmware-cmd <vm-confi g> connectdevice <device-name> • disconnectdevice Disconnect a device from a virtual machine. is only applies to connect- able devices, including the virtual fl oppy drive, virtual CD/DVD-ROM drives, and virtual Ethernet adapters. e virtual CPU, memory, virtual SCSI controllers, or virtual hard disks cannot be connected or discon- nected. e <device-name> token is the name of the device to disconnect, such as fl oppy0, ide0:1, or ethernet0. # vmware-cmd <vm-confi g> disconnectdevice <device-name> • getcapabilities Obtain the permissions of a virtual machine for the current user. An inte- ger value is retuned as a bit fi eld comprised of the following values: 1 - execute 2 - write 4 - read erefore, a result of 4 specifi es read permissions only, a value of 6 speci- fi es read and write permissions, and a value of 7 specifi es read, write, and execute permissions. # vmware-cmd <vm-confi g> getcapabilities Marshall_AU3931_C015.indd 283Marshall_AU3931_C015.indd 283 4/13/2006 1:40:19 PM4/13/2006 1:40:19 PM 284 Advanced Server Virtualization • getconfi g Obtain the value of a keyword/value pair stored in a virtual machine’s confi guration fi le. e virtual machine confi guration fi le is comprised of a set of keyword/value pairs, one per line. e keyword represents a single property of the virtual machine, such as a device setting, and is separated from the value by an equal character (=). # vmware-cmd <vm-confi g> getconfi g <keyword> • getconfi gfi le Obtain the confi guration fi le name for a running virtual machine. # vmware-cmd <vm-confi g> getconfi gfi le • getguestinfo Obtain the value of a GuestInfo variable for a virtual machine. GuestInfo variables are custom keyword/value pairs that are accessible from inside the virtual machine through facilities in VMware Tools. All GuestInfo vari- ables are user-defi ned. e fi rst time the setguestinfo operation is used, the specifi ed GuestInfo variable, identifi ed by its <keyword>, is created. If an existing GuestInfo variable is set again, its value is updated. GuestInfo variables can only be created and set for running virtual machines. e GuestInfo variables are not persisted and are discarded when the virtual machine is powered off . # vmware-cmd <vm-confi g> getguestinfo <keyword> • getheartbeat Obtain the current heartbeat count value for a running virtual machine. e virtual machine must have VMware Tools installed in order to pro- duce a heartbeat. e count is updated once per second and starts from zero. If a virtual machine stops sending heartbeat signals to ESX Server, the number will stop incrementing. # vmware-cmd <vm-confi g> getheartbeat • getid Obtain the unique world identifi er for a running virtual machine. # vmware-cmd <vm-confi g> getid • getpid Obtain the process identifi er for a running virtual machine. # vmware-cmd <vm-confi g> getpid • getproductinfo Obtain the value of a product information keyword for a virtual machine. Although the values are global to the ESX Server, a valid path to a virtual machine confi guration fi le is required for the operation to work properly. Valid values for the <keyword> token are: product —Returns the product name, esx. Marshall_AU3931_C015.indd 284Marshall_AU3931_C015.indd 284 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM Confi guring VMware ESX Server 285 platform—Returns the platform name, vmnix. build—Returns the build number of ESX Server. majorversion—Returns the major portion of the version number of ESX Server. minorversion—Returns the minor portion of the version number of ESX Server. revision—Returns the revision portion of the version number of ESX Server. # vmware-cmd <vm-confi g> getproductinfo <keyword> • getremoteconnection Obtain the total number of remote connections to a virtual machine. Re- mote connections include connections from the Management Interface, VMRC, or the scripting API. # vmware-cmd <vm-confi g> getremoteconnections • getresource Obtain the value of a resource variable for a virtual machine specifi ed by the <resource-variable> token. See the Resource Variables section for a list of valid resource variables. # vmware-cmd <vm-confi g> getresource <resource-variable> • getstate Obtain the power state of a virtual machine. # vmware-cmd <vm-confi g> getstate • gettoolslastactive Obtain the time in seconds since the last heartbeat signal was received from a running virtual machine. # vmware-cmd <vm-confi g> gettoolslastactive • getuptime Obtain the uptime of the guest operating system of a running virtual ma- chine. # vmware-cmd <vm-confi g> getuptime • reset Reset a virtual machine. Restarts or resets the virtual machine. e default <power-op> is soft if a <power-op> is not specifi ed. # vmware-cmd <vm-confi g> reset <power-op> • setconfi g Set the value of a keyword/value pair stored in a virtual machine’s con- fi guration fi le. e virtual machine confi guration fi le is comprised of a set of keyword/value pairs, one per line. e keyword represents a single Marshall_AU3931_C015.indd 285Marshall_AU3931_C015.indd 285 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM 286 Advanced Server Virtualization property of the virtual machine, such as a device setting, and is separated from the value by an equal character (=). e values set by this command only aff ect running virtual machines and the changes are not saved into the virtual machine’s confi guration fi le. # vmware-cmd <vm-confi g> setconfi g <keyword> <value> • setguestinfo Set a GuestInfo variable for a virtual machine. GuestInfo variables are custom keyword/value pairs that are accessible from inside the virtual machine through facilities in VMware Tools. All GuestInfo variables are user-defi ned. e fi rst time the setguestinfo operation is used, the specifi ed GuestInfo variable, identifi ed by its <keyword>, is created. If an existing GuestInfo variable is set again, its value is updated. GuestInfo variables can only be created and set for running virtual machines. e GuestInfo variables are not persisted and are discarded when the virtual machine is powered off . # vmware-cmd <vm-confi g> setguestinfo <keyword> <value> • setresource Set the value of a resource variable for a virtual machine. e <resource- variable> token specifi es which resource variable should be set and the <value> token represents the new value of the resource variable. See the Resource Variables section for a list of valid resource variables. # vmware-cmd <vm-confi g> setresource <resource-variable> <value> • start Start a virtual machine. If the virtual machine is powered off , it will be powered on. If the virtual machine is suspended, it will be resumed. # vmware-cmd <vm-confi g> start <power-op> • stop Stop a virtual machine. Shuts down and then powers off the virtual ma- chine. e default <power-op> is soft if a <power-op> is not specifi ed. # vmware-cmd <vm-confi g> stop <power-op> • suspend Suspend a virtual machine. e virtual machine must be powered on. e default <power-op> is soft if a <power-op> is not specifi ed. # vmware-cmd <vm-confi g> suspend <power-op> Marshall_AU3931_C015.indd 286Marshall_AU3931_C015.indd 286 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM Confi guring VMware ESX Server 287 Power Operation Values • hard Hard power operations forces the power state change immediately and without condition. When powering off or resetting a virtual machine, this is akin to pressing the main power button or the reset button of a physical computer. • soft Soft power operations always attempt to gracefully handle the guest op- erating system before attempting to apply the power state change. e virtual machine on which a soft power operation is being performed must have VMware Tools installed and running. When powering off a virtual machine, the shut down event script in VMware Tools is fi rst executed and then the guest operating system is shut down gracefully. When resetting a virtual machine, its guest operating system is instead restarted gracefully. When suspending a virtual machine, the defi ned suspend scripts within the virtual machine (see VMware Tools) are fi rst executed. When power- ing on a virtual machine, the power on event script in VMware Tools is executed when VMware Tools becomes available. When resuming a virtual machine that was previously suspended, the resume event script in VM- ware Tools is executed when VMware Tools becomes available. • trysoft e trysoft power operation always attempts to perform a soft power op- eration fi rst and if the soft power operation fails, a hard power operation is then used. Resource Variables for Virtual Machines • cpu.affi nity A comma-delimited list of CPU numbers on which the virtual machine can be executed. is resource variable is read and write capable. • cpu.emin, cpu.<vcpu>.emin e eff ective minimum percentage of CPU allocation for a virtual ma- chine. By default, cpu.emin reports the value for virtual CPU0 only. e alternate form can be used where <vcpu> is the zero-based number of the virtual CPU for which the value will be reported. is resource variable is read-only. • cpu.extrasec, cpu.<vcpu>.extrasec e amount of cumulative processor time consumed by the virtual proces- sor above the eff ective minimum CPU allocation defi ned by the cpu.emin resource variable. e value is expressed as a fl oating-point number which is the amount of time in milliseconds. By default, cpu.extrasec reports the Marshall_AU3931_C015.indd 287Marshall_AU3931_C015.indd 287 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM 288 Advanced Server Virtualization value for virtual CPU0 only. e alternate form can be used where <vcpu> is the zero-based number of the virtual CPU for which the value will be reported. is resource variable is read-only. • cpu.htSharing Defi nes the policy regarding the sharing of Hyper reading processor re- sources by a virtual machine. Valid values for this resource variable are: any e virtual machine’s virtual CPU may share Hyper readed processor resources at any time with any other virtual CPUs from the same or other virtual machines. internal e virtual machine’s virtual CPU may share Hyper readed processor resources at any time with any other virtual CPUs from the same virtual machine only. is only applies to ESX Servers with VMware Virtual SMP installed and to virtual machines with more than one virtual pro- cessor. none e virtual machine’s virtual CPU may never share Hyper readed processor resources at any time with any other virtual CPUs from the same or other virtual machines. e default value is any. is resource variable is read and write ca- pable. • cpu.max e maximum percentage of CPU allocation for the virtual machine’s virtual processors. e valid range of value is from zero to (100 * num- ber_of_virtual_processors). A virtual machine with two virtual processors has a valid potential range from 0 to 200. is resource variable is read and write capable. • cpu.min e minimum percentage of CPU allocation guaranteed for the virtual machine. is resource variable is read and write capable. • cpu.number e number of processors assigned to the virtual machine. is resource variable is read-only. • cpu.shares e number of CPU resources shares assigned to the virtual machine. is resource variable is read and write capable. • cpu.syssec, cpu.<vcpu>.syssec e amount of CPU time consumed by the VMKernel for the virtual machine performing system operations such as disk or network I/O. is is a subset of the time reported by the cpu.usedsec resource variable. e value is expressed as a fl oating point number and represents the number of milliseconds of CPU time used. By default, cpu.syssec reports the value Marshall_AU3931_C015.indd 288Marshall_AU3931_C015.indd 288 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM Confi guring VMware ESX Server 289 for virtual CPU0 only. e alternate form can be used where <vcpu> is the zero-based number of the virtual CPU for which the value will be reported. is resource variable is read-only. • cpu.uptime, cpu.<vcpu>.uptime e number of seconds since the virtual machine was powered on. By default, cpu.uptime reports the value for virtual CPU0 only. e alternate form can be used where <vcpu> is the zero-based number of the virtual CPU for which the value will be reported. is resource variable is read- only. • cpu.usedsec, cpu.<vcpu>.usedsec e total amount of CPU time used by a virtual machine. By default, cpu. usedsec reports the value for virtual CPU0 only. e alternate form can be used where <vcpu> is the zero-based number of the virtual CPU for which the value will be reported. is resource variable is read-only. • cpu.waitsec, cpu.<vcpu>.waitsec e total amount of idle or blocked CPU time for the virtual machine. By default, cpu.waitsec reports the value for virtual CPU0 only. e alternate form can be used where <vcpu> is the zero-based number of the virtual CPU for which the value will be reported. is resource variable is read- only. • disk.HTL Returns a space-delimited set of Host Target LUNs (HTL). is resource variable is read-only. • disk.<HTL>.busResets e total number of bus resets invoked by commands originating from the virtual machine on the specifi ed Host Target LUN (<HTL>). is resource variable is read-only. • disk.<HTL>.cmds e total number of commands issued by the virtual machine to the speci- fi ed Host Target LUN (<HTL>). is resource variable is read-only. • disk.<HTL>.cmdsAborted e total number of commands issued by the virtual machine to the speci- fi ed Host Target LUN (<HTL>) that were aborted. is resource variable is read-only. • disk.<HTL>.KBread e total number of kilobytes read from the specifi ed Host Target LUN (<HTL>) by the virtual machine. is resource variable is read-only. • disk.<HTL>.KBwritten e total number of kilobytes written to the specifi ed Host Target LUN (<HTL>) by the virtual machine. is resource variable is read-only. • disk.<HTL>.reads e total number of reads on the specifi ed Host Target LUN (<HTL>) by the virtual machine. is resource variable is read-only. Marshall_AU3931_C015.indd 289Marshall_AU3931_C015.indd 289 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM 290 Advanced Server Virtualization • disk.<HTL>.shares e total number of shares allocated to the virtual machine on the speci- fi ed Host Target LUN (<HTL>). is resource variable is read and write capable. • disk.<HTL>.writes e total number of writes on the specifi ed Host Target LUN (<HTL>) by the virtual machine. is resource variable is read-only. • mem.active e amount of actively used memory by a virtual machine. e value rep- resents the memory in kilobytes. is resource variable is read-only. • mem.affi nity e NUMA node memory affi nity of a virtual machine. is resource vari- able is read and write capable. • mem.cpt-tgt e number of kilobytes of memory that the virtual machine reads into physical memory from its suspend fi le if the virtual machine is swapping from a suspended state fi le. Otherwise, a value of zero is retuned. is resource variable is read-only. • mem.cptread e number of kilobytes of the virtual machine’s suspend fi le that has been read into physical memory. A virtual machine’s suspended state fi le may act as a special swap fi le for the VMKernel when the virtual machine is resumed and system memory is low. is resource variable is read-only. • mem.max e absolute maximum amount of memory that the virtual machine can use expressed in megabytes. is resource variable is read and write ca- pable. • mem.mctltgt e size of the vmmemctl balloon driver in the guest operating system of the virtual machine in kilobytes. is resource variable is read-only. • mem.memctl e number of kilobytes of memory reclaimed after the vmmemctl runs for a virtual machine. is resource variable is read-only. • mem.min e absolute minimum amount of memory that the virtual machine will have allocated expressed in megabytes. is resource variable is read and write capable. • mem.overhd e number of kilobytes of memory overhead of a virtual machine. is resource variable is read-only. • mem.ovhdmax e maximum number of kilobytes of memory overhead of a virtual ma- chine. is resource variable is read-only. Marshall_AU3931_C015.indd 290Marshall_AU3931_C015.indd 290 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM Confi guring VMware ESX Server 291 • mem.shared e number of kilobytes of memory that is transparently shared (or con- solidated) for a virtual machine with other virtual machines running on the same ESX Server. is resource variable is read-only. • mem.shares e number of memory resource shares assigned to the virtual machine. is resource variable is read and write capable. • mem.size e actual number of kilobytes of memory consumed by a virtual ma- chine. is resource variable is read-only. • mem.sizetgt e targeted memory size of a virtual machine expressed in kilobytes. is resource variable is read-only. • mem.swapin e total number of kilobytes of data swapped into memory since the virtual machine was powered on. is resource variable is read-only. • mem.swapout e total number of kilobytes of data swapped from memory onto disk since the virtual machine was powered on. is resource variable is read- only. • mem.swapped e total number of kilobytes of data swapped into and out of the VMFS volume’s swap fi le since the virtual machine was powered on. is resource variable is read-only. • mem.swaptgt e targeted number of kilobytes of memory to swap to the VMFS vol- ume’s swap fi le for a virtual machine. is resource variable is read-only. • net.adapters Returns a space-delimited set of MAC addresses that correspond to each virtual network adapter installed in the virtual machine. is resource vari- able is read-only. • net.<mac>.totKBRx e total number of kilobytes of data received by the virtual network adapter identifi ed by its MAC address, specifi ed by <mac>, including both local and remote network traffi c. is resource variable is read-only. • net.<mac>.totKBTx e total number of kilobytes of data transmitted by the virtual network adapter identifi ed by its MAC address, specifi ed by <mac>, including both local and remote network traffi c. is resource variable is read-only • net.<mac>.totPktsRx e total number of packets of data received by the virtual network adapt- er identifi ed by its MAC address, specifi ed by <mac>, including both local and remote network traffi c. is resource variable is read-only. Marshall_AU3931_C015.indd 291Marshall_AU3931_C015.indd 291 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM [...]... Configuration window The Virtual Machine Configuration window will start with the Hardware tab selected, displaying the complete set of virtual hardware installed and configured for the new virtual machine (see Figure 16. 15) Clicking the Close link in the upper right-hand corner of the window will close the Virtual Machine Configuration window At this point, the Status Monitor tab of the main MUI window will... restarting the virtual machine using the normal means After the virtual machine has been rebooted, the installation of VMware Tools has been completed Figure 16.31 VMware Tools Finish Admin Install Marshall_AU3931_C016.indd 316 4/13/2006 1:41:09 PM Creating a VMware ESX Server Virtual Machine 317 The installation of VMware Tools in a virtual machine is a one time event After the installation, the enhanced... Windows XP Microsoft Windows Server 2003 FreeBSD 4.10 Novell NetWare 5. 1 & 6 .5 Server Red Hat Linux 7.2 - 9.0 Red Hat Linux Advanced Server 2.1 Red Hat Enterprise Linux 2.1 & 3.0 SuSE Linux 8.2 - 9.2 SuSE Linux Enterprise Server 8 & 9 Installing Windows Server 2003 in a Virtual Machine The supported operating systems mentioned above interact with the x86-compatible virtual hardware represented in the virtualization. .. Marshall_AU3931_C016.indd 307 4/13/2006 1:41: 05 PM 308 Advanced Server Virtualization Installing a Guest Operating System Installing a guest operating system onto a virtual machine’s virtual hard disk drive is once again the same as installing an operating system on a physical computer Remember that the guest operating system being installed is not aware that it is being installed inside of a virtual machine and not... many other Windows applications Installing a Linux Guest Operating System As noted in the Windows installation above, the installation media must first be loaded into the machine Once the media has been inserted, the virtual machine can be powered on to begin the install We will demonstrate an installation of Red Hat Linux 9.0 1 Once the Red Hat Linux 9.0 media is mounted, power on the virtual machine... VMware Tools for Windows with the previous example of a Microsoft Windows Server 2003 Standard Edition guest operating system To install VMware Tools, follow these steps: 1 After the virtual machine is powered on, connect to the virtual machine using VMRC and log in to the virtual machine as an administrator 2 Once the guest operating system has completely booted, click Settings > Install VMware Tools (see... refreshed its data, displaying the newly created virtual machine (see Figure 16.16) Marshall_AU3931_C016.indd 306 4/13/2006 1:41: 05 PM Creating a VMware ESX Server Virtual Machine 307 Figure 16.14 Saving the virtual hard disk configuration Figure 16. 15 Virtual Machine Configuration Window, Hardware Tab Figure 16.16 ESX Server MUI with one virtual machine The virtual machine has been created and the process... button The virtual machine will now be created This may take a minute or two While the virtual machine is being created, the screen shown in Figure 16.10 will be displayed: Figure 16.10 The new virtual machine is being created Marshall_AU3931_C016.indd 304 4/13/2006 1:41:04 PM Creating a VMware ESX Server Virtual Machine 3 05 Figure 16.11 Choosing the type of virtual hard disk 6 Once the virtual machine... Marshall_AU3931_C016.indd 303 4/13/2006 1:41:03 PM 304 Advanced Server Virtualization For example, if a new virtual machine was given the name, Intranet Web Server, and was created by the root account, its configuration file name and path would be /root /vmware/ intranet_web _server/ intranet_ web _server. vmx Continuing this theme, the virtual machine’s virtual hard disk file name should be intranet_web _server. vmdk... mode installer by typing linux text and then press 3 Follow the installation steps according to the instructions on the screen just as if the operating system were being installed on a physical server To ensure a successful installation, follow the choices outlined in the following steps 4 Choose the language that should be used during the installation process Then choose the model of keyboard . include Microsoft Windows XP and Microsoft Windows Server 2003. Creating a Virtual Machine with Microsoft Windows Server 2003 Guest OS e easiest method of creating a new virtual machine in. 16 Creating a VMware ESX Server Virtual Machine e basic guidelines of creating virtual machines in VMware ESX Server do not diff er much from those of VMware GSX Server or even Microsoft s Virtual. represents a single Marshall_AU3931_C0 15. indd 285Marshall_AU3931_C0 15. indd 2 85 4/13/2006 1:40:20 PM4/13/2006 1:40:20 PM 286 Advanced Server Virtualization property of the virtual machine, such