Commit Graph

10 Commits

Author SHA1 Message Date
Jenkins ca84a77306 Merge "image-tools: Precise dev-bus-id generation" 2017-05-02 07:16:47 +00:00
Andreas Scheuring 335150cc7b guest tools: Fix layer2 configuration
The guest image tools do not properly configure a network interface
in the image for layer2. When hipersockets is used, setting the MAC
fails with "Operation not supported". No communication with the
dhcp on the network is possible.

OSA was not affected as layer2 is the default for OSA if nothing is
provided (for hipersockets it's layer3).

Change-Id: I203a8d4e62afb10666e9b131164e77ab4f85d890
Closes-Bug: #1685737
2017-04-24 11:17:12 +02:00
Andreas Scheuring 0b086b4b66 image-tools: Precise dev-bus-id generation
Adding an additional comment on how the device-bus-id is generated.

Change-Id: Ief9c57866578dba13ce0741dd43448c35eae4610
Closes-Bug: #1682155
2017-04-20 17:08:43 +02:00
Andreas Scheuring 3050554efd guest-image-tools: Fix startup order for autoconfigure_networking.service
Sometimes the autoconfigure_networking.service fails with the following
errors:

  /lib/s390-tools/lsznet.raw: line 187: cannot create temp file for
  here-document: Permission denied
  lsznet.raw: ERROR: sysfs reported 0 CHPIDs instead of expected 8
  /sbin/znetconf: line 1302: cannot create temp file for here-document:
  Read-only file system
  znetconf: Error: No configuration found for device ID 0.0.0004

This happens as the service started too early, even before the local
filesystem is available. Changing the systemd startup order to
start the service after the file system target is reached solves
the issue.

Change-Id: I90fd98ee225405d8d9d60b466a46efaa1aa6b6d8
Closes-Bug: #1670349
2017-03-06 17:47:17 +01:00
Andreas Scheuring 3c02543ea8 guest-tools: Fix "There are no ccwgroup devices"
The error occures if the directory '/sys/bus/ccwgroup/' does not
exist (znetconf is checking for that). This directory gets created
when the 'ccwgroup' kernel module is initialized. Therefore the
solution is to ensure that this kernel module is loaded.

Change-Id: Ifc8917b702f7a8913c5662fcbb9f15c1248ed55d
Closes-Bug: #1666524
2017-03-06 17:47:17 +01:00
Andreas Scheuring 93929b09a3 Tests for guest image tools
Adding Testcases for the functions used by guest-image-tools. The
tests are executed by python and integrated into the py27 and py35
test jobs.

Sometimes the guest image tools call external commands
(like ip, zneconf,...). for this case dummy versions of those
executeables are placed in a faked root directory. The test takes
care of exectuing those commands in this directory, therefore the
dummy (bash) executables are chosen over the real ones.
However those dummy executeables cannot replace mocks where a lot
of assertions can be done. As workaround the dummy executeable just
check if it was called with a certain list of arguments. The test
needs to exactly pass those arguments in order to succeed.

Ideally those tests would be functional tests running on a real
system z envrionement. Doing so we could verify if the real
operations are working as well.

Change-Id: I35d0840c2e4bb9d216d57a5927f20b3f0ff182c0
2017-03-06 17:47:15 +01:00
Andreas Scheuring dad341f2ff Move functions into separate method
Moving all bash functions into a separate file. This avoids that the
main script gets executed when testing function, as now just this
new function file get be sourced.

Change-Id: Ia9219080790d92f671618ba4aef90e2b6bab78b3
2017-03-06 17:46:24 +01:00
Andreas Scheuring a6bee99ff0 Split up autoconfigure_networking into functions
This is required in order to move those functions into a separate
file. This file can than be easily used for testing.

Change-Id: Ib3c7a2cc0625ecda51f21a52d374bd7c7e340dbd
2017-03-06 17:43:49 +01:00
Andreas Scheuring 9c6c952b62 Set exit on error
Since some of the functions are getting called in subshells. Calling
exit in a subshell just quits the subshell but not the whole
programm. As some of the functions should lead to a programm
termination, a fix is required.

Setting "set -e" ensures that the whole programm is being exited in
such cases.

Change-Id: I3269534029e40109e7cec580a83a27f489acbe17
2017-03-03 08:51:11 +01:00
Andreas Scheuring 2544312093 Add DPM Guest Image Tools
The guest image tools must be installed inside an operating system
to allow automated network configuration.

* autoconfigure_networking
  A systemd service that starts before cloud-init. It groups qeth
  devices to network interfaces that can be consumed by Linux.
  Therefore all devices listed in /proc/cmdline get configured with
  the provided portno in layer2 mode. The format of the data in the
  cmdline must be

        <devno>,<portno>[,<mac>];

* Setmac
  A udev rule and the corresponding script to change the MAC address
  of a network interface from within the guests operating system.
  This is done along the data provided via /proc/cmdline. The format
  of the data in the cmdline must be

        <devno>,<portno>,<mac>;

Note: The boot-os-specific-parameters property of a partition is used
to pass in data from Nova into the operation system. This data is
appended to /proc/cmdline.

Change-Id: Iea199b085aca34769128a8691e95e790a396ee80
2017-02-20 09:34:19 +01:00