[Ovirt-devel] Re: [Patch] Experimental Graphs Backend Code

Mohammed Morsi mmorsi at redhat.com
Thu May 29 16:53:02 UTC 2008


Scott Seago wrote:
> Hugh O. Brock wrote:
>>
>>> +    elsif target == 'memory'
>>> +        if (@total[:memory] > @used[:memory])
>>> +            color = 'red' if (@used[:memory].to_f / 
>>> @total[:memory].to_f) > 0.75
>>> +            data_sets.push ({ :name => 'memory_used', :values => 
>>> [@used[:memory]],
>>> +                                :fill => color, :stroke => 
>>> 'lightgray', :strokeWidth => 1 },
>>> +                            { :name => 'memory_available', 
>>> +                                :values => [@available[:memory]], 
>>> :fill => 'white',
>>> +                                :stroke => 'lightgray', 
>>> :strokeWidth => 1})
>>> +        else
>>> +            data_sets.push ({ :name => 'memory_available', :values 
>>> => [@available[:memory]],
>>> +                                :fill => 'white', :stroke => 
>>> 'lightgray', :strokeWidth => 1 },
>>> +                            { :name => 'memory_used', 
>>> +                                :values => [@used[:memory]], :fill 
>>> => 'red',
>>> +                                :stroke => 'lightgray', 
>>> :strokeWidth => 1})
>>> +        end
>>> +
>>>     
>>
>> Right now we *can't* overcommit RAM, so I don't know if we want the
>> same logic for this graph as for the cpu graph. Also, I assume that
>> memory_available is "the sum of all memory on all machines in the
>> pool," where "memory used" is "the sum of all memory currently in use
>> by active VMs?" (Scott, you can probably comment on this too I'm sure)
>>
>>   
> That's how I would interpret this. also, "active VMs" refers to all 
> VMs that are either running or suspended. We don't care about stopped 
> VMs.

So for memory (and cpu?) available, I take a hardware pool and:
 
   used = 0
  @selected_pool.all_sub_vm_resource_pools { |pool|
     pool.vms.each { |vm|
           if (vm.state == running || vm.state == suspended)
               used += vm.memory_used   // or num_vcpus_used
     }
  }

correct?

Also when you say "memory_available is "the sum of all memory on all 
machines in the pool,"".
  1. By this definition it sounds like you mean "total memory". I've 
been using "available" as how much can be used at the given point, eg 
total  = used + available
  2. is the definition of machine == host? If so do "all machines" only 
encompass the hosts in the current pool? Or do they include all hosts in 
all subpools? I think the latter case would look like:

 total = 0
@selected_pool.hosts.each { |host|
     total += host.memory  // or cpus
}

@selected_pool.all_sub_hardware_pools { |pool|
    pool.hosts.each { |host|
        total += host.memory // or cpus
    }
}

>>>      elsif target == 'vms'
>>> -        available = @available_vms
>>> -        used      = @used_vms
>>> +        total_remaining = @total[:vms] - @used[:vms] - 
>>> @available[:vms]
>>> +        data_sets.push({ :name => 'vms_used', :values => 
>>> [@used[:vms]],
>>> +                         :fill => 'blue', :stroke => 'lightgray', 
>>> :strokeWidth => 1 },
>>> +                       { :name => 'vms_available', :values => 
>>> [@available[:vms]],
>>> +                         :fill => 'red',  :stroke => 'lightgray', 
>>> :strokeWidth => 1 },
>>> +                       { :name => 'vms_remaining', :values => 
>>> [total_remaining],
>>> +                         :fill => 'white', :stroke => 'lightgray', 
>>> :strokeWidth => 1})
>>>     
>>
>> I think we realized the other day that there is only one useful number
>> we can give about VMs in a hardware pool, which is "how many are
>> currently running?" I'm not sure how to best express this.
>> Do you suppose it would be useful to contrast the number of VMs
>> currently running in the pool with the number of physical hosts
>> currently in the pool? Or is that just a waste of time? Scott?
>>
>>   
> Not sure what metric is useful here. We've established that we don't 
> care about quotas here -- if we want to discuss quotas, we need a 
> separate area where we mention _all_ quota values (memory, disk, vms, 
> etc.) -- especially, since, in the long run, those other params are 
> more important to quotas than number of VMs.
>
> In addition, we don't care about how many non-running VMs a user has 
> defined. Maybe we show vms-per-host, but that would vary based on host 
> size as much as anything else, and it's still not appropriate for a 
> percentage-type graph as the rest of these are. Maybe we move the VMs 
> from this row entirely and show it somewhere else on the summary. 
> Surely we have other parameters we're showing eventually that are in 
> this same category (i.e. it's a single number, not a time series or a 
> percentage, so a graph isn't really any more useful than just a plan 
> number in a legible font)

It can be removed, or contrasted against any metric. I just need a final 
decision before I can proceed with it. If we want to leave it in, I say 
the simplest way is to contrast active against total. If the graph is a 
little skewed due to quotas so be it for now.


>>
>>  
>>> -    network_load_remaining = 1024 - network_load
>>> +    snapshot_remaining = 1024 - snapshot
>>>  
>>>      color = 'blue'
>>> -    color = 'red' if (network_load.to_f / 1024.to_f) > 0.75  # 3/4 
>>> is the critical boundry for now
>>> +    color = 'red' if (snapshot.to_f / 1024.to_f) > 0.75  # 3/4 is 
>>> the critical boundry for now
>>>  
>>>      graph_object = {
>>>         :timepoints => [],
>>> @@ -208,14 +227,14 @@ class HardwareController < ApplicationController
>>>          [
>>>              {
>>>                  :name => target,
>>> -                :values => [network_load],
>>> +                :values => [snapshot],
>>>                  :fill => color,
>>>                  :stroke => 'lightgray',
>>>                  :strokeWidth => 1
>>>              },
>>>              {
>>>                  :name => target + "remaining",
>>> -                :values => [network_load_remaining],
>>> +                :values => [snapshot_remaining],
>>>                  :fill => 'white',
>>>                  :stroke => 'lightgray',
>>>                  :strokeWidth => 1
>>> @@ -395,23 +414,56 @@ class HardwareController < ApplicationController
>>>      @perm_obj = @pool
>>>      @current_pool_id=@pool.id
>>>  
>>> -    # TODO pull real values in
>>> -    @available_memory = 18
>>> -    @used_memory = 62
>>> -    -    @available_storage = 183
>>> -    @used_storage = 61
>>> -
>>> -    @available_vms = 1
>>> -    @used_vms = 26
>>> -
>>> -    @peak_color = 'red'
>>> -    @average_color = 'blue'
>>> +    # availability graphs - used
>>> +    @used = {:cpu => 0, :memory => 0, :vms => 0}
>>> +    @pool.sub_vm_resource_pools.each { |svrp| @used[:cpu]    += 
>>> svrp.allocated_resources[:current][:cpus] }
>>> +    @pool.sub_vm_resource_pools.each { |svrp| @used[:memory] += 
>>> svrp.allocated_resources[:current][:memory] }
>>> +    @pool.sub_vm_resource_pools.each { |svrp| @used[:vms]    += 
>>> svrp.allocated_resources[:current][:vms]  }
>>> +
>>> +    # availability graphs - total
>>> +    @total          = {:cpu => 0, :memory => 0, :vms => 0}
>>> +    @total[:cpu]    = @pool.total_resources[:cpus]
>>> +    @total[:memory] = @pool.total_resources[:memory]
>>> +    @total[:vms]    = @pool.total_resources[:vms]
>>> +    @total.each_key { |k| @total[k] = 0 if @total[k] == nil }
>>> +
>>> +    # availability graphs - available
>>> +    @available          = {}
>>> +    @available[:cpu]    = (@total[:cpu] - @used[:cpu]).abs
>>> +    @available[:memory] = (@total[:memory] - @used[:memory]).abs
>>> +    @available[:vms]    = 5 # TODO ?
>>> +
>>>     
> @pool.total_resources refers to the default quota for the pool -- if 
> you want total CPUs and Memory in the pool ,we need to define a new 
> API to aggregate host stats.
> I think the latter is what you want here.
>
>
> Scott

  -Mo




More information about the ovirt-devel mailing list