[Ovirt-devel] [PATCH server] Fixed a few bugs in o-identify-node processing.

Darryl L. Pierce dpierce at redhat.com
Wed Apr 1 12:32:20 UTC 2009


On Tue, Mar 31, 2009 at 06:43:30PM -0400, Mohammed Morsi wrote:
> This 'collect' should more optimally be 'each' as we're not using the
> array returned by collect.

Fixed those.

> > -                if detail['MAC'] == nic.mac
> > +                if detail['MAC'].upcase == nic.mac
> > +                  puts "Updating details for: #{nic.interface_name} [#{nic.mac}]}"
> >                      nic_info.delete(detail)
> >   
> The 'detail' nic is being removed from the nic_info array here, and at
> the end of this if block as well (see below)

D'oh! Fixed that.

> >  
> >                      updated_nic = Nic.find_by_id(nic.id)
> > @@ -286,7 +288,6 @@ class HostBrowser
> >                      updated_nic.bandwidth = detail['BANDWIDTH'].to_i
> >                      updated_nic.interface_name = detail['IFACE_NAME']
> >  
> > -                    updated_nic.save!
> >   
> Will this work if you remove this? If I understand what your doing by
> reading this, you are relying on the host.save! a little further down to
> save the updated nics, but the manipulation of the nic object (eg
> updating bandwidth and interface name) occurs on a nic object you
> explicitly retrieve via find_by_id here. Unless I'm mistaken you will
> either need this updated_nic.save! or instead of updating the nic via
> the "updated_nic" object, you can simply use the "nic" object (eg the
> iterator as set via the host.nics.collect{ |nic| above).

This was some old code. I refactored that whole chunk so that it would
use the nic object it already had. Now it'll update that and save it
inline.

Updated patch is in-flight for this.

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Virtual Machine Management - http://www.ovirt.org/
Is fearr Gaeilge bhriste ná Béarla cliste.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090401/30f0a9b4/attachment.sig>


More information about the ovirt-devel mailing list