CLOUDSTACK-6504: removed warnings coming in building hyper-v agent code
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6511b960 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6511b960 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6511b960 Branch: refs/heads/master Commit: 6511b96088af75b7e37a5f8b0cce609b006021fb Parents: 1dc76a2 Author: Anshul Gangwar <anshul.gang...@citrix.com> Authored: Thu Apr 24 22:30:12 2014 -0700 Committer: Devdeep Singh <devd...@gmail.com> Committed: Fri Apr 25 14:46:06 2014 +0530 ---------------------------------------------------------------------- .../HypervResource/CloudStackTypes.cs | 8 +++++++- .../HypervResource/HypervResourceController.cs | 7 +------ .../ServerResource/HypervResource/Utils.cs | 4 ++-- .../ServerResource/HypervResource/WmiCallsV2.cs | 19 ------------------- 4 files changed, 10 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6511b960/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs index c222102..f7bed71 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/CloudStackTypes.cs @@ -302,7 +302,7 @@ namespace HypervResource path = Utils.NormalizePath(path); if (Directory.Exists(path)) { - string[] choices = choices = Directory.GetFiles(path, volInfo.uuid + ".vhd*"); + string[] choices = Directory.GetFiles(path, volInfo.uuid + ".vhd*"); if (choices.Length != 1) { String errMsg = "Tried to guess file extension, but cannot find file corresponding to " + @@ -609,6 +609,7 @@ namespace HypervResource public struct VolumeInfo { +#pragma warning disable 0414 public long id; public string type; public string storagePoolType; @@ -618,6 +619,7 @@ namespace HypervResource public string path; long size; string chainInfo; +#pragma warning restore 0414 public VolumeInfo(long id, string type, string poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) { @@ -635,10 +637,12 @@ namespace HypervResource public class VmState { +#pragma warning disable 0414 [JsonProperty("state")] public String state; [JsonProperty("host")] String host; +#pragma warning restore 0414 public VmState() { } public VmState(String vmState, String host) { @@ -649,6 +653,7 @@ namespace HypervResource public struct StoragePoolInfo { +#pragma warning disable 0414 [JsonProperty("uuid")] public String uuid; [JsonProperty("host")] @@ -667,6 +672,7 @@ namespace HypervResource long availableBytes; [JsonProperty("details")] Dictionary<String, String> details; +#pragma warning restore 0414 public StoragePoolInfo(String uuid, String host, String hostPath, String localPath, string poolType, long capacityBytes, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6511b960/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs index 0f084db..c28cb66 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs @@ -304,7 +304,6 @@ namespace HypervResource else if (disk.type.Equals("DATADISK")) { VolumeObjectTO volume = disk.volumeObjectTO; - PrimaryDataStoreTO primary = volume.primaryDataStore; string diskPath = Utils.NormalizePath(volume.FullFileName); wmiCallsV2.DetachDisk(vmName, diskPath); result = true; @@ -625,7 +624,6 @@ namespace HypervResource string newCopyFileName = null; string poolLocalPath = cmd.localPath; - string poolUuid = cmd.poolUuid; if (!Directory.Exists(poolLocalPath)) { details = "None existent local path " + poolLocalPath; @@ -1173,7 +1171,7 @@ namespace HypervResource string defaultDataPath = wmiCallsV2.GetDefaultDataRoot(); string secondaryPath = Utils.NormalizePath(Path.Combine(share.UncPath, "systemvm")); - string[] choices = choices = Directory.GetFiles(secondaryPath, "systemvm*.iso"); + string[] choices = Directory.GetFiles(secondaryPath, "systemvm*.iso"); if (choices.Length != 1) { String errMsg = "Couldn't locate the systemvm iso on " + secondaryPath; @@ -1537,8 +1535,6 @@ namespace HypervResource try { - dynamic timeout = cmd.wait; // TODO: Useful? - srcTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.srcTO); destTemplateObjectTO = TemplateObjectTO.ParseJson(cmd.destTO); srcVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.srcTO); @@ -1931,7 +1927,6 @@ namespace HypervResource try { StoragePoolType poolType; - string poolId = (string)cmd.id; string hostPath = null; if (!Enum.TryParse<StoragePoolType>((string)cmd.pooltype, out poolType)) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6511b960/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs index d0d3d83..c8e951e 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/Utils.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 @@ -88,7 +88,7 @@ namespace HypervResource { IntPtr token = IntPtr.Zero; - bool isSuccess = LogonUser(cifsShareDetails.User, cifsShareDetails.Domain, cifsShareDetails.Password, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT, ref token); + LogonUser(cifsShareDetails.User, cifsShareDetails.Domain, cifsShareDetails.Password, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT, ref token); using (WindowsImpersonationContext remoteIdentity = new WindowsIdentity(token).Impersonate()) { String dest = ""; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6511b960/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs index ec1103c..71d8cbd 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs @@ -379,7 +379,6 @@ namespace HypervResource } } - String publicIpAddress = ""; int nicCount = 0; // Add the Nics to the VM in the deviceId order. foreach (var nc in nicInfo) @@ -424,11 +423,6 @@ namespace HypervResource vlan = defaultvlan; } - if (nicCount == 2) - { - publicIpAddress = nic.ip; - } - if (nicid == nicCount) { // Create network adapter @@ -496,16 +490,6 @@ namespace HypervResource if (vmName.StartsWith("r-") || vmName.StartsWith("s-") || vmName.StartsWith("v-")) { System.Threading.Thread.Sleep(90000); - // wait for the second boot and then return with sucesss - //if publicIPAddress is empty or null don't ping the ip - /*if (publicIpAddress.Equals("") == true) - { - System.Threading.Thread.Sleep(90000); - } - else - { - pingResource(publicIpAddress); - }*/ } logger.InfoFormat("Started VM {0}", vmName); return newVm; @@ -963,7 +947,6 @@ namespace HypervResource public void ModifyVmVLan(string vmName, uint vlanid, uint pos) { ComputerSystem vm = GetComputerSystem(vmName); - SyntheticEthernetPortSettingData[] nicSettingsViaVm = GetEthernetPortSettings(vm); // Obtain controller for Hyper-V virtualisation subsystem VirtualSystemManagementService vmMgmtSvc = GetVirtualisationSystemManagementService(); @@ -1133,7 +1116,6 @@ namespace HypervResource public void MigrateVolume(string vmName, string volume, string destination) { ComputerSystem vm = GetComputerSystem(vmName); - VirtualSystemSettingData vmSettings = GetVmSettings(vm); VirtualSystemMigrationSettingData migrationSettingData = VirtualSystemMigrationSettingData.CreateInstance(); VirtualSystemMigrationService service = GetVirtualisationSystemMigrationService(); StorageAllocationSettingData[] sasd = GetStorageSettings(vm); @@ -1189,7 +1171,6 @@ namespace HypervResource public void MigrateVmWithVolume(string vmName, string destination, Dictionary<string, string> volumeToPool) { ComputerSystem vm = GetComputerSystem(vmName); - VirtualSystemSettingData vmSettings = GetVmSettings(vm); VirtualSystemMigrationSettingData migrationSettingData = VirtualSystemMigrationSettingData.CreateInstance(); VirtualSystemMigrationService service = GetVirtualisationSystemMigrationService(); StorageAllocationSettingData[] sasd = GetStorageSettings(vm);