Re: [zones-discuss] cli zone configuration

2009-06-13 Thread Ron Halstead
I use a 'here' document in ksh to do what you want. You could use variables to 
pass IP address and zone name to the script. See the attachment.

--ron
-- 
This message posted from opensolaris.org
___
zones-discuss mailing list
zones-discuss@opensolaris.org


[zones-discuss] cli zone configuration

2009-06-12 Thread Patrick J. McEvoy
Folks,

I am trying to configure zones by running a series of
commands because I want to script setting up zones.
The man page for zonecfg only shows interactive examples,
and the PDF documentation suggests exporting a config,
then editing it, then using zonecfg -f. I don't want to
write expect scripts or edit files -- I just want to
run some commands to create and modify zones.

For the global scope, this works:

zonecfg -z zfoo set zonepath=/zonefs/zfoo

But for other scopes I can't find an invocation that works.
For example, if I would do this interactively:

zonecfg:zfoo add net
zonecfg:zfoo:net set physical=foonic0
zonecfg:zfoo:net end
zonecfg:zfoo

how would I do it non-interactively? I can't find any
invocation of zonecfg that lets me both specify scope
and set a property. This works, but is dorky:

printf add net\nset physical=foonic0\nend\n | zonecfg -z zfoo

So...is there any good general way to configure zones
by running a command or series of commands?

Thanks for any help,
swagman
-- 
This message posted from opensolaris.org
___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Peter Tribble
On Fri, Jun 12, 2009 at 8:13 PM, Patrick J.
McEvoyno-re...@opensolaris.org wrote:
 Folks,

 I am trying to configure zones by running a series of
 commands because I want to script setting up zones.
 The man page for zonecfg only shows interactive examples,
 and the PDF documentation suggests exporting a config,
 then editing it, then using zonecfg -f. I don't want to
 write expect scripts or edit files -- I just want to
 run some commands to create and modify zones.

 For the global scope, this works:

zonecfg -z zfoo set zonepath=/zonefs/zfoo

 But for other scopes I can't find an invocation that works.
 For example, if I would do this interactively:

zonecfg:zfoo add net
zonecfg:zfoo:net set physical=foonic0
zonecfg:zfoo:net end
zonecfg:zfoo

 how would I do it non-interactively? I can't find any
 invocation of zonecfg that lets me both specify scope
 and set a property. This works, but is dorky:

printf add net\nset physical=foonic0\nend\n | zonecfg -z zfoo

 So...is there any good general way to configure zones
 by running a command or series of commands?

I just have a file (call it input_file):

create
set zonepath=/export/zones/mysql-node1
set autoboot=true
add net
set physical=nge0
set address=172.18.1.89/24
end
add fs
set dir=/opt/db
set special=/storage/db
set type=lofs
end
verify
commit


And then do

zonecfg -z zone_name -f input_file

(What I actually do is have a skeleton input file for each type of zone that
has parameter substitution run on it to create the above input file, but any
mechanism to build up the file would do.)

-- 
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/
___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Bernd Schemmer

Hi,

write the zonecfg commands that you would enter interactively  into a file and use zonecfg 
-f yourfile -z yourzone  - you don't need expect or something similar for 
this to work

You can also use that syntax to change the configuration of an existing zone 


(see http://bnsmb.de/solaris/create_zone.html for an example)

regards

Bernd



Patrick J. McEvoy wrote:

Folks,

I am trying to configure zones by running a series of
commands because I want to script setting up zones.
The man page for zonecfg only shows interactive examples,
and the PDF documentation suggests exporting a config,
then editing it, then using zonecfg -f. I don't want to
write expect scripts or edit files -- I just want to
run some commands to create and modify zones.

For the global scope, this works:

zonecfg -z zfoo set zonepath=/zonefs/zfoo

But for other scopes I can't find an invocation that works.
For example, if I would do this interactively:

zonecfg:zfoo add net
zonecfg:zfoo:net set physical=foonic0
zonecfg:zfoo:net end
zonecfg:zfoo

how would I do it non-interactively? I can't find any
invocation of zonecfg that lets me both specify scope
and set a property. This works, but is dorky:

printf add net\nset physical=foonic0\nend\n | zonecfg -z zfoo

So...is there any good general way to configure zones
by running a command or series of commands?

Thanks for any help,
swagman
  



--
Bernd Schemmer, Frankfurt am Main, Germany
http://bnsmb.de/

M s temprano que tarde el mundo cambiar .
   Fidel Castro

___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Kris Kasner


In addition to what everyone else has already replied with, I do something like 
this


if [ conditional ]; then
cat  EOF  $zonecfg
add fs
set dir=/usr/local
set special=$dir/$zone/local
set type=lofs
end
EOF
fi



Since the variables get substituted within the script, you can make the zone 
config very very specific according to what exists on the global, command line 
arguments, phase of moon, whatever.


Then feed it to zonecfg with the -f flag.

Good luck.

--Kris

Today at 12:13, Patrick J. McEvoy no-re...@opensolaris.org wrote:


Folks,

I am trying to configure zones by running a series of
commands because I want to script setting up zones.
The man page for zonecfg only shows interactive examples,
and the PDF documentation suggests exporting a config,
then editing it, then using zonecfg -f. I don't want to
write expect scripts or edit files -- I just want to
run some commands to create and modify zones.

For the global scope, this works:

   zonecfg -z zfoo set zonepath=/zonefs/zfoo

But for other scopes I can't find an invocation that works.
For example, if I would do this interactively:

zonecfg:zfoo add net
zonecfg:zfoo:net set physical=foonic0
zonecfg:zfoo:net end
zonecfg:zfoo

how would I do it non-interactively? I can't find any
invocation of zonecfg that lets me both specify scope
and set a property. This works, but is dorky:

printf add net\nset physical=foonic0\nend\n | zonecfg -z zfoo

So...is there any good general way to configure zones
by running a command or series of commands?

Thanks for any help,
swagman



--

Thomas Kris Kasner
Qualcomm Inc.
5775 Morehouse Drive
San Diego, CA 92121
(858)658-4932


You want to be President?
Yes
Good. Put your hand on the book and say 'I Do'
I Do
Done! Let's Eat.
G'Kar and Sheridan, Babylon 5-No Compromises

___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Jordan Vaughan

Hi swagman,

You can lump the commands into a single zonecfg execution by passing 
them as a single string argument in which the commands are separated by 
semicolons.  Using your example:


zonecfg -z zfoo set zonepath=/zonefs/zfoo; add net; set 
physical=foonic0; end


Hope that helps,
Jordan

On 06/12/09 12:13, Patrick J. McEvoy wrote:

Folks,

I am trying to configure zones by running a series of
commands because I want to script setting up zones.
The man page for zonecfg only shows interactive examples,
and the PDF documentation suggests exporting a config,
then editing it, then using zonecfg -f. I don't want to
write expect scripts or edit files -- I just want to
run some commands to create and modify zones.

For the global scope, this works:

zonecfg -z zfoo set zonepath=/zonefs/zfoo

But for other scopes I can't find an invocation that works.
For example, if I would do this interactively:

zonecfg:zfoo add net
zonecfg:zfoo:net set physical=foonic0
zonecfg:zfoo:net end
zonecfg:zfoo

how would I do it non-interactively? I can't find any
invocation of zonecfg that lets me both specify scope
and set a property. This works, but is dorky:

printf add net\nset physical=foonic0\nend\n | zonecfg -z zfoo

So...is there any good general way to configure zones
by running a command or series of commands?

Thanks for any help,
swagman


___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Menno Lageman

On 06/12/09 21:13, Patrick J. McEvoy wrote:

Folks,

I am trying to configure zones by running a series of
commands because I want to script setting up zones.
The man page for zonecfg only shows interactive examples,
and the PDF documentation suggests exporting a config,
then editing it, then using zonecfg -f. I don't want to
write expect scripts or edit files -- I just want to
run some commands to create and modify zones.

For the global scope, this works:

zonecfg -z zfoo set zonepath=/zonefs/zfoo

But for other scopes I can't find an invocation that works.
For example, if I would do this interactively:

zonecfg:zfoo add net
zonecfg:zfoo:net set physical=foonic0
zonecfg:zfoo:net end
zonecfg:zfoo

how would I do it non-interactively? I can't find any
invocation of zonecfg that lets me both specify scope
and set a property. This works, but is dorky:

printf add net\nset physical=foonic0\nend\n | zonecfg -z zfoo

So...is there any good general way to configure zones
by running a command or series of commands?


You can do that like this:

# zonecfg -z foo 'create; set zonepath=/zones/foo; add net; set 
physical=e1000g0; set address=192.168.1.123/24; end'


(Insert a ; where you would use the enter key in interactive mode.)

Menno
--
Menno Lageman - Sun Microsystems - http://blogs.sun.com/menno
___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Patrick J. McEvoy
menno, flippedb,

Sweet! The semi-colon-spearated list of commands works perfectly. How do
I file an RFE to add that to the man page?

Thanks,
swagman
-- 
This message posted from opensolaris.org
___
zones-discuss mailing list
zones-discuss@opensolaris.org


Re: [zones-discuss] cli zone configuration

2009-06-12 Thread Menno Lageman

On 06/12/09 22:39, Patrick J. McEvoy wrote:

menno, flippedb,

Sweet! The semi-colon-spearated list of commands works perfectly. How do
I file an RFE to add that to the man page?



You can file the bug at http://bugs.opensolaris.org. Category 
solaris/manpage, subcategory section1m.


Menno
--
Menno Lageman - Sun Microsystems - http://blogs.sun.com/menno
___
zones-discuss mailing list
zones-discuss@opensolaris.org