def delete(self, server_id): """ Delete a server """ LOG.info('delete(server_id=%s)', server_id) server = self.db.servers.show(id=server_id) # Stop all running tasks associated with this server task.stop(server_id) # Kill the running server self.virt.delete_server(server) # Purge all server files basepath = os.path.join(CONF.instances_dir, server_id) if os.path.exists(basepath): shutil.rmtree(basepath) # Delete the database entry self.db.servers.delete(id=server['id'])
def delete(self, server_id): """ Delete a server """ LOG.info('delete(server_id=%s)', server_id) server = DB.servers.show(id=server_id) # Stop all running tasks associated with this server task.stop(server_id) # Delete the iptables route for the Ec2 metadata service _delete_ec2metadata_route(server['ip'], CONF.ec2_metadata_port) # Kill the running server VIRT.delete_server(server) # Purge all server files basepath = os.path.join(CONF.instances_dir, server_id) if os.path.exists(basepath): shutil.rmtree(basepath) # Delete the database entry DB.servers.delete(id=server['id'])