示例#1
0
 def open_xb_stdout(self):
     """Open the stdout output for a streaming xtrabackup run"""
     config = self.config["xtrabackup"]
     backup_directory = self.target_directory
     stream = util.determine_stream_method(config["stream"])
     if stream:
         if stream == "tar":
             archive_path = join(backup_directory, "backup.tar")
         elif stream == "xbstream":
             archive_path = join(backup_directory, "backup.xb")
         else:
             raise BackupError("Unknown stream method '%s'" % stream)
         zconfig = self.config["compression"]
         try:
             return open_stream(
                 archive_path,
                 "w",
                 method=zconfig["method"],
                 level=zconfig["level"],
                 extra_args=zconfig["options"],
                 inline=zconfig["inline"],
             )
         except OSError as exc:
             raise BackupError("Unable to create output file: %s" % exc)
     else:
         return open("/dev/null", "w")
示例#2
0
文件: plugin.py 项目: rcleere/holland
 def open_xb_stdout(self):
     """Open the stdout output for a streaming xtrabackup run"""
     config = self.config["xtrabackup"]
     backup_directory = self.target_directory
     stream = util.determine_stream_method(config["stream"])
     if stream:
         # XXX: bounce through compression
         if stream == "tar":
             archive_path = join(backup_directory, "backup.tar")
             zconfig = self.config["compression"]
             try:
                 return open_stream(
                     archive_path,
                     "w",
                     method=zconfig["method"],
                     level=zconfig["level"],
                     extra_args=zconfig["options"],
                 )
             except OSError, exc:
                 raise BackupError("Unable to create output file: %s" % exc)
         elif stream == "xbstream":
             archive_path = join(backup_directory, "backup.xb")
             return open(archive_path, "w")
         else:
             raise BackupError("Unknown stream method '%s'" % stream)
示例#3
0
 def open_xb_stdout(self):
     """Open the stdout output for a streaming xtrabackup run"""
     config = self.config["xtrabackup"]
     backup_directory = self.target_directory
     stream = util.determine_stream_method(config["stream"])
     if stream:
         if stream == "tar":
             archive_path = join(backup_directory, "backup.tar")
         elif stream == "xbstream":
             archive_path = join(backup_directory, "backup.xb")
         else:
             raise BackupError("Unknown stream method '%s'" % stream)
         try:
             return open_stream(archive_path, "w", **self.config["compression"])
         except OSError as exc:
             raise BackupError("Unable to create output file: %s" % exc)
     else:
         return open("/dev/null", "w")
示例#4
0
文件: plugin.py 项目: abg/holland
 def open_xb_stdout(self):
     """Open the stdout output for a streaming xtrabackup run"""
     config = self.config['xtrabackup']
     backup_directory = self.target_directory
     stream = util.determine_stream_method(config['stream'])
     if stream:
         if stream == 'tar':
             archive_path = join(backup_directory, 'backup.tar')
         elif stream == 'xbstream':
             archive_path = join(backup_directory, 'backup.xb')
         else:
             raise BackupError("Unknown stream method '%s'" % stream)
         zconfig = self.config['compression']
         try:
             return open_stream(archive_path, 'w',
                                method=zconfig['method'],
                                level=zconfig['level'],
                                extra_args=zconfig['options'])
         except OSError, exc:
             raise BackupError("Unable to create output file: %s" % exc)
示例#5
0
 def open_xb_stdout(self):
     """Open the stdout output for a streaming xtrabackup run"""
     config = self.config['xtrabackup']
     backup_directory = self.target_directory
     stream = util.determine_stream_method(config['stream'])
     if stream:
         # XXX: bounce through compression
         if stream == 'tar':
             archive_path = join(backup_directory, 'backup.tar')
             zconfig = self.config['compression']
             return open_stream(archive_path, 'w',
                                method=zconfig['method'],
                                level=zconfig['level'])
         elif stream == 'xbstream':
             archive_path = join(backup_directory, 'backup.xb')
             return open(archive_path, 'w')
         else:
             raise BackupError("Unknown stream method '%s'" % stream)
     else:
         return open('/dev/null', 'w')
示例#6
0
 def open_xb_stdout(self):
     """Open the stdout output for a streaming xtrabackup run"""
     config = self.config['xtrabackup']
     backup_directory = self.target_directory
     stream = util.determine_stream_method(config['stream'])
     if stream:
         if stream == 'tar':
             archive_path = join(backup_directory, 'backup.tar')
         elif stream == 'xbstream':
             archive_path = join(backup_directory, 'backup.xb')
         else:
             raise BackupError("Unknown stream method '%s'" % stream)
         zconfig = self.config['compression']
         try:
             return open_stream(archive_path,
                                'w',
                                method=zconfig['method'],
                                level=zconfig['level'],
                                extra_args=zconfig['options'])
         except OSError, exc:
             raise BackupError("Unable to create output file: %s" % exc)