Initial pass at automatically confirming resizes after a given window.
This commit is contained in:
parent
68e2158307
commit
693066b76b
@ -321,6 +321,11 @@ def migration_get_by_instance_and_status(context, instance_uuid, status):
|
|||||||
status)
|
status)
|
||||||
|
|
||||||
|
|
||||||
|
def migration_get_all_unconfirmed(context, confirm_window):
|
||||||
|
"""Finds all unconfirmed migrations within the confirmation window."""
|
||||||
|
return IMPL.migration_get_all_unconfirmed(context, confirm_window)
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""
|
|
||||||
Implementation of SQLAlchemy backend.
|
"""Implementation of SQLAlchemy backend."""
|
||||||
"""
|
|
||||||
|
import datetime
|
||||||
import re
|
import re
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
@ -3194,6 +3195,21 @@ def migration_get_by_instance_and_status(context, instance_uuid, status):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@require_admin_context
|
||||||
|
def migration_get_all_unconfirmed(context, confirm_window, session=None):
|
||||||
|
confirm_window = datetime.datetime.utcnow() - datetime.timedelta(
|
||||||
|
seconds=confirm_window)
|
||||||
|
|
||||||
|
if not session:
|
||||||
|
session = get_session()
|
||||||
|
|
||||||
|
results = session.query(models.Migration).\
|
||||||
|
filter(models.Migration.updated_at <= confirm_window).\
|
||||||
|
filter_by(status="VERIFY_RESIZE").all()
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user