From a3fb4cf9c1767e2e8fb69cf06736652df4c439eb Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Fri, 10 Feb 2012 16:08:48 -0800 Subject: [PATCH] Update apikey/secretkey in transaction --- server/src/com/cloud/user/AccountManagerImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 2f5fb2e6f39..fd9c9c2099e 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -1777,7 +1777,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag return _accountDao.findUserAccountByApiKey(apiKey); } - @Override + @Override @DB public String[] createApiKeyAndSecretKey(RegisterCmd cmd) { Long userId = cmd.getId(); @@ -1787,8 +1787,11 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag // generate both an api key and a secret key, update the user table with the keys, return the keys to the user String[] keys = new String[2]; + Transaction txn = Transaction.currentTxn(); + txn.start(); keys[0] = createUserApiKey(userId); keys[1] = createUserSecretKey(userId); + txn.commit(); return keys; }