GlusterFS quota enforcement

Tags: 317 views 0

How to setup GlusterFS quota enforcement for shared hosting packages.

Overview

The default installation of Atomia now supports enforcing shared hosting package disk quotas when using GlusterFS as the storage system.

The following is set up when GlusterFS is configured through our puppet module to include quota management:

  • A script for managing the quota at /opt/atomia/quotamgmt.sh.
  • A SSH user authorized through a public key and with the script as the only allowed command.
  • Quota support is enabled for the mail and web volumes.

Automation Server provisions the quota values through the generic SSH module with a configuration that triggers the quotamgmt.sh script installed on the first GlusterFS node.

Configuring the GlusterFS cluster for quota enforcement

Perform the following steps to enable the quota enforcement on the GlusterFS cluster:

  1. Generate a SSH key. The private key will be used later when configuring the Automation Server resource. The public key will be used in the next step. On any server, execute the following commands:
     ssh-keygen -t rsa -f quotamgmt
     cat quotamgmt # this is the private key
     cat quotamgmt.pub # this is the public key
    
  2. Configure the contents of quotamgmt.pub as the value of the quota_management_ssh_key option for the GlusterFS puppet role.

Configuring Automation Server for GlusterFS quota enforcement

Perform the following steps to enable GlusterFS quota enforcement when provisioning shared hosting packages:

  1. Configure resources for the two related services by replacing the two Hostname values with the IP of your first GlusterFS node and the two PrivateKey values with the content of the generated SSH private key file and then adding the following as C:\Program Files (x86)\Atomia\AutomationServer\Common\Transformation Files\Resources.GlusterFS.xml
      <resourceDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
       <bindings xdt:Locator="XPath(//bindings[moduleList/module/@name='Atomia.Provisioning.Modules.SSHCommand.SSHCommand'])" xdt:Transform="Replace">
         <resourceList>
           <resource name="GlusterFSWebQuotaResource" >
             <property name="ServiceName">GlusterFSWebDirectoryQuota</property>
             <property name="Hostname">YOUR_IP</property>
             <property name="Username">quotamgmt</property>
             <property name="PrivateKey"><![CDATA[-----BEGIN RSA PRIVATE KEY-----
     ... YOUR_KEY_HERE ...
     -----END RSA PRIVATE KEY-----]]></property>
             <property name="GlusterFSWebDirectoryQuota_Add">add web_volume {{accountname}} {{quotavalue}}</property>
             <property name="GlusterFSWebDirectoryQuota_Remove">remove web_volume {{accountname}}</property>
             <property name="GlusterFSWebDirectoryQuota_Modify">remove web_volume {{old_accountname}} &amp;amp;&amp;amp; add web_volume {{accountname}} {{quotavalue}}</property>
           </resource>
           <resource name="GlusterFSMailQuotaResource" >
             <property name="ServiceName">GlusterFSMailDirectoryQuota</property>
             <property name="Hostname">YOUR_IP</property>
             <property name="Username">quotamgmt</property>
             <property name="PrivateKey"><![CDATA[-----BEGIN RSA PRIVATE KEY-----
     ... YOUR_KEY_HERE ...
     -----END RSA PRIVATE KEY-----]]></property>
             <property name="GlusterFSMailDirectoryQuota_Add">add mail_volume {{accountname}} {{quotavalue}}</property>
             <property name="GlusterFSMailDirectoryQuota_Remove">remove mail_volume {{accountname}}</property>
             <property name="GlusterFSMailDirectoryQuota_Modify">remove mail_volume {{old_accountname}} &amp;amp;&amp;amp; add mail_volume {{accountname}} {{quotavalue}}</property>
           </resource>
         </resourceList>
       </bindings>
     </resourceDescription>
    
  2. Configure the quota values to match your storage limits in the definition of your packages. As an example, see the following rows from the default shared hosting packages:
     <set servicePath="CsBase/GlusterFSWebDirectoryQuota" propertyName="QuotaValue" propertyValue="1048576" />
     <set servicePath="CsBase/GlusterFSMailDirectoryQuota" propertyName="QuotaValue" propertyValue="1048576" />
    
  3. Configure the quotas to be provisioned during package provisioning by adding the following as C:\Program Files (x86)\Atomia\AutomationServer\Common\ProvisioningDescriptions\Transformation Files\ProvisioningDescription.EnforceQuota.xml
    <?xml version="1.0" encoding="utf-8"?>
     <provisioningDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
         <complexService xdt:Locator="XPath(//*[@name='CsBase'])">
             <init>
                 <add partName="GlusterFSWebDirectoryQuota" xdt:Transform="Insert"/>
                 <add partName="GlusterFSMailDirectoryQuota" xdt:Transform="Insert" />
             </init>
         </complexService>
     </provisioningDescription>
    

Was this helpful?