Managing Hosts 3.8

:!: **Development version of OpenNebula 3.8**. The material on this page needs to be reviewed for completeness and accuracy.
In order to use your existing physical nodes, you have to add them to the system as OpenNebula hosts. You need the following information: * //Hostname// of the host or IP * //Information Driver// to be used to monitor the host, e.g. ''im_kvm''. These should match the Virtualization Drivers installed and more info about them can be found at the [[.:vmmg|Virtualization Subsystem guide]]. * //Virtualization Driver// to boot, stop, resume or migrate VMs in the host, e.g. ''vmm_kvm''. Information about these drivers can be found in [[.:vmmg|its guide]]. * //Networking Driver// to isolate virtual networks and apply firewalling rules, e.g. ''802.1Q''. Information about these drivers can be found in [[.:nm|its guide]]. * //Cluster// where to place this host. The Cluster assignment is optional, you can read more about it in the [[cluster_guide|Managing Clusters]] guide.
:!: Before adding a host check that you can ssh to it without being prompt for a password
{{INLINETOC}} ====== onehost command ====== The following sections show the basics of the ''[[.:cli | onehost]]'' command with simple usage examples. A complete reference for these commands can be found [[.:cli|here]]. This command enables Host management. Actions offered are: * ''create'': Creates a new Host * ''delete'': Deletes the given Host * ''enable'': Enables the given Host * ''disable'': Disables the given Host * ''update'': Update the template contents. * ''sync'': Synchronizes probes in all the hosts. * ''list'': Lists Hosts in the pool * ''show'': Shows information for the given Host * ''top'': Lists Hosts continuously * ''flush'': Disables the host and reschedules all the running VMs it. ===== Create and Delete ===== Hosts, also known as physical nodes, are the serves managed by OpenNebula responsible for Virtual Machine execution. To use these hosts in OpenNebula you need to register them so they are monitored and well-known to the scheduler. Creating a host: $ onehost create host01 --im im_dummy --vm vmm_dummy --net dummy ID: 0 The parameters are: * ''--im/-i'': Information Manager driver. Valid options: ''im_kvm'', ''im_xen'', ''im_vmware'', ''im_ec2'', ''im_ganglia'', ''im_dummy''. * ''--vm/-v'': Virtual Machine Manager driver. Valid options: ''vmm_kvm'', ''vmm_xen'', ''vmm_vmware'', ''vmm_ec2'', ''im_dummy''. * ''--net/-n'': Network manager driver. Valid options: ''802.1Q'',''dummy'',''ebtables'',''fw'',''ovswitch'',''vmware''. To remove a host, just like with other OpenNebula commands, you can either specify it by ID or by name. The following commands are equivalent: $ onehost delete host01 $ onehost delete 0 ===== Show, List and Top ===== To display information about a single host the ''show'' command is used: $ onehost show 0 HOST 0 INFORMATION ID : 0 NAME : host01 CLUSTER : - STATE : MONITORED IM_MAD : im_dummy VM_MAD : vmm_dummy VN_MAD : dummy LAST MONITORING TIME : 07/06 17:40:41 HOST SHARES TOTAL MEM : 16G USED MEM (REAL) : 857.9M USED MEM (ALLOCATED) : 0K TOTAL CPU : 800 USED CPU (REAL) : 299 USED CPU (ALLOCATED) : 0 RUNNING VMS : 0 MONITORING INFORMATION CPUSPEED="2.2GHz" FREECPU="501" FREEMEMORY="15898723" HOSTNAME="host01" HYPERVISOR="dummy" TOTALCPU="800" TOTALMEMORY="16777216" USEDCPU="299" USEDMEMORY="878493" We can instead display this information in XML format with the ''-x'' parameter: $ onehost show -x 0 0 host01 2 im_dummy vmm_dummy dummy 1341589306 -1 0 0 0 0 16777216 800 0 12852921 735 0 3924295 65 0 To see a list of all the hosts: $ onehost list ID NAME CLUSTER RVM TCPU FCPU ACPU TMEM FMEM AMEM STAT 0 host01 - 0 800 198 800 16G 10.9G 16G on 1 host02 - 0 800 677 800 16G 3.7G 16G on It can also be displayed in XML format using ''-x'': $ onehost list -x ... ... The ''top'' command is similar to the ''list'' command, except that the output is refreshed until the user presses ''CTRL-C''. ===== Enable, Disable and Flush ===== The ''disable'' command disables a host, which means that no further monitorization is performed on this host and no Virtual Machines are deployed in it. It won't however affect the running VMs in the host. $ onehost disable 0 To re-enable the host use the ''enable'' command: $ onehost enable 0 The ''flush'' command will mark all the running VMs in the specified host as to be rescheduled, which means that they will be migrated to another server with enough capacity. At the same time, the specified host will be disabled, so no more Virtual Machines are deployed in it. This command is useful to clean a host of running VMs. $ onehost list ID NAME CLUSTER RVM TCPU FCPU ACPU TMEM FMEM AMEM STAT 0 host01 - 3 800 96 500 16G 11.1G 14.5G on 1 host02 - 0 800 640 800 16G 8.5G 16G on 2 host03 - 3 800 721 500 16G 8.6G 14.5G on $ onevm list ID USER GROUP NAME STAT UCPU UMEM HOST TIME 0 oneadmin oneadmin vm01 runn 54 102.4M host03 0d 00h01 1 oneadmin oneadmin vm02 runn 91 276.5M host02 0d 00h01 2 oneadmin oneadmin vm03 runn 13 174.1M host01 0d 00h01 3 oneadmin oneadmin vm04 runn 72 204.8M host03 0d 00h00 4 oneadmin oneadmin vm05 runn 49 112.6M host02 0d 00h00 5 oneadmin oneadmin vm06 runn 87 414.7M host01 0d 00h00 $ onehost flush host02 $ onehost list ID NAME CLUSTER RVM TCPU FCPU ACPU TMEM FMEM AMEM STAT 0 host01 - 3 800 264 500 16G 3.5G 14.5G on 1 host02 - 0 800 153 800 16G 3.7G 16G off 2 host03 - 3 800 645 500 16G 10.3G 14.5G on $ onevm list ID USER GROUP NAME STAT UCPU UMEM HOST TIME 0 oneadmin oneadmin vm01 runn 95 179.2M host03 0d 00h01 1 oneadmin oneadmin vm02 runn 27 261.1M host03 0d 00h01 2 oneadmin oneadmin vm03 runn 70 343M host01 0d 00h01 3 oneadmin oneadmin vm04 runn 9 133.1M host03 0d 00h01 4 oneadmin oneadmin vm05 runn 87 281.6M host01 0d 00h01 5 oneadmin oneadmin vm06 runn 61 291.8M host01 0d 00h01 ===== Update ===== It's sometimes useful to store information in the host's template. To do so, the ''update'' command is used. An example use case is to add the following line to the host's template: TYPE="production" Which can be used at a later time for scheduling purposes by adding the following section in a VM template: REQUIREMENTS="TYPE=\"production\"" That will restrict the Virtual Machine to be deployed in ''TYPE=production'' hosts. ===== Sync ===== When OpenNebula monitors a host, it copies a certain amount of files to ''/var/tmp/one''. When the administrator changes these files, they can be copied again to the hosts with the ''sync'' command. Take into account that this command is not synchronous. The files will get copied to the hosts the next time the IM (Information Manager driver) monitors the host. ====== Host Life-cycle ====== ^ Short state ^ State ^ Meaning ^ | ''init'' | ''INIT'' | Initial state for enabled hosts. | | ''update'' | ''MONITORING_MONITORED'' | Monitoring a healthy Host. | | ''on'' | ''MONITORED'' | The host has been successfully monitored. | | ''err'' | ''ERROR'' | An error occurred while monitoring the host. See the Host information with ''**onehost show**'' for an error message. | | ''off'' | ''DISABLED'' | The host is disabled, and won't be monitored. The scheduler ignores Hosts in this state. | | ''retry'' | ''MONITORING_ERROR'' | Monitoring a host in error state. | ====== Scheduler Policies ====== You can define global Scheduler Policies for all VMs in the sched.conf file, follow the [[.:schg|Scheduler Guide]] for more information. Additionally, users can require their virtual machines to be deployed in a host that meets certain constrains. These constrains can be defined using any attribute reported by ''onehost show'', like the architecture (ARCH). The attributes and values for a host are inserted by the monitoring probes that run from time to time on the nodes to get information. The administrator can add custom attributes either [[.:img|creating a probe in the host]], or updating the host information with: ''onehost update ''. Calling this command will fire up an editor (the one specified in the ''EDITOR'' environment variable) and you will be able to add, delete or modify some of those values. $ onehost show 3 [...] MONITORING INFORMATION CPUSPEED=2.2GHz FREECPU=800 FREEMEMORY=16777216 HOSTNAME=ursa06 HYPERVISOR=dummy TOTALCPU=800 TOTALMEMORY=16777216 USEDCPU=0 USEDMEMORY=0 $ onehost update 3 [in editor, add CUSTOM_ATTRIBUTE=VALUE] $onehost show 3 [...] MONITORING INFORMATION CPUSPEED=2.2GHz FREECPU=800 FREEMEMORY=16777216 HOSTNAME=ursa06 HYPERVISOR=dummy TOTALCPU=800 TOTALMEMORY=16777216 USEDCPU=0 USEDMEMORY=0 CUSTOM_ATTRIBUTE=VALUE This feature is useful when we want to separate a series of hosts or marking some special features of different hosts. These values can then be used for scheduling the same as the ones added by the monitoring probes, as a [[.:template#placement_section | placement requirement]]: REQUIREMENTS = "CUSTOM_ATTRIBUTE = \"SOME_VALUE\"" ====== A Sample Session ====== Hosts can be added to the system anytime with the ''[[.:cli#onehost | onehost]]'' command. You can add the hosts to be used by OpenNebula like this: $ onehost create host01 --im im_kvm --vm vmm_kvm --net dummy $ onehost create host02 --im im_kvm --vm vmm_kvm --net dummy The status of the hosts can be checked with the ''[[.:cli#onehost | onehost list]]'' command: $ onehost list ID NAME CLUSTER RVM TCPU FCPU ACPU TMEM FMEM AMEM STAT 0 host01 - 7 400 290 400 3.7G 2.2G 3.7G on 1 host02 - 2 400 294 400 3.7G 2.2G 3.7G on 2 host03 - 0 400 312 400 3.7G 2.2G 3.7G off And specific information about a host with ''[[.:cli#onehost | show]]'': $ onehost show host01 HOST 0 INFORMATION ID : 0 NAME : host01 CLUSTER : - STATE : MONITORED IM_MAD : im_kvm VM_MAD : vmm_kvm VN_MAD : dummy LAST MONITORING TIME : 1332756227 HOST SHARES MAX MEM : 3921416 USED MEM (REAL) : 1596540 USED MEM (ALLOCATED) : 0 MAX CPU : 400 USED CPU (REAL) : 74 USED CPU (ALLOCATED) : 0 RUNNING VMS : 7 MONITORING INFORMATION ARCH=x86_64 CPUSPEED=2393 FREECPU=326.0 FREEMEMORY=2324876 HOSTNAME=rama HYPERVISOR=kvm MODELNAME="Intel(R) Core(TM) i5 CPU M 450 @ 2.40GHz" NETRX=0 NETTX=0 TOTALCPU=400 TOTALMEMORY=3921416 USEDCPU=74.0 USEDMEMORY=1596540 If you want not to use a given host you can temporarily disable it: $ onehost disable host01 A disabled host should be listed with ''STAT off'' by ''onehost list''. You can also remove a host permanently with: $ onehost delete host01
:!: Detailed information of the ''onehost'' utility can be found [[.:cli#onehost| in the Command Line Reference]]
====== Using Sunstone to Manage Hosts ====== You can also manage your hosts using [[.:sunstone| Sunstone]]. Select the Host tab, and there, you will be able to create, enable, disable, delete and see information about your hosts in a user friendly way. {{ :documentation:rel3.6:sunstone:view_hosts.png?700 |}}