[Ovirt-devel] [PATCH]: Add host memory in kb to the database

Steve Linabery slinabery at redhat.com
Mon Aug 11 14:45:00 UTC 2008


On Mon, Aug 11, 2008 at 03:16:29PM +0200, Chris Lalancette wrote:
>     When inserting memory values into the database, ovirt-identify-node is
>     sending over values in kilobytes.  The database is also in kilobytes.
>     Don't run a non-sensical "mb_to_kb" conversion on the memory value
>     before sticking it into the database.
>     
>     Signed-off-by: Chris Lalancette <clalance at redhat.com>
> 
> diff --git a/wui/src/host-browser/host-browser.rb b/wui/src/host-browser/host-browser.rb
> index a1bda3d..881b2ae 100755
> --- a/wui/src/host-browser/host-browser.rb
> +++ b/wui/src/host-browser/host-browser.rb
> @@ -219,7 +219,7 @@ class HostBrowser
>                      "hostname"        => host_info['HOSTNAME'],
>                      "hypervisor_type" => host_info['HYPERVISOR_TYPE'],
>                      "arch"            => host_info['ARCH'],
> -                    "memory_in_mb"    => host_info['MEMSIZE'],
> +                    "memory"          => host_info['MEMSIZE'],
>                      "is_disabled"     => 0,
>                      "hardware_pool"   => HardwarePool.get_default_pool,
>                      # Let host-status mark it available when it
> @@ -232,7 +232,7 @@ class HostBrowser
>              host.uuid         = host_info['UUID']
>              host.hostname     = host_info['HOSTNAME']
>              host.arch         = host_info['ARCH']
> -            host.memory_in_mb = host_info['MEMSIZE']
> +            host.memory       = host_info['MEMSIZE']
>          end
>  
>          # delete an existing CPUs and create new ones based on the data
> 
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel

I don't think this is necessary. The migration file for CreateHosts (currently wui/src/db/migrate/002_create_hosts.rb) doesn't define memory_in_mb, so this attribute is never being stuck into the database.

I'm not sure I understand what effect this:
"memory_in_mb"    => host_info['MEMSIZE'],

was intended to have in host-browser.rb in the first place (creating an instance of Host using a non-existent attribute? Do I just not know ruby well enough to know what's going on here?)

Thanks,
Steve




More information about the ovirt-devel mailing list