diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs index febd10abb46..94b640edd1b 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentService.cs @@ -1,4 +1,4 @@ -// Licensed to the Apache Software Foundation (ASF) under one +// 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 @@ -76,7 +76,6 @@ namespace CloudStack.Plugin.AgentShell rsrcCnf.RootDeviceName = AgentSettings.Default.RootDeviceName; rsrcCnf.ParentPartitionMinMemoryMb = AgentSettings.Default.dom0MinMemory; rsrcCnf.LocalSecondaryStoragePath = AgentSettings.Default.local_secondary_storage_path; - rsrcCnf.systemVmIso = null; // Side effect: loads the assembly containing HypervResourceController, which // allows HttpSelfHostServer to route requests to the controller. diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs index 5af37a9a5b3..077d5a31f49 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs @@ -81,7 +81,6 @@ namespace HypervResource public string RootDeviceName; public ulong ParentPartitionMinMemoryMb; public string LocalSecondaryStoragePath; - public string systemVmIso; private string getPrimaryKey(string id) { @@ -157,7 +156,6 @@ namespace HypervResource public static HypervResourceControllerConfig config = new HypervResourceControllerConfig(); private static ILog logger = LogManager.GetLogger(typeof(HypervResourceController)); - private string systemVmIso = ""; Dictionary contextMap = new Dictionary(); public static void Initialize() @@ -1160,39 +1158,25 @@ namespace HypervResource try { - string systemVmIsoPath = systemVmIso; - lock (systemVmIso) + string systemVmIsoPath = null; + String uriStr = (String)cmd.secondaryStorage; + if (!String.IsNullOrEmpty(uriStr)) { - systemVmIsoPath = systemVmIso; - String uriStr = (String)cmd.secondaryStorage; - if (!String.IsNullOrEmpty(uriStr)) + NFSTO share = new NFSTO(); + share.uri = new Uri(uriStr); + string defaultDataPath = wmiCallsV2.GetDefaultDataRoot(); + string secondaryPath = Utils.NormalizePath(Path.Combine(share.UncPath, "systemvm")); + string[] choices = Directory.GetFiles(secondaryPath, "systemvm*.iso"); + if (choices.Length != 1) { - if (String.IsNullOrEmpty(systemVmIsoPath) || !File.Exists(systemVmIsoPath)) - { - NFSTO share = new NFSTO(); - share.uri = new Uri(uriStr); - string defaultDataPath = wmiCallsV2.GetDefaultDataRoot(); - - string secondaryPath = Utils.NormalizePath(Path.Combine(share.UncPath, "systemvm")); - string[] choices = Directory.GetFiles(secondaryPath, "systemvm*.iso"); - if (choices.Length != 1) - { - String errMsg = "Couldn't locate the systemvm iso on " + secondaryPath; - logger.Debug(errMsg); - } - else - { - systemVmIsoPath = Utils.NormalizePath(Path.Combine(defaultDataPath, Path.GetFileName(choices[0]))); - if (!File.Exists(systemVmIsoPath)) - { - Utils.DownloadCifsFileToLocalFile(choices[0], share, systemVmIsoPath); - } - systemVmIso = systemVmIsoPath; - } - } + String errMsg = "Couldn't locate the systemvm iso on " + secondaryPath; + logger.Error(errMsg); + } + else + { + systemVmIsoPath = choices[0]; } } - wmiCallsV2.DeployVirtualMachine(cmd, systemVmIsoPath); result = true; }