Managing Hosts 3.8
In order to use your existing physical nodes, you have to add them to the system as OpenNebula hosts. You need the following information:
im_kvm
. These should match the Virtualization Drivers installed and more info about them can be found at the Virtualization Subsystem guide.vmm_kvm
. Information about these drivers can be found in its guide.802.1Q
. Information about these drivers can be found in its guide.
The following sections show the basics of the onehost
command with simple usage examples. A complete reference for these commands can be found here.
This command enables Host management. Actions offered are:
create
: Creates a new Hostdelete
: Deletes the given Hostenable
: Enables the given Hostdisable
: Disables the given Hostupdate
: Update the template contents.sync
: Synchronizes probes in all the hosts.list
: Lists Hosts in the poolshow
: Shows information for the given Hosttop
: Lists Hosts continuouslyflush
: Disables the host and reschedules all the running VMs it.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:
<xterm> $ onehost create host01 –im im_dummy –vm vmm_dummy –net dummy ID: 0 </xterm>
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:
<xterm> $ onehost delete host01 $ onehost delete 0 </xterm>
To display information about a single host the show
command is used:
<xterm>
$ 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” </xterm>
We can instead display this information in XML format with the -x
parameter:
<xterm> $ onehost show -x 0 <HOST>
<ID>0</ID> <NAME>host01</NAME> <STATE>2</STATE> <IM_MAD>im_dummy</IM_MAD> <VM_MAD>vmm_dummy</VM_MAD> <VN_MAD>dummy</VN_MAD> <LAST_MON_TIME>1341589306</LAST_MON_TIME> <CLUSTER_ID>-1</CLUSTER_ID> <CLUSTER/> <HOST_SHARE> <DISK_USAGE>0</DISK_USAGE> <MEM_USAGE>0</MEM_USAGE> <CPU_USAGE>0</CPU_USAGE> <MAX_DISK>0</MAX_DISK> <MAX_MEM>16777216</MAX_MEM> <MAX_CPU>800</MAX_CPU> <FREE_DISK>0</FREE_DISK> <FREE_MEM>12852921</FREE_MEM> <FREE_CPU>735</FREE_CPU> <USED_DISK>0</USED_DISK> <USED_MEM>3924295</USED_MEM> <USED_CPU>65</USED_CPU> <RUNNING_VMS>0</RUNNING_VMS> </HOST_SHARE> <TEMPLATE> <CPUSPEED><![CDATA[2.2GHz]]></CPUSPEED> <FREECPU><![CDATA[735]]></FREECPU> <FREEMEMORY><![CDATA[12852921]]></FREEMEMORY> <HOSTNAME><![CDATA[host01]]></HOSTNAME> <HYPERVISOR><![CDATA[dummy]]></HYPERVISOR> <TOTALCPU><![CDATA[800]]></TOTALCPU> <TOTALMEMORY><![CDATA[16777216]]></TOTALMEMORY> <USEDCPU><![CDATA[65]]></USEDCPU> <USEDMEMORY><![CDATA[3924295]]></USEDMEMORY> </TEMPLATE>
</HOST> </xterm>
To see a list of all the hosts:
<xterm> $ 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
</xterm>
It can also be displayed in XML format using -x
:
<xterm> $ onehost list -x <HOST_POOL>
<HOST> ... </HOST> ...
</HOST_POOL> </xterm>
The top
command is similar to the list
command, except that the output is refreshed until the user presses CTRL-C
.
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.
<xterm> $ onehost disable 0 </xterm>
To re-enable the host use the enable
command:
<xterm> $ onehost enable 0 </xterm>
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.
<xterm> $ 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
</xterm>
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: <xterm> TYPE=“production” </xterm>
Which can be used at a later time for scheduling purposes by adding the following section in a VM template: <xterm> REQUIREMENTS=“TYPE=\”production\“” </xterm>
That will restrict the Virtual Machine to be deployed in TYPE=production
hosts.
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.
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. |
You can define global Scheduler Policies for all VMs in the sched.conf file, follow the 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 creating a probe in the host, or updating the host information with: onehost update <HOST_ID>
. 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.
<xterm> $ 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 </xterm>
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 placement requirement:
REQUIREMENTS = "CUSTOM_ATTRIBUTE = \"SOME_VALUE\""
Hosts can be added to the system anytime with the onehost
command. You can add the hosts to be used by OpenNebula like this:
<xterm> $ onehost create host01 –im im_kvm –vm vmm_kvm –net dummy $ onehost create host02 –im im_kvm –vm vmm_kvm –net dummy </xterm>
The status of the hosts can be checked with the onehost list
command:
<xterm> $ 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
</xterm>
And specific information about a host with show
:
<xterm> $ 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 </xterm>
If you want not to use a given host you can temporarily disable it:
<xterm> $ onehost disable host01 </xterm>
A disabled host should be listed with STAT off
by onehost list
. You can also remove a host permanently with:
<xterm> $ onehost delete host01 </xterm>
You can also manage your hosts using 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.