cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yas...@apache.org
Subject [2/2] git commit: updated refs/heads/master to 0cdf0f6
Date Fri, 17 Jan 2014 00:13:52 GMT
CLOUDSTACK-5779: Moving bumpUpPriority, edithosts.sh, dnsmasq.sh to use routeProxy


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

Branch: refs/heads/master
Commit: 0cdf0f6f67c99a06fc1b94c2f2a38eff020f3f67
Parents: b703b43
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Thu Jan 16 12:48:27 2014 -0800
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Thu Jan 16 16:03:09 2014 -0800

----------------------------------------------------------------------
 .../virtualnetwork/VirtualRoutingResource.java  |  98 +++-----
 .../vmware/resource/VmwareResource.java         | 192 ++++++++-------
 .../xen/resource/CitrixResourceBase.java        |   2 +-
 scripts/network/domr/bumpUpPriority.sh          |  47 ----
 scripts/network/domr/call_dnsmasq.sh            |  27 ---
 scripts/network/domr/dhcp_entry.sh              |  82 -------
 scripts/vm/hypervisor/xenserver/vmops           |  47 +---
 .../config/opt/cloud/bin/bumpup_priority.sh     |  19 ++
 .../debian/config/opt/cloud/bin/dnsmasq.sh      | 130 +++++++++++
 .../debian/config/opt/cloud/bin/edithosts.sh    | 234 +++++++++++++++++++
 .../debian/config/root/bumpup_priority.sh       |  19 --
 systemvm/patches/debian/config/root/dnsmasq.sh  | 130 -----------
 .../patches/debian/config/root/edithosts.sh     | 234 -------------------
 13 files changed, 517 insertions(+), 744 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 8478b31..f469d8a 100755
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -16,31 +16,6 @@
 // under the License.
 package com.cloud.agent.resource.virtualnetwork;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.net.InetSocketAddress;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.channels.SocketChannel;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import com.cloud.agent.api.routing.SetMonitorServiceCommand;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-
-import com.google.gson.Gson;
-
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.BumpUpPriorityCommand;
 import com.cloud.agent.api.CheckRouterAnswer;
@@ -66,6 +41,7 @@ import com.cloud.agent.api.routing.RemoteAccessVpnCfgCommand;
 import com.cloud.agent.api.routing.SavePasswordCommand;
 import com.cloud.agent.api.routing.SetFirewallRulesAnswer;
 import com.cloud.agent.api.routing.SetFirewallRulesCommand;
+import com.cloud.agent.api.routing.SetMonitorServiceCommand;
 import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer;
 import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
 import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand;
@@ -92,6 +68,27 @@ import com.cloud.utils.net.NetUtils;
 import com.cloud.utils.script.OutputInterpreter;
 import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SshHelper;
+import com.google.gson.Gson;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.InetSocketAddress;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.channels.SocketChannel;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * VirtualNetworkResource controls and configures virtual networking
@@ -107,14 +104,12 @@ public class VirtualRoutingResource implements Manager {
     private String _publicIpAddress;
     private String _firewallPath;
     private String _loadbPath;
-    private String _dhcpEntryPath;
     private String _publicEthIf;
     private String _privateEthIf;
     private String _bumpUpPriorityPath;
     private String _routerProxyPath;
     private String _createIpAliasPath;
     private String _deleteIpAliasPath;
-    private String _callDnsMasqPath;
 
     private int _timeout;
     private int _startTimeout;
@@ -559,35 +554,34 @@ public class VirtualRoutingResource implements Manager {
     }
 
     protected Answer execute(final DhcpEntryCommand cmd) {
-        final Script command = new Script(_dhcpEntryPath, _timeout, s_logger);
-        command.add("-r", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP));
+        String args = " -m " + cmd.getVmMac();
         if (cmd.getVmIpAddress() != null) {
-            command.add("-v", cmd.getVmIpAddress());
+            args += " -4 " + cmd.getVmIpAddress();
         }
-        command.add("-m", cmd.getVmMac());
-        command.add("-n", cmd.getVmName());
+        args += " -h " + cmd.getVmName();
 
         if (cmd.getDefaultRouter() != null) {
-            command.add("-d", cmd.getDefaultRouter());
-        }
-        if (cmd.getStaticRoutes() != null) {
-            command.add("-s", cmd.getStaticRoutes());
+            args += " -d " + cmd.getDefaultRouter();
         }
 
         if (cmd.getDefaultDns() != null) {
-            command.add("-N", cmd.getDefaultDns());
+            args += " -n " + cmd.getDefaultDns();
+        }
+
+        if (cmd.getStaticRoutes() != null) {
+            args += " -s " + cmd.getStaticRoutes();
         }
 
         if (cmd.getVmIp6Address() != null) {
-            command.add("-6", cmd.getVmIp6Address());
-            command.add("-u", cmd.getDuid());
+            args += " -6 " + cmd.getVmIp6Address();
+            args += " -u " + cmd.getDuid();
         }
 
         if (!cmd.isDefault()) {
-            command.add("-z");
+            args += " -N";
         }
 
-        final String result = command.execute();
+        final String result = routerProxy("edithosts.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args);
         return new Answer(cmd, result == null, result);
     }
 
@@ -625,16 +619,13 @@ public class VirtualRoutingResource implements Manager {
     }
 
     protected Answer execute(final DnsMasqConfigCommand cmd) {
-        final Script command = new Script(_callDnsMasqPath, _timeout, s_logger);
         String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
         List<DhcpTO> dhcpTos = cmd.getIps();
         String args = "";
         for (DhcpTO dhcpTo : dhcpTos) {
             args = args + dhcpTo.getRouterIp() + ":" + dhcpTo.getGateway() + ":" + dhcpTo.getNetmask() + ":" + dhcpTo.getStartIpOfSubnet() + "-";
         }
-        command.add(routerIp);
-        command.add(args);
-        final String result = command.execute();
+        final String result = routerProxy("dnsmasq.sh", routerIp, args);
         return new Answer(cmd, result == null, result);
     }
 
@@ -693,13 +684,9 @@ public class VirtualRoutingResource implements Manager {
     }
 
     protected Answer execute(BumpUpPriorityCommand cmd) {
-        final String routerPrivateIPAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
-        final Script command = new Script(_bumpUpPriorityPath, _timeout, s_logger);
-        final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
-        command.add(routerPrivateIPAddress);
-        String result = command.execute(parser);
+        String result = routerProxy("bumpup_priority.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), null);
         if (result != null) {
-            return new Answer(cmd, false, "BumpUpPriorityCommand failed: " + result);
+            return new Answer(cmd, false, "BumpUpPriorityCommand failed due to " + result);
         }
         return new Answer(cmd, true, null);
     }
@@ -1137,11 +1124,6 @@ public class VirtualRoutingResource implements Manager {
             throw new ConfigurationException("Unable to find the call_loadbalancer.sh");
         }
 
-        _dhcpEntryPath = findScript("dhcp_entry.sh");
-        if (_dhcpEntryPath == null) {
-            throw new ConfigurationException("Unable to find dhcp_entry.sh");
-        }
-
         _publicEthIf = (String)params.get("public.network.device");
         if (_publicEthIf == null) {
             _publicEthIf = "xenbr1";
@@ -1171,10 +1153,6 @@ public class VirtualRoutingResource implements Manager {
         if (_deleteIpAliasPath == null) {
             throw new ConfigurationException("unable to find deleteipAlias.sh");
         }
-        _callDnsMasqPath = findScript("call_dnsmasq.sh");
-        if (_callDnsMasqPath == null) {
-            throw new ConfigurationException("unable to find call_dnsmasq.sh");
-        }
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 8b25276..a2073ea 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -16,98 +16,6 @@
 // under the License.
 package com.cloud.hypervisor.vmware.resource;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.ConnectException;
-import java.net.InetSocketAddress;
-import java.net.URI;
-import java.nio.channels.SocketChannel;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.Set;
-import java.util.TimeZone;
-import java.util.UUID;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import javax.naming.ConfigurationException;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.NDC;
-
-import com.google.gson.Gson;
-import com.vmware.vim25.AboutInfo;
-import com.vmware.vim25.BoolPolicy;
-import com.vmware.vim25.ClusterDasConfigInfo;
-import com.vmware.vim25.ComputeResourceSummary;
-import com.vmware.vim25.CustomFieldStringValue;
-import com.vmware.vim25.DVPortConfigInfo;
-import com.vmware.vim25.DVPortConfigSpec;
-import com.vmware.vim25.DatastoreSummary;
-import com.vmware.vim25.DistributedVirtualPort;
-import com.vmware.vim25.DistributedVirtualSwitchPortConnection;
-import com.vmware.vim25.DistributedVirtualSwitchPortCriteria;
-import com.vmware.vim25.DynamicProperty;
-import com.vmware.vim25.GuestInfo;
-import com.vmware.vim25.HostCapability;
-import com.vmware.vim25.HostHostBusAdapter;
-import com.vmware.vim25.HostInternetScsiHba;
-import com.vmware.vim25.HostInternetScsiHbaAuthenticationProperties;
-import com.vmware.vim25.HostInternetScsiHbaStaticTarget;
-import com.vmware.vim25.HostInternetScsiTargetTransport;
-import com.vmware.vim25.HostScsiDisk;
-import com.vmware.vim25.HostScsiTopology;
-import com.vmware.vim25.HostScsiTopologyInterface;
-import com.vmware.vim25.HostScsiTopologyLun;
-import com.vmware.vim25.HostScsiTopologyTarget;
-import com.vmware.vim25.ManagedObjectReference;
-import com.vmware.vim25.ObjectContent;
-import com.vmware.vim25.OptionValue;
-import com.vmware.vim25.PerfCounterInfo;
-import com.vmware.vim25.PerfEntityMetric;
-import com.vmware.vim25.PerfEntityMetricBase;
-import com.vmware.vim25.PerfMetricId;
-import com.vmware.vim25.PerfMetricIntSeries;
-import com.vmware.vim25.PerfMetricSeries;
-import com.vmware.vim25.PerfQuerySpec;
-import com.vmware.vim25.PerfSampleInfo;
-import com.vmware.vim25.RuntimeFaultFaultMsg;
-import com.vmware.vim25.ToolsUnavailableFaultMsg;
-import com.vmware.vim25.VMwareDVSPortSetting;
-import com.vmware.vim25.VimPortType;
-import com.vmware.vim25.VirtualDevice;
-import com.vmware.vim25.VirtualDeviceBackingInfo;
-import com.vmware.vim25.VirtualDeviceConfigSpec;
-import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
-import com.vmware.vim25.VirtualDisk;
-import com.vmware.vim25.VirtualEthernetCard;
-import com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo;
-import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo;
-import com.vmware.vim25.VirtualMachineConfigSpec;
-import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
-import com.vmware.vim25.VirtualMachinePowerState;
-import com.vmware.vim25.VirtualMachineRelocateSpec;
-import com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator;
-import com.vmware.vim25.VirtualMachineRuntimeInfo;
-import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
-
-import org.apache.cloudstack.storage.command.DeleteCommand;
-import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.to.VolumeObjectTO;
-
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.AttachIsoCommand;
@@ -327,6 +235,94 @@ import com.cloud.vm.VirtualMachine.PowerState;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineName;
 import com.cloud.vm.VmDetailConstants;
+import com.google.gson.Gson;
+import com.vmware.vim25.AboutInfo;
+import com.vmware.vim25.BoolPolicy;
+import com.vmware.vim25.ClusterDasConfigInfo;
+import com.vmware.vim25.ComputeResourceSummary;
+import com.vmware.vim25.CustomFieldStringValue;
+import com.vmware.vim25.DVPortConfigInfo;
+import com.vmware.vim25.DVPortConfigSpec;
+import com.vmware.vim25.DatastoreSummary;
+import com.vmware.vim25.DistributedVirtualPort;
+import com.vmware.vim25.DistributedVirtualSwitchPortConnection;
+import com.vmware.vim25.DistributedVirtualSwitchPortCriteria;
+import com.vmware.vim25.DynamicProperty;
+import com.vmware.vim25.GuestInfo;
+import com.vmware.vim25.HostCapability;
+import com.vmware.vim25.HostHostBusAdapter;
+import com.vmware.vim25.HostInternetScsiHba;
+import com.vmware.vim25.HostInternetScsiHbaAuthenticationProperties;
+import com.vmware.vim25.HostInternetScsiHbaStaticTarget;
+import com.vmware.vim25.HostInternetScsiTargetTransport;
+import com.vmware.vim25.HostScsiDisk;
+import com.vmware.vim25.HostScsiTopology;
+import com.vmware.vim25.HostScsiTopologyInterface;
+import com.vmware.vim25.HostScsiTopologyLun;
+import com.vmware.vim25.HostScsiTopologyTarget;
+import com.vmware.vim25.ManagedObjectReference;
+import com.vmware.vim25.ObjectContent;
+import com.vmware.vim25.OptionValue;
+import com.vmware.vim25.PerfCounterInfo;
+import com.vmware.vim25.PerfEntityMetric;
+import com.vmware.vim25.PerfEntityMetricBase;
+import com.vmware.vim25.PerfMetricId;
+import com.vmware.vim25.PerfMetricIntSeries;
+import com.vmware.vim25.PerfMetricSeries;
+import com.vmware.vim25.PerfQuerySpec;
+import com.vmware.vim25.PerfSampleInfo;
+import com.vmware.vim25.RuntimeFaultFaultMsg;
+import com.vmware.vim25.ToolsUnavailableFaultMsg;
+import com.vmware.vim25.VMwareDVSPortSetting;
+import com.vmware.vim25.VimPortType;
+import com.vmware.vim25.VirtualDevice;
+import com.vmware.vim25.VirtualDeviceBackingInfo;
+import com.vmware.vim25.VirtualDeviceConfigSpec;
+import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
+import com.vmware.vim25.VirtualDisk;
+import com.vmware.vim25.VirtualEthernetCard;
+import com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo;
+import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo;
+import com.vmware.vim25.VirtualMachineConfigSpec;
+import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
+import com.vmware.vim25.VirtualMachinePowerState;
+import com.vmware.vim25.VirtualMachineRelocateSpec;
+import com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator;
+import com.vmware.vim25.VirtualMachineRuntimeInfo;
+import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
+import org.apache.cloudstack.storage.command.DeleteCommand;
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+import org.apache.log4j.Logger;
+import org.apache.log4j.NDC;
+
+import javax.naming.ConfigurationException;
+import java.io.File;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.nio.channels.SocketChannel;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 
 public class VmwareResource implements StoragePoolResource, ServerResource, VmwareHostService {
     private static final Logger s_logger = Logger.getLogger(VmwareResource.class);
@@ -2147,13 +2143,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
         }
 
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/edithosts.sh " + args);
+            s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/edithosts.sh " + args);
         }
 
         try {
             VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
             String controlIp = getRouterSshControlIp(cmd);
-            Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/edithosts.sh " + args);
+            Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/edithosts.sh " + args);
 
             if (!result.first()) {
                 s_logger.error("dhcp_entry command on domR " + controlIp + " failed, message: " + result.second());
@@ -2275,9 +2271,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
         File keyFile = mgr.getSystemVMKeyFile();
 
         try {
-            Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/dnsmasq.sh " + args);
+            Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/dnsmasq.sh " + args);
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug("Run command on domain router " + routerIp + ",  /root/dnsmasq.sh");
+                s_logger.debug("Run command on domain router " + routerIp + ",  /opt/cloud/bin/dnsmasq.sh");
             }
 
             if (!result.first()) {
@@ -2397,14 +2393,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
     protected Answer execute(BumpUpPriorityCommand cmd) {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Executing resource BumpUpPriorityCommand: " + _gson.toJson(cmd));
-            s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/bumpup_priority.sh ");
+            s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /opt/cloud/bin/bumpup_priority.sh ");
         }
 
         Pair<Boolean, String> result;
         try {
             VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
             String controlIp = getRouterSshControlIp(cmd);
-            result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/root/bumpup_priority.sh ");
+            result = SshHelper.sshExecute(controlIp, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/bumpup_priority.sh ");
 
             if (!result.first()) {
                 s_logger.error("BumpUpPriority command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + " failed, message: " + result.second());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 2568a21..ea812e3 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -2324,7 +2324,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     }
 
     protected synchronized Answer execute(final DhcpEntryCommand cmd) {
-        String args = "";
+        String args = " -m " + cmd.getVmMac();
         if (cmd.getVmIpAddress() != null) {
             args += " -4 " + cmd.getVmIpAddress();
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/scripts/network/domr/bumpUpPriority.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/bumpUpPriority.sh b/scripts/network/domr/bumpUpPriority.sh
deleted file mode 100755
index 3a7eaf9..0000000
--- a/scripts/network/domr/bumpUpPriority.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-usage() {
-  printf "Usage:\n %s <domR eth1 ip> \n" $(basename $0) >&2
-  printf " %s <domR eth1 ip> \n" $(basename $0) >&2
-}
-
-cert="/root/.ssh/id_rsa.cloud"
-domRIp=$1
-shift
-
-check_gw() {
-  ping -c 1 -n -q $1 > /dev/null
-  if [ $? -gt 0 ]
-  then
-    sleep 1
-    ping -c 1 -n -q $1 > /dev/null
-  fi
-  return $?;
-}
-
-
-check_gw "$domRIp"
-if [ $? -gt 0 ]
-then
-  exit 1
-fi
-
-ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/bumpup_priority.sh"
-exit $?

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/scripts/network/domr/call_dnsmasq.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/call_dnsmasq.sh b/scripts/network/domr/call_dnsmasq.sh
deleted file mode 100755
index 81c218d..0000000
--- a/scripts/network/domr/call_dnsmasq.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-usage() {
-  printf "Usage: %s:  <domR eth1 ip>  <path_to_new_config_file>\n" $(basename $0) >&2
-}
-
-cert="/root/.ssh/id_rsa.cloud"
-
-ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/dnsmasq.sh $2"	 
-exit $?
-      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/scripts/network/domr/dhcp_entry.sh
----------------------------------------------------------------------
diff --git a/scripts/network/domr/dhcp_entry.sh b/scripts/network/domr/dhcp_entry.sh
deleted file mode 100755
index fb5a166..0000000
--- a/scripts/network/domr/dhcp_entry.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-# $Id: dhcp_entry.sh 9804 2010-06-22 18:36:49Z alex $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/network/domr/dhcp_entry.sh $
-# dhcp_entry.sh -- add dhcp entry on domr
-# @VERSION@
-
-usage() {
-  printf "Usage: %s: -r <domr-ip> -m <vm mac> -v <vm ip> -n <vm name> -s <static route> -d <default router> -N <dns> -6 <vm IPv6> -u <duid> [-z]\n" $(basename $0) >&2
-  exit 2
-}
-
-cert="/root/.ssh/id_rsa.cloud"
-
-domrIp=
-vmMac=
-vmIp=
-vmName=
-staticrt=
-dfltrt=
-dns=
-ipv6=
-duid=
-
-opts=
-
-while getopts 'r:m:v:n:d:s:N:6:u:z' OPTION
-do
-  case $OPTION in
-  r)  domrIp="$OPTARG"
-      ;;
-  v)  vmIp="$OPTARG"
-      opts="$opts -4 $vmIp"
-      ;;
-  m)  vmMac="$OPTARG"
-      opts="$opts -m $vmMac"
-      ;;
-  n)  vmName="$OPTARG"
-      opts="$opts -h $vmName"
-      ;;
-  s)  staticrt="$OPTARG"
-      opts="$opts -s $staticrt"
-      ;;
-  d)  dfltrt="$OPTARG"
-      opts="$opts -d $dfltrt"
-      ;;
-  N)  dns="$OPTARG"
-      opts="$opts -n $dns"
-      ;;
-  6)  ipv6="$OPTARG"
-      opts="$opts -6 $ipv6"
-      ;;
-  u)  duid="$OPTARG"
-      opts="$opts -u $duid"
-      ;;
-  z)  opts="$opts -N"
-      ;;
-  ?)  usage
-      exit 1
-      ;;
-  esac
-done
-
-ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$domrIp "/root/edithosts.sh $opts " >/dev/null
-
-exit $?

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/scripts/vm/hypervisor/xenserver/vmops
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops
index 2e14fad..1b04533 100755
--- a/scripts/vm/hypervisor/xenserver/vmops
+++ b/scripts/vm/hypervisor/xenserver/vmops
@@ -178,21 +178,6 @@ def savePassword(session, args):
     return txt
 
 @echo
-def saveDhcpEntry(session, args):
-    sargs = args['args']
-    cmd = sargs.split(' ')
-    cmd.insert(0, "/opt/cloud/bin/dhcp_entry.sh")
-    cmd.insert(0, "/bin/bash")
-    try:
-        txt = util.pread2(cmd)
-        txt = 'success'
-    except:
-        logging.debug(" save dhcp entry failed "  )
-        txt = '' 
-
-    return txt
-    
-@echo
 def setLinkLocalIP(session, args):
     brName = args['brName']
     try:
@@ -286,18 +271,6 @@ def setLoadBalancerRule(session, args):
         txt = '' 
 
     return txt
-@echo
-def configdnsmasq(session, args):
-    routerip = args['routerip']
-    args = args['args']
-    target   = "root@"+routerip
-    try:
-       util.pread2(['ssh','-p','3922','-q','-o','StrictHostKeyChecking=no','-i','/root/.ssh/id_rsa.cloud',target,'/root/dnsmasq.sh',args])
-       txt='success'
-    except:
-       logging.debug("failed to config dnsmasq server")
-       txt=''
-    return txt
 
 @echo
 def createipAlias(session, args):
@@ -1608,28 +1581,12 @@ def network_rules(session, args):
   except:
     logging.debug("Failed to network rule !")
 
-@echo
-def bumpUpPriority(session, args):
-    sargs = args['args']
-    cmd = sargs.split(' ')
-    cmd.insert(0, "/opt/cloud/bin/bumpUpPriority.sh")
-    cmd.insert(0, "/bin/bash")
-    try:
-        txt = util.pread2(cmd)
-        txt = 'success'
-    except:
-        logging.debug("bump up priority fail! ")
-        txt = ''
-
-    return txt
-
-
 if __name__ == "__main__":
      XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats, 
                             "getgateway": getgateway, "preparemigration": preparemigration, 
                             "setIptables": setIptables, "pingdomr": pingdomr, "pingxenserver": pingxenserver,  
                             "savePassword": savePassword, 
-                            "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "routerProxy": routerProxy, 
+                            "setFirewallRule": setFirewallRule, "routerProxy": routerProxy, 
                             "setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile, 
                             "network_rules":network_rules, 
                             "can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules,
@@ -1637,12 +1594,10 @@ if __name__ == "__main__":
                             "default_network_rules_systemvm":default_network_rules_systemvm, 
                             "network_rules_vmSecondaryIp":network_rules_vmSecondaryIp,
                             "createipAlias":createipAlias,
-                            "configdnsmasq":configdnsmasq,
                             "deleteipAlias":deleteipAlias,
                             "get_rule_logs_for_vms":get_rule_logs_for_vms, 
 			    "add_to_VCPUs_params_live":add_to_VCPUs_params_live,
                             "setLinkLocalIP":setLinkLocalIP,
                             "cleanup_rules":cleanup_rules,
-                            "bumpUpPriority":bumpUpPriority,
                             "createFileInDomr":createFileInDomr,
                             "kill_copy_process":kill_copy_process})

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/systemvm/patches/debian/config/opt/cloud/bin/bumpup_priority.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/bumpup_priority.sh b/systemvm/patches/debian/config/opt/cloud/bin/bumpup_priority.sh
new file mode 100755
index 0000000..2b8d8c3
--- /dev/null
+++ b/systemvm/patches/debian/config/opt/cloud/bin/bumpup_priority.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+touch /tmp/rrouter_bumped

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/systemvm/patches/debian/config/opt/cloud/bin/dnsmasq.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/dnsmasq.sh b/systemvm/patches/debian/config/opt/cloud/bin/dnsmasq.sh
new file mode 100755
index 0000000..8fae25c
--- /dev/null
+++ b/systemvm/patches/debian/config/opt/cloud/bin/dnsmasq.sh
@@ -0,0 +1,130 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+usage() {
+  printf "Usage: %s:  <routerAliasIp:gateway:netmask:start_ip_of_subnet:-routerAlisIp:gateway:....>\n" $(basename $0) >&2
+}
+
+source /root/func.sh
+
+lock="biglock"
+locked=$(getLockFile $lock)
+if [ "$locked" != "1" ]
+then
+    exit 1
+fi
+
+#set -x
+#backup the old config file
+DHCP_CONFIG=/etc/dnsmasq.d/multiple_ranges.conf
+DHCP_CONFIG_BAK=/etc/dnsmasq.d/multiple_ranges.conf.bak
+DHCP_CONFIG_MAIN=/etc/dnsmasq.conf
+DHCP_CONFIG_MAIN_BAK=/etc/dnsmasq.conf.bak
+DHCP_FAILURE_CONFIG=/etc/multiple_ranges.conf.failure
+DHCP_FAILURE_CONFIG_MAIN=/etc/dnsmasq.conf.failure
+CMDLINE=$(cat /var/cache/cloud/cmdline | tr '\n' ' ')
+
+#take a backup copy of the dnsmasq file.
+cp "$DHCP_CONFIG_MAIN"  "$DHCP_CONFIG_MAIN_BAK"
+cp "$DHCP_CONFIG" "$DHCP_CONFIG_BAK"
+
+#empty the config file
+echo > $DHCP_CONFIG
+
+var="$1"
+dhcp_range=""
+dhcp_gateway=""
+dhcp_netmask=""
+dns_option=""
+dns_servers=""
+count=0
+
+
+# fetching the dns Ips from the command line.
+dns1=$(echo "$CMDLINE" | grep -o " dns1=[[:digit:]].* " | sed -e 's/dns1=//' | awk '{print $1}')
+dns2=$(echo "$CMDLINE" | grep -o " dns2=[[:digit:]].* "  | sed -e 's/dns2=//' | awk '{print $1}')
+
+dns_servers="${dns1}"
+if [ -n "$dns2" ]
+then
+dns_servers="${dns1},${dns2}"
+fi
+
+
+# check if useextdns is true
+use_ext_dns=$(echo "$CMDLINE" | grep -o "useextdns=true")
+while [ -n "$var" ]
+do
+ var1=$(echo $var | cut -f1 -d "-")
+ routerip=$( echo $var1 | cut -f1 -d ":" )
+ gateway=$(echo $var1 | cut -f2 -d ":")
+ netmask=$(echo $var1 | cut -f3 -d ":")
+ start_ip_of_subnet=$(echo $var1 | cut -f4 -d ":")
+ dhcp_range="${dhcp_range}"'dhcp-range=set:range'$count","$start_ip_of_subnet",static \n"
+ dhcp_gateway="${dhcp_gateway}"'dhcp-option=tag:range'$count",3,"$gateway" \n"
+ dhcp_netmask="${dhcp_netmask}"'dhcp-option=tag:range'$count",1,"$netmask" \n"
+ if [ -n "$use_ext_dns" ]
+ then
+ dns_option="${dns_option}"'dhcp-option=tag:range'$count",6,"$dns_servers" \n"
+ else
+ dns_option="${dns_option}"'dhcp-option=tag:range'$count",6,$routerip"","$dns_servers" \n"
+ fi
+ var=$( echo $var | sed "s/${var1}-//" )
+ count=$[$count+1]
+done
+
+#logging the configuration being removed.
+log=""
+log="${log}"`grep "^dhcp-option=6" "$DHCP_CONFIG_MAIN"`"\n"
+log="${log}"`grep "^dhcp-option=option:router" "$DHCP_CONFIG_MAIN"`"\n"
+log="${log}"`grep "^dhcp-range=" "$DHCP_CONFIG_MAIN"`"\n"
+
+if [ "$log" != '\n\n\n' ]
+then
+ #Cleaning the existing dhcp confgiuration
+ logger -t cloud "dnsmasq.sh: remvoing the primaryip confg from dnsmasq.conf and adding it to /etc/dnsmaq.d/multiple_ranges.conf"
+ logger -t cloud "dnsmasq.sh: config removed from dnsmasq.conf is $log"
+ sed -i -e '/dhcp-option=6/d'  "$DHCP_CONFIG_MAIN"
+ sed -i -e '/dhcp-option=option:router/d' "$DHCP_CONFIG_MAIN"
+ sed -i -e '/^dhcp-range=/d' "$DHCP_CONFIG_MAIN"
+fi
+
+#wrting the new config into the config file.
+echo -e "$dhcp_range" >> "$DHCP_CONFIG"
+echo -e "$dhcp_gateway" >> "$DHCP_CONFIG"
+echo -e "$dhcp_netmask" >> "$DHCP_CONFIG"
+echo -e "$dns_option" >> "$DHCP_CONFIG"
+
+
+#restart the dnsmasq
+service dnsmasq restart
+result=$?
+if [ "$result" -ne "0" ]
+then
+   logger -t cloud "dnsmasq.sh: could not configure dnsmasq"
+   logger -t cloud "dnsmasq.sh: reverting to the old config"
+   logger -t cloud "dnsmasq.sh: copying the failure config to `$DHCP_FAILURE_CONFIG` and `$DHCP_FAILURE_CONFIG_MAIN`"
+   cp "$DHCP_CONFIG" "$DHCP_FAILURE_CONFIG"
+   cp "$DHCP_CONFIG_MAIN" "$DHCP_FAILURE_CONFIG_MAIN"
+   cp "$DHCP_CONFIG_BAK" "$DHCP_CONFIG"
+   cp "$DHCP_CONFIG_MAIN_BAK" "$DHCP_CONFIG_MAIN"
+   service dnsmasq restart
+   unlock_exit $result $lock $locked
+fi
+rm "$DHCP_CONFIG_BAK"
+rm "$DHCP_CONFIG_MAIN_BAK"
+unlock_exit $result $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh b/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
new file mode 100755
index 0000000..b82fb8e
--- /dev/null
+++ b/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
@@ -0,0 +1,234 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+ 
+# edithosts.sh -- edit the dhcphosts file on the routing domain
+
+usage() {
+  printf "Usage: %s: -m <MAC address> -4 <IPv4 address> -6 <IPv6 address> -h <hostname> -d <default router> -n <name server address> -s <Routes> -u <DUID> [-N]\n" $(basename $0) >&2
+}
+
+mac=
+ipv4=
+ipv6=
+host=
+dflt=
+dns=
+routes=
+duid=
+nondefault=
+
+while getopts 'm:4:h:d:n:s:6:u:N' OPTION
+do
+  case $OPTION in
+  m)    mac="$OPTARG"
+        ;;
+  4)    ipv4="$OPTARG"
+        ;;
+  6)    ipv6="$OPTARG"
+        ;;
+  u)    duid="$OPTARG"
+        ;;
+  h)    host="$OPTARG"
+        ;;
+  d)    dflt="$OPTARG"
+        ;;
+  n)    dns="$OPTARG"
+        ;;
+  s)    routes="$OPTARG"
+        ;;
+  N)    nondefault=1
+        ;;
+  ?)    usage
+        exit 2
+        ;;
+  esac
+done
+
+DHCP_HOSTS=/etc/dhcphosts.txt
+DHCP_OPTS=/etc/dhcpopts.txt
+DHCP_LEASES=/var/lib/misc/dnsmasq.leases
+HOSTS=/etc/hosts
+
+source /root/func.sh
+
+lock="biglock"
+#default timeout value is 30 mins as DhcpEntryCommand is not synchronized on agent side any more,
+#and multiple commands can be sent to the same VR at a time
+locked=$(getLockFile $lock 1800)
+if [ "$locked" != "1" ]
+then
+    exit 1
+fi
+
+grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
+no_redundant=$?
+
+command -v dhcp_release > /dev/null 2>&1
+no_dhcp_release=$?
+
+wait_for_dnsmasq () {
+  local _pid=$(pidof dnsmasq)
+  for i in 0 1 2 3 4 5 6 7 8 9 10
+  do
+    sleep 1
+    _pid=$(pidof dnsmasq)
+    [ "$_pid" != "" ] && break;
+  done
+  [ "$_pid" != "" ] && return 0;
+  logger -t cloud "edithosts: timed out waiting for dnsmasq to start"
+  return 1
+}
+
+if [ $ipv6 ]
+then
+    no_dhcp_release=1
+fi
+
+if [ $no_dhcp_release -eq 0 ]
+then
+  #release previous dhcp lease if present
+  logger -t cloud "edithosts: releasing $ipv4"
+  dhcp_release eth0 $ipv4 $(grep "$ipv4 " $DHCP_LEASES | awk '{print $2}') > /dev/null 2>&1
+  logger -t cloud "edithosts: released $ipv4"
+fi
+
+logger -t cloud "edithosts: update $mac $ipv4 $ipv6 $host to hosts"
+
+[ ! -f $DHCP_HOSTS ] && touch $DHCP_HOSTS
+[ ! -f $DHCP_OPTS ] && touch $DHCP_OPTS
+[ ! -f $DHCP_LEASES ] && touch $DHCP_LEASES
+
+#delete any previous entries from the dhcp hosts file
+sed -i  /$mac/d $DHCP_HOSTS
+if [ $ipv4 ]
+then
+  sed -i  /$ipv4,/d $DHCP_HOSTS
+fi
+if [ $ipv6 ]
+then
+  #searching with [$ipv6], matching other ip so using $ipv6],
+  sed -i  /$ipv6],/d $DHCP_HOSTS
+fi
+# don't want to do this in the future, we can have same VM with multiple nics/entries
+#sed -i  /$host,/d $DHCP_HOSTS
+
+
+#put in the new entry
+if [ $ipv4 ]
+then
+  echo "$mac,$ipv4,$host,infinite" >>$DHCP_HOSTS
+fi
+if [ $ipv6 ]
+then
+  if [ $nondefault ]
+  then
+    echo "id:$duid,set:nondefault6,[$ipv6],$host,infinite" >>$DHCP_HOSTS
+  else
+    echo "id:$duid,[$ipv6],$host,infinite" >>$DHCP_HOSTS
+  fi
+fi
+
+#delete leases to supplied mac and ip addresses
+if [ $ipv4 ]
+then
+  sed -i  /$mac/d $DHCP_LEASES 
+  sed -i  /"$ipv4 "/d $DHCP_LEASES 
+fi
+if [ $ipv6 ]
+then
+  sed -i  /$duid/d $DHCP_LEASES 
+  sed -i  /"$ipv6 "/d $DHCP_LEASES 
+fi
+sed -i  /"$host "/d $DHCP_LEASES 
+
+#put in the new entry
+if [ $ipv4 ]
+then
+  echo "0 $mac $ipv4 $host *" >> $DHCP_LEASES
+fi
+if [ $ipv6 ]
+then
+  echo "0 $duid $ipv6 $host *" >> $DHCP_LEASES
+fi
+
+#edit hosts file as well
+if [ $ipv4 ]
+then
+  sed -i  /"$ipv4 "/d $HOSTS
+fi
+if [ $ipv6 ]
+then
+  sed -i  /"$ipv6 "/d $HOSTS
+fi
+sed -i  /" $host$"/d $HOSTS
+if [ $ipv4 ]
+then
+  echo "$ipv4 $host" >> $HOSTS
+fi
+if [ $ipv6 ]
+then
+  echo "$ipv6 $host" >> $HOSTS
+fi
+
+if [ "$dflt" != "" ]
+then
+  #make sure dnsmasq looks into options file
+  sed -i /dhcp-optsfile/d /etc/dnsmasq.conf
+  echo "dhcp-optsfile=$DHCP_OPTS" >> /etc/dnsmasq.conf
+
+  tag=$(echo $ipv4 | tr '.' '_')
+  sed -i /$tag/d $DHCP_OPTS
+  if [ "$dflt" == "0.0.0.0" ]
+  then
+    logger -t cloud "$0: unset default router for $ipv4"
+    logger -t cloud "$0: unset dns server for $ipv4"
+    echo "$tag,3" >> $DHCP_OPTS
+    echo "$tag,6" >> $DHCP_OPTS
+    echo "$tag,15" >> $DHCP_OPTS
+  fi
+  [ "$routes" != "" ] && echo "$tag,121,$routes" >> $DHCP_OPTS
+  #delete entry we just put in because we need a tag
+  sed -i  /$ipv4,/d $DHCP_HOSTS
+  #put it back with a tag
+  echo "$mac,set:$tag,$ipv4,$host,infinite" >>$DHCP_HOSTS
+fi
+
+# make dnsmasq re-read files
+pid=$(pidof dnsmasq)
+if [ "$pid" != "" ]
+then
+  # use SIGHUP to avoid service outage if dhcp_release is available.
+  if [ $no_dhcp_release -eq 0 ]
+  then
+    kill -HUP $pid
+  else
+    service dnsmasq restart
+  fi
+else
+  if [ $no_redundant -eq 1 ]
+  then
+      wait_for_dnsmasq
+  else
+      logger -t cloud "edithosts: skip wait dnsmasq due to redundant virtual router"
+  fi
+fi
+
+ret=$?
+unlock_exit $ret $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/systemvm/patches/debian/config/root/bumpup_priority.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/root/bumpup_priority.sh b/systemvm/patches/debian/config/root/bumpup_priority.sh
deleted file mode 100755
index 2b8d8c3..0000000
--- a/systemvm/patches/debian/config/root/bumpup_priority.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-touch /tmp/rrouter_bumped

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/systemvm/patches/debian/config/root/dnsmasq.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/root/dnsmasq.sh b/systemvm/patches/debian/config/root/dnsmasq.sh
deleted file mode 100755
index 8fae25c..0000000
--- a/systemvm/patches/debian/config/root/dnsmasq.sh
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-usage() {
-  printf "Usage: %s:  <routerAliasIp:gateway:netmask:start_ip_of_subnet:-routerAlisIp:gateway:....>\n" $(basename $0) >&2
-}
-
-source /root/func.sh
-
-lock="biglock"
-locked=$(getLockFile $lock)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-#set -x
-#backup the old config file
-DHCP_CONFIG=/etc/dnsmasq.d/multiple_ranges.conf
-DHCP_CONFIG_BAK=/etc/dnsmasq.d/multiple_ranges.conf.bak
-DHCP_CONFIG_MAIN=/etc/dnsmasq.conf
-DHCP_CONFIG_MAIN_BAK=/etc/dnsmasq.conf.bak
-DHCP_FAILURE_CONFIG=/etc/multiple_ranges.conf.failure
-DHCP_FAILURE_CONFIG_MAIN=/etc/dnsmasq.conf.failure
-CMDLINE=$(cat /var/cache/cloud/cmdline | tr '\n' ' ')
-
-#take a backup copy of the dnsmasq file.
-cp "$DHCP_CONFIG_MAIN"  "$DHCP_CONFIG_MAIN_BAK"
-cp "$DHCP_CONFIG" "$DHCP_CONFIG_BAK"
-
-#empty the config file
-echo > $DHCP_CONFIG
-
-var="$1"
-dhcp_range=""
-dhcp_gateway=""
-dhcp_netmask=""
-dns_option=""
-dns_servers=""
-count=0
-
-
-# fetching the dns Ips from the command line.
-dns1=$(echo "$CMDLINE" | grep -o " dns1=[[:digit:]].* " | sed -e 's/dns1=//' | awk '{print $1}')
-dns2=$(echo "$CMDLINE" | grep -o " dns2=[[:digit:]].* "  | sed -e 's/dns2=//' | awk '{print $1}')
-
-dns_servers="${dns1}"
-if [ -n "$dns2" ]
-then
-dns_servers="${dns1},${dns2}"
-fi
-
-
-# check if useextdns is true
-use_ext_dns=$(echo "$CMDLINE" | grep -o "useextdns=true")
-while [ -n "$var" ]
-do
- var1=$(echo $var | cut -f1 -d "-")
- routerip=$( echo $var1 | cut -f1 -d ":" )
- gateway=$(echo $var1 | cut -f2 -d ":")
- netmask=$(echo $var1 | cut -f3 -d ":")
- start_ip_of_subnet=$(echo $var1 | cut -f4 -d ":")
- dhcp_range="${dhcp_range}"'dhcp-range=set:range'$count","$start_ip_of_subnet",static \n"
- dhcp_gateway="${dhcp_gateway}"'dhcp-option=tag:range'$count",3,"$gateway" \n"
- dhcp_netmask="${dhcp_netmask}"'dhcp-option=tag:range'$count",1,"$netmask" \n"
- if [ -n "$use_ext_dns" ]
- then
- dns_option="${dns_option}"'dhcp-option=tag:range'$count",6,"$dns_servers" \n"
- else
- dns_option="${dns_option}"'dhcp-option=tag:range'$count",6,$routerip"","$dns_servers" \n"
- fi
- var=$( echo $var | sed "s/${var1}-//" )
- count=$[$count+1]
-done
-
-#logging the configuration being removed.
-log=""
-log="${log}"`grep "^dhcp-option=6" "$DHCP_CONFIG_MAIN"`"\n"
-log="${log}"`grep "^dhcp-option=option:router" "$DHCP_CONFIG_MAIN"`"\n"
-log="${log}"`grep "^dhcp-range=" "$DHCP_CONFIG_MAIN"`"\n"
-
-if [ "$log" != '\n\n\n' ]
-then
- #Cleaning the existing dhcp confgiuration
- logger -t cloud "dnsmasq.sh: remvoing the primaryip confg from dnsmasq.conf and adding it to /etc/dnsmaq.d/multiple_ranges.conf"
- logger -t cloud "dnsmasq.sh: config removed from dnsmasq.conf is $log"
- sed -i -e '/dhcp-option=6/d'  "$DHCP_CONFIG_MAIN"
- sed -i -e '/dhcp-option=option:router/d' "$DHCP_CONFIG_MAIN"
- sed -i -e '/^dhcp-range=/d' "$DHCP_CONFIG_MAIN"
-fi
-
-#wrting the new config into the config file.
-echo -e "$dhcp_range" >> "$DHCP_CONFIG"
-echo -e "$dhcp_gateway" >> "$DHCP_CONFIG"
-echo -e "$dhcp_netmask" >> "$DHCP_CONFIG"
-echo -e "$dns_option" >> "$DHCP_CONFIG"
-
-
-#restart the dnsmasq
-service dnsmasq restart
-result=$?
-if [ "$result" -ne "0" ]
-then
-   logger -t cloud "dnsmasq.sh: could not configure dnsmasq"
-   logger -t cloud "dnsmasq.sh: reverting to the old config"
-   logger -t cloud "dnsmasq.sh: copying the failure config to `$DHCP_FAILURE_CONFIG` and `$DHCP_FAILURE_CONFIG_MAIN`"
-   cp "$DHCP_CONFIG" "$DHCP_FAILURE_CONFIG"
-   cp "$DHCP_CONFIG_MAIN" "$DHCP_FAILURE_CONFIG_MAIN"
-   cp "$DHCP_CONFIG_BAK" "$DHCP_CONFIG"
-   cp "$DHCP_CONFIG_MAIN_BAK" "$DHCP_CONFIG_MAIN"
-   service dnsmasq restart
-   unlock_exit $result $lock $locked
-fi
-rm "$DHCP_CONFIG_BAK"
-rm "$DHCP_CONFIG_MAIN_BAK"
-unlock_exit $result $lock $locked

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0cdf0f6f/systemvm/patches/debian/config/root/edithosts.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/root/edithosts.sh b/systemvm/patches/debian/config/root/edithosts.sh
deleted file mode 100755
index b82fb8e..0000000
--- a/systemvm/patches/debian/config/root/edithosts.sh
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env bash
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
- 
-# edithosts.sh -- edit the dhcphosts file on the routing domain
-
-usage() {
-  printf "Usage: %s: -m <MAC address> -4 <IPv4 address> -6 <IPv6 address> -h <hostname> -d <default router> -n <name server address> -s <Routes> -u <DUID> [-N]\n" $(basename $0) >&2
-}
-
-mac=
-ipv4=
-ipv6=
-host=
-dflt=
-dns=
-routes=
-duid=
-nondefault=
-
-while getopts 'm:4:h:d:n:s:6:u:N' OPTION
-do
-  case $OPTION in
-  m)    mac="$OPTARG"
-        ;;
-  4)    ipv4="$OPTARG"
-        ;;
-  6)    ipv6="$OPTARG"
-        ;;
-  u)    duid="$OPTARG"
-        ;;
-  h)    host="$OPTARG"
-        ;;
-  d)    dflt="$OPTARG"
-        ;;
-  n)    dns="$OPTARG"
-        ;;
-  s)    routes="$OPTARG"
-        ;;
-  N)    nondefault=1
-        ;;
-  ?)    usage
-        exit 2
-        ;;
-  esac
-done
-
-DHCP_HOSTS=/etc/dhcphosts.txt
-DHCP_OPTS=/etc/dhcpopts.txt
-DHCP_LEASES=/var/lib/misc/dnsmasq.leases
-HOSTS=/etc/hosts
-
-source /root/func.sh
-
-lock="biglock"
-#default timeout value is 30 mins as DhcpEntryCommand is not synchronized on agent side any more,
-#and multiple commands can be sent to the same VR at a time
-locked=$(getLockFile $lock 1800)
-if [ "$locked" != "1" ]
-then
-    exit 1
-fi
-
-grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
-no_redundant=$?
-
-command -v dhcp_release > /dev/null 2>&1
-no_dhcp_release=$?
-
-wait_for_dnsmasq () {
-  local _pid=$(pidof dnsmasq)
-  for i in 0 1 2 3 4 5 6 7 8 9 10
-  do
-    sleep 1
-    _pid=$(pidof dnsmasq)
-    [ "$_pid" != "" ] && break;
-  done
-  [ "$_pid" != "" ] && return 0;
-  logger -t cloud "edithosts: timed out waiting for dnsmasq to start"
-  return 1
-}
-
-if [ $ipv6 ]
-then
-    no_dhcp_release=1
-fi
-
-if [ $no_dhcp_release -eq 0 ]
-then
-  #release previous dhcp lease if present
-  logger -t cloud "edithosts: releasing $ipv4"
-  dhcp_release eth0 $ipv4 $(grep "$ipv4 " $DHCP_LEASES | awk '{print $2}') > /dev/null 2>&1
-  logger -t cloud "edithosts: released $ipv4"
-fi
-
-logger -t cloud "edithosts: update $mac $ipv4 $ipv6 $host to hosts"
-
-[ ! -f $DHCP_HOSTS ] && touch $DHCP_HOSTS
-[ ! -f $DHCP_OPTS ] && touch $DHCP_OPTS
-[ ! -f $DHCP_LEASES ] && touch $DHCP_LEASES
-
-#delete any previous entries from the dhcp hosts file
-sed -i  /$mac/d $DHCP_HOSTS
-if [ $ipv4 ]
-then
-  sed -i  /$ipv4,/d $DHCP_HOSTS
-fi
-if [ $ipv6 ]
-then
-  #searching with [$ipv6], matching other ip so using $ipv6],
-  sed -i  /$ipv6],/d $DHCP_HOSTS
-fi
-# don't want to do this in the future, we can have same VM with multiple nics/entries
-#sed -i  /$host,/d $DHCP_HOSTS
-
-
-#put in the new entry
-if [ $ipv4 ]
-then
-  echo "$mac,$ipv4,$host,infinite" >>$DHCP_HOSTS
-fi
-if [ $ipv6 ]
-then
-  if [ $nondefault ]
-  then
-    echo "id:$duid,set:nondefault6,[$ipv6],$host,infinite" >>$DHCP_HOSTS
-  else
-    echo "id:$duid,[$ipv6],$host,infinite" >>$DHCP_HOSTS
-  fi
-fi
-
-#delete leases to supplied mac and ip addresses
-if [ $ipv4 ]
-then
-  sed -i  /$mac/d $DHCP_LEASES 
-  sed -i  /"$ipv4 "/d $DHCP_LEASES 
-fi
-if [ $ipv6 ]
-then
-  sed -i  /$duid/d $DHCP_LEASES 
-  sed -i  /"$ipv6 "/d $DHCP_LEASES 
-fi
-sed -i  /"$host "/d $DHCP_LEASES 
-
-#put in the new entry
-if [ $ipv4 ]
-then
-  echo "0 $mac $ipv4 $host *" >> $DHCP_LEASES
-fi
-if [ $ipv6 ]
-then
-  echo "0 $duid $ipv6 $host *" >> $DHCP_LEASES
-fi
-
-#edit hosts file as well
-if [ $ipv4 ]
-then
-  sed -i  /"$ipv4 "/d $HOSTS
-fi
-if [ $ipv6 ]
-then
-  sed -i  /"$ipv6 "/d $HOSTS
-fi
-sed -i  /" $host$"/d $HOSTS
-if [ $ipv4 ]
-then
-  echo "$ipv4 $host" >> $HOSTS
-fi
-if [ $ipv6 ]
-then
-  echo "$ipv6 $host" >> $HOSTS
-fi
-
-if [ "$dflt" != "" ]
-then
-  #make sure dnsmasq looks into options file
-  sed -i /dhcp-optsfile/d /etc/dnsmasq.conf
-  echo "dhcp-optsfile=$DHCP_OPTS" >> /etc/dnsmasq.conf
-
-  tag=$(echo $ipv4 | tr '.' '_')
-  sed -i /$tag/d $DHCP_OPTS
-  if [ "$dflt" == "0.0.0.0" ]
-  then
-    logger -t cloud "$0: unset default router for $ipv4"
-    logger -t cloud "$0: unset dns server for $ipv4"
-    echo "$tag,3" >> $DHCP_OPTS
-    echo "$tag,6" >> $DHCP_OPTS
-    echo "$tag,15" >> $DHCP_OPTS
-  fi
-  [ "$routes" != "" ] && echo "$tag,121,$routes" >> $DHCP_OPTS
-  #delete entry we just put in because we need a tag
-  sed -i  /$ipv4,/d $DHCP_HOSTS
-  #put it back with a tag
-  echo "$mac,set:$tag,$ipv4,$host,infinite" >>$DHCP_HOSTS
-fi
-
-# make dnsmasq re-read files
-pid=$(pidof dnsmasq)
-if [ "$pid" != "" ]
-then
-  # use SIGHUP to avoid service outage if dhcp_release is available.
-  if [ $no_dhcp_release -eq 0 ]
-  then
-    kill -HUP $pid
-  else
-    service dnsmasq restart
-  fi
-else
-  if [ $no_redundant -eq 1 ]
-  then
-      wait_for_dnsmasq
-  else
-      logger -t cloud "edithosts: skip wait dnsmasq due to redundant virtual router"
-  fi
-fi
-
-ret=$?
-unlock_exit $ret $lock $locked


Mime
View raw message