diff options
author | liangke <lokyse@163.com> | 2018-07-26 19:31:46 +0800 |
---|---|---|
committer | liangke <lokyse@163.com> | 2018-07-27 11:43:34 +0800 |
commit | e35c171a9297573a4122f4653587da1ce3cca8b4 (patch) | |
tree | c3a7a720ee5e3d8d2c97d177b095440403ca348b | |
parent | d3d4d6d1daeae08f5bc162a4a1a6d1d90eb7e53e (diff) |
Avoid data sharing in multiprocess for fake_api
Change-Id: I501d7d8725333d0f7634c85406c69c82c7987147
Issue-ID: MULTICLOUD-285
Signed-off-by: liangke <lokyse@163.com>
-rw-r--r-- | vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py index c23a1b2..ff9c066 100644 --- a/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py +++ b/vio/vio/swagger/views/fakeplugin/fakeData/fakeResponse.py @@ -3,7 +3,6 @@ from vio.pub.config.config import MSB_SERVICE_PORT from vio.pub.config.config import MSB_SERVICE_IP from collections import defaultdict -from uuid import uuid4 from datetime import datetime from datetime import timedelta import copy @@ -33,7 +32,7 @@ serverMapps[InitialServer] = \ { "name": "new-server-test", "tenantid": Tenantid, - "status": "ACTIVE", + "status": "BUILDING", 'createTime': (datetime.now()).strftime("%Y-%m-%d %H:%M:%S"), "turnStatusTime": datetime.now() } @@ -1636,7 +1635,9 @@ def create_instance(token, json=None): except Exception: return {"error": {"message": "invalidate data", "code": 403}} - uid = str(uuid4()) + # It's safe to using inner vm id, + # Avoid data sharing in multiprocess. + uid = InitialServer data = { "server": { "id": uid, @@ -1678,8 +1679,7 @@ def _serverStatus(serverid): or serverMapps[serverid]['status'] == "BUILDING": serverMapps[serverid]['status'] = "ACTIVE" elif serverMapps[serverid]['status'] == "DELETING": - del serverMapps[serverid] - raise ValueError() + return elif serverMapps[serverid]['status'] == "POWERING_OFF": serverMapps[serverid]['status'] = "SHUTDOWN" elif serverMapps[serverid]['status'] == "POWERING_ON": |