Mount options for partitions and LVM volumes
Related-Prod: PROD-35384
Change-Id: Id6e684548f4ca993e21fd4884bf058a2e39a9bbb
diff --git a/_modules/maasng.py b/_modules/maasng.py
index 4002e05..06d9ef6 100644
--- a/_modules/maasng.py
+++ b/_modules/maasng.py
@@ -501,7 +501,7 @@
return list_partitions(partition)[name]
-def create_partition(hostname, disk, size, fs_type=None, mount=None):
+def create_partition(hostname, disk, size, fs_type=None, mount=None, mount_options=None):
"""
Create new partition on device.
@@ -551,6 +551,8 @@
data = {
"mount_point": mount
}
+ if mount_options:
+ data["mount_options"] = mount_options
# TODO validation
json_res = json.loads(maas.post(u"api/2.0/nodes/{0}/blockdevices/{1}/partition/{2}".format(
@@ -1063,7 +1065,7 @@
def create_volume(hostname, volume_name, volume_group, size, fs_type=None,
- mount=None):
+ mount=None, mount_options=None):
"""
Create volume on volume group.
@@ -1100,7 +1102,7 @@
if fs_type != None or mount != None:
ret = create_volume_filesystem(
- hostname, volume_group + "-" + volume_name, fs_type, mount)
+ hostname, volume_group + "-" + volume_name, fs_type, mount, mount_options)
return True
@@ -1156,7 +1158,7 @@
# END LVM
-def create_volume_filesystem(hostname, device, fs_type=None, mount=None):
+def create_volume_filesystem(hostname, device, fs_type=None, mount=None, mount_options=None):
maas = _create_maas_client()
system_id = get_machine(hostname)["system_id"]
@@ -1172,6 +1174,8 @@
if mount != None:
data["mount_point"] = mount
+ if mount_options:
+ data["mount_options"] = mount_options
# TODO validation
json_res = json.loads(maas.post(u"/api/2.0/nodes/{0}/blockdevices/{1}/".format(
system_id, blockdevices_id), "mount", **data).read())