Changes to attach the system vm iso when booting the virtual router - part 1.
Copy the iso to the secondary storage and let the hypervisor agent know of its
location during setup. The agent will copy it over once it handles the setup
command.


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

Branch: refs/heads/hyperv
Commit: 15f9b827350d8252b3c86c2a3f3d64d197a83234
Parents: 1b5cd84
Author: Devdeep Singh <devd...@gmail.com>
Authored: Fri Oct 25 15:57:31 2013 +0530
Committer: Devdeep Singh <devd...@gmail.com>
Committed: Fri Oct 25 15:57:31 2013 +0530

----------------------------------------------------------------------
 core/src/com/cloud/agent/api/SetupCommand.java  |  20 ++
 .../discoverer/HypervServerDiscoverer.java      | 231 ++++++++++++++++++-
 .../resource/HypervDirectConnectResource.java   | 105 +++------
 3 files changed, 285 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15f9b827/core/src/com/cloud/agent/api/SetupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/SetupCommand.java 
b/core/src/com/cloud/agent/api/SetupCommand.java
index ee43c59..65700e9 100644
--- a/core/src/com/cloud/agent/api/SetupCommand.java
+++ b/core/src/com/cloud/agent/api/SetupCommand.java
@@ -23,6 +23,8 @@ public class SetupCommand extends Command {
     HostEnvironment env;
     boolean multipath;
     boolean needSetup;
+    String secondaryStorage;
+    String systemVmIso;
 
     public boolean needSetup() {
         return needSetup;
@@ -36,6 +38,8 @@ public class SetupCommand extends Command {
         this.env = env;
         this.multipath = false;
         this.needSetup = false;
+        secondaryStorage = null;
+        systemVmIso = null;
     }
 
     public HostEnvironment getEnvironment() {
@@ -53,6 +57,22 @@ public class SetupCommand extends Command {
         return multipath;
     }
 
+    public void setSecondaryStorage(String secondaryStorage) {
+        this.secondaryStorage = secondaryStorage;
+    }
+
+    public String getSecondaryStorage() {
+        return this.secondaryStorage;
+    }
+
+    public void setSystemVmIso(String systemVmIso) {
+        this.systemVmIso = systemVmIso;
+    }
+
+    public String getSystemVmIso() {
+        return this.systemVmIso;
+    }
+
     @Override
     public boolean executeInSequence() {
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15f9b827/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
index 11df222..f011ce0 100644
--- 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
+++ 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
@@ -16,18 +16,26 @@
 // under the License.
 package com.cloud.hypervisor.hyperv.discoverer;
 
+import java.io.File;
+import java.io.IOException;
 import java.net.InetAddress;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 import java.util.UUID;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.utils.identity.ManagementServerNode;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
@@ -42,6 +50,7 @@ import com.cloud.agent.api.SetupCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
 import com.cloud.alert.AlertManager;
+import com.cloud.configuration.Config;
 import com.cloud.dc.ClusterDetailsDao;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenterVO;
@@ -67,6 +76,13 @@ import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceStateAdapter;
 import com.cloud.resource.ServerResource;
 import com.cloud.resource.UnableDeleteHostException;
+import com.cloud.storage.JavaStorageLayer;
+import com.cloud.storage.StorageLayer;
+import com.cloud.utils.FileUtil;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GlobalLock;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
 
 /**
  * Methods to discover and managem a Hyper-V agent. Prepares a
@@ -76,8 +92,15 @@ import com.cloud.resource.UnableDeleteHostException;
 @Local(value = Discoverer.class)
 public class HypervServerDiscoverer extends DiscovererBase implements
         Discoverer, Listener, ResourceStateAdapter {
-    private static final Logger s_logger = Logger
-            .getLogger(HypervServerDiscoverer.class);
+    private static final Logger s_logger = 
Logger.getLogger(HypervServerDiscoverer.class);
+
+    private String _instance;
+    private String _mountParent;
+    private int _timeout;
+    Random _rand = new Random(System.currentTimeMillis());
+
+    Map<String, String> _storageMounts = new HashMap<String, String>();
+    StorageLayer _storage;
 
     @Inject
     private HostDao _hostDao = null;
@@ -91,6 +114,8 @@ public class HypervServerDiscoverer extends DiscovererBase 
implements
     private HostPodDao _podDao;
     @Inject
     private DataCenterDao _dcDao;
+    @Inject
+    DataStoreManager _dataStoreMgr;
 
     // TODO: AgentManager and AlertManager not being used to transmit info,
     // may want to reconsider.
@@ -152,8 +177,17 @@ public class HypervServerDiscoverer extends DiscovererBase 
implements
             s_logger.debug("Setting up host " + agentId);
         }
 
+        String secondaryStorageUri = 
getSecondaryStorageStoreUrl(cluster.getDataCenterId());
+        if (secondaryStorageUri == null) {
+            s_logger.debug("Secondary storage uri for dc " + 
cluster.getDataCenterId() + " couldn't be obtained");
+        } else {
+            prepareSecondaryStorageStore(secondaryStorageUri);
+        }
+
         HostEnvironment env = new HostEnvironment();
         SetupCommand setup = new SetupCommand(env);
+        setup.setSecondaryStorage(secondaryStorageUri);
+        setup.setSystemVmIso("systemvm/" + 
getSystemVMIsoFileNameOnDatastore());
         if (!host.isSetup()) {
             setup.setNeedSetup(true);
         }
@@ -298,6 +332,7 @@ public class HypervServerDiscoverer extends DiscovererBase 
implements
             params.put("cluster", Long.toString(clusterId));
             params.put("guid", guidWithTail);
             params.put("ipaddress", agentIp);
+            params.put("sec.storage.url", getSecondaryStorageStoreUrl(dcId));
 
             // Hyper-V specific settings
             Map<String, String> details = new HashMap<String, String>();
@@ -348,6 +383,177 @@ public class HypervServerDiscoverer extends 
DiscovererBase implements
         }
         return null;
     }
+    
+
+    private void prepareSecondaryStorageStore(String storageUrl) {
+        String mountPoint = getMountPoint(storageUrl);
+
+        GlobalLock lock = GlobalLock.getInternLock("prepare.systemvm");
+        try {
+            if(lock.lock(3600)) {
+                try {
+                    File patchFolder = new File(mountPoint + "/systemvm");
+                    if(!patchFolder.exists()) {
+                        if(!patchFolder.mkdirs()) {
+                            String msg = "Unable to create systemvm folder on 
secondary storage. location: " + patchFolder.toString();
+                            s_logger.error(msg);
+                            throw new CloudRuntimeException(msg);
+                        }
+                    }
+
+                    File srcIso = getSystemVMPatchIsoFile();
+                    File destIso = new File(mountPoint + "/systemvm/" + 
getSystemVMIsoFileNameOnDatastore());
+                    if(!destIso.exists()) {
+                        s_logger.info("Copy System VM patch ISO file to 
secondary storage. source ISO: " +
+                                srcIso.getAbsolutePath() + ", destination: " + 
destIso.getAbsolutePath());
+                        try {
+                            FileUtil.copyfile(srcIso, destIso);
+                        } catch(IOException e) {
+                            s_logger.error("Unexpected exception ", e);
+
+                            String msg = "Unable to copy systemvm ISO on 
secondary storage. src location: " + srcIso.toString() + ", dest location: " + 
destIso;
+                            s_logger.error(msg);
+                            throw new CloudRuntimeException(msg);
+                        }
+                    } else {
+                        if(s_logger.isTraceEnabled()) {
+                            s_logger.trace("SystemVM ISO file " + 
destIso.getPath() + " already exists");
+                        }
+                    }
+                } finally {
+                    lock.unlock();
+                }
+            }
+        } finally {
+            lock.releaseRef();
+        }
+    }
+
+    private String getMountPoint(String storageUrl) {
+        String mountPoint = null;
+        synchronized(_storageMounts) {
+            mountPoint = _storageMounts.get(storageUrl);
+            if(mountPoint != null) {
+                return mountPoint;
+            }
+
+            URI uri;
+            try {
+                uri = new URI(storageUrl);
+            } catch (URISyntaxException e) {
+                s_logger.error("Invalid storage URL format ", e);
+                throw new CloudRuntimeException("Unable to create mount point 
due to invalid storage URL format " + storageUrl);
+            }
+
+            mountPoint = mount(File.separator + File.separator + uri.getHost() 
+ uri.getPath(), _mountParent,
+                    uri.getScheme(), uri.getQuery());
+            if(mountPoint == null) {
+                s_logger.error("Unable to create mount point for " + 
storageUrl);
+                return "/mnt/sec";
+            }
+
+            _storageMounts.put(storageUrl, mountPoint);
+            return mountPoint;
+        }
+    }
+
+    protected String mount(String path, String parent, String scheme, String 
query) {
+        String mountPoint = setupMountPoint(parent);
+        if (mountPoint == null) {
+            s_logger.warn("Unable to create a mount point");
+            return null;
+        }
+
+        Script script = null;
+        String result = null;
+        if (scheme.equals("cifs")) {
+            Script command = new Script(true, "mount", _timeout, s_logger);
+            command.add("-t", "cifs");
+            command.add(path);
+            command.add(mountPoint);
+
+            if (query != null) {
+                query = query.replace('&', ',');
+                command.add("-o", query);
+            }
+            result = command.execute();
+        }
+
+        if (result != null) {
+            s_logger.warn("Unable to mount " + path + " due to " + result);
+            File file = new File(mountPoint);
+            if (file.exists()) {
+                file.delete();
+            }
+            return null;
+        }
+
+        // Change permissions for the mountpoint
+        script = new Script(true, "chmod", _timeout, s_logger);
+        script.add("-R", "777", mountPoint);
+        result = script.execute();
+        if (result != null) {
+            s_logger.warn("Unable to set permissions for " + mountPoint + " 
due to " + result);
+        }
+        return mountPoint;
+    }
+
+    private String setupMountPoint(String parent) {
+        String mountPoint = null;
+        long mshostId = ManagementServerNode.getManagementServerId();
+        for (int i = 0; i < 10; i++) {
+            String mntPt = parent + File.separator + String.valueOf(mshostId) 
+ "." + Integer.toHexString(_rand.nextInt(Integer.MAX_VALUE));
+            File file = new File(mntPt);
+            if (!file.exists()) {
+                if (_storage.mkdir(mntPt)) {
+                    mountPoint = mntPt;
+                    break;
+                }
+            }
+            s_logger.error("Unable to create mount: " + mntPt);
+        }
+
+        return mountPoint;
+    }
+
+    private String getSystemVMIsoFileNameOnDatastore() {
+        String version = 
this.getClass().getPackage().getImplementationVersion();
+        String fileName = "systemvm-" + version + ".iso";
+        return fileName.replace(':', '-');
+    }
+
+    private File getSystemVMPatchIsoFile() {
+        // locate systemvm.iso
+        URL url = 
this.getClass().getClassLoader().getResource("vms/systemvm.iso");
+        File isoFile = null;
+        if (url != null) {
+            isoFile = new File(url.getPath());
+        }
+
+        if(isoFile == null || !isoFile.exists()) {
+            isoFile = new 
File("/usr/share/cloudstack-common/vms/systemvm.iso");
+        }
+
+        assert(isoFile != null);
+        if(!isoFile.exists()) {
+            s_logger.error("Unable to locate systemvm.iso in your setup at " + 
isoFile.toString());
+        }
+        return isoFile;
+    }
+
+    private String getSecondaryStorageStoreUrl(long zoneId) {
+        String secUrl = null;
+        DataStore secStore = _dataStoreMgr.getImageStore(zoneId);
+        if (secStore != null) {
+            secUrl = secStore.getUri();
+        }
+
+        if (secUrl == null) {
+            s_logger.warn("Secondary storage uri couldn't be retrieved");
+        }
+
+        return secUrl;
+    }
 
     /**
      * Encapsulate GUID calculation in public method to allow access to test
@@ -371,10 +577,27 @@ public class HypervServerDiscoverer extends 
DiscovererBase implements
     // Inherit Adapter.stop
     // Inherit Adapter.start
     @Override
-    public final boolean configure(final String name,
-            final Map<String, Object> params) throws ConfigurationException {
+    public final boolean configure(final String name, final Map<String, 
Object> params) throws ConfigurationException {
         super.configure(name, params);
 
+        _mountParent = (String) params.get(Config.MountParent.key());
+        if (_mountParent == null) {
+            _mountParent = File.separator + "mnt";
+        }
+
+        if (_instance != null) {
+            _mountParent = _mountParent + File.separator + _instance;
+        }
+
+        String value = (String)params.get("scripts.timeout");
+        _timeout = NumbersUtil.parseInt(value, 30) * 1000;
+
+        _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey);
+        if (_storage == null) {
+            _storage = new JavaStorageLayer();
+            _storage.configure("StorageLayer", params);
+        }
+
         // TODO: allow timeout on we HTTPRequests to be configured
         _agentMgr.registerForHostEvents(this, true, false, true);
         _resourceMgr.registerResourceStateAdapter(this.getClass()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15f9b827/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index 6d6dc1f..7069748 100644
--- 
a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ 
b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -27,14 +27,20 @@ import java.nio.channels.SocketChannel;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Random;
 import java.util.UUID;
 
+import javax.ejb.Local;
+import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.utils.identity.ManagementServerNode;
 import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
-import org.apache.http.HttpStatus;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -54,11 +60,12 @@ import com.cloud.agent.api.NetworkUsageCommand;
 import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.PingRoutingCommand;
 import com.cloud.agent.api.PingTestCommand;
+import com.cloud.agent.api.StartCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
+import com.cloud.agent.api.StartupRoutingCommand.VmState;
 import com.cloud.agent.api.StartupStorageCommand;
 import com.cloud.agent.api.UnsupportedAnswer;
-import com.cloud.agent.api.StartupRoutingCommand.VmState;
 import com.cloud.agent.api.check.CheckSshAnswer;
 import com.cloud.agent.api.check.CheckSshCommand;
 import com.cloud.agent.api.routing.CreateIpAliasCommand;
@@ -88,6 +95,8 @@ import com.cloud.agent.api.to.FirewallRuleTO;
 import com.cloud.agent.api.to.IpAddressTO;
 import com.cloud.agent.api.to.PortForwardingRuleTO;
 import com.cloud.agent.api.to.StaticNatRuleTO;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.configuration.Config;
 import com.cloud.dc.DataCenter.NetworkType;
 import com.cloud.host.Host.Type;
 import com.cloud.hypervisor.Hypervisor;
@@ -98,19 +107,26 @@ import com.cloud.network.rules.FirewallRule;
 import com.cloud.resource.ServerResource;
 import com.cloud.resource.ServerResourceBase;
 import com.cloud.serializer.GsonHelper;
+import com.cloud.storage.JavaStorageLayer;
+import com.cloud.storage.StorageLayer;
+import com.cloud.utils.FileUtil;
+import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
+import com.cloud.utils.db.GlobalLock;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
+import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SshHelper;
+import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineName;
 import com.google.gson.Gson;
 
 /**
  * Implementation of dummy resource to be returned from discoverer.
  **/
-
-public class HypervDirectConnectResource extends ServerResourceBase implements
-        ServerResource {
+@Local(value = ServerResource.class)
+public class HypervDirectConnectResource extends ServerResourceBase implements 
ServerResource {
     public static final int DEFAULT_AGENT_PORT = 8250;
     private static final Logger s_logger = Logger
             .getLogger(HypervDirectConnectResource.class.getName());
@@ -387,7 +403,7 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
             answer = execute((VmDataCommand) cmd);
         } else if (clazz == SavePasswordCommand.class) {
             answer = execute((SavePasswordCommand) cmd);
-        } else  if (clazz == SetFirewallRulesCommand.class) {
+        } else if (clazz == SetFirewallRulesCommand.class) {
             answer = execute((SetFirewallRulesCommand)cmd);
         } else if (clazz == LoadBalancerConfigCommand.class) {
             answer = execute((LoadBalancerConfigCommand) cmd);
@@ -411,19 +427,19 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
             answer = execute((SetStaticRouteCommand) cmd);
         }
         else {
-        // Else send the cmd to hyperv agent.
-        String ansStr = postHttpRequest(s_gson.toJson(cmd), agentUri);
-        if (ansStr == null) {
-           return Answer.createUnsupportedCommandAnswer(cmd);
-        }
-        // Only Answer instances are returned by remote agents.
-        // E.g. see Response.getAnswers()
-        Answer[] result = s_gson.fromJson(ansStr, Answer[].class);
-        s_logger.debug("executeRequest received response "
-                + s_gson.toJson(result));
-        if (result.length > 0) {
-            return result[0];
-        }
+            // Else send the cmd to hyperv agent.
+            String ansStr = postHttpRequest(s_gson.toJson(cmd), agentUri);
+            if (ansStr == null) {
+               return Answer.createUnsupportedCommandAnswer(cmd);
+            }
+            // Only Answer instances are returned by remote agents.
+            // E.g. see Response.getAnswers()
+            Answer[] result = s_gson.fromJson(ansStr, Answer[].class);
+            s_logger.debug("executeRequest received response "
+                    + s_gson.toJson(result));
+            if (result.length > 0) {
+                return result[0];
+            }
         }
         return answer;
     }
@@ -1259,7 +1275,6 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
         for(DhcpTO dhcpTo : dhcpTos) {
             args = args + 
dhcpTo.getRouterIp()+":"+dhcpTo.getGateway()+":"+dhcpTo.getNetmask()+":"+dhcpTo.getStartIpOfSubnet()+"-";
         }
-        //File keyFile = mgr.getSystemVMKeyFile();
 
         try {
             Pair<Boolean, String> result = SshHelper.sshExecute(controlIp, 
DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/root/dnsmasq.sh " + 
args);
@@ -1319,43 +1334,17 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
     protected void assignPublicIpAddress(final String vmName, final String 
privateIpAddress, final String publicIpAddress, final boolean add, final 
boolean firstIP,
             final boolean sourceNat, final String vlanId, final String 
vlanGateway, final String vlanNetmask, final String vifMacAddress) throws 
Exception {
 
-        //String publicNeworkName = 
HypervisorHostHelper.getPublicNetworkNamePrefix(vlanId);
-        //Pair<Integer, VirtualDevice> publicNicInfo = 
vmMo.getNicDeviceIndex(publicNeworkName);
-
-        if (s_logger.isDebugEnabled()) {
-            //s_logger.debug("Find public NIC index, public network name: " + 
publicNeworkName + ", index: " + publicNicInfo.first());
-        }
-
         boolean addVif = false;
         boolean removeVif = false;
-        if (add ) { // && publicNicInfo.first().intValue() == -1) {
+        if (add) {
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Plug new NIC to associate" + privateIpAddress 
+ " to " + publicIpAddress);
             }
-
             addVif = true;
         } else if (!add && firstIP) {
             removeVif = true;
-
-            if (s_logger.isDebugEnabled()) {
-                //s_logger.debug("Unplug NIC " + publicNicInfo.first());
-            }
         }
 
-/*        if (addVif) {
-            plugPublicNic(vmMo, vlanId, vifMacAddress);
-            publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName);
-            if (publicNicInfo.first().intValue() >= 0) {
-                networkUsage(privateIpAddress, "addVif", "eth" + 
publicNicInfo.first());
-            }
-        }
-*/
-/*        if (publicNicInfo.first().intValue() < 0) {
-            String msg = "Failed to find DomR VIF to associate/disassociate IP 
with.";
-            s_logger.error(msg);
-            throw new InternalErrorException(msg);
-        }
-*/
         String args = null;
 
         if (add) {
@@ -1400,7 +1389,7 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
         }
     }
 
-   protected Answer execute(GetDomRVersionCmd cmd) {
+    protected Answer execute(GetDomRVersionCmd cmd) {
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Executing resource GetDomRVersionCmd: " + 
s_gson.toJson(cmd));
             s_logger.debug("Run command on domR " + 
cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", 
/opt/cloud/bin/get_template_version.sh ");
@@ -1558,25 +1547,6 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
         return null;
     }
 
-    private File getSystemVMPatchIsoFile() {
-        // locate systemvm.iso
-        URL url = 
this.getClass().getClassLoader().getResource("vms/systemvm.iso");
-        File isoFile = null;
-        if (url != null) {
-            isoFile = new File(url.getPath());
-        }
-
-        if(isoFile == null || !isoFile.exists()) {
-            isoFile = new 
File("/usr/share/cloudstack-common/vms/systemvm.iso");
-        }
-
-        assert(isoFile != null);
-        if(!isoFile.exists()) {
-            s_logger.error("Unable to locate systemvm.iso in your setup at " + 
isoFile.toString());
-        }
-        return isoFile;
-    }
-
     public File getSystemVMKeyFile() {
         URL url = 
this.getClass().getClassLoader().getResource("scripts/vm/systemvm/id_rsa.cloud");
         File keyFile = null;
@@ -1721,6 +1691,7 @@ public class HypervDirectConnectResource extends 
ServerResourceBase implements
     public void setRunLevel(final int level) {
         // TODO Auto-generated method stub
     }
+
     protected String connect(final String vmName, final String ipAddress, 
final int port) {
         long startTick = System.currentTimeMillis();
 

Reply via email to