Merge ~ltrager/maas:enable_vnic_characteristics_on_s390x into maas:master

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: f11fbf1b55808d64255682f104ef00ace589119b
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ltrager/maas:enable_vnic_characteristics_on_s390x
Merge into: maas:master
Diff against target: 114 lines (+78/-9)
2 files modified
src/metadataserver/tests/test_vendor_data.py (+48/-1)
src/metadataserver/vendor_data.py (+30/-8)
Reviewer Review Type Date Requested Status
Björn Tillenius Approve
MAAS Lander Approve
Review via email: mp+401011@code.launchpad.net

Commit message

Automatically enable VNIC characteristics on S390X when deploying a VM host

S390X partitions do not forward packets over bridges by default. To allow
packet forward VNIC characteristics must be enabled. Do this by default
when a VM host is deployed.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b enable_vnic_characteristics_on_s390x lp:~ltrager/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 32e91beee705559183f74408858169aee68ed940

review: Approve
Revision history for this message
Björn Tillenius (bjornt) wrote :

Looks good to me, but please see comment inline.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/metadataserver/tests/test_vendor_data.py b/src/metadataserver/tests/test_vendor_data.py
index 3fd39d4..cc9288f 100644
--- a/src/metadataserver/tests/test_vendor_data.py
+++ b/src/metadataserver/tests/test_vendor_data.py
@@ -422,7 +422,54 @@ class TestGenerateKVMPodConfiguration(MAASServerTestCase):
422 {422 {
423 "path": "/etc/rc.local",423 "path": "/etc/rc.local",
424 "content": (424 "content": (
425 "#!/bin/sh\n" "ppc64_cpu --smt=off\n" "exit 0\n"425 "#!/bin/sh\n"
426 "# This file was generated by MAAS to disable SMT "
427 "on PPC64EL since\n"
428 "# VMs are not supported otherwise.\n"
429 "ppc64_cpu --smt=off\n"
430 "exit 0\n"
431 ),
432 "permissions": "0755",
433 },
434 ],
435 ),
436 config,
437 )
438 self.assertIn(("runcmd", ["/etc/rc.local"]), config)
439
440 def test_enables_vnic_characteristics_on_s390x(self):
441 password = "123secure"
442 self.patch(vendor_data, "_generate_password").return_value = password
443 node = factory.make_Node(
444 status=NODE_STATUS.DEPLOYING,
445 osystem="ubuntu",
446 netboot=False,
447 architecture="s390x/generic",
448 register_vmhost=True,
449 )
450 config = list(generate_kvm_pod_configuration(node))
451 self.assertIn(
452 (
453 "write_files",
454 [
455 {
456 "path": "/etc/rc.local",
457 "content": (
458 "#!/bin/bash\n"
459 "# This file was generated by MAAS to enable VNIC "
460 "characteristics to allow\n"
461 "# packets to be forwarded over a bridge.\n"
462 'for bridge in $(bridge link show | awk -F"[ :]" '
463 "'{ print $3 }'); do\n"
464 " # Isolated networks are not associated with "
465 "a qeth and do not need\n"
466 " # anything enabled. Ignore them.\n"
467 " phy_addr=$(lsqeth $bridge 2>/dev/null | "
468 "awk -F ': ' '/cdev0/ {print $2}')\n"
469 ' if [ -n "$phy_addr" ]; then\n'
470 " chzdev $phy_addr vnicc/learning=1\n"
471 " fi\n"
472 "done\n"
426 ),473 ),
427 "permissions": "0755",474 "permissions": "0755",
428 },475 },
diff --git a/src/metadataserver/vendor_data.py b/src/metadataserver/vendor_data.py
index 8236e8e..81092df 100644
--- a/src/metadataserver/vendor_data.py
+++ b/src/metadataserver/vendor_data.py
@@ -251,19 +251,41 @@ def generate_kvm_pod_configuration(node):
251 },251 },
252 ]252 ]
253253
254 # disable SMT on ppc64el since VMs are not supported otherwise
255 if arch == "ppc64el":254 if arch == "ppc64el":
255 rc_script = dedent(
256 """\
257 #!/bin/sh
258 # This file was generated by MAAS to disable SMT on PPC64EL since
259 # VMs are not supported otherwise.
260 ppc64_cpu --smt=off
261 exit 0
262 """
263 )
264 elif arch == "s390x":
265 rc_script = dedent(
266 """\
267 #!/bin/bash
268 # This file was generated by MAAS to enable VNIC characteristics to allow
269 # packets to be forwarded over a bridge.
270 for bridge in $(bridge link show | awk -F"[ :]" '{ print $3 }'); do
271 # Isolated networks are not associated with a qeth and do not need
272 # anything enabled. Ignore them.
273 phy_addr=$(lsqeth $bridge 2>/dev/null | awk -F ': ' '/cdev0/ {print $2}')
274 if [ -n "$phy_addr" ]; then
275 chzdev $phy_addr vnicc/learning=1
276 fi
277 done
278 """
279 )
280 else:
281 rc_script = None
282
283 if rc_script:
256 rc_local = "/etc/rc.local"284 rc_local = "/etc/rc.local"
257 yield "write_files", [285 yield "write_files", [
258 {286 {
259 "path": rc_local,287 "path": rc_local,
260 "content": dedent(288 "content": rc_script,
261 """\
262 #!/bin/sh
263 ppc64_cpu --smt=off
264 exit 0
265 """
266 ),
267 "permissions": "0755",289 "permissions": "0755",
268 },290 },
269 ]291 ]

Subscribers

People subscribed via source and target branches