Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] *draft* for setting up network bridge with systemd (for qemu/kvm)
Date: Tue, 29 Jan 2013 19:50:00
Message-Id: CADPrc80MmXNb1BBxDBNGRkBJpgyiwg1K=NR-8DQq+ise+RRA9A@mail.gmail.com
In Reply to: Re: [gentoo-user] *draft* for setting up network bridge with systemd (for qemu/kvm) by "Stefan G. Weichinger"
1 On Tue, Jan 29, 2013 at 1:33 PM, Stefan G. Weichinger <lists@×××××.at> wrote:
2 > Am 29.01.2013 20:23, schrieb Canek Peláez Valdés:
3 >
4 >> I really believe the most important thing abount systemd unit files is
5 >> that they are small and simple. You can also check the exit status
6 >> from each command in the script, or even better, you can do a test
7 >> after all the commands are done to check the status of the bridge and
8 >> see if it was created correctly.
9 >>
10 >> None of this belongs in the unit service, IMO. Otherwise, you end
11 >> creating ssh keys and user groups in unit files, and none of this
12 >> belongs there. Clear separation between the services and the init
13 >> system.
14 >>
15 >> But of course, as I said to Stefan, if it works it works.
16 >
17 > As I mentioned it is a first version ... just to make things work.
18 >
19 > If all the services/daemons/stuff work with systemd then I am able to
20 > use it as default init-system here and I don't have switch back to
21 > openrc to do my work (for example when I need KVM-based virtualization
22 > on my workstation).
23 >
24 > I agree with your argument that unitfiles should be as small and simple
25 > as possible, on the other hand those commands just get pulled in from
26 > elsewhere: the complexity is just moved out of sight, right?
27
28 I don't think so, no. It's like the Model/View/Controller design
29 pattern: The code does the same (sometimes it even grows in
30 complexity), so we are just moving stuff around, right? No, we are
31 clearly splitting the information we have, and how do we present it to
32 the user, with a set of well defined interfaces in the control module
33 on how to update the second using the first.
34
35 Or with a webapp; we can mix the information with the presentation,
36 why to split them? We are just moving it out of sight, right? No,
37 again, we split the information on a web page from how do we present
38 it to the user, so when something breaks, we know where it did.
39
40 Imagine that systemd had a bug in its ExecStart= directive. Perhaps it
41 works for the first 5 commands, but it fails in the 6th. Then you
42 would have been stuck for hours (perhaps days) trying to debug your
43 unit file, when it had nothing wrong, really. If instead you put all
44 the logic pertaining to your service in a script, or executable, or
45 whatever, but *clearly separated* from systemd, and you got it
46 working, and it doesn't work with systemd, then you *know* where the
47 problem is.
48
49 I really believe the proper solution is to clearly separate this
50 stuff. You can abuse the Type=oneshot unit files, or heck, even put
51 everything in a single ExecStart=( command1; command2; command3; ...;
52 commandN). That doesn't mean you should.
53
54 Just my 0.02 cents.
55
56 > I did quite some research to find more elegant solutions ... so far I
57 > wasn't successful.
58
59 I find more elegant to clearly split the commands your service uses
60 from the unit file.
61
62 > For now I am happy to get my itches scratched ... I am absolutely ready
63 > to learn and improve things. Sharing my first steps here maybe helps to
64 > motivate other gentoo-users to give systemd a try?
65
66 I would not bet on that ;) too much resistance. However it is
67 certainly getting better and better: the LWN article on The Biggest
68 Myths about systemd had an overwhelmingly majority of comments
69 positive to systemd, and just a handful of negative comments:
70
71 http://lwn.net/Articles/534210/#Comments
72
73 But that is in LWN; Gentoo is way behind, I believe.
74
75 Regards.
76 --
77 Canek Peláez Valdés
78 Posgrado en Ciencia e Ingeniería de la Computación
79 Universidad Nacional Autónoma de México

Replies