Updated Branches: refs/heads/add_remove_nics bdbbbc36e -> 7de4583d8
Summary: Fixed a bug when trying to change the default NIC when the default nic was already on the same network as the nic you were trying to make the default. Reported-by: Brian Angus <[email protected]> Submitted-by: Brian Angus <[email protected]> Signed-off-by: Marcus Sorensen <[email protected]> 1359070121 -0700 Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7de4583d Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7de4583d Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7de4583d Branch: refs/heads/add_remove_nics Commit: 7de4583d8ee352d1868cca6aa4921b4e518a3242 Parents: bdbbbc3 Author: Marcus Sorensen <[email protected]> Authored: Thu Jan 24 16:28:41 2013 -0700 Committer: Marcus Sorensen <[email protected]> Committed: Thu Jan 24 16:28:41 2013 -0700 ---------------------------------------------------------------------- .../resource/NfsSecondaryStorageResource.java | 3 ++- server/src/com/cloud/vm/UserVmManagerImpl.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7de4583d/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java b/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java index a4bea9d..a634c68 100755 --- a/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java +++ b/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java @@ -398,7 +398,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements @Override public boolean accept(final File directory, final String fileName) { - return !fileName.startsWith("."); + File fileToUpload = new File(directory.getAbsolutePath() + "/" + fileName); + return !fileName.startsWith(".") && !fileToUpload.isDirectory(); } }, new ObjectNamingStrategy() { @Override http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7de4583d/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 d2e85a0..e838258 100644 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -1072,8 +1072,15 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager throw new CloudRuntimeException("refusing to set default nic because chosen nic is already the default"); } - NicProfile existing = _networkModel.getNicProfile(vmInstance, existingdefaultnet.getId(), null); - + NicProfile existing = null; + List<NicProfile> nicProfiles = _networkMgr.getNicProfiles(vmInstance); + for (NicProfile nicProfile : nicProfiles) { + if(nicProfile.isDefaultNic() && nicProfile.getNetworkId() == existingdefaultnet.getId()){ + existing = nicProfile; + continue; + } + } + if (existing == null){ s_logger.warn("Failed to update default nic, no nic profile found for existing default network"); throw new CloudRuntimeException("Failed to find a nic profile for the existing default network. This is bad and probably means some sort of configuration corruption");
