Oracle VM 从2007年的诞生到现在,已有近10个年头,在内容、功能方面更新了不少,最新版为3.4.2。架构从最开始的OC4J变成了Weblogic ADF (Application Development Framework) web application,数据库也从最开始的Oracle XE变成了现在的MySQL Enterprise,从3.2开始Oracle引入了MySQL数据库,引入了命令行工具,后续又支持了光纤通道,支持从Unified Extensible Firmware Interface (UEFI)引导,引入了OSWatcher等。本文列出了Oracle VM Server和Oracle VM Manager基本管理。
如何安装Oracle VM 3.4(VM Server,VM Manager)

Server Pool:一个服务器池包含一个或多个物理服务器,这些使用服务器共享一个存储库
S e r v e r s:服务器池中的Oracle VM Server,就可以被赋予1到3个服务器功能(Server Pool Master,Utility Server,Virtual Machine Server)
Server Pool Master:一个服务器池中只能有一个Oracle VM Server被授予Server Pool Master,此服务器可以被看作VM Server和外界的通道,负责池中的资源协调 Utility Server:主要负责IO密集型操作(创建、删除、迁移等),比如虚拟机的创建 Virtual Machine Server:是指虚拟服务器。还用于收集主机和客户操作系统的性能数据。角色为domU的管理程序
如何管理Oracle VM Agent
[root@ohsvms ~]# /etc/init.d/ovs-agent
Usage: /etc/init.d/ovs-agent {start|stop|restart|reload|status}
[root@ohsvms ~]# /etc/init.d/ovs-agent status log server (pid 9297) is running... notificationserver server (pid 9363) is running... remaster server (pid 9368) is running... monitor server (pid 9371) is running... ha server (pid 9374) is running... stats server (pid 9375) is running... xmlrpc server (pid 9379) is running... fsstats server (pid 9381) is running... apparentsize server (pid 9382) is running... [root@ohsvms ~]# /etc/init.d/ovs-agent restart Stopping Oracle VM Agent: [ OK ] Starting Oracle VM Agent: [ OK ] [root@ohsvms ~]#
XM命令行工具列表
[root@ohsvms ~]# xm helpUsage: xm <subcommand> [args] Control, list, and manipulate Xen guest instances. xm full list of subcommands: console Attach to <Domain>'s console. vncviewer Attach to <Domain>'s VNC server. create Create a domain based on <ConfigFile>. new Adds a domain to Xend domain management delete Remove a domain from Xend domain management. destroy Terminate a domain immediately. domid Convert a domain name to domain id. domname Convert a domain id to domain name. dump-core Dump core for a specific domain. list List information about all/some domains. mem-max Set the maximum amount reservation for a domain. mem-set Set the current memory usage for a domain. migrate Migrate a domain to another machine. pause Pause execution of a domain. reboot Reboot a domain. rename Rename a domain. reset Reset a domain. restore Restore a domain from a saved state. resume Resume a Xend managed domain save Save a domain state to restore later. shutdown Shutdown a domain. start Start a Xend managed domain suspend Suspend a Xend managed domain sysrq Send a sysrq to a domain. trigger Send a trigger to a domain. top Monitor a host and the domains in real time. unpause Unpause a paused domain. uptime Print uptime for all/some domains. usb-add Add the usb device to FV VM. usb-del Delete the usb device to FV VM. domstate get the state of a domain vcpu-list List the VCPUs for all/some domains. vcpu-pin Set which CPUs a VCPU can use. vcpu-set Set the number of active VCPUs allowed for the domain. debug-keys Send debug keys to Xen. dmesg Read and/or clear Xend's message buffer. info Get information about Xen host. log Print Xend log serve Proxy Xend XMLRPC over stdio. sched-credit2 Get/set credit2 scheduler parameters. sched-credit Get/set credit scheduler parameters. sched-sedf Get/set EDF parameters. block-attach Create a new virtual block device. block-detach Destroy a domain's virtual block device. block-list List virtual block devices for a domain. block-configure Change block device configuration network-attach Create a new virtual network device. network-detach Destroy a domain's virtual network device. network-list List virtual network interfaces for a domain. network2-attach Create a new version 2 virtual network device. network2-detach Destroy a domain's version 2 virtual network device. network2-list List version 2 virtual network interfaces for a domain. pci-attach Insert a new pass-through pci device. pci-detach Remove a domain's pass-through pci device. pci-list List pass-through pci devices for a domain. pci-list-assignable-devices List all the assignable pci devices scsi-attach Attach a new SCSI device. scsi-detach Detach a specified SCSI device. scsi-list List all SCSI devices currently attached. usb-attach Attach a new USB physical bus to domain's virtual port. usb-detach Detach a USB physical bus from domain's virtual port. usb-list List domain's attachment state of all virtual port . usb-list-assignable-devices List all the assignable usb devices usb-hc-create Create a domain's new virtual USB host controller. usb-hc-destroy Destroy a domain's virtual USB host controller. vnet-list List Vnets. vnet-create Create a vnet from ConfigFile. vnet-delete Delete a Vnet. setpolicy Set the policy of the system. labels List <type> labels for (active) policy. addlabel Add security label to domain. rmlabel Remove a security label from domain. getlabel Show security label for domain or resource. dry-run Test if a domain can access its resources. resources Show info for each labeled resource. dumppolicy Print hypervisor ACM state information. resetpolicy Set the policy of the system to the default policy. getpolicy Get the policy of the system. getenforce Returns the current enforcing mode for the Flask XSM module (Enforcing,Permissive) setenforce Modifies the current enforcing mode for the Flask XSM module tmem-list List tmem pools. tmem-thaw Thaw tmem pools. tmem-freeze Freeze tmem pools. tmem-destroy Destroy tmem pools. tmem-set Change tmem settings. tmem-shared-auth De/authenticate shared tmem pool. cpupool-create Create a CPU pool based an ConfigFile. cpupool-new Adds a CPU pool to Xend CPU pool management cpupool-start Starts a Xend CPU pool cpupool-list List CPU pools on host cpupool-destroy Deactivates a CPU pool cpupool-delete Removes a CPU pool from Xend management cpupool-cpu-add Adds a CPU to a CPU pool cpupool-cpu-remove Removes a CPU from a CPU pool cpupool-migrate Moves a domain into a CPU pool shell Launch an interactive shell. <Domain> can either be the Domain Name or Id. For more help on 'xm' see the xm(1) man page. For more help on 'xm create' see the xmdomain.cfg(5) man page. [root@ohsvms ~]#
xm查看物理主机信息
[root@ohsvms ~]# xm info host : ohsvms release : 4.1.12-32.1.3.el6uek.x86_64 version : #2 SMP Fri Jan 29 21:07:58 PST 2016 machine : x86_64 nr_cpus : 1 nr_nodes : 1 cores_per_socket : 1 threads_per_core : 1 cpu_mhz : 2712 hw_caps : 078bfbff:28100800:00000000:00003300:d6f8220b:00000000:00000121:00842000 virt_caps : total_memory : 4095 free_memory : 3188 free_cpus : 0 xen_major : 4 xen_minor : 4 xen_extra : .4OVM xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p xen_scheduler : credit xen_pagesize : 4096 platform_params : virt_start=0xffff800000000000 xen_changeset : xen_commandline : placeholder dom0_mem=max:856M allowsuperpage cc_compiler : gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3) cc_compile_by : mockbuild cc_compile_domain : us.oracle.com cc_compile_date : Thu Feb 11 14:09:59 PST 2016 xend_config_format : 4
列出vm信息
[root@ohsvms ~]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 856 1 r----- 1717.5
[root@ohsvms ~]# xm list --long
(domain
(domid 0)
(cpu_weight 65535)
(cpu_cap 0)
(pool_name Pool-0)
(bootloader '')
(vcpus 1)
(cpus ((0)))
(on_poweroff destroy)
(on_crash restart)
(uuid 00000000-0000-0000-0000-000000000000)
(bootloader_args '')
(name Domain-0)
(on_reboot restart)
(maxmem 856)
(memory 856)
(memory_actual 856)
(shadow_memory 0)
(features '')
(on_xend_start ignore)
(on_xend_stop ignore)
(cpu_time 1717.61511724)
(online_vcpus 1)
(image
(linux
(kernel '')
(expose_host_uuid 0)
(superpages 0)
(nomigrate 0)
(tsc_mode 0)
)
)
(status 2)
(state r-----)
) [root@ohsvms ~]#
常用命令
xentop
Displays real-time information about Oracle VM Server and domains.
xm dmesg
Displays log information on the hypervisor.
xm log
Displays log information of the Oracle VM Server daemon.
[root@ohsvms ~]# xm dmesg
Xen 4.4.4OVM (XEN) Xen version 4.4.4OVM (mockbuild@us.oracle.com) (gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)) debug=n Thu Feb 11 14:09:59 PST 2016 (XEN) Latest ChangeSet: (XEN) Bootloader: GRUB 2.02~beta2 (XEN) Command line: placeholder dom0_mem=max:856M allowsuperpage (XEN) Xen image base address: 0xdee00000 (XEN) Video information: (XEN) VGA is text mode 80x25, font 8x16 (XEN) Disc information: (XEN) Found 1 MBR signatures (XEN) Found 1 EDD information structures (XEN) Xen-e820 RAM map: (XEN) 0000000000000000 - 000000000009fc00 (usable) (XEN) 000000000009fc00 - 00000000000a0000 (reserved) (XEN) 00000000000f0000 - 0000000000100000 (reserved) (XEN) 0000000000100000 - 00000000dfff0000 (usable) (XEN) 00000000dfff0000 - 00000000e0000000 (ACPI data) (XEN) 00000000fec00000 - 00000000fec01000 (reserved) (XEN) 00000000fee00000 - 00000000fee01000 (reserved) (XEN) 00000000fffc0000 - 0000000100000000 (reserved) (XEN) 0000000100000000 - 0000000120000000 (usable) (XEN) New Xen image base address: 0xdf800000 (XEN) ACPI: RSDP 000E0000, 0024 (r2 VBOX ) (XEN) ACPI: XSDT DFFF0030, 003C (r1 VBOX VBOXXSDT 1 ASL 61) (XEN) ACPI: FACP DFFF00F0, 00F4 (r4 VBOX VBOXFACP 1 ASL 61) (XEN) ACPI: DSDT DFFF0470, 210F (r1 VBOX VBOXBIOS 2 INTL 20100528) (XEN) ACPI: FACS DFFF0200, 0040 (XEN) ACPI: APIC DFFF0240, 0054 (r2 VBOX VBOXAPIC 1 ASL 61) (XEN) ACPI: SSDT DFFF02A0, 01CC (r1 VBOX VBOXCPUT 2 INTL 20100528) (XEN) System RAM: 4095MB (4193852kB) (XEN) Domain heap initialised (XEN) Processor #0 7:14 APIC version 20 (XEN) IOAPIC[0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23 (XEN) Enabling APIC mode: Flat. Using 1 I/O APICs (XEN) Not enabling x2APIC: depends on iommu_supports_eim. (XEN) Using scheduler: SMP Credit Scheduler (credit) (XEN) Detected 2712.164 MHz processor. (XEN) Initing memory sharing. (XEN) xstate_init: using cntxt_size: 0x440 and states: 0x7 (XEN) I/O virtualisation disabled (XEN) ENABLING IO-APIC IRQs (XEN) -> Using new ACK method (XEN) Platform timer is 3.579MHz ACPI PM Timer (XEN) Allocated console ring of 64 KiB. (XEN) Brought up 1 CPUs (XEN) xenoprof: Initialization failed. Intel processor family 6 model 94is not supported (XEN) Dom0 has maximum 208 PIRQs (XEN) *** LOADING DOMAIN 0 *** (XEN) Xen kernel: 64-bit, lsb, compat32 (XEN) Dom0 kernel: 64-bit, PAE, lsb, paddr 0x1000000 -> 0x2092000 (XEN) PHYSICAL MEMORY ARRANGEMENT: (XEN) Dom0 alloc.: 0000000114000000->0000000118000000 (190714 pages to be allocated) (XEN) Init. ramdisk: 000000011d0fa000->000000011ffffbb4 (XEN) VIRTUAL MEMORY ARRANGEMENT: (XEN) Loaded kernel: ffffffff81000000->ffffffff82092000 (XEN) Init. ramdisk: 0000000000000000->0000000000000000 (XEN) Phys-Mach map: ffffffff82092000->ffffffff8223e000 (XEN) Start info: ffffffff8223e000->ffffffff8223e4b4 (XEN) Page tables: ffffffff8223f000->ffffffff82254000 (XEN) Boot stack: ffffffff82254000->ffffffff82255000 (XEN) TOTAL: ffffffff80000000->ffffffff82400000 (XEN) ENTRY ADDRESS: ffffffff81bee1f0 (XEN) Dom0 has maximum 1 VCPUs (XEN) Scrubbing Free RAM on 1 nodes using 1 CPUs (XEN) ....................................done. (XEN) Initial low memory virq threshold set at 0x4000 pages. (XEN) Std. Loglevel: Errors and warnings (XEN) Guest Loglevel: Nothing (Rate-limited: Errors and warnings) (XEN) Xen is relinquishing VGA console. (XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch input to Xen) (XEN) Freed 1376kB init memory. (XEN) traps.c:2525:d0 Domain attempted WRMSR 00000000c0000081 from 0xe023e00800000000 to 0x0023001000000000. (XEN) traps.c:2525:d0 Domain attempted WRMSR 00000000c0000082 from 0xffff82d0804d3000 to 0xffffffff816b79d0. (XEN) traps.c:2525:d0 Domain attempted WRMSR 00000000c0000083 from 0xffff82d0804d3080 to 0xffffffff816ba370. (XEN) traps.c:2525:d0 Domain attempted WRMSR 0000000000000174 from 0x000000000000e008 to 0x0000000000000010. (XEN) traps.c:2525:d0 Domain attempted WRMSR 0000000000000175 from 0xffff82d0804d7fc0 to 0x0000000000000000. (XEN) traps.c:2525:d0 Domain attempted WRMSR 0000000000000176 from 0xffff82d080325580 to 0xffffffff816ba140. (XEN) traps.c:2525:d0 Domain attempted WRMSR 00000000c0000084 from 0x0000000000034700 to 0x0000000000047700. (XEN) domain.c:661:d0 Attempt to change CR4 flags 00000620 -> 00040660 (XEN) 'u' pressed -> dumping numa info (now-0x5178:FB420451) (XEN) idx0 -> NODE0 start->0 size->1179648 free->816292 (XEN) phys_to_nid(0000000000001000) -> 0 should be 0 (XEN) CPU0 -> NODE0 (XEN) Memory location of each domain: (XEN) Domain 0 (total: 219136): (XEN) Node 0: 219136 (XEN) 'u' pressed -> dumping numa info (now-0x52D5:8B4D91EC) (XEN) idx0 -> NODE0 start->0 size->1179648 free->816292 (XEN) phys_to_nid(0000000000001000) -> 0 should be 0 (XEN) CPU0 -> NODE0 (XEN) Memory location of each domain: (XEN) Domain 0 (total: 219136): (XEN) Node 0: 219136 [root@ohsvms ~]# xm vcpu-list Name ID VCPU CPU State Time(s) CPU Affinity Domain-0 0 0 0 r-- 1727.6 any cpu [root@ohsvms ~]#
OS性能诊断工具OSWatcher
[root@ohsvms ~]# /usr/sbin/OSWatcher -h
Usage: OSWatcher [OPTIONS] DATADIR Periodically log information about a running system -i, --interval=SECONDS Run data collection programs every SECONDS (default: 30) -m, --maxAge=HOURS Discard data files older than HOURS (default: 48) -z, --zip=PROGRAM Compress files with PROFRAM (default: none) -l, --logfile=FILE Log file (default: none) -p, --pidfile=FILE PID file (default: none) [root@ohsvms ~]#To start, stop, and check the status of OSWatcher, use the following command:
# service oswatcher {start|stop|status|restart|reload|condrestart}
[root@ohsvms ~]# service oswatcher status
OSWatcher (pid 1710) is running...
[root@ohsvms ~]#
如何修改dom0的内存
修改grub.cfg文件 [root@ohsvms ~]# grep multiboot2 /boot/grub2/grub.cfg multiboot2 /xen.gz placeholder dom0_mem=max:856M allowsuperpage ${xen_rm_opts} [root@ohsvms ~]#
如何管理Oracle VM Manager
[oracle@ovm ~]$ ls /u01/app/oracle/
java Middleware mysql oraInventory ovm-manager-3
[oracle@ovm ~]$ /u01/app/oracle/ovm-manager-3/ovm_upgrade/bin/ovmkeytool.sh check Oct 04, 2016 8:05:57 AM oracle.security.jps.JpsStartup start INFO: Jps initializing. Oct 04, 2016 8:05:58 AM oracle.security.jps.JpsStartup start INFO: Jps started. Oracle MiddleWare Home (MW_HOME): /u01/app/oracle/Middleware WebLogic domain directory: [/u01/app/oracle/ovm-manager-3/domains/ovm_domain] WebLogic server name: [AdminServer] WebLogic username: [weblogic] WebLogic password: [********] The Oracle VM Manager CA and SSL configuration appears to be valid. [oracle@ovm ~]$
ovm_admin管理工具
[oracle@ovm ~]$ /u01/app/oracle/ovm-manager-3/bin/ovm_admin
Oracle VM Manager Release 3.4.1 Admin tool Usage: /u01/app/oracle/ovm-manager-3/ovm_wlst/bin/ovm_admin.sh [options] options --help Shows this message --createuser Create new Oracle VM Manager admin user --deleteuser <admin> Delete Oracle VM Manager admin user --listusers List Oracle VM Manager users --modifyuser Modify Oracle VM Manager user password --lockusers <tries> Max login tries before locking account. This setting is global. --unlockuser <admin> Unlock user account --modifyds Modify Oracle VM Manager Data Sources --listds List Oracle VM Manager Data Sources --listconfig List configuration --rotatelogsdaily <time> Rotate Logs Daily (HH:MM) --rotatelogsbysize <size> Rotate Logs By Size (KB) [oracle@ovm ~]$
列出用户
[oracle@ovm ~]$ /u01/app/oracle/ovm-manager-3/bin/ovm_admin --listusers Oracle VM Manager Release 3.4.1 Admin tool Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands 2016-10-04 08:08:51,719 [main] INFO ovm.wlst.commands - Connecting using URL t3://localhost:7001 Please enter the password for weblogic: Location changed to serverRuntime tree. This is a read-only tree with DomainMBean as the root. For more help, use help('domainConfig') OracleSystemUser, weblogic, admin, appframework
列出数据源
[oracle@ovm ~]$ /u01/app/oracle/ovm-manager-3/bin/ovm_admin --listds Oracle VM Manager Release 3.4.1 Admin tool Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands 2016-10-04 08:09:18,797 [main] INFO ovm.wlst.commands - Connecting using URL t3://localhost:7001 Please enter the password for weblogic: Please enter the name of a MySQL user: [appfw, ovs] ovs Listing Oracle VM Manager Data Source 'ovm-jpa-ds'... DriverName com.mysql.jdbc.Driver Url jdbc:mysql://localhost:49500/ovs DatabaseName ovs Listing Oracle VM Manager Data Source 'ovm-jpa-ds' successfully Listing Oracle VM Manager Data Source 'ovm-odof-ds'... DriverName com.mysql.jdbc.Driver Url jdbc:mysql://localhost:49500/ovs DatabaseName ovs Listing Oracle VM Manager Data Source 'ovm-odof-ds' successfully
列出配置信息
[oracle@ovm ~]$ /u01/app/oracle/ovm-manager-3/bin/ovm_admin --listconfig Oracle VM Manager Release 3.4.1 Admin tool Oracle VM Manager Configuration Database type : MySQL Database Server hostname : localhost Database name : ovs Database Listener port : 49500 Oracle VM Database user : ovs WebLogic Server admin : weblogic Oracle VM Manager admin : admin [oracle@ovm ~]$管理MySQL Database
[oracle@ovm ~]$ /etc/init.d/ovmm_mysql Usage: ovmm_mysql {start|stop|restart|reload|force-reload|status} [ MySQL server options ] [oracle@ovm ~]$ /etc/init.d/ovmm_mysql status MySQL running (7988) [ OK ] [oracle@ovm ~]$ which mysql /usr/bin/mysql手动备份MySQL Database
[oracle@ovm ~]$ /u01/app/oracle/ovm-manager-3/ovm_tools/bin/BackupDatabase -w
Enter your OVM Manager username: admin
Enter your OVM Manager password:
INFO: Backup job starting with destination:
/u01/app/oracle/mysql/dbbackup/ManualBackup-20161004_082047
Job Id = 'Start Backup to: ManualBackup(1475583647413) Uri: https://localhost:7002/ovm/core/wsapi/rest/Job/1475583647413'
Job Name = 'Start Backup to: ManualBackup'
INFO: Backup job finished [oracle@ovm ~]$
备份Oracle VM Manager配置文件.config
[oracle@ovm ~]$ cat /u01/app/oracle/ovm-manager-3/.config DBTYPE=MySQL DBHOST=localhost SID=ovs LSNR=49500 OVSSCHEMA=ovs APEX=8080 WLSADMIN=weblogic OVSADMIN=admin COREPORT=54321 UUID=0004fb00000100008f97757a8ea47d65 BUILDID=3.4.1.1369 [oracle@ovm ~]$收集诊断信息
[root@ovm ~]# /u01/app/oracle/ovm-manager-3/ovm_tools/support/vmpinfo3.sh --username=admin Enter OVM Manager Password: Gathering files from all servers. This process may take some time. Gathering OVM Model Dump files Gathering sosreport from ohsvms Gathering OVM Manager Logs Compressing VMPinfo3 20161004-082505 ======================================================================================= Please send /tmp/vmpinfo3-3.4.1.1369-20161004-082505.tar.gz to Oracle support ======================================================================================= [root@ovm ~]#
如何快速一步步的学会使用VM Server
Oracle VM的管理简单地可以理解为主要是存储和网络的管理
http://docs.oracle.com/cd/E64076_01/E64080/html/vmgsg-getting-started.html
Reference
https://blogs.oracle.com/virtualization/entry/oracle_vm_3_4_1
http://www.oracle.com/us/technologies/virtualization/024973.htm
http://www.oracle.com/us/technologies/virtualization/oraclevm/oraclevm-3-2-whatsnew-1898120.pdf
Oracle VM3 Quick Start Guide
http://www.oracle.com/technetwork/server-storage/vm/ovm3-quick-start-guide-wp-516656.pdf
Oracle VM Designing, Creating and Testing an Oracle VM3.2 Environment
http://www.oracle.com/technetwork/server-storage/vm/ovm32-deployment-wp-1936835.pdf
Oracle VM 3Architecture and Technical Overview
http://www.oracle.com/us/technologies/virtualization/ovm3-arch-tech-overview-459307.pdf
Server Pool Deployment Planning Considerations for Scalability and Availability
http://www.oracle.com/us/technologies/virtualization/ovm3-server-pool-459310.pdf
Getting Started With Disaster Recovery
http://www.oracle.com/technetwork/server-storage/vm/ovm3-disaster-recovery-1872591.pdfVM Server User's Guide Release 2.1
https://blogs.oracle.com/wim/entry/understanding_memory_allocation_in_oracle
http://docs.oracle.com/cd/E15458_01/doc.22/e15442/ovsig.htm
http://docs.oracle.com/cd/E11081_01/doc/doc.21/e10898/ovmagent.htm
http://docs.oracle.com/cd/E11081_01/doc/doc.21/e10898/ovmagentarch.htm