OpenLMI Mounting Model

This page presents a draft of a CIM model that will be used to implement mounting in OpenLMI. The implemented provider will be used to mount and unmount local and remote filesystems. The provider will support binding mounts as well.

Mouting pic

Classes


[ Description (
    "Class for representing mount options. Basic boolean properties represent "
    "filesystem independent mount options (as listed in mount(8)). Options "
    "'auto' and 'user' are ommited, as they only make sense in /etc/fstab." ) ]
class LMI_MountedFileSystemSetting : CIM_SettingData
{
    [ Description (
        "All I/O to the filesystem should be done synchronously. In case of "
        "media with limited number of write cycles (e.g. some flash drives), "
        "this option may cause life-cycle shortening. Corresponds to 'sync' "
        "mount option." ) ]
    boolean SynchronousIO;

    [ Description (
        "All directory updates within the filesystem should be done "
        "synchronously. This affects the following system calls: creat, link, "
        "unlink, symlink, mkdir, rmdir, mknod and rename. Corresponds to "
        "'dirsync' mount option." ) ]
    boolean SynchronousDirectoryUpdates;

    [ Description (
        "Update inode access times on this filesystem. Corresponds to 'atime' "
        "mount option." ) ]
    boolean UpdateAccessTimes;

    [ Description (
        "Allows to explicitly requesting full atime updates. This makes it "
        "possible for kernel to defaults to relatime or noatime but still "
        "allow userspace to override it. Corresponds to 'strictatime' mount "
        "option." ) ]
    boolean UpdateFullAccessTimes;

    [ Description (
        "Update inode access times relative to modify or change time. Access "
        "time is only updated if the previous access time was earlier than the "
        "current modify or change time. Corresponds to 'relatime' mount "
        "option." ) ]
    boolean UpdateRelativeAccessTimes;

    [ Description (
        "Update directory inode access times on this filesystem. This is the "
        "default. Corresponds to 'diratime' mount option." ) ]
    boolean UpdateDirectoryAccessTimes;

    [ Description (
        "Interpret character or block special devices on the filesystem."
        "Corresponds to 'dev' mount option." ) ]
    boolean InterpretDevices;

    [ Description (
        "Allow mandatory locks on this filesystem. See fcntl(2). Corresponds "
        "to 'mand' mount option." ) ]
    boolean AllowMandatoryLock;

    [ Description (
        "Permit execution of binaries. Corresponds to 'exec' mount option." ) ]
    boolean AllowExecution;

    [ Description (
        "Allow set-user-identifier or set-group-identifier bits to take "
        "effect. Corresponds to 'suid' mount option." ) ]
    boolean AllowSUID;

    [ Description (
        "Mount the filesystem read-write. If false, mount read-only."
        "Corresponds to 'rw' mount option." ) ]
    boolean AllowWrite;

    [ Description (
        "Turn on the silent flag. Corresponds to 'silent' mount option." ) ]
    boolean Silent;

    [ Description (
        "Other mount options that can be filesystem specific. This property is "
        "also used to specify options with values (e.g. uid=0 or gid=100). "
        "OtherOptions are appended (in the same order as they appear in the "
        "array) to the basic options." ),
      ArrayType ( "Indexed" ) ]
    string OtherOptions[];

    [ Description (
        "This field is used for these filesystems by the dump(8) command to "
        "determine which filesystems need to be dumped. If the field is "
        "not present, a value of zero is returned and dump will assume that "
        "the filesystem does not need to be dumped." ) ]
    boolean Dump;

    [ Description (
        "Used by the fsck(8) program to determine the order in which "
        "filesystem checks are done at reboot time. The root filesystem should "
        "be specified with a 1, other filesystems with a 2. Filesystems within "
        "a drive are checked sequentially, but filesystems on different drives "
        "are checked in parallel." ) ]
    int FileSystemCheckOrder;
};

[ Description (
    "Class for representing mounted filesystems. Can be thought of as an entry "
    "in /etc/mtab." ) ]
class MountedFileSystem : CIM_ManagedElement
{
    [ Description (
        "Filesystem type.") ]
    string FileSystemType;

    [ Key, Description (
        "Filesystem specification. Corresponds to the device field in "
        "/etc/fstab." ) ]
    string FileSystemSpec;

    [ Key, Description (
        "Path to a directory where the device is mounted." ) ]
    string MountPointPath;
};

class LMI_MountedFileSystemCapabilities : CIM_Capabilities
{
    [ Description (
        "Method to create and populate an LMI_MountedFileSystemSetting instance. This "
        "removes the need to populate default settings and other settings "
        "in the context of each LMI_MountedFileSystemCapabilities (which could be "
        "numerous)." ),
      ValueMap { "0", "1", "2", "3", "4", "5", "..", "32768..65535" },
      Values { "Success", "Not Supported", "Unspecified Error", "Timeout",
               "Failed", "Invalid Parameter", "DMTF Reserved",
               "Vendor Specific" } ]
    uint32 CreateSetting(
        [ IN(false), OUT, Description (
            "Reference to the created setting instance." ) ]
        LMI_MountedFileSystemSetting REF MountSetting,
    );

    [ ValueMap { "0", "1", "2" },
      Values { "CreateMount", "ModifyMount", "DeleteMount" } ]
    uint16 SupportedAsynchronousMethods[];
};

class LMI_MountConfigurationService : CIM_Service
{
    [ Description (
        "Mounts the specified filesystem to a mountpoint." ),
      ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "4096",
                 "4097", "4098..32767", "32768..65535" },
      Values { "Job Completed with No Error", "Not Supported",
               "Unknown", "Timeout", "Failed", "Invalid Parameter",
               "In Use", "DMTF Reserved",
               "Method Parameters Checked - Job Started",
               "Size Not Supported", "Method Reserved", "Vendor Specific" } ]
    uint32 CreateMount(
        [ IN(false), OUT, Description (
            "Reference to the created job." ) ]
        CIM_ConcreteJob REF Job,

        [ IN(false), OUT, Description (
            "Reference to the created LMI_MountedFileSystem instance." ) ]
        LMI_MountedFileSystem REF Mount,

        [ IN, Description (
           "Existing filesystem that should be mounted. If NULL, mount a "
           "non-local filesystem. If not NULL, mount a local filesystem. When "
           "mounting a local filesystem, the FileSystemType parameter has to "
           "agree with the type of FileSystem." ) ]
        CIM_FileSystem REF FileSystem,

        [ IN, Description (
            "Directory where the mounted filesystem should be attached at." ) ]
        string MountPoint,

        [ IN, Description (
            "Filesystem specification. Specifies the device that should be "
            "mounted." ) ]
        string FileSystemSpec,

        [ IN, Description (
            "Filesystem type. If NULL, perform a binding mount. If binding a "
            "local filesystem, this parameter has to be in agreement with the "
            "FileSystem." ) ]
        string FileSystemType,

        [ IN, Description (
            "Desired mount settings. If NULL, defaults will be used. Default "
            "mount options are 'rw, suid, dev, exec, auto, nouser, async'." ) ]
        LMI_MountedFileSystemSetting REF Goal,

        [ IN, Description (
            "The mode in which the configuration is to be applied to the "
            "MountedFileSystem."
            "\nMode 0 - Not used."
            "\nMode 1 - IsNext = 1, IsCurrent = 1."
            "\nMode 2 - IsNext = 1, IsCurrent not affected."
            "\nMode 3 - Not used."
            "\nMode 4 - IsNext = 2, IsCurrent = 2."
            "\nMode 5 - IsNext = 2, IsCurrent not affected."
            "\nMode 6 - Not used."
            "\nMode 32768 - IsNext not affected, IsCurrent = 1."
            "\nMode 32769 - IsNext not affected, IsCurrent = 2." ),
          ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "32768", "32769" },
          Values { "Mode 0", "Mode 1", "Mode 2", "Mode 3", "Mode 4", "Mode 5",
                   "Mode 6", "DMTF Reserved", "Mode 32768", "Mode 32769" } ]
        uint16 Mode
    );

    [ Description (
        "Modifies (remounts) an existing mount." ),
      ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "4096",
                 "4097", "4098..32767", "32768..65535" },
      Values { "Job Completed with No Error", "Not Supported",
               "Unknown", "Timeout", "Failed", "Invalid Parameter",
               "In Use", "DMTF Reserved",
               "Method Parameters Checked - Job Started",
               "Size Not Supported", "Method Reserved", "Vendor Specific" } ]
    uint32 ModifyMount(
        [ IN(false), OUT, Description (
            "Reference to the created job." ) ]
        CIM_ConcreteJob REF Job,

        [ IN, OUT, Description (
            "Reference to the LMI_Mount instance that is being modified. " ) ]
        LMI_MountedFileSystem REF Mount,

        [ IN, Description (
           "Desired mount settings. If NULL, defaults will be used. Default "
           "mount options are 'rw, suid, dev, exec, auto, nouser, async'." ) ]
        LMI_MountedFileSystemSetting REF Goal,

        [ IN, Description (
            "The mode in which the configuration is to be applied to the "
            "MountedFileSystem."
            "\nMode 0 - Not used."
            "\nMode 1 - IsNext = 1, IsCurrent = 1."
            "\nMode 2 - IsNext = 1, IsCurrent not affected."
            "\nMode 3 - Not used."
            "\nMode 4 - IsNext = 2, IsCurrent = 2."
            "\nMode 5 - IsNext = 2, IsCurrent not affected."
            "\nMode 6 - Not used."
            "\nMode 32768 - IsNext not affected, IsCurrent = 1."
            "\nMode 32769 - IsNext not affected, IsCurrent = 2." ),
          ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "32768", "32769" },
          Values { "Mode 0", "Mode 1", "Mode 2", "Mode 3", "Mode 4", "Mode 5",
                   "Mode 6", "DMTF Reserved", "Mode 32768", "Mode 32769" } ]
        uint16 Mode
    );

    [ Description (
        "Unmounts an existing mount." ),
      ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "4096",
                 "4097", "4098..32767", "32768..65535" },
      Values { "Job Completed with No Error", "Not Supported",
               "Unknown", "Timeout", "Failed", "Invalid Parameter",
               "In Use", "DMTF Reserved",
               "Method Parameters Checked - Job Started",
               "Size Not Supported", "Method Reserved", "Vendor Specific" } ]
    uint32 DeleteMount(
        [ IN(false), OUT, Description (
            "Reference to the created job." ) ]
        CIM_ConcreteJob REF Job,

        [ IN, Description (
            "An existing mount." ) ]
        LMI_MountedFileSystem REF Mount,

        [ IN, Description (
            "The mode in which the configuration is to be applied to the "
            "MountedFileSystem."
            "\nMode 0 - Not used."
            "\nMode 1 - IsNext = 1, IsCurrent = 1."
            "\nMode 2 - IsNext = 1, IsCurrent not affected."
            "\nMode 3 - Not used."
            "\nMode 4 - IsNext = 2, IsCurrent = 2."
            "\nMode 5 - IsNext = 2, IsCurrent not affected."
            "\nMode 6 - Not used."
            "\nMode 32768 - IsNext not affected, IsCurrent = 1."
            "\nMode 32769 - IsNext not affected, IsCurrent = 2." ),
          ValueMap { "0", "1", "2", "3", "4", "5", "6", "..", "32768", "32769" },
          Values { "Mode 0", "Mode 1", "Mode 2", "Mode 3", "Mode 4", "Mode 5",
                   "Mode 6", "DMTF Reserved", "Mode 32768", "Mode 32769" } ]
        uint16 Mode
    );
};

[ Association ]
class LMI_HostedMount : CIM_Dependency
{
    [ Override("Antecedent"), Description (
        "CIM_ComputerSystem reference." ) ]
    CIM_System REF CIM_ComputerSystem;

    [ Override("Dependent"), Description (
        "LMI_MountedFileSystem reference." ) ]
    CIM_ManagedElement REF LMI_MountedFileSystem;
};

[ Association ]
class LMI_MountedFileSystemElementSettingData : CIM_ElementSettingData
{
    [ Override("ManagedElement"), Description (
        "LMI_Mount reference." ) ]
    CIM_ManagedElement REF ManagedElement;

    [ Override("SettingData"), Description (
        "LMI_MountSetting reference." ) ]
    CIM_SettingData REF SettingData;
};

[ Association ]
class LMI_MountElementCapabilities : CIM_ElementCapabilities
{
    [ Override("Capabilities"), Description (
        "LMI_MountedFileSystemCapabilities reference." ) ]
    CIM_Capabilities REF Capabilities;

    [ Override("ManagedElement"), Description (
        "LMI_MountConfigurationService reference." ) ]
    CIM_ManagedElement REF ManagedElement;
};

[ Association ]
class MountPoint: CIM_Dependency
{
    [ Override("Antecedent"), Description (
        "CIM_Directory reference." ) ]
    CIM_ManagedElement REF Antecedent;

    [ Override("Dependent"), Description (
        "LMI_MountedFileSystem reference." ) ]
    CIM_Directory REF Dependent;
};

[ Association ]
class AttachedFileSystem: CIM_Dependency
{
    [ Override("Antecedent"), Description (
        "LMI_FileSystem reference." ) ]
    CIM_ManagedElement REF Antecedent;

    [ Override("Dependent"), Description (
        "MountedFileSystem reference." ) ]
    CIM_ManageElement REF Dependent;
};
      

Design Notes

NFS shares

The CIM System schema already defines a model for remote filesystems and file exporting. It does not consider any local variant though, thus will not be used. It could, in theory, be used with our mouting model, although that would mean making it very complex (for example, there would be two service classes to create settings). Therefore, remote filesystems shall be implemented using our model.

CIM_Mount

CIM_Mount is not considered in the schema and will not be implemented. This decision is based on the fact that it is necessary to connect both Directory and FileSystem with MountedFileSystem and associating a CIM_Managed element with an association would mean breaking the original model. Instead of CIM_Mount, two additional associations were introduced (MountPoint and AttachedFileSystebm). Rest of the documentation is inlined in mouting.mof.

CreateMount() with string arguments

The FileSystemSpec and FileSystemType arguments could be specified as enums, which would lead to a cleaner design. However, 'Other' would have to be used in the enum and another string argument would have to be introduced to cope with it. Therefore, strings are used instead to simplify the API.

On modes

There are two different properties that the modes consider. They are IsNext and IsCurrent.
 ValueMeaning
IsNext1Is Next. In mounting this means persistency, an entry in /etc/fstab.
2Is Not Next. No entry in /etc/fstab.
IsCurrent1Is Current. Currently, the device is mounted. Can be thought of as an entry in /etc/mtab.
2Is Not Current. The device is not mounted.

Service methods perform their operations according to the mode. The table below displays only supported modes.
ModeIsNextIsCurrent CreateMount() ModifyMount() DeleteMount()
111 Perform mount and add to /etc/fstab. Return an error if either can't be done. Perform remount and replace the corresponding line in /etc/fstab. Return an error if either can't be done. No effect.
21Not affected. Add line to /etc/fstab. Replace the corresponding line in /etc/fstab. No effect.
422 No effect. No effect. Unmount and remove the corresponding line from /etc/fstab.
52Not affected. No effect. No effect. Remove the corresponding line from /etc/fstab.
32768Not affected.1 Perform mount. Return an error if something goes wrong. Remount. Return an error if something goes wrong. No effect.
32769N/A2 No effect. No effect. Unmount.

Use cases

TBD

Older versions