Status: New
Owner: ----

New issue 1074 by [email protected]: LXC: support more then one disk
https://code.google.com/p/ganeti/issues/detail?id=1074

Hi,

currently the LXC hypervisor supports only one disk. One solution could be, to allow multiple disks via lxc.mount.entry directive. I abused the name of an disk to encode the mount entry information (mountpoint, filesystem type and mount options). It's up to the user to make sure, that the disk contains the specified filesystem. lxc-start fails if it can't mount the disk.

--- old/hv_lxc.py  2015-03-09 10:37:19.000000000 +0100
+++ new/hv_lxc.py  2015-04-22 07:59:13.000000000 +0200

  def _CreateConfigFile(self, instance, sda_dev_path):
...
     out.append("lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0")
     out.append("lxc.mount.entry = sysfs sys sysfs defaults 0 0")

+    # aditional disks
+    for idx, disk in enumerate(instance.disks_info):
+      if idx == 0:
+        continue
+      if disk.name is None:
+        raise HypervisorError("In order to support LXC with more than one"
+ " disk attached to it, you must give every disk" + " starting from position 1 a name in an fstab"
+                              " like manner: mountpoint:filesystem:options"
+ " example: name='/data:xfs:nosuid\,nodev\,noexec'")
+      fstab_line = disk.name.split(':')
+      if len(fstab_line) != 3:
+        raise HypervisorError("In order to support LXC with more than one"
+ " disk attached to it, you must give every disk" + " starting from position 1 a name in an fstab"
+                              " like manner: mountpoint:filesystem:options"
+ " example: name='/data:xfs:nosuid\,nodev\,noexec'")
+      out.append("# DISK %d" % idx)
+      out.append("lxc.mount.entry = %s %s %s %s,create=dir 0 0" %
+                 ( disk.logical_id[1],
+                   fstab_line[0].strip('/'),
+                   fstab_line[1],
+                   fstab_line[2]  ) )
+
     # CPUs
     if instance.hvparams[constants.HV_CPU_MASK]:
...
...
...

  def _VerifyDiskRequirements(cls, block_devices):
...
     if len(block_devices) == 0:
       raise HypervisorError("LXC cannot have diskless instances.")

-    if len(block_devices) > 1:
- raise HypervisorError("At the moment, LXC cannot support more than one"
-                            " disk attached to it. Please create this"
-                            " instance anew with fewer disks.")

Thanks, Sascha.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

Reply via email to