Remove deprecated code

And deprecates freezer-scheduler cli, use python-freezerclient

Change-Id: I2960b1f21758a47e11a9df1723a962b745474bd8
This commit is contained in:
Pierre-Arthur MATHIEU 2016-09-19 11:57:21 +01:00
parent e200a40840
commit c385a7953a
12 changed files with 43 additions and 96 deletions

View File

@ -6,7 +6,7 @@ Please check README.rst for further installation instructions.
Install from sources::
----------------------
You have now the freezerc tool installed in /usr/local/bin/freezerc
You have now the freezer-agent tool installed in /usr/local/bin/freezer-agent
Please execute the following command to all the available options::

View File

@ -586,7 +586,6 @@ The Freezer architecture is composed of the following components:
| | - Multi-platform as it can be run on Linux, Windows, \*BSD and OSX |
| | - Automatic removal of old backups |
| | |
| | "freezerc" binary is deprecated and won't be available in next releases. Use freezer-agent instead. |
+-------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Freezer API | The API is used to store and provide metadata to the Freezer Web UI and to the Freezer Scheduler. |
| | Also the API is used to store session information for multi node backup synchronization. No workload data is stored in the API. |
@ -1018,15 +1017,6 @@ optional arguments:
If no default is set, logging will go to stderr as
defined by use_stderr. This option is ignored if
log_config_append is set.
--log-format FORMAT DEPRECATED. A logging.Formatter log message format
string which may use any of the available
logging.LogRecord attributes. This option is
deprecated. Please use logging_context_format_string
and logging_default_format_string instead. This option
is ignored if log_config_append is set.
--lvm-auto-snap LVM_AUTO_SNAP
Automatically guess the volume group and volume name
for given PATH.
--lvm-dirmount LVM_DIRMOUNT
Set the directory you want to mount the lvm snapshot
to. If not provided, a unique name will be generated
@ -1114,8 +1104,7 @@ optional arguments:
Checks in the specified container for object older
than the specified days. If i.e. 30 is specified, it
will remove the remote object older than 30 days.
Default False (Disabled) The option --remove-older-
then is deprecated and will be removed soon
Default False (Disabled)
--restart-always-level RESTART_ALWAYS_LEVEL
Restart the backup from level 0 after n days. Valid
only if --always-level option if set. If --always-

View File

@ -123,12 +123,6 @@ _COMMON = [
"backup. When used, the lvm parameters will be guessed "
"and/or the default values will be used, on windows it "
"will invoke vssadmin"),
cfg.StrOpt('lvm-auto-snap',
dest='lvm_auto_snap',
default=DEFAULT_PARAMS['lvm_auto_snap'],
help="(Deprecated) Please use --snapshot instead"
"Automatically guess the volume group and volume name for "
"given PATH."),
cfg.StrOpt('lvm-srcvol',
dest='lvm_srcvol',
default=DEFAULT_PARAMS['lvm_srcvol'],
@ -218,7 +212,6 @@ _COMMON = [
cfg.StrOpt('hostname',
dest='hostname',
default=DEFAULT_PARAMS['hostname'],
deprecated_name='restore-from-host',
help="Set hostname to execute actions. If you are executing "
"freezer from one host but you want to delete objects "
"belonging to another host then you can set this option "
@ -427,15 +420,13 @@ _COMMON = [
"Please note this option is currently only available "
"for file system backups. "
"Please also note checking backup consistency is a "
"resource intensive operation, so use it carefully!",
deprecated_name='consistency_check'),
"resource intensive operation, so use it carefully!"),
cfg.StrOpt('consistency-checksum',
dest='consistency_checksum',
default=DEFAULT_PARAMS['consistency_checksum'],
help="Compute the checksum of the restored file(s) and compare "
"it to the (provided) checksum to verify that the backup "
"was successful",
deprecated_name='consistency_checksum'),
"was successful"),
cfg.BoolOpt('incremental',
default=DEFAULT_PARAMS['incremental'],
help="When the option is set, freezer will perform a "
@ -494,10 +485,6 @@ def get_backup_args():
defaults.update(conf.default)
# TODO(ANONYMOUS): restore_from_host is deprecated and to be removed
defaults['hostname'] = (conf.default.get('hostname') or
conf.default.get('restore_from_host'))
if defaults['log_file']:
CONF.set_override('log_file', defaults['log_file'])
@ -580,9 +567,6 @@ def get_backup_args():
# TODO(enugaev): move it to new command line param backup_media
if backup_args.lvm_auto_snap:
raise Exception('lvm-auto-snap is deprecated. '
'Please use --snapshot instead')
backup_media = 'fs'
if backup_args.cinder_vol_id:
backup_media = 'cinder'

View File

@ -56,7 +56,7 @@ class MysqlMode(mode.Mode):
raise ImportError('Please install PyMySQL module')
with open(conf.mysql_conf, 'r') as mysql_file_fd:
parsed_config = config.ini_parse(mysql_file_fd.read())
parsed_config = config.ini_parse(mysql_file_fd)
# Initialize the DB object and connect to the db according to
# the db mysql backup file config
self.released = False

View File

@ -35,7 +35,7 @@ class SqlserverMode(mode.Mode):
self.released = False
with open(conf.sql_server_conf, 'r') as sql_conf_file_fd:
self.sql_server_instance = \
config.ini_parse(sql_conf_file_fd.read())["instance"]
config.ini_parse(sql_conf_file_fd)["instance"]
@property
def name(self):

View File

@ -202,7 +202,7 @@ def main():
doers = _get_doers(shell)
doers.update(_get_doers(utils))
possible_actions = doers.keys() + ['start', 'stop', 'status']
possible_actions = doers.keys() + ['start', 'stop', 'status', 'reload']
arguments.parse_args(possible_actions)
arguments.setup_logging()
@ -211,6 +211,11 @@ def main():
CONF.print_help()
return 65 # os.EX_DATAERR
if CONF.action not in ['start', 'stop', 'status', 'reload']:
sys.stderr.write("Using freezer-scheduler as a command line client is "
"deprecated. Please use the freezer command line tool"
" from python-freezerclient.")
apiclient = None
insecure = False
if CONF.insecure:

View File

@ -229,7 +229,7 @@ class BaseFreezerTest(tempest.test.BaseTestCase):
backup_args += ['--compression', compression]
if consistency_check:
backup_args += ['--consistency_check']
backup_args += ['--consistency-check']
if incremental:
if always_level is not None:

View File

@ -55,7 +55,7 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest):
'--container', metadata['container'],
'--backup-name', self.backup_name,
'--storage', 'local',
'--consistency_checksum', checksum]
'--consistency-checksum', checksum]
self.run_subprocess(restore_args,
'Test restore from local storage with '
@ -77,7 +77,7 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest):
'--container', metadata['container'],
'--backup-name', self.backup_name,
'--storage', 'local',
'--consistency_checksum', bad_checksum]
'--consistency-checksum', bad_checksum]
process = subprocess.Popen(restore_args,
stdout=subprocess.PIPE,

View File

@ -25,7 +25,7 @@ import tempfile
import unittest
import paramiko
FREEZERC = distutils.spawn.find_executable('freezerc')
FREEZERC = distutils.spawn.find_executable('freezer-agent')
class CommandFailed(Exception):

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from six.moves import cStringIO
import unittest
from freezer.utils import config
@ -34,24 +35,6 @@ class TestConfig(unittest.TestCase):
res = config.osrc_parse(string)
self.assertEqual("http://abracadabra/v3", res["OS_AUTH_URL"])
def test_ini_like(self):
string = """# This is a comment line
#
host = 127.0.0.1
port = 3306
user = openstack
password = 'aNiceQuotedPassword'
password2 = "aNiceQuotedPassword"
spaced = value"""
res = config.ini_parse(string)
self.assertEqual('127.0.0.1', res['host'])
self.assertEqual('openstack', res['user'])
self.assertEqual('3306', res['port'])
self.assertEqual('aNiceQuotedPassword', res['password'])
self.assertEqual('aNiceQuotedPassword', res['password2'])
self.assertEqual('value', res['spaced'])
def test_ini(self):
string = """[default]
# This is a comment line
@ -63,7 +46,8 @@ class TestConfig(unittest.TestCase):
password2 = "aNiceQuotedPassword"
spaced = value"""
res = config.ini_parse(string)
fd = cStringIO(string)
res = config.ini_parse(fd)
self.assertEqual('127.0.0.1', res['host'])
self.assertEqual('openstack', res['user'])
self.assertEqual('3306', res['port'])

View File

@ -17,7 +17,6 @@ import os
import re
from six.moves import configparser
from six.moves import cStringIO
from oslo_log import log
@ -81,28 +80,15 @@ def osrc_parse(lines):
return find_all(EXPORT, lines)
def ini_parse(lines):
def ini_parse(fd):
"""
:param lines:
:type lines: str
:param fd:
:type fd: file_descriptor
:return:
"""
try:
fd = cStringIO(lines)
parser = configparser.ConfigParser()
parser.readfp(fd)
return dict(parser.items('default'))
except Exception as e:
try:
# TODO(ANONYMOUS): Remove the parsing of ini-like file via regex
conf = find_all(INI, lines)
LOG.warning("Using non-INI files for database configuration "
"file is deprecated. Falling back to Regex.")
LOG.warning("INI parser error was: {}".format(str(e)))
return conf
except Exception:
LOG.warning("Couldn't parse non-INI config file using Regex")
raise
def find_all(regex, lines):

View File

@ -57,7 +57,6 @@ oslo.config.opts =
scheduler = freezer.scheduler.arguments:list_opts
console_scripts =
freezer-scheduler = freezer.scheduler.freezer_scheduler:main
freezerc = freezer.main:main
freezer-agent = freezer.main:main
tempest.test_plugins =
freezer_tempest_tests = freezer.tests.freezer_tempest_plugin.plugin:FreezerTempestPlugin