Add support for MySQL 5.7 on Ubuntu Xenial
Ubuntu Trusty continues to get MySQL 5.6. The selection of the MySQL version is based on the version of Ubuntu that is installed. If the script trovestack is invoked on Xenial, the version that is chosen is 5.7. If it is invoked on Trusty, then version 5.6 is chosen. The only thing that is eliminated is the dubious combination of MySQL 5.6 on Ubuntu Xenial. This combination is probably not supported by Ubuntu as it is down level from their standard offering is probably not tested anywhere. Note Xenial does not provide the 5.6 version of mysql. This was accomplished by initializing the Apt repo with the Trusty software repository. The size of the root file system is increased from 3 to 4 GBs as the Mysql Xenial image does not fit in 3 GBs. This has an impact on the flavors that are used by Trove for testing as the name of the flavor includes the size of the root file system. This is turn caused a change to each of the db specific test config files as the trove falvors are referenced in them. Change-Id: I4f4e497208b8f4728580e48239a8ae208e0a96dd
This commit is contained in:
parent
ccb6752f69
commit
36926f39e6
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "5.6",
|
||||
"name": "5.7",
|
||||
"links": [
|
||||
{
|
||||
"href": "https://10.240.28.38:8779/v1.0/27bee406abb5486e81ef3ff4382aabaf/datastores/versions/2dc7faa0-efff-4c2b-8cff-bcd949c518a5",
|
||||
@ -13,6 +13,6 @@
|
||||
"image": "b69fbd9e-b31d-46ff-8afb-cbf452f6f835",
|
||||
"active": 1,
|
||||
"datastore": "3a8968d8-e5f5-4452-83ca-f6c90b5de06a",
|
||||
"packages": "mysql-server-5.6",
|
||||
"packages": "mysql-server-5.7",
|
||||
"id": "2dc7faa0-efff-4c2b-8cff-bcd949c518a5"
|
||||
}
|
||||
|
@ -26,9 +26,15 @@ TROVE_POLICY_JSON=${TROVE_POLICY_JSON:-${TROVE_CONF_DIR}/policy.json}
|
||||
TROVE_LOCAL_CONF_DIR=${TROVE_LOCAL_CONF_DIR:-${TROVE_DIR}/etc/trove}
|
||||
TROVE_LOCAL_API_PASTE_INI=${TROVE_LOCAL_API_PASTE_INI:-${TROVE_LOCAL_CONF_DIR}/api-paste.ini}
|
||||
TROVE_LOCAL_POLICY_JSON=${TROVE_LOCAL_POLICY_JSON:-${TROVE_LOCAL_CONF_DIR}/policy.json}
|
||||
|
||||
TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
|
||||
TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.6"}
|
||||
TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.6"}
|
||||
if [ "$DISTRO" == "xenial" ]; then
|
||||
TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.7"}
|
||||
TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.7"}
|
||||
else
|
||||
TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.6"}
|
||||
TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.6"}
|
||||
fi
|
||||
|
||||
# Configuration values listed here for reference
|
||||
TROVE_MAX_ACCEPTED_VOLUME_SIZE=${TROVE_MAX_ACCEPTED_VOLUME_SIZE}
|
||||
|
@ -36,19 +36,19 @@ Setting up the Image
|
||||
example ``mysql.cloudinit``.
|
||||
|
||||
* Create a cloud-init file for your datastore and put it into place.
|
||||
For this example, it is assumed you are using Ubuntu 14.04, with
|
||||
the MySQL database and a Trove Agent from the Mitaka release. You
|
||||
For this example, it is assumed you are using Ubuntu 16.04, with
|
||||
the MySQL database and a Trove Agent from the Pike release. You
|
||||
would put this into ``/etc/trove/cloudinit/mysql.cloudinit``.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
#cloud-config
|
||||
# For Ubuntu-14.04 cloudimage
|
||||
# For Ubuntu-16.04 cloudimage
|
||||
apt_sources:
|
||||
- source: "cloud-archive:mitaka"
|
||||
- source: "cloud-archive:pike"
|
||||
packages:
|
||||
- trove-guestagent
|
||||
- mysql-server-5.5
|
||||
- mysql-server-5.7
|
||||
write_files:
|
||||
- path: /etc/sudoers.d/trove
|
||||
content: |
|
||||
@ -69,6 +69,6 @@ Setting up the Image
|
||||
the Trusty Cloud image.
|
||||
|
||||
When trove launches the Guest Instance, the cloud-init will install
|
||||
the Mitaka Trove Guest Agent and MySQL database, and then adjust
|
||||
the Pike Trove Guest Agent and MySQL database, and then adjust
|
||||
the configuration files and launch the Guest Agent.
|
||||
|
||||
|
@ -26,7 +26,7 @@ A running OpenStack environment is required, including the following components:
|
||||
- A networking component (either Neutron or Nova-Network)
|
||||
- If you want to provision datastores on block-storage volumes, you also will need Block Storage (Cinder)
|
||||
- If you want to do backup/restore and replication, you will also need Object Storage (Swift)
|
||||
- An environment with a freshly installed Ubuntu 14.04 LTS to run Trove services.
|
||||
- An environment with a freshly installed Ubuntu 16.04 LTS to run Trove services.
|
||||
This will be referred to as "local environment"
|
||||
- AMQP service (RabbitMQ or QPID)
|
||||
- MySQL (SQLite, PostgreSQL) database for Trove's internal needs, accessible from the local environment
|
||||
@ -303,10 +303,10 @@ Example::
|
||||
|
||||
- ID - edb1d22a-b66d-4e86-be60-756240439272
|
||||
- Datastore ID - 9c3d890b-a2f2-4ba5-91b2-2997d0791502
|
||||
- Name - mysql-5.6
|
||||
- Name - mysql-5.7
|
||||
- Datastore manager - mysql
|
||||
- Image ID - d73a402-3953-4721-8c99-86fc72e1cb51
|
||||
- Packages - mysql-server=5.5, percona-xtrabackup=2.1
|
||||
- Packages - mysql-server=5.7, percona-xtrabackup=2.4
|
||||
- Active - True
|
||||
|
||||
--------------------------------------------
|
||||
@ -319,9 +319,9 @@ To register a datastore, you must execute:
|
||||
|
||||
$ export DATASTORE_TYPE="mysql" # available options: mysql, mongodb, postgresql, redis, cassandra, couchbase, couchdb, db2, vertica, etc.
|
||||
|
||||
$ export DATASTORE_VERSION="5.6" # available options: for cassandra 2.0.x, for mysql: 5.x, for mongodb: 2.x.x, etc.
|
||||
$ export DATASTORE_VERSION="5.7" # available options: for cassandra 2.0.x, for mysql: 5.x, for mongodb: 2.x.x, etc.
|
||||
|
||||
$ export PACKAGES="mysql-server-5.6" # available options: cassandra=2.0.9, mongodb=2.0.4, etc
|
||||
$ export PACKAGES="mysql-server-5.7" # available options: cassandra=2.0.9, mongodb=2.0.4, etc
|
||||
|
||||
$ export IMAGEID="9910350b-77e3-4790-86be-b971d0cf9175" # Glance image ID of the relevant Datastore version (see Source images section)
|
||||
|
||||
@ -459,10 +459,10 @@ If you are interested in documentation for a specific OpenStack release, visit:
|
||||
|
||||
http://docs.openstack.org/<release-code-name>/
|
||||
|
||||
For example, the documentation for the Newton release is found at:
|
||||
For example, the documentation for the Pike release is found at:
|
||||
|
||||
http://docs.openstack.org/newton/
|
||||
http://docs.openstack.org/pike/
|
||||
|
||||
and the documentation for the Mitaka release is found at:
|
||||
and the documentation for the Queens release is found at:
|
||||
|
||||
http://docs.openstack.org/mitaka/
|
||||
http://docs.openstack.org/queens/
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.large-5",
|
||||
"instance_bigger_flavor_name": "test.large-5.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-5",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-5.resize",
|
||||
"instance_flavor_name": "test.large-8",
|
||||
"instance_bigger_flavor_name": "test.large-8.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-8",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-8.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.large-5",
|
||||
"instance_bigger_flavor_name": "test.large-5.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-5",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-5.resize",
|
||||
"instance_flavor_name": "test.large-8",
|
||||
"instance_bigger_flavor_name": "test.large-8.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-8",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-8.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.small-5",
|
||||
"instance_bigger_flavor_name": "test.small-5.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-5",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-5.resize",
|
||||
"instance_flavor_name": "test.small-8",
|
||||
"instance_bigger_flavor_name": "test.small-8.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-8",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-8.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.small-4",
|
||||
"instance_bigger_flavor_name": "test.small-4.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-4",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-4.resize",
|
||||
"instance_flavor_name": "test.small-7",
|
||||
"instance_bigger_flavor_name": "test.small-7.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-7",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-7.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.large-5",
|
||||
"instance_bigger_flavor_name": "test.large-5.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-5",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-5.resize",
|
||||
"instance_flavor_name": "test.large-8",
|
||||
"instance_bigger_flavor_name": "test.large-8.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-8",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-8.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 5,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.small-4",
|
||||
"instance_bigger_flavor_name": "test.small-4.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-4",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-4.resize",
|
||||
"instance_flavor_name": "test.small-7",
|
||||
"instance_bigger_flavor_name": "test.small-7.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-7",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-7.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.small-4",
|
||||
"instance_bigger_flavor_name": "test.small-4.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-4",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-4.resize",
|
||||
"instance_flavor_name": "test.small-7",
|
||||
"instance_bigger_flavor_name": "test.small-7.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-7",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-7.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.medium-4",
|
||||
"instance_bigger_flavor_name": "test.medium-4.resize",
|
||||
"instance_eph_flavor_name": "test.eph.medium-4",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.medium-4.resize",
|
||||
"instance_flavor_name": "test.medium-7",
|
||||
"instance_bigger_flavor_name": "test.medium-7.resize",
|
||||
"instance_eph_flavor_name": "test.eph.medium-7",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.medium-7.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.small-4",
|
||||
"instance_bigger_flavor_name": "test.small-4.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-4",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-4.resize",
|
||||
"instance_flavor_name": "test.small-7",
|
||||
"instance_bigger_flavor_name": "test.small-7.resize",
|
||||
"instance_eph_flavor_name": "test.eph.small-7",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.small-7.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.tiny-3",
|
||||
"instance_bigger_flavor_name": "test.tiny-3.resize",
|
||||
"instance_eph_flavor_name": "test.eph.tiny-3",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.tiny-3.resize",
|
||||
"instance_flavor_name": "test.tiny-4",
|
||||
"instance_bigger_flavor_name": "test.tiny-4.resize",
|
||||
"instance_eph_flavor_name": "test.eph.tiny-4",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.tiny-4.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 1,
|
||||
|
@ -101,5 +101,5 @@
|
||||
"shared_network_subnet": "%shared_network_subnet%",
|
||||
"instance_fault_1_flavor_name": "test.fault_1-1",
|
||||
"instance_fault_1_eph_flavor_name": "test.eph.fault_1-1",
|
||||
"instance_fault_2_flavor_name": "test.fault_2-5",
|
||||
"instance_fault_2_eph_flavor_name": "test.eph.fault_2-5",
|
||||
"instance_fault_2_flavor_name": "test.fault_2-7",
|
||||
"instance_fault_2_eph_flavor_name": "test.eph.fault_2-7",
|
||||
|
@ -1,6 +1,6 @@
|
||||
"instance_flavor_name": "test.large-10",
|
||||
"instance_bigger_flavor_name": "test.large-10.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-10",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-10.resize",
|
||||
"instance_flavor_name": "test.large-13",
|
||||
"instance_bigger_flavor_name": "test.large-13.resize",
|
||||
"instance_eph_flavor_name": "test.eph.large-13",
|
||||
"instance_bigger_eph_flavor_name": "test.eph.large-13.resize",
|
||||
"trove_volume_support": true,
|
||||
"trove_volume_size": 5,
|
||||
|
@ -8,14 +8,45 @@ set -o xtrace
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
|
||||
apt-get -y update
|
||||
apt-get --allow-unauthenticated -y install mysql-client mysql-server
|
||||
|
||||
apt-get --allow-unauthenticated -y install mysql-client-5.6 mysql-server-5.6 percona-xtrabackup${PXB_VERSION_OVERRIDE}
|
||||
# Xenial provides mysql 5.7 which requires percona-xtrabackup-24
|
||||
|
||||
PXB_VERSION_OVERRIDE=24
|
||||
PKGS=$(apt-cache search percona-xtrabackup-${PXB_VERSION_OVERRIDE})
|
||||
if [[ "$PKGS" == *"percona-xtrabackup-$PXB_VERSION_OVERRIDE"* ]]; then
|
||||
apt-get --allow-unauthenticated -y install percona-xtrabackup-${PXB_VERSION_OVERRIDE}
|
||||
else
|
||||
# Architecture is not supported by percona website. Compile and install it
|
||||
PXB_VERSION=${PXB_VERSION_OVERRIDE:0:1}.${PXB_VERSION_OVERRIDE:1:1}
|
||||
|
||||
apt-get --allow-unauthenticated -y install build-essential flex bison automake autoconf \
|
||||
libtool cmake libaio-dev mysql-client libncurses-dev zlib1g-dev \
|
||||
libgcrypt11-dev libev-dev libcurl4-gnutls-dev vim-common
|
||||
|
||||
pushd /tmp
|
||||
|
||||
git clone https://github.com/percona/percona-xtrabackup.git
|
||||
cd percona-xtrabackup
|
||||
git checkout $PXB_VERSION
|
||||
|
||||
mkdir /tmp/boost
|
||||
cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost -DBUILD_CONFIG=xtrabackup_release -DWITH_MAN_PAGES=OFF && make -j4
|
||||
make install
|
||||
ln -s /usr/local/xtrabackup/bin/* /usr/bin/
|
||||
|
||||
dpkg -P build-essential automake autoconf libtool cmake
|
||||
apt-get -y clean
|
||||
|
||||
popd
|
||||
|
||||
rm -rf /tmp/boost /tmp/percona-xtrabackup
|
||||
fi
|
||||
|
||||
cat >/etc/mysql/conf.d/no_perf_schema.cnf <<_EOF_
|
||||
[mysqld]
|
||||
performance_schema = off
|
||||
show_compatibility_56 = on
|
||||
_EOF_
|
||||
|
||||
mv /etc/mysql/my.cnf.fallback /etc/mysql/my.cnf
|
||||
@ -26,7 +57,9 @@ cat >/etc/mysql/my.cnf <<_EOF_
|
||||
!includedir /etc/mysql/conf.d/
|
||||
_EOF_
|
||||
|
||||
rm /etc/init/mysql.conf
|
||||
systemctl daemon-reload
|
||||
if [ -e /etc/init/mysql.conf ]; then
|
||||
rm -f /etc/init/mysql.conf
|
||||
fi
|
||||
|
||||
systemctl enable mysql
|
||||
|
||||
|
@ -535,8 +535,15 @@ function set_bin_path() {
|
||||
function set_mysql_pkg() {
|
||||
if is_fedora; then
|
||||
MYSQL_PKG="mysql-community-server"
|
||||
MYSQL_VER="5.6"
|
||||
else
|
||||
MYSQL_PKG="mysql-server-5.6"
|
||||
if [ "$RELEASE" == "xenial" ]; then
|
||||
MYSQL_PKG="mysql-server-5.7"
|
||||
MYSQL_VER="5.7"
|
||||
else
|
||||
MYSQL_PKG="mysql-server-5.6"
|
||||
MYSQL_VER="5.6"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -549,10 +556,11 @@ function cmd_set_datastore() {
|
||||
# rd_manage datastore_update <datastore_name> <default_version>
|
||||
rd_manage datastore_update "$DATASTORE_TYPE" ""
|
||||
PACKAGES=${PACKAGES:-""}
|
||||
|
||||
if [ "$DATASTORE_TYPE" == "mysql" ]; then
|
||||
set_mysql_pkg
|
||||
PACKAGES=${PACKAGES:-$MYSQL_PKG}
|
||||
VERSION="5.6"
|
||||
VERSION=$MYSQL_VER
|
||||
elif [ "$DATASTORE_TYPE" == "percona" ]; then
|
||||
PACKAGES=${PACKAGES:-"percona-server-server-5.6"}
|
||||
VERSION="5.6"
|
||||
@ -768,23 +776,23 @@ function add_test_flavors() {
|
||||
# name id ram root_vol vcpu
|
||||
# the ram and vcpu for name.resize are automatically calculated
|
||||
# eph and non-eph flavors are created for each entry
|
||||
add_flavor 'tiny' 10 512 3 1
|
||||
add_flavor 'tiny' 10 768 4 1
|
||||
|
||||
add_flavor 'small' 15 768 3 1
|
||||
add_flavor 'small' 16 768 4 1
|
||||
add_flavor 'small' 17 768 5 1
|
||||
add_flavor 'small' 15 1024 6 1
|
||||
add_flavor 'small' 16 1024 7 1
|
||||
add_flavor 'small' 17 1024 8 1
|
||||
|
||||
add_flavor 'medium' 20 1024 4 1
|
||||
add_flavor 'medium' 21 1024 5 1
|
||||
add_flavor 'medium' 20 1536 7 1
|
||||
add_flavor 'medium' 21 1536 8 1
|
||||
|
||||
add_flavor 'large' 25 2048 5 1
|
||||
add_flavor 'large' 26 2048 10 1
|
||||
add_flavor 'large' 27 2048 15 1
|
||||
add_flavor 'large' 25 2048 8 1
|
||||
add_flavor 'large' 26 2048 13 1
|
||||
add_flavor 'large' 27 2048 18 1
|
||||
|
||||
# This will allow Nova to create an instance, but not enough disk to boot the image
|
||||
add_flavor 'fault_1' 30 512 1 1 'skip_resize'
|
||||
add_flavor 'fault_1' 30 1536 1 1 'skip_resize'
|
||||
# This should be enough memory to cause Nova to fail entirely due to too much allocation
|
||||
add_flavor 'fault_2' 31 131072 5 1 'skip_resize'
|
||||
add_flavor 'fault_2' 31 131072 7 1 'skip_resize'
|
||||
}
|
||||
|
||||
function cmd_test_init() {
|
||||
@ -914,7 +922,7 @@ function init_fake_mode() {
|
||||
INSERT INTO datastores values ('e00000e0-00e0-0e00-00e0-000e000000ee', \
|
||||
'Test_Datastore_1', ''); \
|
||||
INSERT INTO datastore_versions VALUES ('b00000b0-00b0-0b00-00b0-000b000000bb', \
|
||||
'a00000a0-00a0-0a00-00a0-000a000000aa', '5.6', \
|
||||
'a00000a0-00a0-0a00-00a0-000a000000aa', $MYSQL_VER, \
|
||||
'c00000c0-00c0-0c00-00c0-000c000000cc', $MYSQL_PKG, 1, 'mysql'); \
|
||||
INSERT INTO datastore_versions VALUES ('d00000d0-00d0-0d00-00d0-000d000000dd', \
|
||||
'a00000a0-00a0-0a00-00a0-000a000000aa', 'inactive_version', \
|
||||
|
@ -666,14 +666,25 @@ class BaseMySqlApp(object):
|
||||
|
||||
@staticmethod
|
||||
def _generate_root_password(client):
|
||||
"""Generate and set a random root password and forget about it."""
|
||||
"""Generate, set, and preserve a random password
|
||||
for root@localhost when invoking mysqladmin to
|
||||
determine the execution status of the mysql service.
|
||||
"""
|
||||
localhost = "localhost"
|
||||
new_password = utils.generate_random_password()
|
||||
uu = sql_query.SetPassword(
|
||||
models.MySQLUser.root_username, host=localhost,
|
||||
new_password=utils.generate_random_password())
|
||||
new_password=new_password)
|
||||
t = text(str(uu))
|
||||
client.execute(t)
|
||||
|
||||
# Save the password to root's private .my.cnf file
|
||||
root_sect = {'client': {'user': 'root',
|
||||
'password': new_password,
|
||||
'host': localhost}}
|
||||
operating_system.write_file('/root/.my.cnf',
|
||||
root_sect, codec=IniCodec(), as_root=True)
|
||||
|
||||
def install_if_needed(self, packages):
|
||||
"""Prepare the guest machine with a secure
|
||||
mysql server installation.
|
||||
|
@ -73,6 +73,19 @@ class MySQLRestoreMixin(object):
|
||||
raise exc
|
||||
|
||||
def _start_mysqld_safe_with_init_file(self, init_file, err_log_file):
|
||||
# This directory is added and removed by the mysql systemd service
|
||||
# as the database is started and stopped. The restore operation
|
||||
# takes place when the database is stopped, so the directory does
|
||||
# not exist, but it is assumed to exist by the mysqld_safe command
|
||||
# which starts the database. This command used to create this
|
||||
# directory if it didn't exist, but it was changed recently to
|
||||
# simply fail in this case.
|
||||
run_dir = "/var/run/mysqld"
|
||||
if not os.path.exists(run_dir):
|
||||
utils.execute("mkdir", run_dir,
|
||||
run_as_root=True, root_helper="sudo")
|
||||
utils.execute("chown", "mysql:mysql", run_dir, err_log_file.name,
|
||||
run_as_root=True, root_helper="sudo")
|
||||
child = pexpect.spawn(
|
||||
"sudo mysqld_safe --init-file=%s --log-error=%s" %
|
||||
(init_file.name, err_log_file.name))
|
||||
|
@ -123,7 +123,7 @@ class ResizeTests(ResizeTestBase):
|
||||
def _start_mysql(self):
|
||||
datastore = Mock(spec=DatastoreVersion)
|
||||
datastore.datastore_name = 'mysql'
|
||||
datastore.name = 'mysql-5.6'
|
||||
datastore.name = 'mysql-5.7'
|
||||
datastore.manager = 'mysql'
|
||||
config = template.SingleInstanceConfigTemplate(
|
||||
datastore, NEW_FLAVOR.__dict__, self.instance.id)
|
||||
|
@ -62,7 +62,7 @@ class TemplateTest(trove_testtools.TestCase):
|
||||
def test_single_instance_config_rendering(self):
|
||||
datastore = Mock(spec=DatastoreVersion)
|
||||
datastore.datastore_name = 'MySql'
|
||||
datastore.name = 'mysql-5.6'
|
||||
datastore.name = 'mysql-5.7'
|
||||
datastore.manager = 'mysql'
|
||||
config = template.SingleInstanceConfigTemplate(datastore,
|
||||
self.flavor_dict,
|
||||
@ -85,7 +85,7 @@ class TemplateTest(trove_testtools.TestCase):
|
||||
def test_replica_source_config_rendering(self):
|
||||
datastore = Mock(spec=DatastoreVersion)
|
||||
datastore.datastore_name = 'MySql'
|
||||
datastore.name = 'mysql-5.6'
|
||||
datastore.name = 'mysql-5.7'
|
||||
datastore.manager = 'mysql'
|
||||
config = template.ReplicaSourceConfigTemplate(datastore,
|
||||
self.flavor_dict,
|
||||
@ -95,7 +95,7 @@ class TemplateTest(trove_testtools.TestCase):
|
||||
def test_replica_config_rendering(self):
|
||||
datastore = Mock(spec=DatastoreVersion)
|
||||
datastore.datastore_name = 'MySql'
|
||||
datastore.name = 'mysql-5.6'
|
||||
datastore.name = 'mysql-5.7'
|
||||
datastore.manager = 'mysql'
|
||||
config = template.ReplicaConfigTemplate(datastore,
|
||||
self.flavor_dict,
|
||||
|
@ -1404,6 +1404,7 @@ class MySqlAppTest(trove_testtools.TestCase):
|
||||
@patch.object(dbaas, 'get_engine')
|
||||
@patch.object(utils, 'generate_random_password',
|
||||
return_value='some_password')
|
||||
@patch.object(operating_system, 'write_file')
|
||||
def test_secure_root(self, *args):
|
||||
with patch.object(dbaas.MySqlApp, 'local_sql_client',
|
||||
return_value=self.mock_client):
|
||||
|
@ -262,8 +262,8 @@ class PkgDEBVersionTestCase(trove_testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PkgDEBVersionTestCase, self).setUp()
|
||||
self.pkgName = 'mysql-server-5.5'
|
||||
self.pkgVersion = '5.5.28-0'
|
||||
self.pkgName = 'mysql-server-5.7'
|
||||
self.pkgVersion = '5.7.20-0'
|
||||
self.getoutput = pkg.getoutput
|
||||
|
||||
def tearDown(self):
|
||||
|
@ -56,11 +56,11 @@ class BaseInstanceStatusTestCase(trove_testtools.TestCase):
|
||||
self.version = models.DBDatastoreVersion.create(
|
||||
id=self.db_info.datastore_version_id,
|
||||
datastore_id=self.datastore.id,
|
||||
name='5.5' + str(uuid.uuid4()),
|
||||
name='5.7' + str(uuid.uuid4()),
|
||||
manager='mysql',
|
||||
image_id=str(uuid.uuid4()),
|
||||
active=1,
|
||||
packages="mysql-server-5.5"
|
||||
packages="mysql-server-5.7"
|
||||
)
|
||||
super(BaseInstanceStatusTestCase, self).setUp()
|
||||
|
||||
|
@ -35,7 +35,7 @@ class TestDatastoreVersionController(trove_testtools.TestCase):
|
||||
"name": "test_vr1",
|
||||
"datastore_manager": "mysql",
|
||||
"image": "154b350d-4d86-4214-9067-9c54b230c0da",
|
||||
"packages": ["mysql-server-5.6"],
|
||||
"packages": ["mysql-server-5.7"],
|
||||
"active": True,
|
||||
"default": False
|
||||
}
|
||||
@ -96,7 +96,7 @@ class TestDatastoreVersionController(trove_testtools.TestCase):
|
||||
mock_ds_version_create.assert_called_with(
|
||||
'test_dsx', 'test_vr1', 'mysql',
|
||||
'154b350d-4d86-4214-9067-9c54b230c0da',
|
||||
'mysql-server-5.6', True)
|
||||
'mysql-server-5.7', True)
|
||||
|
||||
@patch.object(datastore_models.DatastoreVersion, 'load_by_uuid')
|
||||
def test_show_ds_version(self, mock_ds_version_load):
|
||||
@ -154,4 +154,4 @@ class TestDatastoreVersionController(trove_testtools.TestCase):
|
||||
mock_ds_version_update.assert_called_with(
|
||||
'test_dsx', 'test_vr1', 'mysql',
|
||||
'21c8805a-a800-4bca-a192-3a5a2519044d',
|
||||
'mysql-server-5.6', True)
|
||||
'mysql-server-5.7', True)
|
||||
|
@ -40,7 +40,7 @@ class DetailedModuleViewTest(trove_testtools.TestCase):
|
||||
self.module.created = 'Yesterday'
|
||||
self.module.updated = 'Now'
|
||||
self.module.datastore = 'mysql'
|
||||
self.module.datastore_version = '5.6'
|
||||
self.module.datastore_version = '5.7'
|
||||
self.module.auto_apply = False
|
||||
self.module.tenant_id = 'my_tenant'
|
||||
self.module.is_admin = False
|
||||
|
Loading…
Reference in New Issue
Block a user