[Ovirt-devel] [PATCH node] Fixed where sending no NICs returned an error result.
Steve Linabery
slinabery at redhat.com
Tue Apr 21 15:20:29 UTC 2009
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!
More information about the ovirt-devel
mailing list