#NEWLINE# def dump( device , destination , level = 0 , label = None , noerase = None ) : #NEWLINE# #INDENT# "\n    Dump filesystem device to the media (file, tape etc).\n\n    Required parameters:\n\n    * **device**: XFS device, content of which to be dumped.\n    * **destination**: Specifies a dump destination.\n\n    Valid options are:\n\n    * **label**: Label of the dump. Otherwise automatically generated label is used.\n    * **level**: Specifies a dump level of 0 to 9.\n    * **noerase**: Pre-erase media.\n\n    Other options are not used in order to let ``xfsdump`` use its default\n    values, as they are most optimal. See the ``xfsdump(8)`` manpage for\n    a more complete description of these options.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' xfs.dump /dev/sda1 /detination/on/the/client\n        salt '*' xfs.dump /dev/sda1 /detination/on/the/client label='Company accountancy'\n        salt '*' xfs.dump /dev/sda1 /detination/on/the/client noerase=True\n    " #NEWLINE# if ( not salt . utils . which ( 'xfsdump' ) ) : #NEWLINE# #INDENT# raise CommandExecutionError ( 'Utility "xfsdump" has to be installed or missing.' ) #NEWLINE# #UNINDENT# label = ( ( label and label ) or time . strftime ( 'XFS dump for "{0}" of %Y.%m.%d, %H:%M' . format ( device ) , time . localtime ( ) ) . replace ( "'" , '"' ) ) #NEWLINE# cmd = [ 'xfsdump' ] #NEWLINE# cmd . append ( '-F' ) #NEWLINE# if ( not noerase ) : #NEWLINE# #INDENT# cmd . append ( '-E' ) #NEWLINE# #UNINDENT# cmd . append ( "-L '{0}'" . format ( label ) ) #NEWLINE# cmd . append ( '-l {0}' . format ( level ) ) #NEWLINE# cmd . append ( '-f {0}' . format ( destination ) ) #NEWLINE# cmd . append ( device ) #NEWLINE# cmd = ' ' . join ( cmd ) #NEWLINE# out = __salt__ [ 'cmd.run_all' ] ( cmd ) #NEWLINE# _verify_run ( out , cmd = cmd ) #NEWLINE# return _xfsdump_output ( out [ 'stdout' ] )