CLOUDSTACK-6504: removed warnings coming in building hyper-v agent code

This commit is contained in:
Anshul Gangwar 2014-04-24 22:30:12 -07:00 committed by Devdeep Singh
parent 1dc76a2743
commit 6511b96088
4 changed files with 10 additions and 28 deletions

View File

@ -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,

View File

@ -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))
{

View File

@ -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 = "";

View File

@ -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);