diff options
27 files changed, 170 insertions, 98 deletions
diff --git a/api-ref/source/samples/db-list-datastore-versions.json b/api-ref/source/samples/db-list-datastore-versions.json index e80e70c0..c1fc53de 100644 --- a/api-ref/source/samples/db-list-datastore-versions.json +++ b/api-ref/source/samples/db-list-datastore-versions.json @@ -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" } diff --git a/devstack/settings b/devstack/settings index 45cd862c..44eaf0d7 100644 --- a/devstack/settings +++ b/devstack/settings @@ -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} diff --git a/doc/source/admin/guest_cloud_init.rst b/doc/source/admin/guest_cloud_init.rst index eb95f203..af469372 100644 --- a/doc/source/admin/guest_cloud_init.rst +++ b/doc/source/admin/guest_cloud_init.rst @@ -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. diff --git a/doc/source/install/manual_install.rst b/doc/source/install/manual_install.rst index 18b800cd..12661236 100644 --- a/doc/source/install/manual_install.rst +++ b/doc/source/install/manual_install.rst @@ -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/ diff --git a/integration/scripts/conf/cassandra.conf b/integration/scripts/conf/cassandra.conf index 5a2f0acc..f322d09a 100644 --- a/integration/scripts/conf/cassandra.conf +++ b/integration/scripts/conf/cassandra.conf @@ -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, diff --git a/integration/scripts/conf/couchbase.conf b/integration/scripts/conf/couchbase.conf index 5a2f0acc..f322d09a 100644 --- a/integration/scripts/conf/couchbase.conf +++ b/integration/scripts/conf/couchbase.conf @@ -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, diff --git a/integration/scripts/conf/db2.conf b/integration/scripts/conf/db2.conf index a842ea02..e9a4e282 100644 --- a/integration/scripts/conf/db2.conf +++ b/integration/scripts/conf/db2.conf @@ -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, diff --git a/integration/scripts/conf/mariadb.conf b/integration/scripts/conf/mariadb.conf index 0e29d114..15998d28 100644 --- a/integration/scripts/conf/mariadb.conf +++ b/integration/scripts/conf/mariadb.conf @@ -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, diff --git a/integration/scripts/conf/mongodb.conf b/integration/scripts/conf/mongodb.conf index 0e0aae02..be0989b6 100644 --- a/integration/scripts/conf/mongodb.conf +++ b/integration/scripts/conf/mongodb.conf @@ -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, diff --git a/integration/scripts/conf/mysql.conf b/integration/scripts/conf/mysql.conf index 0e29d114..15998d28 100644 --- a/integration/scripts/conf/mysql.conf +++ b/integration/scripts/conf/mysql.conf @@ -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, diff --git a/integration/scripts/conf/percona.conf b/integration/scripts/conf/percona.conf index 0e29d114..15998d28 100644 --- a/integration/scripts/conf/percona.conf +++ b/integration/scripts/conf/percona.conf @@ -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, diff --git a/integration/scripts/conf/postgresql.conf b/integration/scripts/conf/postgresql.conf index 8033f582..42e87ce5 100644 --- a/integration/scripts/conf/postgresql.conf +++ b/integration/scripts/conf/postgresql.conf @@ -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, diff --git a/integration/scripts/conf/pxc.conf b/integration/scripts/conf/pxc.conf index 0e29d114..15998d28 100644 --- a/integration/scripts/conf/pxc.conf +++ b/integration/scripts/conf/pxc.conf @@ -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, diff --git a/integration/scripts/conf/redis.conf b/integration/scripts/conf/redis.conf index 65bd382c..37de4599 100644 --- a/integration/scripts/conf/redis.conf +++ b/integration/scripts/conf/redis.conf @@ -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, diff --git a/integration/scripts/conf/test_begin.conf b/integration/scripts/conf/test_begin.conf index 22dbd966..534341c6 100644 --- a/integration/scripts/conf/test_begin.conf +++ b/integration/scripts/conf/test_begin.conf @@ -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", diff --git a/integration/scripts/conf/vertica.conf b/integration/scripts/conf/vertica.conf index 242d7fa1..c42f7f32 100644 --- a/integration/scripts/conf/vertica.conf +++ b/integration/scripts/conf/vertica.conf @@ -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, diff --git a/integration/scripts/files/elements/ubuntu-xenial-mysql/install.d/30-mysql b/integration/scripts/files/elements/ubuntu-xenial-mysql/install.d/30-mysql index 75ccdc66..a0002df1 100755 --- a/integration/scripts/files/elements/ubuntu-xenial-mysql/install.d/30-mysql +++ b/integration/scripts/files/elements/ubuntu-xenial-mysql/install.d/30-mysql @@ -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 diff --git a/integration/scripts/trovestack b/integration/scripts/trovestack index 8ba8c10d..442b2604 100755 --- a/integration/scripts/trovestack +++ b/integration/scripts/trovestack @@ -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', \ diff --git a/trove/guestagent/datastore/mysql_common/service.py b/trove/guestagent/datastore/mysql_common/service.py index 442c8e73..72e1cb59 100644 --- a/trove/guestagent/datastore/mysql_common/service.py +++ b/trove/guestagent/datastore/mysql_common/service.py @@ -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. diff --git a/trove/guestagent/strategies/restore/mysql_impl.py b/trove/guestagent/strategies/restore/mysql_impl.py index 4d2c1bc7..ebc5ca38 100644 --- a/trove/guestagent/strategies/restore/mysql_impl.py +++ b/trove/guestagent/strategies/restore/mysql_impl.py @@ -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)) diff --git a/trove/tests/api/instances_resize.py b/trove/tests/api/instances_resize.py index aef79123..066a0656 100644 --- a/trove/tests/api/instances_resize.py +++ b/trove/tests/api/instances_resize.py @@ -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) diff --git a/trove/tests/unittests/common/test_template.py b/trove/tests/unittests/common/test_template.py index 9a77ef8f..2dcd3cfa 100644 --- a/trove/tests/unittests/common/test_template.py +++ b/trove/tests/unittests/common/test_template.py @@ -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, diff --git a/trove/tests/unittests/guestagent/test_dbaas.py b/trove/tests/unittests/guestagent/test_dbaas.py index c4accede..c041822d 100644 --- a/trove/tests/unittests/guestagent/test_dbaas.py +++ b/trove/tests/unittests/guestagent/test_dbaas.py @@ -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): diff --git a/trove/tests/unittests/guestagent/test_pkg.py b/trove/tests/unittests/guestagent/test_pkg.py index 118f5340..16b61023 100644 --- a/trove/tests/unittests/guestagent/test_pkg.py +++ b/trove/tests/unittests/guestagent/test_pkg.py @@ -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): diff --git a/trove/tests/unittests/instance/test_instance_status.py b/trove/tests/unittests/instance/test_instance_status.py index 0efb34ee..9dc7e406 100644 --- a/trove/tests/unittests/instance/test_instance_status.py +++ b/trove/tests/unittests/instance/test_instance_status.py @@ -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() diff --git a/trove/tests/unittests/mgmt/test_datastore_controller.py b/trove/tests/unittests/mgmt/test_datastore_controller.py index 9b594879..2cf5caf2 100644 --- a/trove/tests/unittests/mgmt/test_datastore_controller.py +++ b/trove/tests/unittests/mgmt/test_datastore_controller.py @@ -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) diff --git a/trove/tests/unittests/module/test_module_views.py b/trove/tests/unittests/module/test_module_views.py index 97edc330..b976b9cd 100644 --- a/trove/tests/unittests/module/test_module_views.py +++ b/trove/tests/unittests/module/test_module_views.py @@ -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 |