mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	In imgcapture, added option for specifying device to capture (only s390x). In rmimage, added support to remove provmethod = raw (native SCSI/FCP) images. In imgimport and imgexport, added remote host option to download from a node not managed by xCAT, fixed indentation issues, and added support for provmethod = raw (native SCSI/FCP device image)
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16697 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -46,10 +46,11 @@ sub process_request { | ||||
|     @ARGV = @{$request->{arg}} if (defined $request->{arg}); | ||||
|     my $argc = scalar @ARGV; | ||||
|  | ||||
|     my $usage = "Usage: imgcapture <node> -t|--type diskless [-p | --profile <profile>] [-o|--osimage <osimage>] [-i <nodebootif>] [-n <nodenetdrivers>] [-V | --verbose] \n imgcapture <node> -t|--type sysclone -o|--osimage <osimage> [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]"; | ||||
|     my $usage = "Usage: imgcapture <node> -t|--type diskless [-p | --profile <profile>] [-o|--osimage <osimage>] [-i <nodebootif>] [-n <nodenetdrivers>] [-d | --device <devicesToCapture>] [-V | --verbose] \n imgcapture <node> -t|--type sysclone -o|--osimage <osimage> [-V | --verbose] \n imgcapture [-h|--help] \n imgcapture [-v|--version]"; | ||||
|  | ||||
|     my $os; | ||||
|     my $arch; | ||||
|     my $device; | ||||
|     my $profile; | ||||
|     my $bootif; | ||||
|     my $netdriver; | ||||
| @@ -63,6 +64,7 @@ sub process_request { | ||||
|         "i=s" => \$bootif, | ||||
|         'n=s' => \$netdriver, | ||||
|         'osimage|o=s' => \$osimg, | ||||
|         "device|d=s" => \$device, | ||||
|         "help|h" => \$help, | ||||
|         "version|v" => \$version, | ||||
|         "verbose|V" => \$verbose, | ||||
| @@ -76,6 +78,7 @@ sub process_request { | ||||
|         xCAT::MsgUtils->message("D", $rsp, $callback); | ||||
|         return 0; | ||||
|     } | ||||
|      | ||||
|     if($version) { | ||||
|         my $version = xCAT::Utils->Version(); | ||||
|         my $rsp = {}; | ||||
| @@ -105,9 +108,25 @@ sub process_request { | ||||
|         xCAT::MsgUtils->message("E", $rsp, $callback); | ||||
|         return 1;     | ||||
|     } | ||||
|      | ||||
|     my $nodetypetab = xCAT::Table->new("nodetype"); | ||||
|     my $ref_nodetype = $nodetypetab->getNodeAttribs($node, ['os','arch','profile']); | ||||
|     $os = $ref_nodetype->{os}; | ||||
|     $arch = $ref_nodetype->{arch}; | ||||
|     unless($profile) { | ||||
|         $profile = $ref_nodetype->{profile}; | ||||
|     } | ||||
|      | ||||
|     # sysclone | ||||
|     unless($type =~ /diskless/) | ||||
|     { | ||||
|     	# Handle image capture separately for s390x  | ||||
|     	if ($arch eq 's390x') { | ||||
|             eval { require xCAT_plugin::zvm; };  # Load z/VM plugin dynamically | ||||
|             xCAT_plugin::zvm->imageCapture($callback, $node, $os, $arch, $profile, $osimg, $device); | ||||
|             return; | ||||
|         } | ||||
|      | ||||
|         my $shortname = xCAT::InstUtils->myxCATname(); | ||||
|  | ||||
|         my $rc; | ||||
| @@ -143,25 +162,14 @@ sub process_request { | ||||
|             return 1; | ||||
|         } | ||||
|  | ||||
|  | ||||
|          | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     my $nodetypetab = xCAT::Table->new("nodetype"); | ||||
|     my $ref_nodetype = $nodetypetab->getNodeAttribs($node, ['os','arch','profile']); | ||||
|     $os = $ref_nodetype->{os}; | ||||
|     $arch = $ref_nodetype->{arch}; | ||||
|     unless($profile) { | ||||
|         $profile = $ref_nodetype->{profile}; | ||||
|     } | ||||
|  | ||||
|      | ||||
|     # -i flag is required with sles genimage | ||||
|     if (!$bootif && $os =~ /^sles/) { | ||||
|         $bootif = "eth0"; | ||||
|     } | ||||
|      | ||||
|  | ||||
|     # check whether the osimage exists or not | ||||
|     if($osimg) { | ||||
|         my $osimgtab=xCAT::Table->new('osimage', -create=>1); | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -105,8 +105,8 @@ sub process_request { | ||||
|        if($verbose) { | ||||
|            $callback->({info=>["For osimage $imagename: osver = $osver, arch = $arch, profile = $profile, method = $method in osimage table"]}); | ||||
|        } | ||||
|        if (($method) && ($method ne "netboot") && ($method ne "statelite")) { | ||||
|           $callback->({error=>["Invalid method \"$method\", the rmimage command can only be used to remove the netboot or statelite image files"],errorcode=>[1]}); | ||||
|        if (($method) && ($method ne "netboot") && ($method ne "statelite") && ($method ne "raw")) { | ||||
|           $callback->({error=>["Invalid method \"$method\", the rmimage command can only be used to remove the netboot, statelite, or raw image files"], errorcode=>[1]}); | ||||
|           return; | ||||
|        } | ||||
|             | ||||
| @@ -136,15 +136,24 @@ sub process_request { | ||||
|                    $callback->({error=>["Invalid image name $imagename"],errorcode=>[1]}); | ||||
|                    return; | ||||
|                } | ||||
|                if (($method ne "netboot") && ($method ne "statelite")) { | ||||
|                   $callback->({error=>["Invalid method \"$method\", the rmimage command can only be used to remove the netboot or statelite image files"],errorcode=>[1]}); | ||||
|                if (($method ne "netboot") && ($method ne "statelite") && ($method ne "raw")) { | ||||
|                   $callback->({error=>["Invalid method \"$method\", the rmimage command can only be used to remove the netboot, statelite, or raw image files"], errorcode=>[1]}); | ||||
|                   return; | ||||
|                } | ||||
|            } | ||||
|            $imagedir = "$installroot/netboot/$osver/$arch/$profile"; | ||||
|  | ||||
|            if ($method eq "raw") { | ||||
|                $imagedir = "$installroot/$method/$osver/$arch/$profile"; | ||||
|            } else { | ||||
|                $imagedir = "$installroot/netboot/$osver/$arch/$profile"; | ||||
|            } | ||||
|        } | ||||
|    } else { # imagename is not specified | ||||
|        $imagedir = "$installroot/netboot/$osver/$arch/$profile"; | ||||
|        if ($method eq "raw") { | ||||
|            $imagedir = "$installroot/$method/$osver/$arch/$profile"; | ||||
|        } else { | ||||
|        	   $imagedir = "$installroot/netboot/$osver/$arch/$profile"; | ||||
|        } | ||||
|    } | ||||
|     | ||||
|    if($verbose) { | ||||
| @@ -156,7 +165,6 @@ sub process_request { | ||||
|        return; | ||||
|    } | ||||
|  | ||||
|  | ||||
|    my @filestoremove = ("$imagedir/rootimg.gz", "$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); | ||||
|  | ||||
|    #some rpms like atftp mount the rootimg/proc to /proc, we need to make sure rootimg/proc is free of junk  | ||||
| @@ -186,6 +194,12 @@ sub process_request { | ||||
|        $callback->({info=>["Removing directory $tftpdir"]}); | ||||
|        rmtree "$tftpdir"; | ||||
|    } | ||||
|     | ||||
|    # For s390x, remove the image directory. | ||||
|    if (($arch eq "s390x") && (-d "$imagedir") && (($method eq "raw") || ($method eq "netboot"))) { | ||||
|        $callback->({info=>["Removing directory $imagedir"]}); | ||||
|        rmtree "$imagedir";	 | ||||
|    } | ||||
|  | ||||
|    $callback->({info=>["Image files have been removed successfully from this management node."]}); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user