Example #1
0
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of the FreeBSD Project.
#
# Authors: Jan Synacek <*****@*****.**>
#

"""
Mounting management functions.
"""

from lmi.scripts.common.errors import LmiFailed
from lmi.scripts.common import get_logger
LOG = get_logger(__name__)
from lmi.scripts.storage import common

_OPTS = ['AllowExecution',
         'AllowMandatoryLock',
         'AllowSUID',
         'AllowUserMount',
         'AllowWrite',
         'Auto',
         'Dump',
         'FileSystemCheckOrder',
         'InterpretDevices',
         'Silent',
         'SynchronousDirectoryUpdates',
         'SynchronousIO',
         'UpdateAccessTimes',
                  property of CIM_StorageExtent object.

    --gpt       Create GPT partition table (default).
    --msdos     Create MS-DOS partition table.
"""

from lmi.shell.LMIUtil import lmi_isinstance
from lmi.scripts.common import command
from lmi.scripts.common import get_logger
from lmi.scripts.common.formatter import command as fcmd
from lmi.scripts.storage import show, fs, lvm, mount, raid, partition
from lmi.scripts.storage.common import (size2str, get_devices, get_children,
                                        get_parents, str2device, str2size,
                                        str2vg)

LOG = get_logger(__name__)


class PartitionTableList(command.LmiLister):
    COLUMNS = ('Name', 'Type', 'Largest free region')

    def transform_options(self, options):
        """
        Rename 'device' option to 'devices' parameter name for better
        readability.
        """
        options['<devices>'] = options.pop('<device>')

    def execute(self, ns, devices=None):
        """
        Implementation of 'partition-table list' command.
Example #3
0
import sys

from lmi.scripts import common
from lmi.scripts.common import errors
from lmi.scripts._metacommand import util
from lmi.scripts._metacommand import exit
from lmi.scripts._metacommand.help import Help
from lmi.scripts._metacommand.manager import CommandManager
from lmi.scripts._metacommand.interactive import Interactive
from lmi.scripts._metacommand.toplevel import TopLevelCommand
from lmi.scripts.common.command import LmiCommandMultiplexer, LmiBaseCommand
from lmi.scripts.common.configuration import Configuration
from lmi.scripts.common.session import Session
from lmi.shell import LMIUtil

LOG = common.get_logger(__name__)

# write errors to stderr until logging is configured
logging.getLogger('').addHandler(logging.StreamHandler())

class MetaCommand(object):
    """
    Main application class. It instantiates configuration object, logging and
    then it passes control to commands.

    Example usage:

        MetaCommand().run()
    """

    def __init__(self):