[Ovirt-devel] [PATCH] ovirt-identify-node now submits all extended CPU details.
Scott Seago
sseago at redhat.com
Tue Jul 8 13:26:00 UTC 2008
Darryl L. Pierce wrote:
> diff --git a/wui/src/app/models/host.rb b/wui/src/app/models/host.rb
> index 6917226..3413370 100644
> --- a/wui/src/app/models/host.rb
> +++ b/wui/src/app/models/host.rb
> @@ -21,8 +21,11 @@ require 'util/ovirt'
>
> class Host < ActiveRecord::Base
> belongs_to :hardware_pool
> +
> + has_many :cpus
> has_many :nics, :dependent => :destroy
> has_many :vms, :dependent => :nullify do
> +
> def consuming_resources
> find(:all, :conditions=>{:state=>Vm::RUNNING_STATES})
> end
>
Should probably add ':dependent => :destroy' here like we do for nics to
handle automatic deletion of the CPU objects when the host is deleted.
> @@ -42,12 +45,18 @@ class Host < ActiveRecord::Base
> STATE_UNAVAILABLE = "unavailable"
> STATE_AVAILABLE = "available"
> STATES = [STATE_UNAVAILABLE, STATE_AVAILABLE]
> +
> + KVM_HYPERVISOR_TYPE = "KVM"
> + HYPERVISOR_TYPES = [KVM_HYPERVISOR_TYPE]
> +
> def memory_in_mb
> kb_to_mb(memory)
> end
> +
> def memory_in_mb=(mem)
> self[:memory]=(mb_to_kb(mem))
> end
> +
> def status_str
> "#{state} (#{disabled? ? 'disabled':'enabled'})"
> end
> @@ -61,4 +70,12 @@ class Host < ActiveRecord::Base
> not(disabled? and vms.consuming_resources.empty?) and
> tasks.pending_clear_tasks.empty?
> end
> +
> + def num_cpus
> + return cpu_details.size
> + end
> +
> + def cpu_speed
> + "FIX ME!"
> + end
> end
>
I'm assuming cpu_speed above is so that the WUI view code doesn't break
with this change. This is a question for Hugh or Tim -- have we
determined what the UI should look like for this? Off the top of my
head, we leave num_cpus in the host flexigrid tables and just remove
cpu_speed. Then in the host detail pane we add a table (not a flexigrid)
with the enumerated CPU details. Do we show all 10 attributes per CPU or
just some of them?
> diff --git a/wui/src/db/migrate/002_create_hosts.rb b/wui/src/db/migrate/002_create_hosts.rb
> index cef7996..442e674 100644
> --- a/wui/src/db/migrate/002_create_hosts.rb
> +++ b/wui/src/db/migrate/002_create_hosts.rb
> @@ -23,8 +23,6 @@ class CreateHosts < ActiveRecord::Migration
> t.string :uuid
> t.string :hypervisor_type
> t.string :hostname
> - t.integer :num_cpus
> - t.integer :cpu_speed
> t.string :arch
> t.integer :memory
> t.integer :is_disabled
>
I think we had agreed that after the beta we'd track schema changes by
adding new migrations rather than modifying existing ones. Hugh -- is
this correct, or are we still doing it this way?
If we are adding new migrations, then we'd need the above done as
something like 11_remove_cpu_from_hosts.rb or whatever you want to call
it. Another point we'll need to clarify -- if we're doing incremental
migrations, do we have to handle existing data too? Or can we explicitly
_not_ support live data migrations until later?
OK, that's it for my comments here -- I'll let someone on the managed
node side look at/test the back end bits.
Scott
More information about the ovirt-devel
mailing list