Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mksyscfg and SSH 1

Status
Not open for further replies.

avalon111

IS-IT--Management
Feb 11, 2010
10
NL
Hi!

I have a shell script that runs on a utility server to build VIO's and LPARs. The script interrogates a HMC and builds a number of partitions based on the resources available. Amongst other things it selects 'required' resources and defines Virtual Ethernet and SCSI adapters using aslot assignment criteria we employ.

I have a problem, not with mksyscfg, but rather with how to use it with SSH.

This kind of simple routine works fine from the NIM, sshíng to the HMC;

ssh zk152hmc-eth1 "mksyscfg -r lpar -m <frame name> -i
\"profile_name=normal,lpar_env=vioserver,min_mem=1024,desired_mem=2048,max_mem=4096,proc_mode=shared,min_proc_units=0.1,desired_proc_units=0.1,max_proc_units=1,min_procs=1,desired_procs=1,max_procs=2,sharing_mode=uncap,uncap_weight=250,max_virtual_slots=200,boot_mode=norm,name=<vios name from script>\""

This, with a bit more complexity, works fine through SSH;

ssh zk152hmc-eth1 "mksyscfg -r lpar -m <frame name> -i
\"profile_name=normal,lpar_env=vioserver,min_mem=1024,desired_mem=2048,max_mem=4096,proc_mode=shared,min_proc_units=0.1,desired_proc_units=0.1,max_proc_units=1,min_procs=1,desired_procs=1,max_procs=2,sharing_mode=uncap,uncap_weight=250,max_virtual_slots=200,boot_mode=norm,name=<vios name selected by script>\"\"io_slots=21010222//1\""

When I try to add some more argument though to the io_slots or in adding virtual ethernet adapters, I come unstuck.

This sort of routine works fine on the HMC', without SSH;

mksyscfg -r lpar -m <frqame name> -i "profile_name=normal,lpar_env=vioserver,min_mem=1024,desired_mem=2048,max_mem=4096,proc_mode=shared,min_proc_units=0.1,desired_proc_units=0.1,max_proc_units=1,min_procs=1,desired_procs=1,max_procs=2,sharing_mode=uncap,uncap_weight=250,max_virtual_slots=200,boot_mode=norm,name=<vios name chosen by script>,\"io_slots=21010222//1,21010227//1,21010200//1\",\"virtual_eth_adapters=30/1/1/30/0/1,31/1/31//0/1,32/1/32//0/1,33/1/33//0/1\"""

But I can't find any combination of double speech marks, single speech marks and escapes that will have the above routine accepted by SSH. I could of course just resort to chsyscfg for the awkward bits, but it would be nice to wrap the whole lot into one, so I can activate the VIOS with the
next routine and move on to identifying the remaining resources for the next VIOS.

Any assistance or working examples will be very helpful. The examples I've seen to date have just one argument to attributes like 'virtual_eth_adapters'.

Thanks!

avalon
 
Try it with single quotes around the whole mksyscfg cmd:

[tt]ssh zk152hmc-eth1 [red]'[/red]mksyscfg -r lpar -m <frqame name> -i "profile_name=normal,lpar_env=vioserver,min_mem=1024,desired_mem=2048,max_mem=4096,proc_mode=shared,min_proc_units=0.1,desired_proc_units=0.1,max_proc_units=1,min_procs=1,desired_procs=1,max_procs=2,sharing_mode=uncap,uncap_weight=250,max_virtual_slots=200,boot_mode=norm,name=<vios name chosen by script>,\"io_slots=21010222//1,21010227//1,21010200//1\",\"virtual_eth_adapters=30/1/1/30/0/1,31/1/31//0/1,32/1/32//0/1,33/1/33//0/1\""[red]'[/red][/tt]


HTH,

p5wizard
 
It nearly does the trick; works fine on the command-line. However the single quotes stop the variables being expanded when running in a shell script. So if I begin with;

$SSH ${USER}@${HMC} 'mksysb -r lpar -m ${MS} -i "${parm_list}...

the managed server variable ${MS} isn't expanded, and I suspect none of the other variables will be.

I'm messing around finding a combination that will work, but certainly the solution was valid for the command-line as requested.
 
Indeed, single quotes hide everything from the shell, so you "interrupt" them where needed. You might also want to comment this funny quoting syntax in your scripts so whoever comes after you knows why you did this (to hide double quotes from the shell and to un-hide shell variable expansion where needed)

Code:
$SSH    ${USER}@${HMC}   'mksysb -r lpar -m '${MS}' -i "'${parm_list}'... ...'
                         ^                  ^     ^
 quoted string begins here                  |     |
                      and is interrupted here     |
                            shell interprets ${MS}|
                    quoted string is continued here
and so on...



HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top