You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/08/09 03:41:08 UTC

[17/23] git commit: agent: Never write to agent.properties

agent: Never write to agent.properties

A daemon should never write to a configuration file

Admins might use tools like Puppet and they don't like changing files


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

Branch: refs/heads/vpc
Commit: c4f847518f9075e1a3a69c1ba742c716bb1d7cb0
Parents: 6c015d4
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Wed Aug 8 20:37:25 2012 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Wed Aug 8 22:31:06 2012 +0200

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |   29 ---------------
 1 files changed, 0 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c4f84751/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 359497e..dea00bd 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -412,34 +412,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements
         return "scripts/storage/qcow2";
     }
 
-    private void saveProperties(Map<String, Object> params)
-            throws ConfigurationException {
-        final File file = PropertiesUtil.findConfigFile("agent.properties");
-        if (file == null) {
-            throw new ConfigurationException("Unable to find agent.properties.");
-        }
-
-        s_logger.info("agent.properties found at " + file.getAbsolutePath());
-
-        try {
-            Properties _properties = new Properties();
-            _properties.load(new FileInputStream(file));
-            Set<String> names = _properties.stringPropertyNames();
-            for (String key : params.keySet()) {
-                if (!names.contains(key)) {
-                    _properties.setProperty(key, (String) params.get(key));
-                }
-            }
-            _properties.store(new FileOutputStream(file), "");
-        } catch (final FileNotFoundException ex) {
-            throw new CloudRuntimeException("Cannot find the file: "
-                    + file.getAbsolutePath(), ex);
-        } catch (final IOException ex) {
-            throw new CloudRuntimeException("IOException in reading "
-                    + file.getAbsolutePath(), ex);
-        }
-    }
-
     @Override
     public boolean configure(String name, Map<String, Object> params)
             throws ConfigurationException {
@@ -749,7 +721,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements
             }
             params.put("vm.migrate.speed", String.valueOf(_migrateSpeed));
         }
-        saveProperties(params);
 
         return true;
     }