本文整理汇总了Python中mdl_updater.model_updater函数的典型用法代码示例。如果您正苦于以下问题:Python model_updater函数的具体用法?Python model_updater怎么用?Python model_updater使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了model_updater函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: auth_del
def auth_del(self, **kwargs):
"""
Remove Authorised keyring
"""
self.model.kargs_apply(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
if m.cluster_name == None:
u.defaults_refresh()
self.cluster_name = m.cluster_name
u.load_confg(m.cluster_name)
u.mon_members_refresh()
q = mdl_query.mdl_query(m)
if not q.mon_is():
raise Error("Not ruining a mon daemon")
u.mon_status()
if not q.mon_quorum():
raise Error("mon daemon is not in quorum")
arguments = [
"ceph",
"auth",
"del",
self.keyring_name
]
cmd_out = utils.execute_local_command(arguments)
return True
示例2: update_model
def update_model(mdl):
# Utility function to update model for osd_ctrl
u = mdl_updater.model_updater(mdl)
u.symlinks_refresh()
u.defaults_refresh()
u.partitions_all_refresh()
u.discover_partitions_refresh()
示例3: auth_add
def auth_add(self, **kwargs):
"""
Authorise keyring
"""
self.model.kargs_apply(**kwargs)
u = mdl_updater.model_updater(self.model)
u.hostname_refresh()
if self.model.cluster_name == None:
u.defaults_refresh()
keyring_path = self.get_path_keyring()
if not os.path.isfile(keyring_path):
raise Error("rgw keyring not found")
u.load_confg(self.model.cluster_name)
u.mon_members_refresh()
q = mdl_query.mdl_query(self.model)
if not q.mon_is():
raise Error("Not ruining a mon daemon")
u.mon_status()
if not q.mon_quorum():
raise Error("mon daemon is not in quorum")
arguments = [
"ceph",
"auth",
"import",
"-i",
keyring_path
]
cmd_out = utils.execute_local_command(arguments)
return True
示例4: __init__
def __init__(self, **kwargs):
self.model = model.model(**kwargs)
self._clear_implementation()
u = mdl_updater.model_updater(self.model)
u.ceph_version_refresh()
q = mdl_query.mdl_query(self.model)
self.ceph_daemon_user = q.ceph_daemon_user()
示例5: status
def status(self, **kwargs):
"""
Get status from mon deamon
CLI Example:
salt '*' sesceph.prepare
'cluster_name'='ceph' \
'cluster_uuid'='cluster_uuid' \
Notes:
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
cluster_name
Set the cluster name. Defaults to "ceph".
"""
hostname = platform.node()
u = mdl_updater.model_updater(self.model)
u.hostname_refresh()
try:
u.defaults_refresh()
except:
return {}
u.load_confg(self.model.cluster_name)
u.mon_members_refresh()
q = mdl_query.mdl_query(self.model)
if not q.mon_is():
raise Error("Not a mon node")
u.mon_status()
p = presenter.mdl_presentor(self.model)
return p.mon_status()
示例6: quorum
def quorum(self, **kwargs):
"""
Is mon deamon in quorum
CLI Example:
salt '*' sesceph.prepare
'cluster_name'='ceph' \
'cluster_uuid'='cluster_uuid' \
Notes:
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
cluster_name
Set the cluster name. Defaults to "ceph".
"""
hostname = platform.node()
u = mdl_updater.model_updater(self.model)
u.hostname_refresh()
try:
u.defaults_refresh()
except:
raise Error("Could not get cluster details")
u.load_confg(self.model.cluster_name)
u.mon_members_refresh()
u.mon_status()
q = mdl_query.mdl_query(self.model)
return q.mon_quorum()
示例7: cluster_status
def cluster_status(**kwargs):
"""
Get the cluster status
CLI Example:
salt '*' sesceph.cluster_status \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
Notes:
Get the cluster status including health if in quorum.
Scope:
Cluster wide
Arguments:
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
cluster_name
Set the cluster name. Defaults to "ceph".
"""
m = model.model(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
u.defaults_refresh()
u.load_confg(m.cluster_name)
u.mon_members_refresh()
mur = mdl_updater_remote.model_updater_remote(m)
can_connect = mur.connect()
if not can_connect:
raise Error("Cant connect to cluster.")
p = presenter.mdl_presentor(m)
return p.cluster_status()
示例8: keyring_auth_list
def keyring_auth_list(**kwargs):
"""
List all cephx authorization keys
CLI Example:
salt '*' sesceph.auth_list \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
Notes:
cluster_name
Set the cluster name. Defaults to "ceph".
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
"""
m = model.model(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
try:
u.defaults_refresh()
except:
return {}
u.load_confg(m.cluster_name)
u.mon_members_refresh()
u.auth_list()
p = presenter.mdl_presentor(m)
return p.auth_list()
示例9: pool_del
def pool_del(pool_name, **kwargs):
"""
List all cephx authorization keys
CLI Example:
salt '*' sesceph.pool_del pool_name \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
Notes:
cluster_name
Set the cluster name. Defaults to "ceph".
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
"""
m = model.model(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
u.defaults_refresh()
u.load_confg(m.cluster_name)
u.mon_members_refresh()
mur = mdl_updater_remote.model_updater_remote(m)
can_connect = mur.connect()
if not can_connect:
raise Error("Cant connect to cluster.")
mur.pool_list()
return mur.pool_del(pool_name)
示例10: cluster_quorum
def cluster_quorum(**kwargs):
"""
Get the cluster status
CLI Example:
salt '*' sesceph.cluster_status \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
Notes:
Get the cluster quorum status.
Scope:
Cluster wide
Arguments:
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
cluster_name
Set the cluster name. Defaults to "ceph".
"""
m = model.model(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
u.defaults_refresh()
u.load_confg(m.cluster_name)
u.mon_members_refresh()
mur = mdl_updater_remote.model_updater_remote(m)
can_connect = mur.connect()
if not can_connect:
return False
q = mdl_query.mdl_query(m)
return q.cluster_quorum()
示例11: mon_is
def mon_is(self, **kwargs):
"""
Is this a mon node
CLI Example:
salt '*' sesceph.keys_create
'cluster_name'='ceph' \
'cluster_uuid'='cluster_uuid' \
Notes:
cluster_name
Set the cluster name. Defaults to "ceph".
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
"""
u = mdl_updater.model_updater(self.model)
u.hostname_refresh()
try:
u.defaults_refresh()
except:
return False
u.load_confg(self.model.cluster_name)
u.mon_members_refresh()
q = mdl_query.mdl_query(self.model)
return q.mon_is()
示例12: update
def update(self):
self.updater = mdl_updater.model_updater(self.model)
self.updater.hostname_refresh()
try:
self.updater.defaults_refresh()
except utils.Error, e:
log.error(e)
示例13: keyring_present_type
def keyring_present_type(**kwargs):
"""
Check if keyring exists on disk
CLI Example:
salt '*' sesceph.keyring_admin_save \\
'[mon.]\n\tkey = AQA/vZ9WyDwsKRAAxQ6wjGJH6WV8fDJeyzxHrg==\n\tcaps mon = \"allow *\"\n' \\
'cluster_name'='ceph' \\
'cluster_uuid'='cluster_uuid'
Notes:
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
cluster_name
Set the cluster name. Defaults to "ceph".
keyring_type
Set the keyring type
"""
keyring_type = kwargs.get("keyring_type")
if (keyring_type is None):
raise Error("keyring_type is None")
m = model.model(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
try:
u.defaults_refresh()
except:
pass
keyobj = keyring.keyring_facard(m)
keyobj.key_type = keyring_type
return keyobj.present()
示例14: pool_del
def pool_del(pool_name, **kwargs):
"""
List all cephx authorization keys
CLI Example:
salt '*' sesceph.pool_del pool_name \
'cluster_name'='ceph' \
'cluster_uuid'='cluster_uuid' \
Notes:
cluster_name
Set the cluster name. Defaults to "ceph".
cluster_uuid
Set the cluster UUID. Defaults to value found in ceph config file.
"""
m = model.model(**kwargs)
u = mdl_updater.model_updater(m)
u.hostname_refresh()
try:
u.defaults_refresh()
except:
return {}
u.load_confg(m.cluster_name)
u.mon_members_refresh()
u.pool_list()
u.pool_del(pool_name)
return True
示例15: active
def active(self, **kwargs):
"""
Is mon deamon running
"""
u = mdl_updater.model_updater(self.model)
u.hostname_refresh()
q = mdl_query.mdl_query(self.model)
return q.mon_active()