diff --git a/xCAT-client/pods/man1/imgcapture.1.pod b/xCAT-client/pods/man1/imgcapture.1.pod index 067839f6a..fbcbeccd8 100644 --- a/xCAT-client/pods/man1/imgcapture.1.pod +++ b/xCAT-client/pods/man1/imgcapture.1.pod @@ -4,8 +4,7 @@ B - Captures an image from a Linux diskful node and create a diskles =head1 SYNOPSIS -B node [B<-p>|B<--profile> I] [B<-i> I] [B<-n> I] [B<-V>|B<--verbose>] - +B node [B<-p>|B<--profile> I] [B<-o>|B<--osimage> I] [B<-i> I] [B<-n> I] [B<-V>|B<--verbose>] B [B<-h> | B<--help>] | [B<-v> | B<--version>] =head1 DESCRIPTION @@ -28,7 +27,11 @@ After the B command returns without any errors, you can customize th =item B<-p|--profile> I -assign I as the profile of the image to be created. +Assign I as the profile of the image to be created. + +=item B<-o|--osimage> I + +Assign the pre-defined I object. The attributes of I will be used to capture and prepare the root image. =item B<-i> I @@ -80,17 +83,20 @@ Verbose output. B is one diskful Linux node, which is managed by xCAT. -1. In order to create the image, run the following command: +1. In order to capture and prepare the root image, run the following command: imgcapture node1 -2. In order to create the image with B as profile, run the command: +2. In order to capture and prepare the root image with B as profile, run the command: imgcapture node1 -p hpc -3. Create the image: its profile is B, and the network interface the diskless node will boot over is B, the driver modules for this network interface is B. +3. In order to capture and prepare the root image: its profile is B, and the network interface the diskless node will boot over is B, the driver modules for this network interface is B. imgcapture node1 -p hpc -i eth0 -n e1000e + +4. There's one pre-defined I. In order to capture and prepare the root image for I, run the command: +imgcapture node1 -o osimage =head1 FILES diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index 230c50692..852d387c4 100644 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -344,7 +344,16 @@ sub imgcapture { $rsp->{data}->[0] = qq{"The genimage command is: $cmd"}; xCAT::MsgUtils->message("D", $rsp, $callback); } - xCAT::Utils->runcmd($cmd); + my @cmdoutput = xCAT::Utils->runcmd($cmd, 0); + if($::RUNCMD_RC) { + my $rsp = {}; + foreach (@cmdoutput) { + push @{$rsp->{data}}, $_; + } + xCAT::MsgUtils->message("E", $rsp, $callback); + unlink $xcat_imgcapture_tmpfile; + return; + } } else { my $rsp = {}; $rsp->{data}->[0] = qq{Can't run the "genimage" command for $os}; @@ -353,7 +362,7 @@ sub imgcapture { } my $rsp = {}; - $rsp->{data}->[0] = qq{"Done."}; + $rsp->{data}->[0] = qq{Done.}; xCAT::MsgUtils->message("D", $rsp, $callback); unlink $xcat_imgcapture_tmpfile;