Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加虚拟机备份、编辑磁盘描述 #170

Merged
merged 10 commits into from
Sep 22, 2016
Merged

添加虚拟机备份、编辑磁盘描述 #170

merged 10 commits into from
Sep 22, 2016

Conversation

lsglsf
Copy link
Contributor

@lsglsf lsglsf commented Sep 21, 2016

IP_cinder = "192.168.190.11"
PORT_cinder = "8774"
#读取配置文件
cf = ConfigParser.ConfigParser()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要读取配置文件啊?不是都在settings里面直接引用吗?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这些都属于可配置项,在settings里面如果给出的是pyc的文件就不能修改了

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在配置都提取到yaml文件中了。你可以看看这个issue. #143
该issue已经修复了。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个版本里面配置文件还没改,版本合过去后我把这几个配置写到yaml里面去

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的。


pro_path = os.path.split(os.path.realpath(__file__))[0]
LOG_PATH = os.path.join(pro_path, "log") # 日志路径
DB_PATH = os.path.join(pro_path, "db.sqlite3")
CONFIG_PATH = os.path.join(pro_path,"setting.conf")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上面两行:

LOG_PATH = os.path.join(pro_path, "log")  # 日志路径
DB_PATH =  os.path.join(pro_path, "db.sqlite3")

这两个不是全部已经配置了吗?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已改成从settings里面获取项目路径

:return:
'''
assert self.token != "","not login"
path = "/v2/%s/volumes/%s"%(self.project_id, volume_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的path。不要写在代码里面了。提取出来放在一个单独的文件中统一管理。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path会随着用户和操作对象的变化而变化,如果只是把相同的部分放在公用变量里面再拼接起来好像没什么意义

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用拼接吧。url统一定义成模版的形式使用的时候渲染然后集中放在一个地方比较好管理一点。
例如模版:

opensatckUrl = "/v1/{project_id}/volumes/{volume_id}"

使用的时候渲染就可以了。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不是我们程序的url地址,是openstack cinder API的地址,我不确定我们理解的是不是一样的

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你说的openstack cinder API的地址不是可以理解为第3方服务的api地址么?

@LuPan2015
Copy link
Collaborator

LuPan2015 commented Sep 21, 2016

和张鼎那边讨论是暂时先通过。然后后续url作统一的处理,该问题转移到issue #177
LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants