Remove deprecated code
And deprecates freezer-scheduler cli, use python-freezerclient Change-Id: I2960b1f21758a47e11a9df1723a962b745474bd8
This commit is contained in:
parent
e200a40840
commit
c385a7953a
|
@ -6,7 +6,7 @@ Please check README.rst for further installation instructions.
|
||||||
Install from sources::
|
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::
|
Please execute the following command to all the available options::
|
||||||
|
|
||||||
|
|
13
README.rst
13
README.rst
|
@ -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 |
|
| | - Multi-platform as it can be run on Linux, Windows, \*BSD and OSX |
|
||||||
| | - Automatic removal of old backups |
|
| | - 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. |
|
| 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. |
|
| | 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
|
If no default is set, logging will go to stderr as
|
||||||
defined by use_stderr. This option is ignored if
|
defined by use_stderr. This option is ignored if
|
||||||
log_config_append is set.
|
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
|
--lvm-dirmount LVM_DIRMOUNT
|
||||||
Set the directory you want to mount the lvm snapshot
|
Set the directory you want to mount the lvm snapshot
|
||||||
to. If not provided, a unique name will be generated
|
to. If not provided, a unique name will be generated
|
||||||
|
@ -1114,8 +1104,7 @@ optional arguments:
|
||||||
Checks in the specified container for object older
|
Checks in the specified container for object older
|
||||||
than the specified days. If i.e. 30 is specified, it
|
than the specified days. If i.e. 30 is specified, it
|
||||||
will remove the remote object older than 30 days.
|
will remove the remote object older than 30 days.
|
||||||
Default False (Disabled) The option --remove-older-
|
Default False (Disabled)
|
||||||
then is deprecated and will be removed soon
|
|
||||||
--restart-always-level RESTART_ALWAYS_LEVEL
|
--restart-always-level RESTART_ALWAYS_LEVEL
|
||||||
Restart the backup from level 0 after n days. Valid
|
Restart the backup from level 0 after n days. Valid
|
||||||
only if --always-level option if set. If --always-
|
only if --always-level option if set. If --always-
|
||||||
|
|
|
@ -123,12 +123,6 @@ _COMMON = [
|
||||||
"backup. When used, the lvm parameters will be guessed "
|
"backup. When used, the lvm parameters will be guessed "
|
||||||
"and/or the default values will be used, on windows it "
|
"and/or the default values will be used, on windows it "
|
||||||
"will invoke vssadmin"),
|
"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',
|
cfg.StrOpt('lvm-srcvol',
|
||||||
dest='lvm_srcvol',
|
dest='lvm_srcvol',
|
||||||
default=DEFAULT_PARAMS['lvm_srcvol'],
|
default=DEFAULT_PARAMS['lvm_srcvol'],
|
||||||
|
@ -218,7 +212,6 @@ _COMMON = [
|
||||||
cfg.StrOpt('hostname',
|
cfg.StrOpt('hostname',
|
||||||
dest='hostname',
|
dest='hostname',
|
||||||
default=DEFAULT_PARAMS['hostname'],
|
default=DEFAULT_PARAMS['hostname'],
|
||||||
deprecated_name='restore-from-host',
|
|
||||||
help="Set hostname to execute actions. If you are executing "
|
help="Set hostname to execute actions. If you are executing "
|
||||||
"freezer from one host but you want to delete objects "
|
"freezer from one host but you want to delete objects "
|
||||||
"belonging to another host then you can set this option "
|
"belonging to another host then you can set this option "
|
||||||
|
@ -427,15 +420,13 @@ _COMMON = [
|
||||||
"Please note this option is currently only available "
|
"Please note this option is currently only available "
|
||||||
"for file system backups. "
|
"for file system backups. "
|
||||||
"Please also note checking backup consistency is a "
|
"Please also note checking backup consistency is a "
|
||||||
"resource intensive operation, so use it carefully!",
|
"resource intensive operation, so use it carefully!"),
|
||||||
deprecated_name='consistency_check'),
|
|
||||||
cfg.StrOpt('consistency-checksum',
|
cfg.StrOpt('consistency-checksum',
|
||||||
dest='consistency_checksum',
|
dest='consistency_checksum',
|
||||||
default=DEFAULT_PARAMS['consistency_checksum'],
|
default=DEFAULT_PARAMS['consistency_checksum'],
|
||||||
help="Compute the checksum of the restored file(s) and compare "
|
help="Compute the checksum of the restored file(s) and compare "
|
||||||
"it to the (provided) checksum to verify that the backup "
|
"it to the (provided) checksum to verify that the backup "
|
||||||
"was successful",
|
"was successful"),
|
||||||
deprecated_name='consistency_checksum'),
|
|
||||||
cfg.BoolOpt('incremental',
|
cfg.BoolOpt('incremental',
|
||||||
default=DEFAULT_PARAMS['incremental'],
|
default=DEFAULT_PARAMS['incremental'],
|
||||||
help="When the option is set, freezer will perform a "
|
help="When the option is set, freezer will perform a "
|
||||||
|
@ -494,10 +485,6 @@ def get_backup_args():
|
||||||
|
|
||||||
defaults.update(conf.default)
|
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']:
|
if defaults['log_file']:
|
||||||
CONF.set_override('log_file', 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
|
# 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'
|
backup_media = 'fs'
|
||||||
if backup_args.cinder_vol_id:
|
if backup_args.cinder_vol_id:
|
||||||
backup_media = 'cinder'
|
backup_media = 'cinder'
|
||||||
|
|
|
@ -56,7 +56,7 @@ class MysqlMode(mode.Mode):
|
||||||
raise ImportError('Please install PyMySQL module')
|
raise ImportError('Please install PyMySQL module')
|
||||||
|
|
||||||
with open(conf.mysql_conf, 'r') as mysql_file_fd:
|
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
|
# Initialize the DB object and connect to the db according to
|
||||||
# the db mysql backup file config
|
# the db mysql backup file config
|
||||||
self.released = False
|
self.released = False
|
||||||
|
|
|
@ -35,7 +35,7 @@ class SqlserverMode(mode.Mode):
|
||||||
self.released = False
|
self.released = False
|
||||||
with open(conf.sql_server_conf, 'r') as sql_conf_file_fd:
|
with open(conf.sql_server_conf, 'r') as sql_conf_file_fd:
|
||||||
self.sql_server_instance = \
|
self.sql_server_instance = \
|
||||||
config.ini_parse(sql_conf_file_fd.read())["instance"]
|
config.ini_parse(sql_conf_file_fd)["instance"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|
|
@ -202,7 +202,7 @@ def main():
|
||||||
doers = _get_doers(shell)
|
doers = _get_doers(shell)
|
||||||
doers.update(_get_doers(utils))
|
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.parse_args(possible_actions)
|
||||||
arguments.setup_logging()
|
arguments.setup_logging()
|
||||||
|
@ -211,6 +211,11 @@ def main():
|
||||||
CONF.print_help()
|
CONF.print_help()
|
||||||
return 65 # os.EX_DATAERR
|
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
|
apiclient = None
|
||||||
insecure = False
|
insecure = False
|
||||||
if CONF.insecure:
|
if CONF.insecure:
|
||||||
|
|
|
@ -229,7 +229,7 @@ class BaseFreezerTest(tempest.test.BaseTestCase):
|
||||||
backup_args += ['--compression', compression]
|
backup_args += ['--compression', compression]
|
||||||
|
|
||||||
if consistency_check:
|
if consistency_check:
|
||||||
backup_args += ['--consistency_check']
|
backup_args += ['--consistency-check']
|
||||||
|
|
||||||
if incremental:
|
if incremental:
|
||||||
if always_level is not None:
|
if always_level is not None:
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest):
|
||||||
'--container', metadata['container'],
|
'--container', metadata['container'],
|
||||||
'--backup-name', self.backup_name,
|
'--backup-name', self.backup_name,
|
||||||
'--storage', 'local',
|
'--storage', 'local',
|
||||||
'--consistency_checksum', checksum]
|
'--consistency-checksum', checksum]
|
||||||
|
|
||||||
self.run_subprocess(restore_args,
|
self.run_subprocess(restore_args,
|
||||||
'Test restore from local storage with '
|
'Test restore from local storage with '
|
||||||
|
@ -77,7 +77,7 @@ class TestFreezerMetadataChecksum(base.BaseFreezerTest):
|
||||||
'--container', metadata['container'],
|
'--container', metadata['container'],
|
||||||
'--backup-name', self.backup_name,
|
'--backup-name', self.backup_name,
|
||||||
'--storage', 'local',
|
'--storage', 'local',
|
||||||
'--consistency_checksum', bad_checksum]
|
'--consistency-checksum', bad_checksum]
|
||||||
|
|
||||||
process = subprocess.Popen(restore_args,
|
process = subprocess.Popen(restore_args,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
|
@ -25,7 +25,7 @@ import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
import paramiko
|
import paramiko
|
||||||
|
|
||||||
FREEZERC = distutils.spawn.find_executable('freezerc')
|
FREEZERC = distutils.spawn.find_executable('freezer-agent')
|
||||||
|
|
||||||
|
|
||||||
class CommandFailed(Exception):
|
class CommandFailed(Exception):
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from six.moves import cStringIO
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from freezer.utils import config
|
from freezer.utils import config
|
||||||
|
@ -20,50 +21,33 @@ from freezer.utils import config
|
||||||
class TestConfig(unittest.TestCase):
|
class TestConfig(unittest.TestCase):
|
||||||
def test_export(self):
|
def test_export(self):
|
||||||
string = """unset OS_DOMAIN_NAME
|
string = """unset OS_DOMAIN_NAME
|
||||||
export OS_AUTH_URL="http://abracadabra/v3"
|
export OS_AUTH_URL="http://abracadabra/v3"
|
||||||
export OS_PROJECT_NAME=abracadabra_project
|
export OS_PROJECT_NAME=abracadabra_project
|
||||||
export OS_USERNAME=abracadabra_username
|
export OS_USERNAME=abracadabra_username
|
||||||
export OS_PASSWORD=abracadabra_password
|
export OS_PASSWORD=abracadabra_password
|
||||||
export OS_PROJECT_DOMAIN_NAME=Default
|
export OS_PROJECT_DOMAIN_NAME=Default
|
||||||
export OS_USER_DOMAIN_NAME=Default
|
export OS_USER_DOMAIN_NAME=Default
|
||||||
export OS_IDENTITY_API_VERSION=3
|
export OS_IDENTITY_API_VERSION=3
|
||||||
export OS_AUTH_VERSION=3
|
export OS_AUTH_VERSION=3
|
||||||
export OS_CACERT=/etc/ssl/certs/ca-certificates.crt
|
export OS_CACERT=/etc/ssl/certs/ca-certificates.crt
|
||||||
export OS_ENDPOINT_TYPE=internalURL"""
|
export OS_ENDPOINT_TYPE=internalURL"""
|
||||||
|
|
||||||
res = config.osrc_parse(string)
|
res = config.osrc_parse(string)
|
||||||
self.assertEqual("http://abracadabra/v3", res["OS_AUTH_URL"])
|
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):
|
def test_ini(self):
|
||||||
string = """[default]
|
string = """[default]
|
||||||
# This is a comment line
|
# This is a comment line
|
||||||
#
|
#
|
||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
port = 3306
|
port = 3306
|
||||||
user = openstack
|
user = openstack
|
||||||
password = 'aNiceQuotedPassword'
|
password = 'aNiceQuotedPassword'
|
||||||
password2 = "aNiceQuotedPassword"
|
password2 = "aNiceQuotedPassword"
|
||||||
spaced = value"""
|
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('127.0.0.1', res['host'])
|
||||||
self.assertEqual('openstack', res['user'])
|
self.assertEqual('openstack', res['user'])
|
||||||
self.assertEqual('3306', res['port'])
|
self.assertEqual('3306', res['port'])
|
||||||
|
|
|
@ -17,7 +17,6 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from six.moves import configparser
|
from six.moves import configparser
|
||||||
from six.moves import cStringIO
|
|
||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
|
@ -81,28 +80,15 @@ def osrc_parse(lines):
|
||||||
return find_all(EXPORT, lines)
|
return find_all(EXPORT, lines)
|
||||||
|
|
||||||
|
|
||||||
def ini_parse(lines):
|
def ini_parse(fd):
|
||||||
"""
|
"""
|
||||||
:param lines:
|
:param fd:
|
||||||
:type lines: str
|
:type fd: file_descriptor
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
parser = configparser.ConfigParser()
|
||||||
fd = cStringIO(lines)
|
parser.readfp(fd)
|
||||||
parser = configparser.ConfigParser()
|
return dict(parser.items('default'))
|
||||||
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):
|
def find_all(regex, lines):
|
||||||
|
|
|
@ -57,7 +57,6 @@ oslo.config.opts =
|
||||||
scheduler = freezer.scheduler.arguments:list_opts
|
scheduler = freezer.scheduler.arguments:list_opts
|
||||||
console_scripts =
|
console_scripts =
|
||||||
freezer-scheduler = freezer.scheduler.freezer_scheduler:main
|
freezer-scheduler = freezer.scheduler.freezer_scheduler:main
|
||||||
freezerc = freezer.main:main
|
|
||||||
freezer-agent = freezer.main:main
|
freezer-agent = freezer.main:main
|
||||||
tempest.test_plugins =
|
tempest.test_plugins =
|
||||||
freezer_tempest_tests = freezer.tests.freezer_tempest_plugin.plugin:FreezerTempestPlugin
|
freezer_tempest_tests = freezer.tests.freezer_tempest_plugin.plugin:FreezerTempestPlugin
|
||||||
|
|
Loading…
Reference in New Issue