def backup_az(az_domain, backup_az_domain, ceph_host, backup_ceph_host): # get ceph conf and keyring LOG.info("connect to ceph: host=%s" % ceph_host) ceph = Ceph(ceph_host=ceph_host, ceph_user=CEPH_USER, ceph_key_file=CEPH_KEYPAIR) LOG.info("get %s from %s" % (CEPH_CONF, ceph_host)) ceph.get_file(LOCAL_CEPH_PATH + "/" + CEPH_CONF, REMOTE_CEPH_PATH + "/" + CEPH_CONF) LOG.info("get %s from %s" % (CEPH_KEYRING, ceph_host)) ceph.get_file(LOCAL_CEPH_PATH + "/" + CEPH_KEYRING, REMOTE_CEPH_PATH + "/" + CEPH_KEYRING) ceph.close() # get backup ceph conf and keyring LOG.info("connect to backup_ceph: host=%s" % backup_ceph_host) backup_ceph = Ceph(ceph_host=backup_ceph_host, ceph_user=CEPH_USER, ceph_key_file=CEPH_KEYPAIR) LOG.info("get %s from %s" % (CEPH_BACKUP_CONF, backup_ceph_host)) backup_ceph.get_file(LOCAL_CEPH_PATH + "/" + CEPH_BACKUP_CONF, REMOTE_CEPH_PATH + "/" + CEPH_BACKUP_CONF) LOG.info("get %s from %s" % (CEPH_BACKUP_KEYRING, backup_ceph_host)) backup_ceph.get_file(LOCAL_CEPH_PATH + "/" + CEPH_BACKUP_KEYRING, REMOTE_CEPH_PATH + "/" + CEPH_BACKUP_KEYRING) backup_ceph.close() backend = Backend() # update volume_backend_name volume_backend_name = CEPH_VOLUME_PREFIX + ":" + az_domain + ":" + backup_az_domain LOG.info("ceph storage backend update: volume_backend_name = %s" % volume_backend_name) backend.update_ceph_param("volume_backend_name", volume_backend_name) # update iscsi_server_ip LOG.info("ceph storage backend update:iscsi_server_ip=%s" % ceph_host) backend.update_ceph_param("iscsi_server_ip", ceph_host) # backend.commit() ''' update_params = {} volume_backend_name = CEPH_VOLUME_PREFIX+":"+az_domain+":"+backup_az_domain update_params["volume_backend_name"] = volume_backend_name update_params["iscsi_server_ip"] = ceph_host backend.update_ceph_params(update_params) ''' # set volume_type key # volume_type=VOLUME_TYPE_PREFIX+"@"+az_domain shell_file = CURRENT_PATH + "/script/volume_backend_name.sh" # os.system("/bin/bash " + shell_file + " " + volume_type + " " + volume_backend_name) os.system("/bin/bash " + shell_file + " " + az_domain + " " + backup_az_domain) # restart Service restart_component("cinder", "cinder-volume") restart_component("cinder", "cinder-backup")
def __init__(self, rbd=None, snap=None): self.ceph = Ceph(None).backup self.tmp_dir = None self.dev = None self.rbd = rbd self.snap = snap
def __get_ceph_storage(self): result = {} for storage in self.px.storage.get(): if storage['type'] != 'rbd': continue name = storage['storage'] endpoint = self.__get_ceph_endpoint(name) result[name] = Ceph(storage['pool'], endpoint=endpoint) return result
def initialize(self): self.__marathon = MarathonClient(options.marathon_masters, options.marathon_port) self.__ceph = Ceph(options.ceph_api_host, options.ceph_api_port)
def initialize(self): self.__ceph = Ceph()