<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/src/platform/tests, branch th/dedup-multi</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>platform: use NMDedupMultiIndex for routes in NMPCache</title>
<updated>2017-06-26T09:48:27+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-06-21T08:53:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=cb85c36b204232870357844ab915a65b9e38ef4a'/>
<id>cb85c36b204232870357844ab915a65b9e38ef4a</id>
<content type='text'>
Rework platform object cache to use NMDedupMultiIndex.

Already previously, NMPCache used NMMultiIndex and had thus
O(1) for most operations. What is new is:

- NMDedupMultiIndex preserves the order of the cached items.
  This is important to handle routes properly as kernel will
  replace the first matching route based on network/plen/metric
  properties. See related bug rh#1337855.
  Without tracking the order of routes as they are exposed
  by kernel, we cannot properly maintain the route cache.

- All NMPObject instances are now treated immutable, refcounted
  and get de-duplicated via NMDedupMultiIndex. This allows
  to have a global NMDedupMultiIndex that can be shared with
  NMIP4Config and NMRouteManager. It also allows to share the
  objects themselves.
  Immutable objects are so much nicer. We can get rid of the
  update pre-hook callback, which was required previously because
  we would mutate the object inplace. Now, we can just update
  the cache, and compare obj_old and obj_new after the fact.

- NMMultiIndex was treated as an internal of NMPCache. On the other
  hand, NMDedupMultiIndex exposes NMDedupMultiHeadEntry, which is
  basically an object that allows to iterate over all related
  objects. That means, we can now lookup objects in the cache
  and give the NMDedupMultiHeadEntry instance to the caller,
  which then can iterate the list on it's own -- without need
  for copying anything.
  Currently, at various places we still create copies of lookup
  results. That can be improved later.

The ability to share NMPObject instances should enable us to
significantly improve performance and scale with large number
of routes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rework platform object cache to use NMDedupMultiIndex.

Already previously, NMPCache used NMMultiIndex and had thus
O(1) for most operations. What is new is:

- NMDedupMultiIndex preserves the order of the cached items.
  This is important to handle routes properly as kernel will
  replace the first matching route based on network/plen/metric
  properties. See related bug rh#1337855.
  Without tracking the order of routes as they are exposed
  by kernel, we cannot properly maintain the route cache.

- All NMPObject instances are now treated immutable, refcounted
  and get de-duplicated via NMDedupMultiIndex. This allows
  to have a global NMDedupMultiIndex that can be shared with
  NMIP4Config and NMRouteManager. It also allows to share the
  objects themselves.
  Immutable objects are so much nicer. We can get rid of the
  update pre-hook callback, which was required previously because
  we would mutate the object inplace. Now, we can just update
  the cache, and compare obj_old and obj_new after the fact.

- NMMultiIndex was treated as an internal of NMPCache. On the other
  hand, NMDedupMultiIndex exposes NMDedupMultiHeadEntry, which is
  basically an object that allows to iterate over all related
  objects. That means, we can now lookup objects in the cache
  and give the NMDedupMultiHeadEntry instance to the caller,
  which then can iterate the list on it's own -- without need
  for copying anything.
  Currently, at various places we still create copies of lookup
  results. That can be improved later.

The ability to share NMPObject instances should enable us to
significantly improve performance and scale with large number
of routes.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform: let NMPObject implement NMDedupIndexObj</title>
<updated>2017-06-26T09:48:26+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-06-12T16:39:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=195b673f5e6db8541261be66a0335c4d6a1383cb'/>
<id>195b673f5e6db8541261be66a0335c4d6a1383cb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>all: add base object type in "nm-obj.h"</title>
<updated>2017-06-26T08:13:33+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-06-04T18:45:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=de6ea2d597a3a5dc9bfd301e43aa8628aeb83242'/>
<id>de6ea2d597a3a5dc9bfd301e43aa8628aeb83242</id>
<content type='text'>
Platform has it's own, simple implementation of object types:
NMPObject. Extract a base type and move it to "shared/nm-utils/nm-obj.h"
so it can be reused.

The base type is trival, but it allows us to implement other objects
which are compatible with NMPObjects. Currently there is no API for generic
NMObjBaseInst type, so compatible in this case only means, that they
can be used in the same context (see example below).
The only thing that you can do with a NMObjBaseInst is check it's
NMObjBaseClass.

Incidentally, NMObjBaseInst is also made compatible to GTypeInstance.
It means, an NMObjBaseInst is not necessarily a valid GTypeInstance (like NMPObject
is not), but it could be implemented as such.

For example, you could do:

    if (NMP_CLASS_IS_VALID ((NMPClass *) obj-&gt;klass)) {
        /* is an NMPObject */
    } else if (G_TYPE_CHECK_INSTANCE_TYPE (obj, NM_TYPE_SOMETHING)) {
        /* it a NMSometing GType */
    } else {
        /* something else? */
    }

The reason why NMPObject is not implemented as proper GTypeInstance is
because it would require us to register a GType (like
g_type_register_fundamental). However, then the NMPClass struct can
no longer be const and immutable memory. But we could.

NMObjBaseInst may or may not be a GTypeInstance. In a sense, it's
a base type of GTypeInstance and all our objects should be based
on it (optionally, they we may make them valid GTypes too).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Platform has it's own, simple implementation of object types:
NMPObject. Extract a base type and move it to "shared/nm-utils/nm-obj.h"
so it can be reused.

The base type is trival, but it allows us to implement other objects
which are compatible with NMPObjects. Currently there is no API for generic
NMObjBaseInst type, so compatible in this case only means, that they
can be used in the same context (see example below).
The only thing that you can do with a NMObjBaseInst is check it's
NMObjBaseClass.

Incidentally, NMObjBaseInst is also made compatible to GTypeInstance.
It means, an NMObjBaseInst is not necessarily a valid GTypeInstance (like NMPObject
is not), but it could be implemented as such.

For example, you could do:

    if (NMP_CLASS_IS_VALID ((NMPClass *) obj-&gt;klass)) {
        /* is an NMPObject */
    } else if (G_TYPE_CHECK_INSTANCE_TYPE (obj, NM_TYPE_SOMETHING)) {
        /* it a NMSometing GType */
    } else {
        /* something else? */
    }

The reason why NMPObject is not implemented as proper GTypeInstance is
because it would require us to register a GType (like
g_type_register_fundamental). However, then the NMPClass struct can
no longer be const and immutable memory. But we could.

NMObjBaseInst may or may not be a GTypeInstance. In a sense, it's
a base type of GTypeInstance and all our objects should be based
on it (optionally, they we may make them valid GTypes too).
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: minor fix in _wait_for_ipv6_addr_non_tentative()</title>
<updated>2017-05-31T09:01:52+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-05-31T09:01:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=b8707cba3c6dcdcdd25bec17314f658cb71fa9fb'/>
<id>b8707cba3c6dcdcdd25bec17314f658cb71fa9fb</id>
<content type='text'>
For better or worse, there is a platform argument. Use it instead
of the singleton.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For better or worse, there is a platform argument. Use it instead
of the singleton.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: reorder wait-loop in test_ip6_route_options()</title>
<updated>2017-05-31T08:46:43+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-05-31T07:41:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=d6aae6af7202e7d28d6a52fad2376ee3ce6e1583'/>
<id>d6aae6af7202e7d28d6a52fad2376ee3ce6e1583</id>
<content type='text'>
- no need to call nm_platform_process_events() after
  nmtstp_wait_for_signal(). The latter processes all events
  that are pending.
- with addr_n number of addresses, we still only want to wait
  a maximum time, not for each addresss individually. Basically,
  the for-loop must be inside NMTST_WAIT(), not the other way around.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- no need to call nm_platform_process_events() after
  nmtstp_wait_for_signal(). The latter processes all events
  that are pending.
- with addr_n number of addresses, we still only want to wait
  a maximum time, not for each addresss individually. Basically,
  the for-loop must be inside NMTST_WAIT(), not the other way around.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: make timeout_ms argument for nmtstp_wait_for_signal() signed</title>
<updated>2017-05-31T08:46:43+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-05-31T08:09:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=07751b444bbf92b77687ba5a2cfeaeb3c449bbd2'/>
<id>07751b444bbf92b77687ba5a2cfeaeb3c449bbd2</id>
<content type='text'>
Having an unsigned "guint timeout_ms" argument is very inconvenient, because

    nmtstp_wait_for_signal (NM_PLATFORM_GET (), end_time - now_time);

might easily be negative. In such a case, the correct behavior
is to wait not at all.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Having an unsigned "guint timeout_ms" argument is very inconvenient, because

    nmtstp_wait_for_signal (NM_PLATFORM_GET (), end_time - now_time);

might easily be negative. In such a case, the correct behavior
is to wait not at all.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: change nmtstp_wait_for_signal() to wait with zero timeout</title>
<updated>2017-05-31T08:46:43+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-05-31T08:03:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=af9c474844fb109c49adba2653a2af9bf6423f29'/>
<id>af9c474844fb109c49adba2653a2af9bf6423f29</id>
<content type='text'>
The previous behavior, of treating timeout_ms as *no timeout*, makes
no sense. At least not for unit tests. If you have a really long timeout,
then set it. "0" should really mean to schedule a zero timeout.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous behavior, of treating timeout_ms as *no timeout*, makes
no sense. At least not for unit tests. If you have a really long timeout,
then set it. "0" should really mean to schedule a zero timeout.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: fix test_ip6_route_options</title>
<updated>2017-05-30T17:00:54+00:00</updated>
<author>
<name>Francesco Giudici</name>
<email>fgiudici@redhat.com</email>
</author>
<published>2017-05-30T17:00:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=21a941d40b6619a6243aa561b2c8d4573fccfc34'/>
<id>21a941d40b6619a6243aa561b2c8d4573fccfc34</id>
<content type='text'>
when adding a route with RTA_PREFSRC some kernel versions will reject
the request if the specified source address is still tentative: be sure
that the just added addresses are no more tentative before adding the
routes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
when adding a route with RTA_PREFSRC some kernel versions will reject
the request if the specified source address is still tentative: be sure
that the just added addresses are no more tentative before adding the
routes.
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: use nm_platform_link_veth_add() to create veth pair in test</title>
<updated>2017-05-27T21:16:56+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-05-26T18:05:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=d3c71ce4dade9f2ba3e966f63bd7554d9c40f95a'/>
<id>d3c71ce4dade9f2ba3e966f63bd7554d9c40f95a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>platform/tests: recreate test environment for each route test</title>
<updated>2017-05-27T21:16:56+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2017-05-26T10:21:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=2c4d9f66aeac9f2e79baea963f4fbd5573f402d0'/>
<id>2c4d9f66aeac9f2e79baea963f4fbd5573f402d0</id>
<content type='text'>
Use nmtstp_env1_add_test_func*() to setup and teardown a new
interface for each test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use nmtstp_env1_add_test_func*() to setup and teardown a new
interface for each test.
</pre>
</div>
</content>
</entry>
</feed>
