2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2024-11-21 09:02:00 +00:00
1 Support uploading openbmc firmware in parallel
chenglch edited this page 2017-10-12 02:30:36 -05:00

The main purpose of this design is to help solve the issue of #4055 [1].

[1] https://github.com/xcat2/xcat-core/issues/4055

Background

As the http async perl library do not provide the interface to upload large attachment, xcat is using curl command to upload file to the openbmc side. As shell command is called in block mode, the original implementation call only upload files sequentially. For a large cluster, this is unacceptable.

Solution

This design hope to reuse the old frame as far as possible. The shell command will be called within the child process for each node. When the command ends, the parent process will extract the node from process id and continue the state machine depends on its return code. Some example like below:

while (1) { 
        last unless ($wait_node_num);
        while (my ($response, $handle_id) = $async->wait_for_next_response) {
            deal_with_response($handle_id, $response);
        }
        while ((my $cpid = waitpid(-1, WNOHANG)) > 0) {
            if ($child_node_map{$cpid}) {
                my $node = $child_node_map{$cpid};
                my $rc = $? >> 8;
                if ($rc != 0) {
                    $wait_node_num--;
                } else {
                    $status_info{ $node_info{$node}{cur_status} }->{process}->($node, undef);
                }
                delete $child_node_map{$cpid};
            }
        }
    } 

Plan

  1. Complete the state machine, fork and wait framework for the firmware upload.
  2. Reuse this framework to upload the ssh key ( By Xu Wei)
  3. error handling for uploading/activating for rflash https://github.com/xcat2/xcat-core/issues/4063
  4. Run rflash in background https://github.com/xcat2/xcat-core/issues/3671