Merge "Make guest agent api changes backwards compatible"
This commit is contained in:
@@ -36,13 +36,17 @@ class API(object):
|
|||||||
|
|
||||||
API version history:
|
API version history:
|
||||||
* 1.0 - Initial version.
|
* 1.0 - Initial version.
|
||||||
|
* 1.1 - Added argement ds_version to prepare and
|
||||||
|
start_db_with_conf_changes
|
||||||
|
- Remove do_not_start_on_reboot from stop_db
|
||||||
|
- Added online argument to resize_fs
|
||||||
|
|
||||||
When updating this API, also update API_LATEST_VERSION
|
When updating this API, also update API_LATEST_VERSION
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# API_LATEST_VERSION should bump the minor number each time
|
# API_LATEST_VERSION should bump the minor number each time
|
||||||
# a method signature is added or changed
|
# a method signature is added or changed
|
||||||
API_LATEST_VERSION = '1.0'
|
API_LATEST_VERSION = '1.1'
|
||||||
|
|
||||||
# API_BASE_VERSION should only change on major version upgrade
|
# API_BASE_VERSION should only change on major version upgrade
|
||||||
API_BASE_VERSION = '1.0'
|
API_BASE_VERSION = '1.0'
|
||||||
@@ -54,6 +58,8 @@ class API(object):
|
|||||||
'liberty': '1.0',
|
'liberty': '1.0',
|
||||||
'mitaka': '1.0',
|
'mitaka': '1.0',
|
||||||
'newton': '1.0',
|
'newton': '1.0',
|
||||||
|
'ussuri': '1.0',
|
||||||
|
'victoria': '1.1',
|
||||||
|
|
||||||
'latest': API_LATEST_VERSION
|
'latest': API_LATEST_VERSION
|
||||||
}
|
}
|
||||||
@@ -320,7 +326,7 @@ class API(object):
|
|||||||
"""
|
"""
|
||||||
LOG.debug("Sending the call to prepare the Guest.")
|
LOG.debug("Sending the call to prepare the Guest.")
|
||||||
|
|
||||||
version = self.API_BASE_VERSION
|
version = '1.1'
|
||||||
|
|
||||||
# Taskmanager is a publisher, guestagent is a consumer. Usually
|
# Taskmanager is a publisher, guestagent is a consumer. Usually
|
||||||
# consumer creates a queue, but in this case we have to make sure
|
# consumer creates a queue, but in this case we have to make sure
|
||||||
@@ -329,15 +335,20 @@ class API(object):
|
|||||||
self._create_guest_queue()
|
self._create_guest_queue()
|
||||||
|
|
||||||
packages = packages.split()
|
packages = packages.split()
|
||||||
self._cast(
|
|
||||||
"prepare", version=version, packages=packages,
|
prepare_args = dict(
|
||||||
databases=databases, memory_mb=memory_mb, users=users,
|
packages=packages, databases=databases, memory_mb=memory_mb,
|
||||||
device_path=device_path, mount_point=mount_point,
|
users=users, device_path=device_path, mount_point=mount_point,
|
||||||
backup_info=backup_info, config_contents=config_contents,
|
backup_info=backup_info, config_contents=config_contents,
|
||||||
root_password=root_password, overrides=overrides,
|
root_password=root_password, overrides=overrides,
|
||||||
cluster_config=cluster_config, snapshot=snapshot, modules=modules,
|
cluster_config=cluster_config, snapshot=snapshot, modules=modules,
|
||||||
ds_version=ds_version)
|
ds_version=ds_version)
|
||||||
|
|
||||||
|
if not self.client.can_send_version(version):
|
||||||
|
prepare_args.pop('ds_version')
|
||||||
|
version = '1.0'
|
||||||
|
self._cast("prepare", version=version, **prepare_args)
|
||||||
|
|
||||||
def _create_guest_queue(self):
|
def _create_guest_queue(self):
|
||||||
"""Call to construct, start and immediately stop rpc server in order
|
"""Call to construct, start and immediately stop rpc server in order
|
||||||
to create a queue to communicate with the guestagent. This is
|
to create a queue to communicate with the guestagent. This is
|
||||||
@@ -401,11 +412,16 @@ class API(object):
|
|||||||
LOG.debug("Sending the call to start the database process on "
|
LOG.debug("Sending the call to start the database process on "
|
||||||
"the Guest with a timeout of %s.",
|
"the Guest with a timeout of %s.",
|
||||||
self.agent_high_timeout)
|
self.agent_high_timeout)
|
||||||
version = self.API_BASE_VERSION
|
start_args = dict(config_contents=config_contents,
|
||||||
|
ds_version=ds_version)
|
||||||
|
|
||||||
|
version = '1.1'
|
||||||
|
if not self.client.can_send_version(version):
|
||||||
|
start_args.pop('ds_version')
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
self._call("start_db_with_conf_changes", self.agent_high_timeout,
|
self._call("start_db_with_conf_changes", self.agent_high_timeout,
|
||||||
version=version, config_contents=config_contents,
|
version=version, **start_args)
|
||||||
ds_version=ds_version)
|
|
||||||
|
|
||||||
def reset_configuration(self, configuration):
|
def reset_configuration(self, configuration):
|
||||||
"""Ignore running state of the database server; just change
|
"""Ignore running state of the database server; just change
|
||||||
@@ -419,14 +435,19 @@ class API(object):
|
|||||||
self._call("reset_configuration", self.agent_high_timeout,
|
self._call("reset_configuration", self.agent_high_timeout,
|
||||||
version=version, configuration=configuration)
|
version=version, configuration=configuration)
|
||||||
|
|
||||||
def stop_db(self):
|
def stop_db(self, do_not_start_on_reboot=False):
|
||||||
"""Stop the database server."""
|
"""Stop the database server."""
|
||||||
LOG.debug("Sending the call to stop the database process "
|
LOG.debug("Sending the call to stop the database process "
|
||||||
"on the Guest.")
|
"on the Guest.")
|
||||||
version = self.API_BASE_VERSION
|
|
||||||
|
version = '1.1'
|
||||||
|
stop_args = {}
|
||||||
|
if not self.client.can_send_version(version):
|
||||||
|
stop_args['do_not_start_on_reboot'] = do_not_start_on_reboot
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
self._call("stop_db", self.agent_low_timeout,
|
self._call("stop_db", self.agent_low_timeout,
|
||||||
version=version)
|
version=version, **stop_args)
|
||||||
|
|
||||||
def get_volume_info(self):
|
def get_volume_info(self):
|
||||||
"""Make a synchronous call to get volume info for the container."""
|
"""Make a synchronous call to get volume info for the container."""
|
||||||
@@ -478,12 +499,18 @@ class API(object):
|
|||||||
"""Resize the filesystem."""
|
"""Resize the filesystem."""
|
||||||
LOG.debug("Resize device %(device)s on instance %(id)s.", {
|
LOG.debug("Resize device %(device)s on instance %(id)s.", {
|
||||||
'device': device_path, 'id': self.id})
|
'device': device_path, 'id': self.id})
|
||||||
version = self.API_BASE_VERSION
|
|
||||||
|
resize_args = dict(device_path=device_path,
|
||||||
|
mount_point=mount_point,
|
||||||
|
online=online)
|
||||||
|
|
||||||
|
version = '1.1'
|
||||||
|
if not self.client.can_send_version(version):
|
||||||
|
resize_args.pop('online')
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
self._call("resize_fs",
|
self._call("resize_fs",
|
||||||
self.agent_high_timeout, version=version,
|
self.agent_high_timeout, version=version, **resize_args)
|
||||||
device_path=device_path, mount_point=mount_point,
|
|
||||||
online=online)
|
|
||||||
|
|
||||||
def update_overrides(self, overrides, remove=False):
|
def update_overrides(self, overrides, remove=False):
|
||||||
"""Update the overrides."""
|
"""Update the overrides."""
|
||||||
|
|||||||
@@ -1877,7 +1877,7 @@ class ResizeActionBase(object):
|
|||||||
"""Initiates the action."""
|
"""Initiates the action."""
|
||||||
try:
|
try:
|
||||||
LOG.debug("Instance %s calling stop_db...", self.instance.id)
|
LOG.debug("Instance %s calling stop_db...", self.instance.id)
|
||||||
self.instance.guest.stop_db()
|
self.instance.guest.stop_db(do_not_start_on_reboot=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self.ignore_stop_error:
|
if self.ignore_stop_error:
|
||||||
LOG.warning(f"Failed to stop db {self.instance.id}, error: "
|
LOG.warning(f"Failed to stop db {self.instance.id}, error: "
|
||||||
|
|||||||
Reference in New Issue
Block a user