[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



Scott Seago wrote:
>> 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.
>> 
>> 
> memory_in_mb is a method defined on Host which converts from MB to kb to 
> stuff in the db.  The idea is when you have a number  already in kb, you just
> set host.memory, but if your value is in mb (as it would be if you're
> soliciting user input via the WUI), you set host.memory_in_mb, which converts
> to kb and stores in the db.

Right, that's exactly it.

<snip>

> On this particular change, I seem to recall a bug a while back where we had
> to change the host browser code to use the _in_mb methods to fix an earlier
> problem. Could it be that the semantics of host_browser has changed and that,
> at one point, we were passing memory in MB?

This I'm not sure about, and I can't remember the bug you are talking about
anymore.  Looking at earlier code (like what's in master, for instance), we were
passing the value in MEMSIZE straight into "memory", so this looks like recent
breakage.

> 
> In a larger sense (i.e. beyond this particular bugfix, etc.) we've talked
> about how we need a more robust way of dealing with storage/memory sizing and
> conversion/display. As we see here, it's currently a bit fragile.

Yeah, agreed.  It's not always clear what values belong where, although luckily
it seems we were smart enough to always have things in kb in the database; it's
just getting things in and out of the DB that's a little hairy.  I'm not sure
how to make it more robust, but we definitely need this bug fix.

Chris Lalancette


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]