diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml
index 53194c700..32ec87f8e 100644
--- a/data/org.freedesktop.UDisks2.xml
+++ b/data/org.freedesktop.UDisks2.xml
@@ -148,7 +148,7 @@
@level: The RAID level for the array.
@name: The name for the array.
@chunk: The chunk size (in bytes) or 0 if @level is raid1.
- @options: Options - known options (in addition to standard options) include bitmap (of type 'ay').
+ @options: Options - known options (in addition to standard options) include bitmap (of type 'ay') and version (of type 'ay').
@resulting_array: An object path to the object implementing the #org.freedesktop.UDisks2.MDRaid interface.
@since: 2.0.0
@@ -171,6 +171,10 @@
is not present, it is up to mdadm to decide
whether to create an internal bitmap (typically for arrays larger
than 100 GB) or not.
+
+ The @version option specifies the MD metadata version, for example
+ '0.90'. If not specified the default medata version specified by
+ mdadm is used. (since 2.11)
-->
diff --git a/src/tests/dbus-tests/test_mdraid.py b/src/tests/dbus-tests/test_mdraid.py
index 5aa4222ae..0a8f5277e 100644
--- a/src/tests/dbus-tests/test_mdraid.py
+++ b/src/tests/dbus-tests/test_mdraid.py
@@ -77,14 +77,17 @@ def _force_remove(self, array_name, array_members):
def _zero_superblock(self, device):
self.run_command('mdadm --zero-superblock --force %s' % device)
- def _array_create(self, array_name, bitmap=None):
+ def _array_create(self, array_name, bitmap=None, version=None):
# set the 'force' cleanup now in case create fails
self.addCleanup(self._force_remove, array_name, [m.path for m in self.members])
d = self.no_options
- if bitmap:
+ if bitmap or version:
d = dbus.Dictionary(signature='sv')
- d['bitmap'] = self.str_to_ay(bitmap)
+ if bitmap:
+ d['bitmap'] = self.str_to_ay(bitmap)
+ if version:
+ d['version'] = self.str_to_ay(version)
manager = self.get_object('/Manager')
with wait_for_action('resync'):
@@ -391,6 +394,25 @@ def test_bitmap_location(self):
dbus_bitmap.assertEqual(self.str_to_ay(sys_bitmap))
self.assertStartswith(sys_bitmap, '+')
+ @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE)
+ def test_metadata_version(self):
+ array_name = 'udisks_test_version'
+ array = self._array_create(array_name, version='0.90')
+
+ # check IdVersion on the Block interface
+ for member in self.members:
+ md_version = self.get_property(member.obj, '.Block', 'IdVersion')
+ md_version.assertEqual('0.90.0')
+
+ array.Delete(self.no_options, dbus_interface=self.iface_prefix + '.MDRaid')
+ self.udev_settle()
+
+ array = self._array_create(array_name)
+ # check IdVersion on the Block interface
+ for member in self.members:
+ md_version = self.get_property(member.obj, '.Block', 'IdVersion')
+ md_version.assertEqual('1.2')
+
@udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE)
def test_request_action(self):
diff --git a/src/udiskslinuxmanager.c b/src/udiskslinuxmanager.c
index 491edb92b..139be7caa 100644
--- a/src/udiskslinuxmanager.c
+++ b/src/udiskslinuxmanager.c
@@ -562,6 +562,7 @@ handle_mdraid_create (UDisksManager *_object,
guint disks_top = 0;
gboolean success = FALSE;
const gchar *option_bitmap = NULL;
+ const gchar *option_version = NULL;
if (!udisks_daemon_util_get_caller_uid_sync (manager->daemon,
invocation,
@@ -767,7 +768,8 @@ handle_mdraid_create (UDisksManager *_object,
disks[disks_top] = NULL;
g_variant_lookup (arg_options, "bitmap", "^&ay", &option_bitmap);
- if (!bd_md_create (array_name, arg_level, disks, 0, NULL, option_bitmap, arg_chunk, NULL, &error))
+ g_variant_lookup (arg_options, "version", "^&ay", &option_version);
+ if (!bd_md_create (array_name, arg_level, disks, 0, option_version, option_bitmap, arg_chunk, NULL, &error))
{
g_prefix_error (&error, "Error creating RAID array: ");
udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), FALSE, error->message);