cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject git commit: updated refs/heads/4.4 to 7b19b6c
Date Mon, 24 Mar 2014 22:54:24 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 b3ad4192d -> 7b19b6cc1


vm meta sync sync xstoolsversion as well


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7b19b6cc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7b19b6cc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7b19b6cc

Branch: refs/heads/4.4
Commit: 7b19b6cc19aa1cfd39b5ddbf362004fb0a15f327
Parents: b3ad419
Author: Anthony Xu <anthony.xu@citrix.com>
Authored: Mon Mar 24 15:48:21 2014 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Mon Mar 24 15:49:15 2014 -0700

----------------------------------------------------------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java | 28 +++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7b19b6cc/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 2ff870a..5c449ca 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1051,10 +1051,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                                 if (vm.getType() == VirtualMachine.Type.User) {
                                     String platform = answer.getPlatform();
                                     if (platform != null) {
-                                        UserVmVO userVm = _userVmDao.findById(vm.getId());
-                                        _userVmDao.loadDetails(userVm);
-                                        userVm.setDetail("platform", platform);
-                                        _userVmDao.saveDetails(userVm);
+                                        Map<String,String> vmmetadata = new HashMap<String,String>();
+                                        vmmetadata.put(vm.getInstanceName(), platform);
+                                        syncVMMetaData(vmmetadata);
                                     }
                                 }
                             }
@@ -2558,21 +2557,32 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             }
             VMInstanceVO vm = _vmDao.findVMByInstanceName(name);
             if (vm != null && vm.getType() == VirtualMachine.Type.User) {
-                // track platform info
+                boolean changed = false;
                 UserVmVO userVm = _userVmDao.findById(vm.getId());
                 _userVmDao.loadDetails(userVm);
-                userVm.setDetail("platform",  platform);
+                if ( userVm.details.containsKey("timeoffset")) {
+                    userVm.details.remove("timeoffset");
+                    changed = true;
+                }
+                if (!userVm.details.containsKey("platform") || !userVm.details.get("platform").equals(platform))
{
+                    userVm.setDetail("platform",  platform);
+                    changed = true;
+                }
                 String pvdriver = "xenserver56";
                 if ( platform.contains("device_id")) {
                     pvdriver = "xenserver61";
                 }
-                userVm.setDetail("hypervisortoolsversion", pvdriver);
-                _userVmDao.saveDetails(userVm);
+                if (!userVm.details.containsKey("hypervisortoolsversion") || !userVm.details.get("hypervisortoolsversion").equals(pvdriver))
{
+                    userVm.setDetail("hypervisortoolsversion", pvdriver);
+                    changed = true;
+                }
+                if ( changed ) {
+                    _userVmDao.saveDetails(userVm);
+                }
             }
         }
     }
 
-
     public void deltaSync(Map<String, Pair<String, State>> newStates) {
         Map<Long, AgentVmInfo> states = convertToInfos(newStates);
 


Mime
View raw message