You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2013/05/27 21:33:48 UTC
[1/4] git commit: updated refs/heads/4.0 to a572399
Updated Branches:
refs/heads/4.0 48e7eadb8 -> a5723992a
CLOUDSTACK-512: add space before
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cf47a721
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cf47a721
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cf47a721
Branch: refs/heads/4.0
Commit: cf47a72142ad2458d292ec8d16017d0722049fb4
Parents: 48e7ead
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon May 27 21:29:01 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon May 27 21:29:01 2013 +0200
----------------------------------------------------------------------
patches/systemvm/debian/config/root/edithosts.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf47a721/patches/systemvm/debian/config/root/edithosts.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/edithosts.sh b/patches/systemvm/debian/config/root/edithosts.sh
index b71089d..5481ea4 100755
--- a/patches/systemvm/debian/config/root/edithosts.sh
+++ b/patches/systemvm/debian/config/root/edithosts.sh
@@ -88,7 +88,7 @@ echo "0 $mac $ip $host *" >> $DHCP_LEASES
#edit hosts file as well
sed -i /"$ip "/d $HOSTS
-sed -i /"$host "/d $HOSTS
+sed -i /" $host "/d $HOSTS
echo "$ip $host " >> $HOSTS
if [ "$dflt" != "" ]
[3/4] git commit: updated refs/heads/4.0 to a572399
Posted by we...@apache.org.
remove duplicated Vpc routers in return of listByStateAndNetworkType
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6fa95273
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6fa95273
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6fa95273
Branch: refs/heads/4.0
Commit: 6fa9527353facb90f55950f44ad74e3e2aa19ec9
Parents: 98a9edf
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon May 27 21:30:37 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon May 27 21:30:37 2013 +0200
----------------------------------------------------------------------
.../src/com/cloud/vm/dao/DomainRouterDaoImpl.java | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fa95273/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
index 175d3f2..44dcf1a 100755
--- a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
+++ b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
@@ -16,6 +16,7 @@
// under the License.
package com.cloud.vm.dao;
+import java.util.ArrayList;
import java.util.List;
import javax.ejb.Local;
@@ -37,6 +38,7 @@ import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.JoinBuilder.JoinType;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.db.UpdateBuilder;
@@ -97,6 +99,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
HostUpSearch.done();
StateNetworkTypeSearch = createSearchBuilder();
+ StateNetworkTypeSearch.select(null, Func.DISTINCT, StateNetworkTypeSearch.entity().getId());
StateNetworkTypeSearch.and("state", StateNetworkTypeSearch.entity().getState(), Op.EQ);
SearchBuilder<RouterNetworkVO> joinRouterNetwork4 = _routerNetworkDao.createSearchBuilder();
joinRouterNetwork4.and("networkId", joinRouterNetwork4.entity().getNetworkId(), Op.EQ);
@@ -223,7 +226,12 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
sc.setParameters("state", state);
sc.setJoinParameters("networkRouter", "type", type);
sc.setJoinParameters("host", "mgmtServerId", mgmtSrvrId);
- return listBy(sc);
+ List<DomainRouterVO> routerIds = listBy(sc);
+ List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
+ for (DomainRouterVO router : routerIds) {
+ routers.add(findById(router.getId()));
+ }
+ return routers;
}
@Override
[4/4] git commit: updated refs/heads/4.0 to a572399
Posted by we...@apache.org.
CLOUDSTACK-1325: add password in response of RestoreVM
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a5723992
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a5723992
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a5723992
Branch: refs/heads/4.0
Commit: a5723992a0eeea9fc383c656b0d61dfc9e541ff9
Parents: 6fa9527
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon May 27 21:32:56 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon May 27 21:32:56 2013 +0200
----------------------------------------------------------------------
api/src/com/cloud/vm/UserVmService.java | 2 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 59 ++++++++++--------
2 files changed, 34 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5723992/api/src/com/cloud/vm/UserVmService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index 6635657..804d223 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -416,5 +416,5 @@ public interface UserVmService {
VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool);
- UserVm restoreVM(RestoreVMCmd cmd);
+ UserVm restoreVM(RestoreVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5723992/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index dbcbeb8..b5ac80d 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -409,22 +409,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
_accountMgr.checkAccess(caller, null, true, userVm);
- boolean result = resetVMPasswordInternal(cmd, password);
+ boolean result = resetVMPasswordInternal(vmId, password);
if (result) {
userVm.setPassword(password);
- //update the password in vm_details table too
- // Check if an SSH key pair was selected for the instance and if so use it to encrypt & save the vm password
- String sshPublicKey = userVm.getDetail("SSH.PublicKey");
- if (sshPublicKey != null && !sshPublicKey.equals("") && password != null && !password.equals("saved_password")) {
- String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(sshPublicKey, password);
- if (encryptedPasswd == null) {
- throw new CloudRuntimeException("Error encrypting password");
- }
-
- userVm.setDetail("Encrypted.Password", encryptedPasswd);
- _vmDao.saveDetails(userVm);
- }
+ savePasswordToDB(userVm, password);
} else {
throw new CloudRuntimeException("Failed to reset password for the virtual machine ");
}
@@ -432,8 +421,22 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
return userVm;
}
- private boolean resetVMPasswordInternal(ResetVMPasswordCmd cmd, String password) throws ResourceUnavailableException, InsufficientCapacityException {
- Long vmId = cmd.getId();
+ private void savePasswordToDB(UserVmVO vm, String password) {
+ // update the password in vm_details table too
+ // Check if an SSH key pair was selected for the instance and if so use it to encrypt & save the vm password
+ String sshPublicKey = vm.getDetail("SSH.PublicKey");
+ if (sshPublicKey != null && !sshPublicKey.equals("") && password != null && !password.equals("saved_password")) {
+ String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(sshPublicKey, password);
+ if (encryptedPasswd == null) {
+ throw new CloudRuntimeException("Error encrypting password");
+ }
+
+ vm.setDetail("Encrypted.Password", encryptedPasswd);
+ _vmDao.saveDetails(vm);
+ }
+ }
+
+ private boolean resetVMPasswordInternal(Long vmId, String password) throws ResourceUnavailableException, InsufficientCapacityException {
Long userId = UserContext.current().getCallerUserId();
VMInstanceVO vmInstance = _vmDao.findById(vmId);
@@ -2908,16 +2911,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
// Check if an SSH key pair was selected for the instance and if so use it to encrypt & save the vm password
- String sshPublicKey = vm.getDetail("SSH.PublicKey");
- if (sshPublicKey != null && !sshPublicKey.equals("") && password != null && !password.equals("saved_password")) {
- String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(sshPublicKey, password);
- if (encryptedPasswd == null) {
- throw new CloudRuntimeException("Error encrypting password");
- }
-
- vm.setDetail("Encrypted.Password", encryptedPasswd);
- _vmDao.saveDetails(vm);
- }
+ savePasswordToDB(vm, password);
params = new HashMap<VirtualMachineProfile.Param, Object>();
if (additionalParams != null) {
@@ -3709,7 +3703,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
@Override
- public UserVm restoreVM(RestoreVMCmd cmd) {
+ public UserVm restoreVM(RestoreVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException {
// Input validation
Account caller = UserContext.current().getCaller();
Long userId = UserContext.current().getCallerUserId();
@@ -3781,6 +3775,19 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
s_logger.debug("Unable to delete old root volume " + root.getId() + ", user may manually delete it", e);
}
+ if (template.getEnablePassword()) {
+ String password = generateRandomPassword();
+ boolean result = resetVMPasswordInternal(vmId, password);
+
+ if (result) {
+ vm.setPassword(password);
+ _vmDao.loadDetails(vm);
+ savePasswordToDB(vm, password);
+ } else {
+ s_logger.debug("Failed to reset password when restore the virtual machine " + vmId + ", user need to reset the password later");
+ }
+ }
+
if (needRestart) {
try {
_itMgr.start(vm, null, user, caller);
[2/4] git commit: updated refs/heads/4.0 to a572399
Posted by we...@apache.org.
remove duplicated ExpungeTask from BareMetalVmManagerImpl
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/98a9edfa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/98a9edfa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/98a9edfa
Branch: refs/heads/4.0
Commit: 98a9edfaaf5e944af24c8dc3b240dbd25109564d
Parents: cf47a72
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon May 27 21:29:43 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon May 27 21:29:43 2013 +0200
----------------------------------------------------------------------
.../cloud/baremetal/BareMetalVmManagerImpl.java | 28 ++++++--------
1 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98a9edfa/server/src/com/cloud/baremetal/BareMetalVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/baremetal/BareMetalVmManagerImpl.java b/server/src/com/cloud/baremetal/BareMetalVmManagerImpl.java
index 3972728..0797711 100755
--- a/server/src/com/cloud/baremetal/BareMetalVmManagerImpl.java
+++ b/server/src/com/cloud/baremetal/BareMetalVmManagerImpl.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.Executors;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
@@ -77,13 +76,11 @@ import com.cloud.user.SSHKeyPair;
import com.cloud.user.User;
import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
-import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Adapters;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.component.Inject;
import com.cloud.utils.component.Manager;
-import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.DB;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.fsm.StateListener;
@@ -448,25 +445,24 @@ public class BareMetalVmManagerImpl extends UserVmManagerImpl implements BareMet
_instance = "DEFAULT";
}
- String workers = configs.get("expunge.workers");
- int wrks = NumbersUtil.parseInt(workers, 10);
-
- String time = configs.get("expunge.interval");
- _expungeInterval = NumbersUtil.parseInt(time, 86400);
-
- time = configs.get("expunge.delay");
- _expungeDelay = NumbersUtil.parseInt(time, _expungeInterval);
-
- _executor = Executors.newScheduledThreadPool(wrks, new NamedThreadFactory("UserVm-Scavenger"));
-
_itMgr.registerGuru(Type.UserBareMetal, this);
VirtualMachine.State.getStateMachine().registerListener(this);
- s_logger.info("User VM Manager is configured.");
+ s_logger.info("Bare Metal VM Manager is configured.");
return true;
}
-
+
+ @Override
+ public boolean start() {
+ return true;
+ }
+
+ @Override
+ public boolean stop() {
+ return true;
+ }
+
@Override
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context) {
UserVmVO vm = profile.getVirtualMachine();