Change libcloud imports to remove deprecated module paths. Actually move the pip cache into the place devstack expects on the devstack host. As soon as the new version of openstack-ci is checked out, start using it for the scripts in the currently running test, so that we are testing as much of the test infrastructure itself as possible. Allow the update and launch scripts to have the server/image name specified in an environment variable for easier testing/upgrading. Change-Id: Iee0a946afa80929e99c08e5a6b0504c1d8dd0093
45 lines
1.4 KiB
Python
Executable File
45 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# Delete a devstack VM.
|
|
|
|
# Copyright (C) 2011 OpenStack LLC.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
#
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from libcloud.compute.base import NodeImage, NodeSize, NodeLocation
|
|
from libcloud.compute.types import Provider
|
|
from libcloud.compute.providers import get_driver
|
|
import os, sys
|
|
import getopt
|
|
import time
|
|
|
|
import vmdatabase
|
|
|
|
CLOUD_SERVERS_DRIVER = os.environ.get('CLOUD_SERVERS_DRIVER','rackspace')
|
|
CLOUD_SERVERS_USERNAME = os.environ['CLOUD_SERVERS_USERNAME']
|
|
CLOUD_SERVERS_API_KEY = os.environ['CLOUD_SERVERS_API_KEY']
|
|
|
|
node_uuid = sys.argv[1]
|
|
db = vmdatabase.VMDatabase()
|
|
machine = db.getMachine(node_uuid)
|
|
|
|
if CLOUD_SERVERS_DRIVER == 'rackspace':
|
|
Driver = get_driver(Provider.RACKSPACE)
|
|
conn = Driver(CLOUD_SERVERS_USERNAME, CLOUD_SERVERS_API_KEY)
|
|
node = [n for n in conn.list_nodes() if n.id==str(machine['id'])][0]
|
|
node.destroy()
|
|
|
|
db.delMachine(node_uuid)
|