curtin-dev team mailing list archive
-
curtin-dev team
-
Mailing list archive
-
Message #01102
[Merge] ~mwhudson/curtin:only-eckd-dasds-extract_storage_config into curtin:master
Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:only-eckd-dasds-extract_storage_config into curtin:master.
Commit message:
storage_config: only produce type: dasd actions for ECKD dasds
this also attempts to improve the dasd documentation a bit
Requested reviews:
Server Team CI bot (server-team-bot): continuous-integration
curtin developers (curtin-dev)
For more details, see:
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/394224
This depends on https://github.com/canonical/probert/pull/101 to do anything interesting so let's not merge this until that is approved.
--
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:only-eckd-dasds-extract_storage_config into curtin:master.
diff --git a/curtin/storage_config.py b/curtin/storage_config.py
index 494b142..84825f6 100644
--- a/curtin/storage_config.py
+++ b/curtin/storage_config.py
@@ -981,6 +981,8 @@ class DasdParser(ProbertParser):
probe_data_key = 'dasd'
def asdict(self, dasd_config):
+ if dasd_config.get("dasd_type", "ECKD") != "ECKD":
+ return None
dasd_name = os.path.basename(dasd_config['name'])
device_id = dasd_config['device_id']
blocksize = dasd_config['blocksize']
diff --git a/doc/topics/storage.rst b/doc/topics/storage.rst
index ebcf8a4..75c5537 100644
--- a/doc/topics/storage.rst
+++ b/doc/topics/storage.rst
@@ -55,14 +55,21 @@ commands include:
Dasd Command
~~~~~~~~~~~~
-The ``dasd`` command sets up a s390x system DASD device for use by curtin.
-DASD devices require several parameters to configure the low-level structure
-of the block device. Curtin will examine the configuration and determine if
-the specified DASD matches the configuration. If the device does not match
-the configuration Curtin will perform a format of the device to achieve the
-required configuration. Once a DASD device has been formatted it may be used
-like regular Linux block devices and can be partitioned (with limitations)
-with Curtin's ``disk`` command. The ``dasd`` command may contain the following
+
+The ``dasd`` command sets up an ECKD s390x system DASD device for use
+by curtin. FBA DASD devices do not require this low level set
+up. ECKD DASD drives can also be passed via virtio to KVM virtual
+machines and in this case this set up must be done on the host prior
+to starting the virtual machine.
+
+DASD devices require several parameters to configure the low-level
+structure of the block device. Curtin will examine the configuration
+and determine if the specified DASD matches the configuration. If the
+device does not match the configuration Curtin will perform a format
+of the device to achieve the required configuration. Once a DASD
+device has been formatted it may be used like regular Linux block
+devices and can be partitioned (with limitations) with Curtin's
+``disk`` command. The ``dasd`` command may contain the following
keys:
**device_id**: *<ccw bus_id: X.Y.ZZZZ>*
@@ -138,11 +145,12 @@ The disk command sets up disks for use by curtin. It can wipe the disks, create
partition tables, or just verify that the disks exist with an existing partition
table. A disk command may contain all or some of the following keys:
-**ptable**: *msdos, gpt*
+**ptable**: *msdos, gpt, vtoc*
If the ``ptable`` key is present and a curtin will create an empty
-partition table of that type on the disk. Curtin supports msdos and
-gpt partition tables.
+partition table of that type on the disk. On almost all drives,
+curtin supports msdos and gpt partition tables; ECKD DASD drives on
+s390x mainframes can only use the "vtoc" partition table.
**serial**: *<serial number>*
diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py
index a38f9cd..c895344 100644
--- a/tests/unittests/test_storage_config.py
+++ b/tests/unittests/test_storage_config.py
@@ -783,7 +783,6 @@ class TestDasdParser(CiTestCase):
def test_dasd_asdict(self):
""" DasdParser converts known dasd_data to expected dict. """
- devname = "/dev/dasda"
expected_dict = {
'type': 'dasd',
'id': 'dasd-dasda',
@@ -792,9 +791,35 @@ class TestDasdParser(CiTestCase):
'mode': 'quick',
'disk_layout': 'cdl',
}
- dasd_data = self.dasd.class_data[devname]
+ dasd_data = self.dasd.class_data["/dev/dasda"]
self.assertDictEqual(expected_dict, self.dasd.asdict(dasd_data))
+ def test_dasd_includes_ECKD(self):
+ """ DasdParser converts known dasd_data to expected dict. """
+ expected_dict = {
+ 'type': 'dasd',
+ 'id': 'dasd-dasda',
+ 'device_id': '0.0.1522',
+ 'blocksize': 4096,
+ 'mode': 'quick',
+ 'disk_layout': 'cdl',
+ }
+ dasd_data = self.dasd.class_data["/dev/dasda"]
+ dasd_data['dasd_type'] = "ECKD"
+ self.assertDictEqual(expected_dict, self.dasd.asdict(dasd_data))
+
+ def test_dasd_skips_FBA(self):
+ """ DasdParser skips FBA dasds. """
+ dasd_data = self.dasd.class_data["/dev/dasda"]
+ dasd_data['dasd_type'] = "FBA"
+ self.assertIsNone(self.dasd.asdict(dasd_data))
+
+ def test_dasd_skips_virt(self):
+ """ DasdParser skips virt dasds. """
+ dasd_data = self.dasd.class_data["/dev/dasda"]
+ dasd_data['dasd_type'] = "virt"
+ self.assertIsNone(self.dasd.asdict(dasd_data))
+
@skipUnlessJsonSchema()
def test_dasd_parser_parses_all_dasd_devs(self):
""" DasdParser returns expected dicts for known dasd probe data."""
@@ -802,6 +827,15 @@ class TestDasdParser(CiTestCase):
self.assertEqual(5, len(configs))
self.assertEqual(0, len(errors))
+ @skipUnlessJsonSchema()
+ def test_dasd_parser_skips_virt_FBA(self):
+ """ DasdParser returns expected dicts for known dasd probe data."""
+ self.dasd.class_data["/dev/dasda"]['dasd_type'] = "FBA"
+ self.dasd.class_data["/dev/dasdb"]['dasd_type'] = "virt"
+ configs, errors = self.dasd.parse()
+ self.assertEqual(3, len(configs))
+ self.assertEqual(0, len(errors))
+
class TestDmCryptParser(CiTestCase):