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 <blangus@betterservers.com>
Submitted-by: Brian Angus <blangus@betterservers.com>
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1359070121 -0700
This commit is contained in:
Marcus Sorensen 2013-01-24 16:28:41 -07:00
parent bdbbbc36e7
commit 7de4583d8e
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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");