James Iter 9 лет назад
Родитель
Сommit
93d719be50
2 измененных файлов с 27 добавлено и 24 удалено
  1. 3 0
      docs/todo.md
  2. 24 24
      tests/test_guest.py

+ 3 - 0
docs/todo.md

@@ -11,4 +11,7 @@
 - 抽象出视图层的父类,尤其是 get、get_list、delete 这些方法基本相同
 - guest_disk 表中加入 path 字段,具体磁盘位置由 path 指明
 - guest 的系统磁盘,也需记录到 guest_disk 表中
+- 将 Guest 的系统镜像合并到单独的磁盘镜像目录中。即不再为 Guest 的系统镜像单独分配目录
 - os_template 表中 name 改为 path 字段。又 path 指明完整路径
+- 统计活着的宿主机,并提供获取列表的接口,供迁移时选择
+- 加入被动更新 Guest xml 的功能,由宿主机主动推送。具体时机待定

+ 24 - 24
tests/test_guest.py

@@ -27,23 +27,23 @@ class TestGuest(unittest.TestCase):
 
     # 创建Guest
     # @unittest.skip('skip create guest')
-    # def test_11_create(self):
-    #     payload = {
-    #         "cpu": 4,
-    #         "memory": 4,
-    #         "os_template_id": 1,
-    #         "quantity": 1,
-    #         "name": "",
-    #         "password": "pswd.com",
-    #         "lease_term": 100
-    #     }
-    #
-    #     url = TestGuest.base_url + '/guest'
-    #     headers = {'content-type': 'application/json'}
-    #     r = requests.post(url, data=json.dumps(payload), headers=headers)
-    #     j_r = json.loads(r.content)
-    #     print json.dumps(j_r, ensure_ascii=False)
-    #     self.assertEqual('200', j_r['state']['code'])
+    def test_11_create(self):
+        payload = {
+            "cpu": 4,
+            "memory": 4,
+            "os_template_id": 2,
+            "quantity": 3,
+            "name": "",
+            "password": "pswd.com",
+            "lease_term": 100
+        }
+
+        url = TestGuest.base_url + '/guest'
+        headers = {'content-type': 'application/json'}
+        r = requests.post(url, data=json.dumps(payload), headers=headers)
+        j_r = json.loads(r.content)
+        print json.dumps(j_r, ensure_ascii=False)
+        self.assertEqual('200', j_r['state']['code'])
 
     # 获取 Guest 列表
     # def test_12_get_list(self):
@@ -243,13 +243,13 @@ class TestGuest(unittest.TestCase):
     #     print json.dumps(j_r, ensure_ascii=False)
     #     self.assertEqual('200', j_r['state']['code'])
 
-    def test_62_content_search(self):
-        url = TestGuest.base_url + '/guests/_search?keyword=10.10.4'
-        headers = {'content-type': 'application/json'}
-        r = requests.get(url, headers=headers)
-        j_r = json.loads(r.content)
-        print json.dumps(j_r, ensure_ascii=False)
-        self.assertEqual('200', j_r['state']['code'])
+    # def test_62_content_search(self):
+    #     url = TestGuest.base_url + '/guests/_search?keyword=10.10.4'
+    #     headers = {'content-type': 'application/json'}
+    #     r = requests.get(url, headers=headers)
+    #     j_r = json.loads(r.content)
+    #     print json.dumps(j_r, ensure_ascii=False)
+    #     self.assertEqual('200', j_r['state']['code'])
 
 
 if __name__ == '__main__':