17
17
from heat.engine import clients
18
18
from heat.openstack.common import log as logging
19
19
from heat.engine import resource
20
from heat.engine.resources.quantum import quantum
20
from heat.engine.resources.neutron import neutron
22
22
logger = logging.getLogger(__name__)
61
61
def router_for_vpc(client, network_id):
62
# first get the quantum net
62
# first get the neutron net
63
63
net = VPC.network_for_vpc(client, network_id)
64
64
# then find a router with the same name
65
65
routers = client.list_routers(name=net['name'])['routers']
75
75
def check_create_complete(self, *args):
76
net = self.network_for_vpc(self.quantum(), self.resource_id)
77
if not quantum.QuantumResource.is_built(net):
76
net = self.network_for_vpc(self.neutron(), self.resource_id)
77
if not neutron.NeutronResource.is_built(net):
79
router = self.router_for_vpc(self.quantum(), self.resource_id)
80
return quantum.QuantumResource.is_built(router)
79
router = self.router_for_vpc(self.neutron(), self.resource_id)
80
return neutron.NeutronResource.is_built(router)
82
82
def handle_delete(self):
83
from quantumclient.common.exceptions import QuantumClientException
84
client = self.quantum()
83
from neutronclient.common.exceptions import NeutronClientException
84
client = self.neutron()
85
85
router = self.router_for_vpc(client, self.resource_id)
87
87
client.delete_router(router['id'])
88
except QuantumClientException as ex:
88
except NeutronClientException as ex:
89
89
if ex.status_code != 404:
93
93
client.delete_network(self.resource_id)
94
except QuantumClientException as ex:
94
except NeutronClientException as ex:
95
95
if ex.status_code != 404:
99
99
def resource_mapping():
100
if clients.quantumclient is None:
100
if clients.neutronclient is None: