[yast-devel] Re: [yast-commit] r67965 - in /branches/SuSE-Code-11-SP2-Branch/lxc: ./ doc/ doc/autodocs/ package/ src/ testsuite/ testsuite/tests/
Nice to see module for such interesting technology like containers, just few notes. First is if we should not start immediatelly in git with such module? On Tue, 17 Apr 2012 15:43:26 -0000 jsuchome@svn2.opensuse.org wrote:
Author: jsuchome Date: Tue Apr 17 17:43:25 2012 New Revision: 67965
URL: http://svn.opensuse.org/viewcvs/yast?rev=67965&view=rev Log: module for LXC (Linux Containers)
Added: +/** + * Read all lxc settings + * @return true on success + */ +global boolean Read() { + + /* Lxc read dialog caption */ + string caption = _("Initializing lxc Configuration"); + + // TODO FIXME Set the right number of stages + integer steps = 4; + + integer sl = 500; + sleep(sl);
Is sleeps really needed? And if so please document it, it looks extremely magic for me why we need it ( especially before we start reading anything). Same apply for write. If we need it for cache writing or UI redraw, please document it.
+ + // TODO FIXME Names of real stages + // We do not set help text here, because it was set outside + Progress::New( caption, " ", steps, [ + /* Progress stage 1/3 */ + _("Read the database"), + /* Progress stage 2/3 */ + _("Read the previous settings"), + /* Progress stage 3/3 */ + _("Detect the devices") + ], [ + /* Progress step 1/3 */ + _("Reading the database..."), + /* Progress step 2/3 */ + _("Reading the previous settings..."), + /* Progress step 3/3 */ + _("Detecting the devices..."), + /* Progress finished */ + _("Finished") + ], + "" + ); + + // read database + if(Abort()) return false; + Progress::NextStage(); + /* Error message */ + if(false) Report::Error(_("Cannot read database1.")); + sleep(sl); + + // read another database + if(Abort()) return false; + Progress::NextStep(); + /* Error message */ + if(false) Report::Error(_("Cannot read database2.")); + sleep(sl); + + // read current settings + if(Abort()) return false; + Progress::NextStage(); + /* Error message */ + if(false) Report::Error(Message::CannotReadCurrentSettings()); + sleep(sl); + + // detect devices + if(Abort()) return false; + Progress::NextStage(); + /* Error message */ + if(false) Report::Warning(_("Cannot detect devices.")); + sleep(sl); + + if(Abort()) return false; + /* Progress finished */ + Progress::NextStage(); + sleep(sl); + + if(Abort()) return false; + modified = false; + return true; +} + +/** + * Write all lxc settings + * @return true on success + */ +global boolean Write() { + + /* Lxc read dialog caption */ + string caption = _("Saving lxc Configuration"); + + // TODO FIXME And set the right number of stages + integer steps = 2; + + integer sl = 500; + sleep(sl); + + // TODO FIXME Names of real stages + // We do not set help text here, because it was set outside + Progress::New(caption, " ", steps, [ + /* Progress stage 1/2 */ + _("Write the settings"), + /* Progress stage 2/2 */ + _("Run SuSEconfig") + ], [ + /* Progress step 1/2 */ + _("Writing the settings..."), + /* Progress step 2/2 */ + _("Running SuSEconfig..."), + /* Progress finished */ + _("Finished") + ], + "" + ); + + // write settings + if(Abort()) return false; + Progress::NextStage(); + /* Error message */ + if(false) Report::Error (_("Cannot write settings.")); + sleep(sl); + + // run SuSEconfig + if(Abort()) return false; + Progress::NextStage (); + /* Error message */ + if(false) Report::Error (Message::SuSEConfigFailed()); + sleep(sl); + + if(Abort()) return false; + /* Progress finished */ + Progress::NextStage(); + sleep(sl); + + if(Abort()) return false; + return true; +} + Added: branches/SuSE-Code-11-SP2-Branch/lxc/src/_cvsignore URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/lxc/sr... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/lxc/src/_cvsignore (added) +++ branches/SuSE-Code-11-SP2-Branch/lxc/src/_cvsignore Tue Apr 17 17:43:25 2012 @@ -0,0 +1,4 @@ +Makefile +Makefile.in +*.ybc +.dep
cvsingore??? does we really need it???
Added: branches/SuSE-Code-11-SP2-Branch/lxc/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/lxc/sr... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/lxc/src/dialogs.ycp (added) +++ branches/SuSE-Code-11-SP2-Branch/lxc/src/dialogs.ycp Tue Apr 17 17:43:25 2012 @@ -0,0 +1,298 @@ +/* ------------------------------------------------------------------------------ + * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
^^^ year here
+/** + * Configure1 dialog + * @return dialog result + */ +any LxcDialog () { + + boolean orig = Progress::set (false); + Security::Read (); + Progress::set (orig); + + map security = Security::Export (); + string method = tolower (security["PASSWD_ENCRYPTION"]:"des"); + + /* Lxc configure1 dialog caption */ + string caption = _("LXC Configuration"); + + list<string> bridge_items = [ "br0", "br1" ];
Does we really support only two bridges? and if so why? document please
+ if (out["exit"]:0 != 0) + { + // error message + Report::Error (sformat (_("Error occured during configuration: + +%1"), out["stdout"]:""));
Why is there stdout and not stderr? And can be message more descriptive like "lxconfig failed with this output:" So it is clear, that problem is not on our side ( of course if we not pass something wrongly ) Josef -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
V Tue, 17 Apr 2012 20:44:40 +0200 Josef Reidinger <jreidinger@suse.cz> napsáno:
Nice to see module for such interesting technology like containers, just few notes. First is if we should not start immediatelly in git with such module?
I don't see a point in having part of development in git and part in svn. So I'd wait for a full switch.
Is sleeps really needed?
Of course not. It's automatically created module from template, that is not used at all so far. Just ignore it.
^^^ year here
You're right.
+ list<string> bridge_items = [ "br0", "br1" ];
Does we really support only two bridges? and if so why? document please
No, of course. But this is just testing phase, before we have anything real.
+ if (out["exit"]:0 != 0) + { + // error message + Report::Error (sformat (_("Error occured during configuration: + +%1"), out["stdout"]:""));
Why is there stdout and not stderr?
Because that command prints error message to stdout. Jiri -- Jiri Suchomel SUSE LINUX, s.r.o. Lihovarská 1060/12 tel: +420 284 028 960 190 00 Praha 9, Czech Republic http://www.suse.cz -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (2)
-
Jiří Suchomel
-
Josef Reidinger