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/master to e3fc5a4
Date Mon, 24 Mar 2014 22:48:54 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 2d5a58d66 -> e3fc5a4d4


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/e3fc5a4d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e3fc5a4d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e3fc5a4d

Branch: refs/heads/master
Commit: e3fc5a4d461aefc262a3bbfed5057d91a6e8e9ec
Parents: 2d5a58d
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:48:21 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/e3fc5a4d/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 bbd49f2..f071c9e 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