[libvirt] [PATCH 0/8] Make NSS module lookup by libvirt domain names too

Michal Privoznik mprivozn at redhat.com
Wed Nov 30 09:59:27 UTC 2016


So far, the NSS module relies on guests providing hostnames
during DHCP transaction, because if they do it's recorded in a
json file that NSS module consults when doing the hostname
translation. But there are few cases where this is not enough:
some system (e.g. old RHEL6) don't provide hostname at all.

If that's the case we can maintain a separate file $bridge.macs
where we would keep a list of pairs <domain, mac address list>.
Thus next time when doing hostname translation we can look up MAC
address list for given domain, and then lookup the MAC <-> IP
mapping in $bridge.status. It's a bit clunky, but it's our best
shot.

Michal Privoznik (8):
  network: Don't unlock non-locked network driver
  nssmock: Prefer free() over VIR_FREE()
  virstring: Introduce virStringListAdd
  virstring: Introduce virStringListRemove
  util: Introduce virFileRewriteStr
  util: Introduce virMACMap module
  network: Track MAC address map
  nss: Lookup by libvirt domain names too

 cfg.mk                               |   2 +-
 docs/nss.html.in                     |  13 +-
 po/POTFILES.in                       |   1 +
 src/Makefile.am                      |   9 +
 src/conf/network_conf.h              |   4 +
 src/conf/virsecretobj.c              |  20 +-
 src/libvirt_private.syms             |  12 ++
 src/network/bridge_driver.c          |  95 ++++++++-
 src/network/leaseshelper.c           |  14 +-
 src/util/virfile.c                   |  24 ++-
 src/util/virfile.h                   |   7 +-
 src/util/virmacmap.c                 | 399 +++++++++++++++++++++++++++++++++++
 src/util/virmacmap.h                 |  48 +++++
 src/util/virstring.c                 |  87 ++++++++
 src/util/virstring.h                 |   6 +
 src/util/virxml.c                    |   4 +-
 tests/Makefile.am                    |  14 ++
 tests/nssdata/virbr0.macs            |  23 ++
 tests/nssdata/virbr0.status          |   5 +
 tests/nssdata/virbr1.macs            |  21 ++
 tests/nssdata/virbr1.status          |   5 +
 tests/nssmock.c                      |  25 ++-
 tests/nsstest.c                      |   2 +
 tests/virmacmapmock.c                |  29 +++
 tests/virmacmaptest.c                | 232 ++++++++++++++++++++
 tests/virmacmaptestdata/complex.json |  45 ++++
 tests/virmacmaptestdata/empty.json   |   3 +
 tests/virmacmaptestdata/simple.json  |   8 +
 tests/virmacmaptestdata/simple2.json |  16 ++
 tests/virstringtest.c                |  80 +++++++
 tools/nss/libvirt_nss.c              | 173 +++++++++++----
 31 files changed, 1340 insertions(+), 86 deletions(-)
 create mode 100644 src/util/virmacmap.c
 create mode 100644 src/util/virmacmap.h
 create mode 100644 tests/nssdata/virbr0.macs
 create mode 100644 tests/nssdata/virbr1.macs
 create mode 100644 tests/virmacmapmock.c
 create mode 100644 tests/virmacmaptest.c
 create mode 100644 tests/virmacmaptestdata/complex.json
 create mode 100644 tests/virmacmaptestdata/empty.json
 create mode 100644 tests/virmacmaptestdata/simple.json
 create mode 100644 tests/virmacmaptestdata/simple2.json

-- 
2.8.4




More information about the libvir-list mailing list