[Ovirt-devel] [PATCH node] Fixed where sending no NICs returned an error result.

Darryl L. Pierce dpierce at redhat.com
Tue Apr 21 15:32:58 UTC 2009


On Tue, Apr 21, 2009 at 10:20:29AM -0500, Steve Linabery wrote:
> On Fri, Apr 17, 2009 at 03:10:39PM -0400, Darryl L. Pierce wrote:
> > If there are no NICs to send, then the result is set to success and then
> > returned.
> > 
> > If no NICs were sent due to the only NIC found being ignored, then a
> > default success is returned.
> > 
> > Otherwise, processing NICs works as desired.
> > 
> > Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
> > ---
> >  ovirt-identify-node/protocol.c |   48 ++++++++++++++++++++++++---------------
> >  1 files changed, 29 insertions(+), 19 deletions(-)
> > 
> > diff --git a/ovirt-identify-node/protocol.c b/ovirt-identify-node/protocol.c
> > index 0382dac..1099ebb 100644
> > --- a/ovirt-identify-node/protocol.c
> > +++ b/ovirt-identify-node/protocol.c
> > @@ -176,26 +176,36 @@ send_nic_details(void)
> >  
> >      nic_info_ptr current = nic_info;
> >  
> > -    while (current != NULL) {
> > -      if((!management_interface) || (strcmp(management_interface, current->iface_name))) {
> > -	send_text("NIC");
> > -
> > -	if (!(get_text("NICINFO?")) &&
> > -	    (!send_value("MAC", current->mac_address)) &&
> > -	    (!send_value("BANDWIDTH", current->bandwidth)) &&
> > -            (!send_value("IFACE_NAME", current->iface_name)) &&
> > -            (!send_value("IP_ADDRESS", current->ip_address)) &&
> > -            (!send_value("NETMASK", current->netmask)) &&
> > -            (!send_value("BROADCAST", current->broadcast))) {
> > -	  send_text("ENDNIC");
> > -	  result = get_text("ACK NIC");
> > -        }
> > -
> > -        current = current->next;
> > -      } else {
> > -	current = current->next;
> > +    /* only send NIC details if we found NICs to process */
> > +    if(current) {
> > +      int sent_count = 0;
> > +      while (current != NULL) {
> > +	if((!management_interface) || (strcmp(management_interface, current->iface_name))) {
> > +	  send_text("NIC");
> > +
> > +	  if (!(get_text("NICINFO?")) &&
> > +	      (!send_value("MAC", current->mac_address)) &&
> > +	      (!send_value("BANDWIDTH", current->bandwidth)) &&
> > +	      (!send_value("IFACE_NAME", current->iface_name)) &&
> > +	      (!send_value("IP_ADDRESS", current->ip_address)) &&
> > +	      (!send_value("NETMASK", current->netmask)) &&
> > +	      (!send_value("BROADCAST", current->broadcast))) {
> > +	    send_text("ENDNIC");
> > +	    result = get_text("ACK NIC");
> > +	    sent_count++;
> > +	  }
> > +
> > +	  current = current->next;
> > +	} else {
> > +	  current = current->next;
> > +	}
> >        }
> > -    }
> > +
> > +      /* if no nics were sent, then set default success */
> > +      if( sent_count == 0)
> > +	result = 0;
> > +
> > +    } else { result = 0; }
> >  
> >      return result;
> >  }
> > -- 
> > 1.6.0.6
> > 
> > _______________________________________________
> > Ovirt-devel mailing list
> > Ovirt-devel at redhat.com
> > https://www.redhat.com/mailman/listinfo/ovirt-devel
> 
> ACK!

Thanks. This is pushed as well.

-- 
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/20090421/c631a608/attachment.sig>


More information about the ovirt-devel mailing list