Skip to content

OS_Distro_Update_xCAT_command_osdistroupdate

ligc edited this page Jul 30, 2015 · 7 revisions

Table of Contents

{{:Design Warning}}

This min-design is to provide the xCAT command interfaces which are for OS Distro Update. This osdistroupdate command is not exposed to end user, just for internal use. So there is no manpage, and only usage. The osdistroupdate command will provide creating/deleting/listing os distro update functions. This min-design is responsible for the the xCAT command interfaces and xCAT plugin. The xCAT plugin will invoke the function subroutines which Xu Xian implements. Wu Xian is responsible for the basic functions, such as download the os updates online and create the repodata on the mn.

External of osdistroupdate

syntax

osdistroupdate [-h|--help|-v|--version]
osdistroupdate -l [<osdistro-name>]
osdistroupdate -d <osdistroupdate-name>
osdistroupdate -c <osdistro-name> [-p <package directory>]

Description

 -h   Show the help message
 -v   Show the version.
 -l   List OS distro update with specified OS distro name, if no OS distro specified, all OS distro updates in system will be listed. The osdistro-name value will be <osver>-<arh>, such as rhels6.2-x86_64 .
 -d   Delete an OS distro update in system
 -c   Create an OS distro updates in system
 -p   Specify local directory which contains packages downloaded from distro official site. This option is used to create OS update from local.

Output of the osdistroupdate

Create os distro update from network

bash#osdistroupdate -c rhels6.2-x86_64
Creating the distro update for rhels6.2-x86_64 from internet, please wait...
Success! Please check the updates in /<distro-name>-<arch>-<downloaded time>-update/

Create os distro update from local

bash#osdistroupdate -c rhels6.2-x86_64 -p /root/rhels6.2-x86_64-updates
Creating the distro update for rhels6.2-x86_64 from the directory /root/rhels6.2-x86_64-updates, please wait...
Success! Please check the updates in /<distro-name>-<arch>-<downloaded time>-update/

List the distro update on the management node

bash#osdistroupdate -l 
osdistroupdate name: rhels6.2-x86_64-update1
        osdistroname=rhels6.2-x86_64
        osupdatedir=/install/osdistroupdates/rhels6.2-x86_64-20120828-update/
        timestamp=2012.08.28 12:30:00

Delete the distro update

bash#osdistroupdate -d rhels6.2-x86_64-update1
Removing the distro update rhels6.2-x86_64-update1 for rhels5.5-x86_64, please wait...
Success!

Internal of osdistroupdate

the osdistroupdate command

The internal commands in xCAT are put into /$install/xcat/sbin, such as fsp-api, lpar_netboot.expect, gatherfip . Considering the osdistroupdate is an internal command, and we will put the osdistroupdate command in /$install/xcat/sbin. osdistroupdate will be a link to ../bin/xcatclientnnr . This link will be created in the xCAT-client.spec file, such as:

ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/osdistroupdate

the osdistroupdate.pm plugin

The osdistroupdate.pm plugin will be in the /$install/xcat/lib/perl/xCAT_plugin directory. Almost all the functions will be implemented in the osdistroupdate.pm plugin.

preprocess_request() in the osdistroupdate.pm plugin

In the preprocess_request() of the osdistroupdate.pm plugin, there is a parse_args() subroutine. And the parse_args() subroutine will parse the arguments of the osdistroupdate command. The result will be stored in the %opt hash. This hash will be set to $request->{opt}.

process_request() in the osdistroupdate.pm plugin

The process_request() of the osdistroupdate.pm plugin is the main function. In the process_request(), the procedure is as following:

(1)get the option from the hash $request, such as  my $opt = $request->{opt};
(2) If $opt->{l}== 1 , it will invoke the list_updates( $request, $callback)
    If $opt->{c} exists, it will invoke the create_updates(  $request, $callback)
    If $opt->{d} exists, it will invoke the delete_update( $request, $callback)
   Note: the $request is one basic hash variable in xCAT.  $callback is used to return the msg immediately.


   $opt = $request->{opt};

In the list_updates($request, $callback), the $opt will look like:

  $opt = {
         'osdistroupdate_name' => undef,
         'l' => 1
       };

or

  $opt = {
         'osdistroupdate_name' => 'rhels6.2',
         'l' => 1
       };

For create_updates($request, $callback), the $opt will look like:

  $opt = {
         'c' => 'rhels6.2_x86_64'
       };

or

  $opt = {
         'p' => '/root/test',
         'c' => 'rhels6.2_x86_64'
       };

For delete_updates($request, $callback), the $opt will look like:

  $opt = {
         'd' => 'rhels6.2_x86_64'
       };

About the 3 subroutines(list_updates,create_updates and delete_update), the return value will be an array,such as [$rc, $data]. The first element of the array will be the return code of the subroutine: 1 and 0. 0 -- success, 1 -- failed. The second element will be the return content of the subroutine.

For example, we will use the list_updates() as follows:

  my $results = &list_updates($request, $callback);
  $rc = shift(@$results); //$rc will be 0 or 1.
  $data= $results;

For list_updates, if $rc = 1, the $data will be an array, and looks like [msg1, msg2, msg3,...];

if $rc = 0, the data will be an array, and looks like [h1, h2, h3...]. And h1,h2,h3 will look like:

  h1= {
          'osupdatename' => 'rhels6.2-x86_64-update12125',
          'osdistroname' => 'rhels6.2-x86_64',
          'dirpath' => '/install/osdistroupdates/rhels6.2-x86_64-20120228-update12125/',
          'downloadtime' => '1330402626',
          'comments' => undef,
          'disable' => '0',
      }

For create_updates/delete_update, if $rc=0 or 1, the data will be an array, and looks like [msg1, msg2, msg3 ...];

The 3 subroutines will be implemented by PCM.

News

History

  • Oct 22, 2010: xCAT 2.5 released.
  • Apr 30, 2010: xCAT 2.4 is released.
  • Oct 31, 2009: xCAT 2.3 released. xCAT's 10 year anniversary!
  • Apr 16, 2009: xCAT 2.2 released.
  • Oct 31, 2008: xCAT 2.1 released.
  • Sep 12, 2008: Support for xCAT 2 can now be purchased!
  • June 9, 2008: xCAT breaths life into (at the time) the fastest supercomputer on the planet
  • May 30, 2008: xCAT 2.0 for Linux officially released!
  • Oct 31, 2007: IBM open sources xCAT 2.0 to allow collaboration among all of the xCAT users.
  • Oct 31, 1999: xCAT 1.0 is born!
    xCAT started out as a project in IBM developed by Egan Ford. It was quickly adopted by customers and IBM manufacturing sites to rapidly deploy clusters.
Clone this wiki locally