def handle_volume_update(self, graph_db, body): """ Handle the volume update events :param graph_db: Instance of Graph DB :param body: event body """ timestamp = time.time() uuid = body['payload']['volume_id'] cinder_db = self.get_cinder_connection() volume = OpenstackResource(uuid) stack_uuid = volume.get_stack(graph_db) heat_db = None if stack_uuid: heat_db = self.get_heat_connection(self.config) keystone_db = self.get_keystone_db(self.config) OpenstackResource(uuid).remove_resource(graph_db) virtual_resources.add_cinder_volumes(cinder_db, graph_db, self.pop, timestamp, uuid=uuid) controller_hostname = config_section_map( 'Openstack', self.config)['controller_hostname'] if heat_db: virtual_resources.add_heat_stacks(heat_db, keystone_db, graph_db, self.pop, timestamp, controller_hostname, uuid=stack_uuid)
def handle_volume_create(self, graph_db, body): """ Handle the volume create events :param graph_db: Instance of Graph DB :param body: event body """ timestamp = time.time() uuid = body['payload']['volume_id'] cinder_db = self.get_cinder_connection() virtual_resources.add_cinder_volumes(cinder_db, graph_db, self.pop, timestamp, uuid=uuid)
def handle_volume_update(self, graph_db, body): """ Handle the volume update events :param graph_db: Instance of Graph DB :param body: event body """ timestamp = time.time() uuid = body['payload']['volume_id'] cinder_db = self.get_cinder_connection() volume = OpenstackResource(uuid) stack_uuid = volume.get_stack(graph_db) heat_db = None if stack_uuid: heat_db = self.get_heat_connection(self.config) keystone_db = self.get_keystone_db(self.config) OpenstackResource(uuid).remove_resource(graph_db) virtual_resources.add_cinder_volumes(cinder_db, graph_db, self.pop, timestamp, uuid=uuid) controller_hostname = config_section_map('Openstack', self.config)['controller_hostname'] if heat_db: virtual_resources.add_heat_stacks(heat_db, keystone_db, graph_db, self.pop, timestamp, controller_hostname, uuid=stack_uuid)