4 A quick test

At this point, OpenNebula and Haizea are both running together, and waiting for you to submit a VM request. From the user's perspective, you will still be submitting your requests to OpenNebula, and Haizea will do all the scheduling work backstage. However, you will be able to add an HAIZEA parameter to your OpenNebula request to access Haizea's features.

So, to test that OpenNebula and Haizea are working correctly, start by taking a known-good OpenNebula template. Just to be on the safe side, you may want to try it with the default scheduler first, to make sure that the VM itself works correctly, etc. Then, just add the following parameter to the template:

HAIZEA = [
  start        = "+00:00:30",
  duration     = "00:01:00",
  preemptible  = "no"
]

The exact meaning of these parameters is explained later on in this document. In a nutshell, the values specified above tell Haizea to schedule the VM to start exactly 30 seconds in the future, to run for one minute, and to not allow the allocated resources to be preempted by other requests. This corresponds to an Haizea advance reservation lease (see Chapter 2).

Before you submit your request to OpenNebula, take a look at the Haizea log. You should see something like this repeating every minute:

[2009-07-30 18:38:44.00] CLOCK   Waking up to manage resources
[2009-07-30 18:38:44.00] CLOCK   Wake-up time recorded as 2009-07-30 18:38:44.00
[2009-07-30 18:38:44.01] CLOCK   Going back to sleep. 
                                 Waking up at 2009-07-30 18:38:54.00 
                                 to see if something interesting has happened by then.

Haizea is configured, by default, to ask OpenNebula if there are any pending requests every minute. Since you haven't submitted anything, Haizea just wakes up every minute and goes right back to sleep. So, go ahead and submit your request (the one where you added the HAIZEA parameter). Assuming you named the template ar.one, run the following:

onevm submit ar.one

If you run onevm list to see the VMs managed by OpenNebula, you'll see that the request is in a pending state:

  ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME
-------------------------------------------------------------------
  42    borja     test pend   0       0                 00 00:00:02

Next time Haizea wakes up, you should see something like this:

[2009-07-30 18:41:49.16] CLOCK   Waking up to manage resources
[2009-07-30 18:41:49.16] CLOCK   Wake-up time recorded as 2009-07-30 18:41:49.00
[2009-07-30 18:41:49.19] LSCHED  Lease #1 has been requested.
[2009-07-30 18:41:49.19] LSCHED  Lease #1 has been marked as pending.
[2009-07-30 18:41:49.19] LSCHED  Scheduling AR lease #1, 1 nodes 
                                     from 2009-07-30 18:42:15.00 
                                       to 2009-07-30 18:43:15.00.
[2009-07-30 18:41:49.19] LSCHED  AR lease #1 has been scheduled.

[2009-07-30 18:41:49.19] CLOCK   Going back to sleep. 
                                 Waking up at 2009-07-30 18:42:15.00 
                                 to handle slot table event.

Notice how Haizea detected that OpenNebula had an AR request, and then scheduled it to start 30 seconds in the future. In fact, Haizea takes care to wake up at that time so the VM can start at exactly that time.

If you run onevm list, the request will still be shown as pending. OpenNebula doesn't track Haizea's internal states, so it will consider the request "pending" until Haizea starts up the VM. You can check the state of Haizea leases using the haizea-list-leases command.

Currently, Haizea has to poll OpenNebula every minute to ask if there are any new requests. An upcoming version of Haizea will support an event-based model where OpenNebula can send Haizea a notification as soon as a new request is received (so the user doesn't have to wait until the next time Haizea wakes up to process the request).

When the VM is scheduled to start, you will see the following in the Haizea logs:

[2009-07-30 18:42:15.02] CLOCK   Waking up to manage resources
[2009-07-30 18:42:15.02] CLOCK   Wake-up time recorded as 2009-07-30 18:42:15.00
[2009-07-30 18:42:15.04] VMSCHED Started VMs for lease 1 on nodes [2]
[2009-07-30 18:42:15.09] CLOCK   Going back to sleep. 
                                 Waking up at 2009-07-30 18:43:00.00 
                                 to handle slot table event.

Haizea has instructed OpenNebula to start the VM for the advance reservation. If you run onevm list, the VM will now show up as running:

  ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME
-------------------------------------------------------------------
  42    borja     test runn  10   65536       cluster05 00 00:00:52

You should be able to access the VM (if you configured it with networking and SSH). However, since we requested the VM to run for just a minute, you will soon see the following in the Haizea logs:

[2009-07-30 18:43:00.04] CLOCK   Waking up to manage resources
[2009-07-30 18:43:00.04] CLOCK   Wake-up time recorded as 2009-07-30 18:43:00.00
[2009-07-30 18:43:00.05] VMSCHED Stopped VMs for lease 1 on nodes [2]
[2009-07-30 18:43:05.07] CLOCK   Going back to sleep. 
                                 Waking up at 2009-07-30 18:43:15.00 
                                 to handle slot table event.

[2009-07-30 18:43:15.00] CLOCK   Waking up to manage resources
[2009-07-30 18:43:15.00] CLOCK   Wake-up time recorded as 2009-07-30 18:43:15.00
[2009-07-30 18:43:15.00] VMSCHED Lease 1's VMs have shutdown.
[2009-07-30 18:43:15.01] CLOCK   Going back to sleep. 
                                 Waking up at 2009-07-30 18:44:15.00 
                                 to see if something interesting has happened by then.

Borja Sotomayor 2009-12-17