Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel

2014-04-07 Thread Tom Gundersen
On Mon, Apr 7, 2014 at 6:35 AM, Susant Sahani sus...@redhat.com wrote:
 I have addressed all your comments.

Cool.

 However I have some queries
 Please find below.
 Hm, we can probably reuse some of the existing address parsing
 functions don't you think? And we should also check the address
 faimilies here right?


 I think I can reuse net_parse_inaddr .

Yes, sounds like the right thing to do. It will also allow you to
force the address family and fail if it is wrong.

 Hm, I guess these should be _append_in_addr() to get the typesafety
 right (might need to verify that we are using the right types for this
 in rtnl-types.c.

  I am missing something in the code . with the current rtnl code
 it does not get appended.  Could you please give a example.

Your follow-up patch does the right thing. The types were sort of
wrong in the library, but it would not be noticed by the kernel as
NLA_IN_ADDR is equivalent to NLA_U32 for IPv4 addresses. However, it
is not for IPv6 addresses, so better to do this explicitly as your
next patch suggests.

 This should be fixed in the kernel I think. All that is needed is to
 add MODULE_ALIA_RTNL_LINK(ipip) to the ipip module (and the same for
 the other modules). This is already done for many (most?) netdev
 kinds, which is why this stuff just works for bridges, bonds, etc.

 I am not sure how it will be fixed in  kernel. If the module not present
 kernel will say not supported . Could you please give a example.
 The main reason for loading module from networkd is avoid users
 loading manually .

The kernel will auto-load any missing module as long as it has the
correct module alias. If it finds that a certain kind is unsupported
it will try to load rtnl-link-kind. Have a look at modinfo
bridge and compare with modinfo ipip to see why the one works and
the other does not. I'll submit a kernel patch for this (but until we
know whether or not that will be applied I'd just keep the module
loading you currently have).

Thanks!

Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel

2014-04-07 Thread Susant Sahani
This patch enables basic ipip tunnel support.
It works with kernel module ipip

Example configuration

file: ipip.netdev
[NetDev]
Name=ipip-tun
Kind=ipip

[Tunnel]
Local=192.168.8.102
Remote=10.4.4.4
TTL=64
MTUBytes=1480

file: ipip.network
[Match]
Name=eth0

[Network]
Tunnel=ipip-tun
---
 Makefile.am   |   7 +-
 src/libsystemd-network/network-internal.c |  33 ++
 src/libsystemd-network/network-internal.h |   3 +
 src/libsystemd/sd-rtnl/rtnl-types.c   |   4 +-
 src/network/networkd-link.c   |  25 -
 src/network/networkd-manager.c|  19 
 src/network/networkd-netdev-gperf.gperf   |   4 +
 src/network/networkd-netdev.c | 175 +-
 src/network/networkd-network-gperf.gperf  |   1 +
 src/network/networkd-network.c|  37 +++
 src/network/networkd.c|   6 +
 src/network/networkd.h|  27 +
 12 files changed, 334 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c51f6ae..60c7016 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \
src/network/networkd.c
 
 systemd_networkd_LDADD = \
-   libsystemd-networkd-core.la
-
+   libsystemd-networkd-core.la \
+   -lkmod
 noinst_LTLIBRARIES += \
libsystemd-networkd-core.la
 
@@ -4189,7 +4189,8 @@ test_network_SOURCES = \
src/network/test-network.c
 
 test_network_LDADD = \
-   libsystemd-networkd-core.la
+   libsystemd-networkd-core.la \
+   -lkmod
 
 tests += \
test-network
diff --git a/src/libsystemd-network/network-internal.c 
b/src/libsystemd-network/network-internal.c
index 3686267..5b41cdb 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char 
*family, void *dst) {
 
 return 0;
 }
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name) {
+struct kmod_list *modlist = NULL, *l;
+int r;
+
+assert(ctx);
+assert(mod_name);
+
+r = kmod_module_new_from_lookup(ctx, mod_name, modlist);
+if (r  0)
+return r;
+
+if (!modlist) {
+log_error(Failed to find module '%s', mod_name);
+return -ENOENT;
+}
+
+kmod_list_foreach(l, modlist) {
+struct kmod_module *mod = kmod_module_get_module(l);
+
+r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, 
NULL);
+if (r = 0)
+r = 0;
+else
+r = -1;
+
+kmod_module_unref(mod);
+}
+
+kmod_module_unref_list(modlist);
+
+return r;
+}
diff --git a/src/libsystemd-network/network-internal.h 
b/src/libsystemd-network/network-internal.h
index 65cd0d7..28f53b9 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -24,6 +24,7 @@
 #include netinet/ether.h
 #include netinet/in.h
 #include stdbool.h
+#include libkmod.h
 
 #include udev.h
 #include condition-util.h
@@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char 
*filename, unsigned line,
 int net_parse_inaddr(const char *address, unsigned char *family, void *dst);
 
 int net_get_unique_predictable_data(struct udev_device *device, uint8_t 
result[8]);
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name);
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c 
b/src/libsystemd/sd-rtnl/rtnl-types.c
index 44ac5ec..96467a3 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -104,8 +104,8 @@ static const NLType 
rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {
 
 static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = {
 [IFLA_IPTUN_LINK]= { .type = NLA_U32 },
-[IFLA_IPTUN_LOCAL]   = { .type = NLA_U32 },
-[IFLA_IPTUN_REMOTE]  = { .type = NLA_U32 },
+[IFLA_IPTUN_LOCAL]   = { .type = NLA_IN_ADDR },
+[IFLA_IPTUN_REMOTE]  = { .type = NLA_IN_ADDR },
 [IFLA_IPTUN_TTL] = { .type = NLA_U8 },
 [IFLA_IPTUN_TOS] = { .type = NLA_U8 },
 [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 },
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 63d253d..848eddd 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) {
 
 link_save(link);
 
-if (!link-network-bridge  !link-network-bond 
+if (!link-network-bridge 
+!link-network-bond 
+!link-network-tunnel 
 hashmap_isempty(link-network-vlans) 
 hashmap_isempty(link-network-macvlans))
 return 

Re: [systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel

2014-04-07 Thread Tom Gundersen
On Mon, Apr 7, 2014 at 9:44 AM, Susant Sahani sus...@redhat.com wrote:
 This patch enables basic ipip tunnel support.
 It works with kernel module ipip

 Example configuration

 file: ipip.netdev
 [NetDev]
 Name=ipip-tun
 Kind=ipip

 [Tunnel]
 Local=192.168.8.102
 Remote=10.4.4.4
 TTL=64
 MTUBytes=1480

 file: ipip.network
 [Match]
 Name=eth0

 [Network]
 Tunnel=ipip-tun
 ---
  Makefile.am   |   7 +-
  src/libsystemd-network/network-internal.c |  33 ++
  src/libsystemd-network/network-internal.h |   3 +
  src/libsystemd/sd-rtnl/rtnl-types.c   |   4 +-
  src/network/networkd-link.c   |  25 -
  src/network/networkd-manager.c|  19 
  src/network/networkd-netdev-gperf.gperf   |   4 +
  src/network/networkd-netdev.c | 175 
 +-
  src/network/networkd-network-gperf.gperf  |   1 +
  src/network/networkd-network.c|  37 +++
  src/network/networkd.c|   6 +
  src/network/networkd.h|  27 +
  12 files changed, 334 insertions(+), 7 deletions(-)

 diff --git a/Makefile.am b/Makefile.am
 index c51f6ae..60c7016 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \
 src/network/networkd.c

  systemd_networkd_LDADD = \
 -   libsystemd-networkd-core.la
 -
 +   libsystemd-networkd-core.la \
 +   -lkmod
  noinst_LTLIBRARIES += \
 libsystemd-networkd-core.la

 @@ -4189,7 +4189,8 @@ test_network_SOURCES = \
 src/network/test-network.c

  test_network_LDADD = \
 -   libsystemd-networkd-core.la
 +   libsystemd-networkd-core.la \
 +   -lkmod

  tests += \
 test-network
 diff --git a/src/libsystemd-network/network-internal.c 
 b/src/libsystemd-network/network-internal.c
 index 3686267..5b41cdb 100644
 --- a/src/libsystemd-network/network-internal.c
 +++ b/src/libsystemd-network/network-internal.c
 @@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char 
 *family, void *dst) {

  return 0;
  }
 +
 +int load_module(struct kmod_ctx *ctx, const char *mod_name) {
 +struct kmod_list *modlist = NULL, *l;
 +int r;
 +
 +assert(ctx);
 +assert(mod_name);
 +
 +r = kmod_module_new_from_lookup(ctx, mod_name, modlist);
 +if (r  0)
 +return r;
 +
 +if (!modlist) {
 +log_error(Failed to find module '%s', mod_name);
 +return -ENOENT;
 +}
 +
 +kmod_list_foreach(l, modlist) {
 +struct kmod_module *mod = kmod_module_get_module(l);
 +
 +r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, 
 NULL, NULL);
 +if (r = 0)
 +r = 0;
 +else
 +r = -1;
 +
 +kmod_module_unref(mod);
 +}
 +
 +kmod_module_unref_list(modlist);
 +
 +return r;
 +}
 diff --git a/src/libsystemd-network/network-internal.h 
 b/src/libsystemd-network/network-internal.h
 index 65cd0d7..28f53b9 100644
 --- a/src/libsystemd-network/network-internal.h
 +++ b/src/libsystemd-network/network-internal.h
 @@ -24,6 +24,7 @@
  #include netinet/ether.h
  #include netinet/in.h
  #include stdbool.h
 +#include libkmod.h

  #include udev.h
  #include condition-util.h
 @@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char 
 *filename, unsigned line,
  int net_parse_inaddr(const char *address, unsigned char *family, void *dst);

  int net_get_unique_predictable_data(struct udev_device *device, uint8_t 
 result[8]);
 +
 +int load_module(struct kmod_ctx *ctx, const char *mod_name);
 diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c 
 b/src/libsystemd/sd-rtnl/rtnl-types.c
 index 44ac5ec..96467a3 100644
 --- a/src/libsystemd/sd-rtnl/rtnl-types.c
 +++ b/src/libsystemd/sd-rtnl/rtnl-types.c
 @@ -104,8 +104,8 @@ static const NLType 
 rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {

  static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = {
  [IFLA_IPTUN_LINK]= { .type = NLA_U32 },
 -[IFLA_IPTUN_LOCAL]   = { .type = NLA_U32 },
 -[IFLA_IPTUN_REMOTE]  = { .type = NLA_U32 },
 +[IFLA_IPTUN_LOCAL]   = { .type = NLA_IN_ADDR },
 +[IFLA_IPTUN_REMOTE]  = { .type = NLA_IN_ADDR },
  [IFLA_IPTUN_TTL] = { .type = NLA_U8 },
  [IFLA_IPTUN_TOS] = { .type = NLA_U8 },
  [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 },
 diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
 index 63d253d..848eddd 100644
 --- a/src/network/networkd-link.c
 +++ b/src/network/networkd-link.c
 @@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) {

  link_save(link);

 -if (!link-network-bridge  !link-network-bond 
 +if (!link-network-bridge 
 + 

Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel

2014-04-07 Thread Jóhann B. Guðmundsson


On 04/07/2014 04:35 AM, Susant Sahani wrote:

This will be much nicer if we simply use ipip as the kind, rather
than tunnel.


Done !


Hmm...

I think it got right the first place from a usability perspective as in 
kind=tunnel then we need to introduce mode= in the associated network 
file as in


|.netdev|

|[NetDev]
Name=tunnel0
Kind=tunnel

||[Match]
Name=enp2s0

.network

[Network]
|||# one of the following|
Mode=ipip | gre | sit | isatap | vti
Address=192.168.0.15/24
Gateway=192.168.0.1|

Or have the Mode= in the .netdev file itself

JBG

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel

2014-04-07 Thread Susant Sahani

On 04/07/2014 02:39 PM, Tom Gundersen wrote:

On Mon, Apr 7, 2014 at 9:44 AM, Susant Sahani sus...@redhat.com wrote:

This patch enables basic ipip tunnel support.
It works with kernel module ipip

Example configuration

file: ipip.netdev
[NetDev]
Name=ipip-tun
Kind=ipip

[Tunnel]
Local=192.168.8.102
Remote=10.4.4.4
TTL=64
MTUBytes=1480

file: ipip.network
[Match]
Name=eth0

[Network]
Tunnel=ipip-tun
---
  Makefile.am   |   7 +-
  src/libsystemd-network/network-internal.c |  33 ++
  src/libsystemd-network/network-internal.h |   3 +
  src/libsystemd/sd-rtnl/rtnl-types.c   |   4 +-
  src/network/networkd-link.c   |  25 -
  src/network/networkd-manager.c|  19 
  src/network/networkd-netdev-gperf.gperf   |   4 +
  src/network/networkd-netdev.c | 175 +-
  src/network/networkd-network-gperf.gperf  |   1 +
  src/network/networkd-network.c|  37 +++
  src/network/networkd.c|   6 +
  src/network/networkd.h|  27 +
  12 files changed, 334 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c51f6ae..60c7016 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \
 src/network/networkd.c

  systemd_networkd_LDADD = \
-   libsystemd-networkd-core.la
-
+   libsystemd-networkd-core.la \
+   -lkmod
  noinst_LTLIBRARIES += \
 libsystemd-networkd-core.la

@@ -4189,7 +4189,8 @@ test_network_SOURCES = \
 src/network/test-network.c

  test_network_LDADD = \
-   libsystemd-networkd-core.la
+   libsystemd-networkd-core.la \
+   -lkmod

  tests += \
 test-network
diff --git a/src/libsystemd-network/network-internal.c 
b/src/libsystemd-network/network-internal.c
index 3686267..5b41cdb 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char 
*family, void *dst) {

  return 0;
  }
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name) {
+struct kmod_list *modlist = NULL, *l;
+int r;
+
+assert(ctx);
+assert(mod_name);
+
+r = kmod_module_new_from_lookup(ctx, mod_name, modlist);
+if (r  0)
+return r;
+
+if (!modlist) {
+log_error(Failed to find module '%s', mod_name);
+return -ENOENT;
+}
+
+kmod_list_foreach(l, modlist) {
+struct kmod_module *mod = kmod_module_get_module(l);
+
+r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, 
NULL);
+if (r = 0)
+r = 0;
+else
+r = -1;
+
+kmod_module_unref(mod);
+}
+
+kmod_module_unref_list(modlist);
+
+return r;
+}
diff --git a/src/libsystemd-network/network-internal.h 
b/src/libsystemd-network/network-internal.h
index 65cd0d7..28f53b9 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -24,6 +24,7 @@
  #include netinet/ether.h
  #include netinet/in.h
  #include stdbool.h
+#include libkmod.h

  #include udev.h
  #include condition-util.h
@@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char 
*filename, unsigned line,
  int net_parse_inaddr(const char *address, unsigned char *family, void *dst);

  int net_get_unique_predictable_data(struct udev_device *device, uint8_t 
result[8]);
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name);
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c 
b/src/libsystemd/sd-rtnl/rtnl-types.c
index 44ac5ec..96467a3 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -104,8 +104,8 @@ static const NLType 
rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {

  static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = {
  [IFLA_IPTUN_LINK]= { .type = NLA_U32 },
-[IFLA_IPTUN_LOCAL]   = { .type = NLA_U32 },
-[IFLA_IPTUN_REMOTE]  = { .type = NLA_U32 },
+[IFLA_IPTUN_LOCAL]   = { .type = NLA_IN_ADDR },
+[IFLA_IPTUN_REMOTE]  = { .type = NLA_IN_ADDR },
  [IFLA_IPTUN_TTL] = { .type = NLA_U8 },
  [IFLA_IPTUN_TOS] = { .type = NLA_U8 },
  [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 },
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 63d253d..848eddd 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) {

  link_save(link);

-if (!link-network-bridge  !link-network-bond 
+if (!link-network-bridge 
+!link-network-bond 
+

[systemd-devel] WTF changed after version 208? systemd won't boot again!

2014-04-07 Thread Aaron Lewis
Hi,

I'm sure what changed in version 209, everything is just fine in 208.

Now I can't boot my system once again. (Downgrade always works)

Here's the problem at boot,

I get a dev-sda1.XX timeout message, that's just weird.
Checked journalctl -xn, nothing helpful, only a few lines says dependency fails

Then I ran systemd-analyze, it says
Failed to start message bus: No socket received.

I did a strace, looks like /run/dbus does not exist, so I created one,
the error persists.

If I run systemctl start dbus the whole system stuck. strace shows it
stuck on msgsend, some 'dbus replace' message, can't recall more

It looks like a dbus problem, what should I do now?
I already have tons of software masked from upgrade, which is all
linked to libsystemd.so, hehe

I'm running Arch Linux, software version:
dbus 1.8.0-1
dbus-glib 0.102-1
dbus-sharp 0.7.0-4
dbus-sharp-glib 0.5.0-4
lib32-libdbus 1.8.0-1
lib32-systemd 212-1
libdbus 1.8.0-1
libdbusmenu-qt 0.9.2-2
libsystemd 212-1
perl-net-dbus 1.0.0-3
python-dbus 1.2.0-3
python-dbus-common 1.2.0-3
python2-dbus 1.2.0-3
systemd 212-1
systemd-sysvcompat 212-1

Someone please, save my life.

-- 
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] WTF changed after version 208? systemd won't boot again!

2014-04-07 Thread Aaron Lewis
Ah it's I'm not sure in the first line, typing too fast, my bad

On Mon, Apr 7, 2014 at 6:42 PM, Aaron Lewis the.warl0ck.1...@gmail.com wrote:
 Hi,

 I'm sure what changed in version 209, everything is just fine in 208.

 Now I can't boot my system once again. (Downgrade always works)

 Here's the problem at boot,

 I get a dev-sda1.XX timeout message, that's just weird.
 Checked journalctl -xn, nothing helpful, only a few lines says dependency 
 fails

 Then I ran systemd-analyze, it says
 Failed to start message bus: No socket received.

 I did a strace, looks like /run/dbus does not exist, so I created one,
 the error persists.

 If I run systemctl start dbus the whole system stuck. strace shows it
 stuck on msgsend, some 'dbus replace' message, can't recall more

 It looks like a dbus problem, what should I do now?
 I already have tons of software masked from upgrade, which is all
 linked to libsystemd.so, hehe

 I'm running Arch Linux, software version:
 dbus 1.8.0-1
 dbus-glib 0.102-1
 dbus-sharp 0.7.0-4
 dbus-sharp-glib 0.5.0-4
 lib32-libdbus 1.8.0-1
 lib32-systemd 212-1
 libdbus 1.8.0-1
 libdbusmenu-qt 0.9.2-2
 libsystemd 212-1
 perl-net-dbus 1.0.0-3
 python-dbus 1.2.0-3
 python-dbus-common 1.2.0-3
 python2-dbus 1.2.0-3
 systemd 212-1
 systemd-sysvcompat 212-1

 Someone please, save my life.

 --
 Best Regards,
 Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
 Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33



-- 
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] WTF changed after version 208? systemd won't boot again!

2014-04-07 Thread Tomasz Torcz
On Mon, Apr 07, 2014 at 06:42:41PM +0800, Aaron Lewis wrote:
 Hi,
 
 I'm sure what changed in version 209, everything is just fine in 208.
 
 Now I can't boot my system once again. (Downgrade always works)
 
 Here's the problem at boot,
 
 I get a dev-sda1.XX timeout message, that's just weird.

  That's usually a symptom of CONFIG_FHANDLE missing from kernel.


-- 
Tomasz TorczOnly gods can safely risk perfection,
xmpp: zdzich...@chrome.pl it's a dangerous thing for a man.  -- Alia

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [RESOLVED] Re: WTF changed after version 208? systemd won't boot again!

2014-04-07 Thread Aaron Lewis
Hey Tom,

Thanks, just rebuilt the kernel. Works ;-P

On Mon, Apr 7, 2014 at 6:46 PM, Tomasz Torcz to...@pipebreaker.pl wrote:
 On Mon, Apr 07, 2014 at 06:42:41PM +0800, Aaron Lewis wrote:
 Hi,

 I'm sure what changed in version 209, everything is just fine in 208.

 Now I can't boot my system once again. (Downgrade always works)

 Here's the problem at boot,

 I get a dev-sda1.XX timeout message, that's just weird.

   That's usually a symptom of CONFIG_FHANDLE missing from kernel.


 --
 Tomasz TorczOnly gods can safely risk perfection,
 xmpp: zdzich...@chrome.pl it's a dangerous thing for a man.  -- Alia

 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel



-- 
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel

2014-04-07 Thread Susant Sahani

On 04/07/2014 03:13 PM, Jóhann B. Guðmundsson wrote:


On 04/07/2014 04:35 AM, Susant Sahani wrote:

This will be much nicer if we simply use ipip as the kind, rather
than tunnel.


Done !


Hmm...

I think it got right the first place from a usability perspective as 
in kind=tunnel then we need to introduce mode= in the associated 
network file as in

Yes from user perceptive this is nice  but few line code more ;)


|.netdev|
|[NetDev]
Name=tunnel0
Kind=tunnel

||[Match]
Name=enp2s0

.network

[Network]
|||# one of the following|
Mode=ipip | gre | sit | isatap | vti
Address=192.168.0.15/24
Gateway=192.168.0.1|

Or have the Mode= in the .netdev file itself

JBG


Thanks,
Susant



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] networkd: Introduce ipip tunnel

2014-04-07 Thread Jóhann B. Guðmundsson


On 04/07/2014 11:09 AM, Susant Sahani wrote:

On 04/07/2014 03:13 PM, Jóhann B. Guðmundsson wrote:


On 04/07/2014 04:35 AM, Susant Sahani wrote:

This will be much nicer if we simply use ipip as the kind, rather
than tunnel.


Done !


Hmm...

I think it got right the first place from a usability perspective as 
in kind=tunnel then we need to introduce mode= in the associated 
network file as in

Yes from user perceptive this is nice  but few line code more ;)


I think this is more correct since you are dealing with multiple types 
of tunnel so the kind= should specify you are using an tunnel and then 
specify what type of tunnel in either .netdev file itself or .network file


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel

2014-04-07 Thread Tom Gundersen
On Mon, Apr 7, 2014 at 12:28 PM, Susant Sahani sus...@redhat.com wrote:
 +r = manager_init_kmod_ctx(m);
 Maybe just do

 manager-kmod_ctx = kmod_ctx_new(NULL, NULL);
 if (!manager-kmod_ctx) {
  r = -ENOMEM;
  etc...
 }

 and drop the wrapping function (see above).

 Any specific reason to drop it   and do directly ?

Either way is fine. I just suggested the wrapper is not really adding
much once you drop the unref() from it.

Cheers,

Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Netconsole NG

2014-04-07 Thread Lukáš Nykrýn

Dne 6.4.2014 17:59, poma napsal(a):


/etc/sysconfig/netconsole:
# This is the EnvironmentFile for the netconsole service. Starting this
# service enables the capture of dmesg output on a destination machine.

# Source port
SRC_PORT=12345

# Source IP address
SRC_IP=192.168.1.2

# Source network device
SRC_DEV=enp1s2

# Destination port
DST_PORT=12345

# Destination IP address
DST_IP=192.168.1.1

# Destination ethernet address
DST_EHA=00:11:22:33:44:55


/usr/lib/systemd/system/netconsole.service:
[Unit]
Description=Adds the netconsole module with the configured parameters
After=network.target

[Service]
EnvironmentFile=/etc/sysconfig/netconsole

Type=simple
RemainAfterExit=yes
ExecStart=/usr/sbin/modprobe netconsole
netconsole=${SRC_PORT}@${SRC_IP}/${SRC_DEV},${DST_PORT}@${DST_IP}/${DST_EHA}
ExecStop=/usr/sbin/modprobe -r netconsole

[Install]
WantedBy=multi-user.target


The original SysV netconsole service with related config - still in use,
https://git.fedorahosted.org/cgit/initscripts.git/plain/rc.d/init.d/netconsole
https://git.fedorahosted.org/cgit/initscripts.git/plain/sysconfig/netconsole

Feel free to comment.


poma



The reason why this was not rewritten a long time ago is that the 
initscript tries to figure some of those values by itself (for example 
the MAC address). But yes, we need to do something with netconsole. It 
is a blocker for my initscripts evil plan.


Lukas
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: local-fs.target waits for nofail mounts

2014-04-07 Thread Vivek Goyal
On Sat, Apr 05, 2014 at 04:24:01AM +0200, Zbigniew Jędrzejewski-Szmek wrote:
 On Fri, Apr 04, 2014 at 05:30:03PM -0400, Vivek Goyal wrote:
  On Fri, Apr 04, 2014 at 02:44:50PM +0800, WANG Chao wrote:
   In kdump kernel, we need mount certain file system, and we use nofail
   for all mounts specified in /etc/fstab. Because we don't want any mount
   failure to interrupt the boot process to arrive at
   dracut-pre-pivot.service (This is the point just before we switch root).
   And at that dracut-pre-pivot, we run our kernel dump capture script
   (called kdump.sh).
   
   Our kdump.sh needs every .mount is mounted (or started in systemd
   context) before it gets run by dracut-pre-pivot.service. And
   dracut-pre-pivot.service is configured to run after local-fs.target. So
   what we expect is no matter nofail is configured or not, local-fs.target
   should be delayed after all mount units are started.
   
   And it's also the same for remote nofail mounts and remote-fs.target.
  
  Chao, will this change not force boot to stop if fsck on said device
  failed? And in that case we will not get a chance to run default
  action in kdump.
  
  I think there is conflict in the definiton of nofail as defined by
  fstab/fsck and as interpreted by systemd fstab generator.
 Current behaviour has an important reason: it is not possible to
 implement wait mode without heavily penalising the case of missing
 devices.  Since systemd boots rather quickly, it has not way of
 knowing whether the device in question is genuinly missing, or just
 slow to be detected, and has to wait the device timeout (3 min, iirc)
 before continuing. In the light of this, current behaviour seems to be
 a reasonable reinterpretation of nofail for an event-based boot
 system.

I have couple of questions. 

- Assume nofail is not specified and device specified in /etc/fstab
  does not show up. How long will we wait before we give up? Looks like
  you think it is 3 mins? So by default it is time bound wait and not an
  infinite wait.

- Say, we timed out and device was not found. I think foo.mount service
  will fail. Now what will happen to all dependent services or targets.
  For example, will initrd.target be reached or not. In the past looks
  like we faced the problem that initrd.target was not reached because
  device could not be found and kdump never got to run.

 
 Nevertheless, I understand the motivation for this patch, and this is
 something that has been discussed before. What about adding an
 local-fs-all.target, something like
 
 [Unit]
 Description=All local mount points configured in /etc/fstab
 
 [Install]
 WantedBy=multi-user.target
 
 and having fstab-generator add Before=local-fs-all.target,
 RequiredBy=local-fs-all.target to the units it generates. Then
 if someone wants to wait for all local mounts, they can use
 Requires=,After=local-fs-all.target.
 
 And thanks to the [Install] section, a user can do
 'systemctl enable local-fs-all.target' to wait for 'nofail' devices.

Defining a new target which by default waits for all the local fs target
sounds interesting. Again, I have the question, what will happen to 
local-fs-all.target if some device does not show up and say one of the
mounts specified in /etc/fstab fails.

What we want is.

- Wait for all devices to show up as specified in /etc/fstab. Run fsck
  on devices. Mount devices to mount points specified.

- If everything is successful, things are fine and local-fs-all.target
  will be reached.

- If some device does not show up, or if fsck fails or mount fails, still
  local-fs-all.target should reach so that kdump module can detect that
  failure happened and can take alternative action.
 
  For example,

  Asssume a user wants to save vmcore to nfs destination. Now for whatever 
  reason, nfs target could not be mounted. In that case kdump will still
  like to get control and alternatively save dump to local root fs.

  If systemd just hangs because nfs mounting failed and local-fs-all.target
  was never reached, then we can't take backup action.

Thanks
Vivek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Netconsole NG

2014-04-07 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Apr 07, 2014 at 05:34:10PM +0200, Lukáš Nykrýn wrote:
 The reason why this was not rewritten a long time ago is that the
 initscript tries to figure some of those values by itself (for
 example the MAC address). But yes, we need to do something with
 netconsole. It is a blocker for my initscripts evil plan.
Doesn't netconsole figure out most of those settings by itself, and
others default to sensible values, so if the network card is up
and has an address configured, only the device and target ip must be given?

 Dne 6.4.2014 17:59, poma napsal(a):
 
 /etc/sysconfig/netconsole:
 # This is the EnvironmentFile for the netconsole service. Starting this
 # service enables the capture of dmesg output on a destination machine.
 
 # Source port
 SRC_PORT=12345
This should default to empty... Kernel will pick something.

 
 # Source IP address
 SRC_IP=192.168.1.2
This should default to empty... Kernel will use configured address,
since we order after network.target anyway.

 # Source network device
 SRC_DEV=enp1s2
Maybe this can be made into a instance argument?

 # Destination port
 DST_PORT=12345
I think this should default to 514/syslog, and can be left unset.

 # Destination IP address
 DST_IP=192.168.1.1
 
 # Destination ethernet address
 DST_EHA=00:11:22:33:44:55
This should default to unset. The kernel will query it if not set.

 /usr/lib/systemd/system/netconsole.service:
 [Unit]
 Description=Adds the netconsole module with the configured parameters
 After=network.target
 
 [Service]
 EnvironmentFile=/etc/sysconfig/netconsole
This is Fedora/RH specific. But I don't know what the proper path should
be, so maybe this is OK for now.

 Type=simple
This is the default... No need to specify.

 RemainAfterExit=yes
 ExecStart=/usr/sbin/modprobe netconsole
This should be /sbin/modprobe for compatibility with split root.

 netconsole=${SRC_PORT}@${SRC_IP}/${SRC_DEV},${DST_PORT}@${DST_IP}/${DST_EHA}
 ExecStop=/usr/sbin/modprobe -r netconsole
Ditto.

 
 [Install]
 WantedBy=multi-user.target
That's a really late... But I don't see a better place unfortunately.

 The original SysV netconsole service with related config - still in use,
 https://git.fedorahosted.org/cgit/initscripts.git/plain/rc.d/init.d/netconsole
 https://git.fedorahosted.org/cgit/initscripts.git/plain/sysconfig/netconsole
 
 Feel free to comment.
Looks like an improvement on status quo.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: local-fs.target waits for nofail mounts

2014-04-07 Thread Andrey Borzenkov
В Mon, 7 Apr 2014 13:40:17 -0400
Vivek Goyal vgo...@redhat.com пишет:

 
 Defining a new target which by default waits for all the local fs target
 sounds interesting. Again, I have the question, what will happen to 
 local-fs-all.target if some device does not show up and say one of the
 mounts specified in /etc/fstab fails.
 
 What we want is.
 
 - Wait for all devices to show up as specified in /etc/fstab. Run fsck
   on devices. Mount devices to mount points specified.
 
 - If everything is successful, things are fine and local-fs-all.target
   will be reached.
 
 - If some device does not show up, or if fsck fails or mount fails, still
   local-fs-all.target should reach so that kdump module can detect that
   failure happened and can take alternative action.
  

You can use OnFailure= to define unit(s) started when
local-fs-all.target fails. But it sounds like you are not really
interested in *all* filesystems, but in specific fileststems defined in
kdump configuration.

   For example,
 
   Asssume a user wants to save vmcore to nfs destination. Now for whatever 
   reason, nfs target could not be mounted. In that case kdump will still
   like to get control and alternatively save dump to local root fs.
 

Without knowing details it sounds like RequiresMountsFor is more
appropriate (and can be set by generator based on actual kdump
configuration).

   If systemd just hangs because nfs mounting failed and local-fs-all.target
   was never reached, then we can't take backup action.
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Four special object test files

2014-04-07 Thread Kevin Wilson
Hi,
I noticed this fact:

For the following source modules:
src/test/test-sched-prio.c
src/test/test-sched-prio.c
src/test/test-unit-file.c
src/test/test-unit-name.c

There are the following object files:
test_sched_prio-test-sched-prio.o
test_cgroup_mask-test-cgroup-mask.o
test_unit_file-test-unit-file.o
test_unit_name-test-unit-name.o

All the other source files (under src/test) have a normal behavior,
meaning that for
src/test/test-unit-name.c
we have:
src/test/test-unit-name.o

What it the reason for this concatenation?

regards,
Kevin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Four special object test files

2014-04-07 Thread Cristian Rodríguez

El 07/04/14 15:15, Kevin Wilson escribió:


What it the reason for this concatenation?


automake subdir-objects does this..



--
Cristian
Team PITA
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: local-fs.target waits for nofail mounts

2014-04-07 Thread Vivek Goyal
On Mon, Apr 07, 2014 at 10:07:20PM +0400, Andrey Borzenkov wrote:
 В Mon, 7 Apr 2014 13:40:17 -0400
 Vivek Goyal vgo...@redhat.com пишет:
 
  
  Defining a new target which by default waits for all the local fs target
  sounds interesting. Again, I have the question, what will happen to 
  local-fs-all.target if some device does not show up and say one of the
  mounts specified in /etc/fstab fails.
  
  What we want is.
  
  - Wait for all devices to show up as specified in /etc/fstab. Run fsck
on devices. Mount devices to mount points specified.
  
  - If everything is successful, things are fine and local-fs-all.target
will be reached.
  
  - If some device does not show up, or if fsck fails or mount fails, still
local-fs-all.target should reach so that kdump module can detect that
failure happened and can take alternative action.
   
 
 You can use OnFailure= to define unit(s) started when
 local-fs-all.target fails. But it sounds like you are not really
 interested in *all* filesystems, but in specific fileststems defined in
 kdump configuration.

Kdump scripts registers with dracut as pre-pivot hook. And I believe
that in initramfs environments /etc/fstab does not contain all
filesystems. It prmarily contains root and any file system specified
on dracut command line using --mount option during initramfs generation.

So my understanding that given the fact that /etc/fstab is minimal in
initramfs, we should be fine waiting for all the fs specified. 

Given the fact that we run under dracut pre-pivot hook callback, I think
dracut-pre-pivot.service wil have to create a dependency to run after
local-fs-all.target is reached.

Now I am not sure who will generate local-fs-all.target. If dracut
generates it then dracut will also specify OnFailure=. Question will
still remain how dracut modules will communicate to dracut that what
to run after local-fs-all.target fails.

In fact if dracut is doing all this, we don't have to create a separate
target. Right now we force nofail so that if mount fails, initrd.target
is still reached.

If we can create a separate service to just handle failures, then we
probably should be able to spcify OnFailure=dracut-failure-hander.service
in right file and as modules to register their failure handler hooks
there.

Something like create new hook called pre-pivot-failure and modules
register a hook to handle pre-pivot-failure. Then kdump can get the
control and handle failure.

And this should allow dracut pre pivot service to specify to launch
dracut-failure-handler.service upon failure.

 
For example,
  
Asssume a user wants to save vmcore to nfs destination. Now for whatever 
reason, nfs target could not be mounted. In that case kdump will still
like to get control and alternatively save dump to local root fs.
  
 
 Without knowing details it sounds like RequiresMountsFor is more
 appropriate (and can be set by generator based on actual kdump
 configuration).

I am not sure how is it useful for this case. dracut already generates
all dependencies and puts them in /etc/fstab. And only entries in
/etc/fstab should be which dracut wants. So I guess we should be fine
and not need using RequiresMountsFor.

Thanks
Vivek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] [RFC] Ignore OOMScoreAdjust in Linux containers

2014-04-07 Thread Richard Weinberger
At least LXC does not allow the container root to change
the OOM Score adjust value.

Signed-off-by: Richard Weinberger rich...@nod.at
---
Hi!

Within Linux containers we cannot use OOMScoreAdjust nor CapabilityBoundingSet 
(and maybe
more related settings).
This patch tells systemd to ignore OOMScoreAdjust if it detects
a container.

Are you fine with such a change?
Otherweise regular distros need a lot of changes in their .service file
to make them work within LXC.

As detect_virtualization() detects more than LXC we have to find out
whether OOMScoreAdjust cannot be used on OpenVZ and other container as well.

I'd volunteer to identify all settings and sending patches...

Thanks,
//richard

---
 src/core/load-fragment.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index c604f90..13f6107 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -59,6 +59,7 @@
 #include bus-error.h
 #include errno-list.h
 #include af-list.h
+#include virt.h
 
 #ifdef HAVE_SECCOMP
 #include seccomp-util.h
@@ -423,6 +424,12 @@ int config_parse_exec_oom_score_adjust(const char* unit,
 assert(rvalue);
 assert(data);
 
+if (detect_virtualization(NULL) == VIRTUALIZATION_CONTAINER) {
+log_syntax(unit, LOG_ERR, filename, line, EPERM,
+   Setting the OOM score adjust value is not allowed 
within containers);
+return 0;
+}
+
 r = safe_atoi(rvalue, oa);
 if (r  0) {
 log_syntax(unit, LOG_ERR, filename, line, -r,
-- 
1.8.4.2

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 0/2] systemd-analyze: read info from remote - fix bug 76498

2014-04-07 Thread Djalal Harouni
Fix bug:
https://bugs.freedesktop.org/show_bug.cgi?id=76498


First, please apply this series:
http://lists.freedesktop.org/archives/systemd-devel/2014-March/018257.html

The fix needs these patches too!


I did make this information available on the bus of hostnamed, since
Lennart suggested that we should not put too much stuff in PID1 :
http://lists.freedesktop.org/archives/systemd-devel/2014-March/017799.html

Thanks!
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/2] hostnamed: expose OperatingSystemVersion on the bus

2014-04-07 Thread Djalal Harouni
This is needed to fix bug:

https://bugs.freedesktop.org/show_bug.cgi?id=76498

Reported-by: Zach zachcook1...@gmail.com
---
 src/hostname/hostnamed.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index abafa62..ca80d50 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -43,6 +43,7 @@ enum {
 PROP_CHASSIS,
 PROP_OS_NAME,
 PROP_OS_RELEASE,
+PROP_OS_VERSION,
 PROP_OS_PRETTY_NAME,
 PROP_OS_CPE_NAME,
 _PROP_MAX
@@ -82,7 +83,9 @@ static int context_read_data(Context *c) {
 assert_se(uname(u) = 0);
 c-data[PROP_OS_NAME] = strdup(u.sysname);
 c-data[PROP_OS_RELEASE] = strdup(u.release);
-if (!c-data[PROP_OS_NAME] || !c-data[PROP_OS_RELEASE])
+c-data[PROP_OS_VERSION] = strdup(u.version);
+if (!c-data[PROP_OS_NAME] || !c-data[PROP_OS_RELEASE] ||
+!c-data[PROP_OS_VERSION])
 return -ENOMEM;
 
 c-data[PROP_HOSTNAME] = gethostname_malloc();
@@ -567,6 +570,7 @@ static const sd_bus_vtable hostname_vtable[] = {
 SD_BUS_PROPERTY(Chassis, s, property_get_chassis, 0, 
SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
 SD_BUS_PROPERTY(OperatingSystemName, s, NULL, offsetof(Context, 
data) + sizeof(char*) * PROP_OS_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(OperatingSystemRelease, s, NULL, offsetof(Context, 
data) + sizeof(char*) * PROP_OS_RELEASE, SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(OperatingSystemVersion, s, NULL, offsetof(Context, 
data) + sizeof(char*) * PROP_OS_VERSION, SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(OperatingSystemPrettyName, s, NULL, 
offsetof(Context, data) + sizeof(char*) * PROP_OS_PRETTY_NAME, 
SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(OperatingSystemCPEName, s, NULL, offsetof(Context, 
data) + sizeof(char*) * PROP_OS_CPE_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_METHOD(SetHostname, sb, NULL, method_set_hostname, 
SD_BUS_VTABLE_UNPRIVILEGED),
-- 
1.8.5.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 2/2] systemd-analyze: read host and system information from remote

2014-04-07 Thread Djalal Harouni
This makes systemd-analyze plot read host information from remote.

While we are it show if this is a virtualized system.

https://bugs.freedesktop.org/show_bug.cgi?id=76498

Reported-by: Zach zachcook1...@gmail.com
---
 src/analyze/analyze.c | 105 ++
 1 file changed, 81 insertions(+), 24 deletions(-)

diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 3d2d08f..49b28d4 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -100,6 +100,15 @@ struct unit_times {
 usec_t time;
 };
 
+struct host_info {
+char *hostname;
+char *os_release;
+char *os_version;
+char *os_pretty_name;
+char *virtualization;
+char *architecture;
+};
+
 static void pager_open_if_enabled(void) {
 
 if (arg_no_pager)
@@ -170,21 +179,6 @@ static int compare_unit_start(const void *a, const void 
*b) {
((struct unit_times *)b)-activating);
 }
 
-static int get_os_name(char **_n) {
-char *n = NULL;
-int r;
-
-r = parse_env_file(/etc/os-release, NEWLINE, PRETTY_NAME, n, 
NULL);
-if (r  0)
-return r;
-
-if (!n)
-return -ENOENT;
-
-*_n = n;
-return 0;
-}
-
 static void free_unit_times(struct unit_times *t, unsigned n) {
 struct unit_times *p;
 
@@ -372,6 +366,61 @@ finish:
 return 0;
 }
 
+static void free_host_info(struct host_info *hi) {
+free(hi-hostname);
+free(hi-os_release);
+free(hi-os_version);
+free(hi-os_pretty_name);
+free(hi-virtualization);
+free(hi-architecture);
+free(hi);
+}
+
+static int acquire_host_info(sd_bus *bus, struct host_info **hi) {
+int r;
+struct host_info *host;
+
+static const struct bus_properties_map hostname_map[] = {
+{ Hostname, s, NULL, offsetof(struct host_info, hostname) 
},
+{ OperatingSystemRelease, s, NULL, offsetof(struct 
host_info, os_release) },
+{ OperatingSystemVersion, s, NULL, offsetof(struct 
host_info, os_version) },
+{ OperatingSystemPrettyName, s, NULL, offsetof(struct 
host_info, os_pretty_name) },
+{}
+};
+
+static const struct bus_properties_map manager_map[] = {
+{ Virtualization, s, NULL, offsetof(struct host_info, 
virtualization) },
+{ Architecture,   s, NULL, offsetof(struct host_info, 
architecture) },
+{}
+};
+
+host = new0(struct host_info, 1);
+if (!host)
+return log_oom();
+
+r = bus_map_all_properties(bus,
+   org.freedesktop.hostname1,
+   /org/freedesktop/hostname1,
+   hostname_map,
+   host);
+if (r  0)
+goto fail;
+
+r = bus_map_all_properties(bus,
+   org.freedesktop.systemd1,
+   /org/freedesktop/systemd1,
+   manager_map,
+   host);
+if (r  0)
+goto fail;
+
+*hi = host;
+return 0;
+fail:
+free_host_info(host);
+return r;
+}
+
 static int pretty_boot_time(sd_bus *bus, char **_buf) {
 char ts[FORMAT_TIMESPAN_MAX];
 struct boot_times *t;
@@ -437,10 +486,10 @@ static void svg_graph_box(double height, double begin, 
double end) {
 static int analyze_plot(sd_bus *bus) {
 struct unit_times *times;
 struct boot_times *boot;
-struct utsname name;
+struct host_info *host = NULL;
 int n, m = 1, y=0;
 double width;
-_cleanup_free_ char *pretty_times = NULL, *osname = NULL;
+_cleanup_free_ char *pretty_times = NULL;
 struct unit_times *u;
 
 n = acquire_boot_times(bus, boot);
@@ -451,12 +500,13 @@ static int analyze_plot(sd_bus *bus) {
 if (n  0)
 return n;
 
-get_os_name(osname);
-assert_se(uname(name) = 0);
+n = acquire_host_info(bus, host);
+if (n  0)
+return n;
 
 n = acquire_time_data(bus, times);
 if (n = 0)
-return n;
+goto out;
 
 qsort(times, n, sizeof(struct unit_times), compare_unit_start);
 
@@ -551,9 +601,13 @@ static int analyze_plot(sd_bus *bus) {
 
 svg(rect class=\background\ width=\100%%\ height=\100%%\ 
/\n);
 svg(text x=\20\ y=\50\%s/text, pretty_times);
-svg(text x=\20\ y=\30\%s %s (%s %s) %s/text,
-isempty(osname) ? Linux : osname,
-name.nodename, name.release, name.version, name.machine);
+svg(text x=\20\ y=\30\%s %s (%s %s) %s %s/text,
+isempty(host-os_pretty_name) ? Linux : host-os_pretty_name,
+  

Re: [systemd-devel] [PATCH] fstab-generator: local-fs.target waits for nofail mounts

2014-04-07 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Apr 07, 2014 at 03:10:14PM -0400, Vivek Goyal wrote:
 On Mon, Apr 07, 2014 at 10:07:20PM +0400, Andrey Borzenkov wrote:
  В Mon, 7 Apr 2014 13:40:17 -0400
  Vivek Goyal vgo...@redhat.com пишет:
  
   
   Defining a new target which by default waits for all the local fs target
   sounds interesting. Again, I have the question, what will happen to 
   local-fs-all.target if some device does not show up and say one of the
   mounts specified in /etc/fstab fails.
It result is different for Requires= and for Wants=. Iff there's a chain
of Requires= from the failing unit (.device in this case) to the target unit
it will fail. Otherwise, it'll just be delayed. If, as I suggested above 
local-fs-all.target
would have Requires= on the .mount units, then your unit could still have
Wants=/After=local-fs-all.target, and it'll be started even if some mounts
fail.

   What we want is.
   
   - Wait for all devices to show up as specified in /etc/fstab. Run fsck
 on devices. Mount devices to mount points specified.
   
   - If everything is successful, things are fine and local-fs-all.target
 will be reached.
   
   - If some device does not show up, or if fsck fails or mount fails, still
 local-fs-all.target should reach so that kdump module can detect that
 failure happened and can take alternative action.
Alternatively, you can specify a soft depenendency on local-fs-all.target by
using Wants=local-fs-all.target. I think this is preferable, because we want
local-fs-all.target to be as similar as possible to local-fs.target, which
has Requires= on the mount points.

With this caveat, this should all be satisfied with my proposal.

  You can use OnFailure= to define unit(s) started when
  local-fs-all.target fails. But it sounds like you are not really
  interested in *all* filesystems, but in specific fileststems defined in
  kdump configuration.
 
 Kdump scripts registers with dracut as pre-pivot hook. And I believe
 that in initramfs environments /etc/fstab does not contain all
 filesystems. It prmarily contains root and any file system specified
 on dracut command line using --mount option during initramfs generation.
 
 So my understanding that given the fact that /etc/fstab is minimal in
 initramfs, we should be fine waiting for all the fs specified. 
 
 Given the fact that we run under dracut pre-pivot hook callback, I think
 dracut-pre-pivot.service wil have to create a dependency to run after
 local-fs-all.target is reached.
Hm, maybe. It would be good to get some input from Harald here.
This is pretty specialized, so maybe it'd be better to have a separate unit
positioned before or after or parallel to dracut-pre-pivot.service.

 Now I am not sure who will generate local-fs-all.target. 
It would become a standard unit in systemd, like local-fs.target.
Mount units would be added to this target by fstab-generator.

 If dracut
 generates it then dracut will also specify OnFailure=. Question will
 still remain how dracut modules will communicate to dracut that what
 to run after local-fs-all.target fails.

 In fact if dracut is doing all this, we don't have to create a separate
 target. Right now we force nofail so that if mount fails, initrd.target
 is still reached.
 
 If we can create a separate service to just handle failures, then we
 probably should be able to spcify OnFailure=dracut-failure-hander.service
 in right file and as modules to register their failure handler hooks
 there.
 
 Something like create new hook called pre-pivot-failure and modules
 register a hook to handle pre-pivot-failure. Then kdump can get the
 control and handle failure.
 
 And this should allow dracut pre pivot service to specify to launch
 dracut-failure-handler.service upon failure.
 
  
 For example,
   
 Asssume a user wants to save vmcore to nfs destination. Now for 
   whatever 
 reason, nfs target could not be mounted. In that case kdump will still
 like to get control and alternatively save dump to local root fs.
   
  
  Without knowing details it sounds like RequiresMountsFor is more
  appropriate (and can be set by generator based on actual kdump
  configuration).
 
 I am not sure how is it useful for this case. dracut already generates
 all dependencies and puts them in /etc/fstab. And only entries in
 /etc/fstab should be which dracut wants. So I guess we should be fine
 and not need using RequiresMountsFor.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Netconsole NG

2014-04-07 Thread poma
On 07.04.2014 17:34, Lukáš Nykrýn wrote:
 Dne 6.4.2014 17:59, poma napsal(a):

 /etc/sysconfig/netconsole:
 # This is the EnvironmentFile for the netconsole service. Starting this
 # service enables the capture of dmesg output on a destination machine.

 # Source port
 SRC_PORT=12345

 # Source IP address
 SRC_IP=192.168.1.2

 # Source network device
 SRC_DEV=enp1s2

 # Destination port
 DST_PORT=12345

 # Destination IP address
 DST_IP=192.168.1.1

 # Destination ethernet address
 DST_EHA=00:11:22:33:44:55


 /usr/lib/systemd/system/netconsole.service:
 [Unit]
 Description=Adds the netconsole module with the configured parameters
 After=network.target

 [Service]
 EnvironmentFile=/etc/sysconfig/netconsole

 Type=simple
 RemainAfterExit=yes
 ExecStart=/usr/sbin/modprobe netconsole
 netconsole=${SRC_PORT}@${SRC_IP}/${SRC_DEV},${DST_PORT}@${DST_IP}/${DST_EHA}
 ExecStop=/usr/sbin/modprobe -r netconsole

 [Install]
 WantedBy=multi-user.target


 The original SysV netconsole service with related config - still in use,
 https://git.fedorahosted.org/cgit/initscripts.git/plain/rc.d/init.d/netconsole
 https://git.fedorahosted.org/cgit/initscripts.git/plain/sysconfig/netconsole

 Feel free to comment.


 poma

 
 The reason why this was not rewritten a long time ago is that the 
 initscript tries to figure some of those values by itself (for example 
 the MAC address). But yes, we need to do something with netconsole. It 
 is a blocker for my initscripts evil plan.
 
 Lukas
 

Yeehaw!


poma


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Netconsole NG

2014-04-07 Thread poma
On 07.04.2014 19:55, Zbigniew Jędrzejewski-Szmek wrote:
 On Mon, Apr 07, 2014 at 05:34:10PM +0200, Lukáš Nykrýn wrote:
 The reason why this was not rewritten a long time ago is that the
 initscript tries to figure some of those values by itself (for
 example the MAC address). But yes, we need to do something with
 netconsole. It is a blocker for my initscripts evil plan.
 Doesn't netconsole figure out most of those settings by itself, and
 others default to sensible values, so if the network card is up
 and has an address configured, only the device and target ip must be given?
 
 Dne 6.4.2014 17:59, poma napsal(a):

 /etc/sysconfig/netconsole:
 # This is the EnvironmentFile for the netconsole service. Starting this
 # service enables the capture of dmesg output on a destination machine.

 # Source port
 SRC_PORT=12345
 This should default to empty... Kernel will pick something.
 

 # Source IP address
 SRC_IP=192.168.1.2
 This should default to empty... Kernel will use configured address,
 since we order after network.target anyway.
 
 # Source network device
 SRC_DEV=enp1s2
 Maybe this can be made into a instance argument?
 
 # Destination port
 DST_PORT=12345
 I think this should default to 514/syslog, and can be left unset.
 
 # Destination IP address
 DST_IP=192.168.1.1

 # Destination ethernet address
 DST_EHA=00:11:22:33:44:55
 This should default to unset. The kernel will query it if not set.
 
 /usr/lib/systemd/system/netconsole.service:
 [Unit]
 Description=Adds the netconsole module with the configured parameters
 After=network.target

 [Service]
 EnvironmentFile=/etc/sysconfig/netconsole
 This is Fedora/RH specific. But I don't know what the proper path should
 be, so maybe this is OK for now.
 
 Type=simple
 This is the default... No need to specify.
 
 RemainAfterExit=yes
 ExecStart=/usr/sbin/modprobe netconsole
 This should be /sbin/modprobe for compatibility with split root.
 
 netconsole=${SRC_PORT}@${SRC_IP}/${SRC_DEV},${DST_PORT}@${DST_IP}/${DST_EHA}
 ExecStop=/usr/sbin/modprobe -r netconsole
 Ditto.
 

 [Install]
 WantedBy=multi-user.target
 That's a really late... But I don't see a better place unfortunately.
 
 The original SysV netconsole service with related config - still in use,
 https://git.fedorahosted.org/cgit/initscripts.git/plain/rc.d/init.d/netconsole
 https://git.fedorahosted.org/cgit/initscripts.git/plain/sysconfig/netconsole

 Feel free to comment.
 Looks like an improvement on status quo.
 
 Zbyszek
 

Shall we still leave something for users to configure.
Thanks for your review.


poma


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/1] networkd: Introduce ipip tunnel

2014-04-07 Thread Susant Sahani
This patch enables basic ipip tunnel support.
It works with kernel module ipip

Example configuration

file: ipip.netdev
--
[NetDev]
Name=ipip-tun
Kind=ipip

[Tunnel]
Local=192.168.8.102
Remote=10.4.4.4
TTL=64
MTUBytes=1480

file: ipip.network
--
[Match]
Name=eth0

[Network]
Tunnel=ipip-tun
---
 Makefile.am   |   7 +-
 src/libsystemd-network/network-internal.c |  33 ++
 src/libsystemd-network/network-internal.h |   3 +
 src/libsystemd/sd-rtnl/rtnl-types.c   |   4 +-
 src/network/networkd-link.c   |  25 -
 src/network/networkd-manager.c|  14 +++
 src/network/networkd-netdev-gperf.gperf   |   4 +
 src/network/networkd-netdev.c | 169 +-
 src/network/networkd-network-gperf.gperf  |   1 +
 src/network/networkd-network.c|  37 +++
 src/network/networkd.c|   6 ++
 src/network/networkd.h|  27 +
 12 files changed, 323 insertions(+), 7 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c51f6ae..60c7016 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4144,8 +4144,8 @@ systemd_networkd_SOURCES = \
src/network/networkd.c
 
 systemd_networkd_LDADD = \
-   libsystemd-networkd-core.la
-
+   libsystemd-networkd-core.la \
+   -lkmod
 noinst_LTLIBRARIES += \
libsystemd-networkd-core.la
 
@@ -4189,7 +4189,8 @@ test_network_SOURCES = \
src/network/test-network.c
 
 test_network_LDADD = \
-   libsystemd-networkd-core.la
+   libsystemd-networkd-core.la \
+   -lkmod
 
 tests += \
test-network
diff --git a/src/libsystemd-network/network-internal.c 
b/src/libsystemd-network/network-internal.c
index 3686267..5b41cdb 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -326,3 +326,36 @@ int net_parse_inaddr(const char *address, unsigned char 
*family, void *dst) {
 
 return 0;
 }
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name) {
+struct kmod_list *modlist = NULL, *l;
+int r;
+
+assert(ctx);
+assert(mod_name);
+
+r = kmod_module_new_from_lookup(ctx, mod_name, modlist);
+if (r  0)
+return r;
+
+if (!modlist) {
+log_error(Failed to find module '%s', mod_name);
+return -ENOENT;
+}
+
+kmod_list_foreach(l, modlist) {
+struct kmod_module *mod = kmod_module_get_module(l);
+
+r = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, 
NULL);
+if (r = 0)
+r = 0;
+else
+r = -1;
+
+kmod_module_unref(mod);
+}
+
+kmod_module_unref_list(modlist);
+
+return r;
+}
diff --git a/src/libsystemd-network/network-internal.h 
b/src/libsystemd-network/network-internal.h
index 65cd0d7..28f53b9 100644
--- a/src/libsystemd-network/network-internal.h
+++ b/src/libsystemd-network/network-internal.h
@@ -24,6 +24,7 @@
 #include netinet/ether.h
 #include netinet/in.h
 #include stdbool.h
+#include libkmod.h
 
 #include udev.h
 #include condition-util.h
@@ -65,3 +66,5 @@ int config_parse_ifalias(const char *unit, const char 
*filename, unsigned line,
 int net_parse_inaddr(const char *address, unsigned char *family, void *dst);
 
 int net_get_unique_predictable_data(struct udev_device *device, uint8_t 
result[8]);
+
+int load_module(struct kmod_ctx *ctx, const char *mod_name);
diff --git a/src/libsystemd/sd-rtnl/rtnl-types.c 
b/src/libsystemd/sd-rtnl/rtnl-types.c
index 44ac5ec..96467a3 100644
--- a/src/libsystemd/sd-rtnl/rtnl-types.c
+++ b/src/libsystemd/sd-rtnl/rtnl-types.c
@@ -104,8 +104,8 @@ static const NLType 
rtnl_link_info_data_bond_types[IFLA_BOND_MAX + 1] = {
 
 static const NLType rtnl_link_info_data_iptun_types[IFLA_IPTUN_MAX + 1] = {
 [IFLA_IPTUN_LINK]= { .type = NLA_U32 },
-[IFLA_IPTUN_LOCAL]   = { .type = NLA_U32 },
-[IFLA_IPTUN_REMOTE]  = { .type = NLA_U32 },
+[IFLA_IPTUN_LOCAL]   = { .type = NLA_IN_ADDR },
+[IFLA_IPTUN_REMOTE]  = { .type = NLA_IN_ADDR },
 [IFLA_IPTUN_TTL] = { .type = NLA_U8 },
 [IFLA_IPTUN_TOS] = { .type = NLA_U8 },
 [IFLA_IPTUN_PMTUDISC]= { .type = NLA_U8 },
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 63d253d..848eddd 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1207,7 +1207,9 @@ static int link_enter_enslave(Link *link) {
 
 link_save(link);
 
-if (!link-network-bridge  !link-network-bond 
+if (!link-network-bridge 
+!link-network-bond 
+!link-network-tunnel 
 hashmap_isempty(link-network-vlans)