This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" Glance client to convert QCOW2 images in Glance to RAW """ | |
# from pprint import pprint | |
from os import environ as env | |
import collections | |
import subprocess | |
# import sys | |
from glanceclient.v2 import client as glclient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
endpoint = 'https://nova.api.cloud.ipnett.se/v2/<some_tenant_uuid>' | |
parts = parse.urlparse(endpoint) | |
if ':' in parts.netloc: | |
root_endpoint = "://".join([parts.scheme, parts.netloc]) | |
else: | |
root_endpoint = endpoint | |
print root_endpoint | |
# Example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def put_object(ioctx, diskpath, objprefix): | |
""" Puts an object from disk, using (objprefix + filename) as key. | |
Naive code which reads entire object to memory before writing. | |
""" | |
bufsize = 2**20 ## 1 MiB | |
key = objprefix + os.path.basename(diskpath) | |
offset = 0 | |
sha = hashlib.sha512() | |
fhd = open(diskpath, 'rb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A ceilometer (newton) resource query can look like the following: | |
--SQL: 'SELECT sample.meter_id AS sample_meter_id, meter.name AS meter_name, meter.type AS meter_type, meter.unit AS meter_unit, resource.resource_id AS resource_resource_id, resource.project_id AS resource_project_id, resource.source_id -- AS resource_source_id, resource.user_id AS resource_user_id | |
-- FROM sample JOIN (SELECT max(sample.id) AS id | |
-- FROM sample JOIN resource ON resource.internal_id = sample.resource_id | |
-- WHERE resource.resource_id = %(resource_id_1)s GROUP BY sample.meter_id, resource.resource_id) AS anon_1 ON anon_1.id = sample.id JOIN meter ON meter.id = sample.meter_id JOIN resource ON resource.internal_id = sample.resource_id | |
-- WHERE resource.resource_id = %(resource_id_2)s'] | |
-- [parameters: {'resource_id_1': u'02c92f6c-6596-489e-a710-0321f3501256', 'resource_id_2': u'02c92f6c-6596-489e-a710-0321f3501256'} | |
-- In the ceilometer database in question, the sample table has 141M rows and the resource table has 1.2M r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ceilometer=# SELECT | |
ceilometer-# sample.meter_id AS sample_meter_id, | |
ceilometer-# meter.name AS meter_name, | |
ceilometer-# meter.type AS meter_type, | |
ceilometer-# meter.unit AS meter_unit, | |
ceilometer-# resource.resource_id AS resource_resource_id, | |
ceilometer-# resource.project_id AS resource_project_id, | |
ceilometer-# resource.source_id AS resource_source_id, | |
ceilometer-# resource.user_id AS resource_user_id | |
ceilometer-# FROM sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Stop all OSDs | |
## Set OSD nodown | |
ceph osd set nodown | |
##Set OSD nobackfill | |
ceph osd set nobackfill | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Script to create reoccuring maintenance windows for PagerDuty""" | |
# | |
# Copyright (c) 2016, PagerDuty, Inc. <info@pagerduty.com> | |
# Copyright (c) 2022, BrainMill AB, <info@brainmill.com> | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# * Redistributions of source code must retain the above copyright |
OlderNewer