Added contextMap data to all the command responses in HyperV

This commit is contained in:
Rajesh Battala 2013-11-25 18:43:23 +05:30
parent d5e497859f
commit 875e1ea281
1 changed files with 58 additions and 28 deletions

View File

@ -142,6 +142,7 @@ namespace HypervResource
private static ILog logger = LogManager.GetLogger(typeof(HypervResourceController));
private static string systemVmIso;
Dictionary<String, String> contextMap = new Dictionary<String, String>();
public static void Initialize()
{
@ -203,7 +204,8 @@ namespace HypervResource
{
result = result,
details = "success - NOP",
_reconnect = false
_reconnect = false,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.SetupAnswer);
@ -248,7 +250,8 @@ namespace HypervResource
object ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.AttachAnswer);
@ -292,7 +295,8 @@ namespace HypervResource
object ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.DettachAnswer);
@ -335,7 +339,8 @@ namespace HypervResource
object ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.RebootAnswer);
@ -397,7 +402,8 @@ namespace HypervResource
object ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
@ -512,7 +518,8 @@ namespace HypervResource
{
result = result,
details = details,
volume = volume
volume = volume,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CreateAnswer);
}
@ -580,7 +587,8 @@ namespace HypervResource
result = result,
details = details,
templateSize = size,
installPath = newCopyFileName
installPath = newCopyFileName,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.PrimaryStorageDownloadAnswer);
}
@ -682,7 +690,8 @@ namespace HypervResource
object ansContent = new
{
result = true,
details = "resource is alive"
details = "resource is alive",
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CheckHealthAnswer);
}
@ -700,7 +709,8 @@ namespace HypervResource
object ansContent = new
{
result = true,
details = "NOP, TODO: implement properly"
details = "NOP, TODO: implement properly",
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CheckSshAnswer);
}
@ -736,7 +746,8 @@ namespace HypervResource
{
result = result,
details = details,
state = state
state = state,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CheckVirtualMachineAnswer);
}
@ -753,7 +764,8 @@ namespace HypervResource
object ansContent = new
{
result = true,
details = "Current implementation does not delete local path corresponding to storage pool!"
details = "Current implementation does not delete local path corresponding to storage pool!",
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
}
@ -775,7 +787,8 @@ namespace HypervResource
object ansContent = new
{
result = true,
details = "success - NOP"
details = "success - NOP",
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
}
@ -800,7 +813,8 @@ namespace HypervResource
ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
}
@ -843,7 +857,8 @@ namespace HypervResource
result = result,
details = details,
templateInfo = tInfo,
poolInfo = poolInfo
poolInfo = poolInfo,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.ModifyStoragePoolAnswer);
@ -885,7 +900,8 @@ namespace HypervResource
object ansContent = new
{
result = false,
details = "nothing to cleanup in our current implementation"
details = "nothing to cleanup in our current implementation",
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
}
@ -902,7 +918,8 @@ namespace HypervResource
object ansContent = new
{
result = true,
details = (string)null
details = (string)null,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CheckNetworkAnswer);
}
@ -919,7 +936,8 @@ namespace HypervResource
object ansContent = new
{
result = true,
details = (string)null
details = (string)null,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.ReadyAnswer);
}
@ -952,7 +970,8 @@ namespace HypervResource
{
result = result,
details = details,
vm = cmd.vm
vm = cmd.vm,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.StartAnswer);
}
@ -984,7 +1003,8 @@ namespace HypervResource
{
result = result,
details = details,
vm = cmd.vm
vm = cmd.vm,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.StopAnswer);
}
@ -1004,7 +1024,8 @@ namespace HypervResource
{
result = true,
details = "success - NOP for MaintainCommand",
_reconnect = false
_reconnect = false,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.MaintainAnswer);
@ -1025,7 +1046,8 @@ namespace HypervResource
{
result = true,
details = "success - NOP for PingRoutingCommand",
_reconnect = false
_reconnect = false,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
@ -1046,7 +1068,8 @@ namespace HypervResource
{
result = true,
details = "success - NOP for PingCommand",
_reconnect = false
_reconnect = false,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.Answer);
@ -1092,6 +1115,7 @@ namespace HypervResource
vmInfos = vmProcessorInfo,
result = result,
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.GetVmStatsAnswer);
}
@ -1261,7 +1285,8 @@ namespace HypervResource
{
result = result,
details = details,
newData = cmd.destTO
newData = cmd.destTO,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.CopyCmdAnswer);
}
@ -1374,7 +1399,8 @@ namespace HypervResource
result = result,
details = details,
capacity = capacity,
used = used
used = used,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.GetStorageStatsAnswer);
}
@ -1435,7 +1461,8 @@ namespace HypervResource
{
result = result,
hostStats = hostStats,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.GetHostStatsAnswer);
}
@ -1466,7 +1493,8 @@ namespace HypervResource
object ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.PrepareForMigrationAnswer);
@ -1498,7 +1526,8 @@ namespace HypervResource
object ansContent = new
{
result = result,
details = details
details = details,
contextMap = contextMap
};
return ReturnCloudStackTypedJArray(ansContent, CloudStackTypes.MigrateAnswer);
@ -1589,7 +1618,8 @@ namespace HypervResource
poolInfo = pi,
guid = pi.uuid,
dataCenter = strtRouteCmd.dataCenter,
resourceType = StorageResourceType.STORAGE_POOL.ToString() // TODO: check encoding
resourceType = StorageResourceType.STORAGE_POOL.ToString(), // TODO: check encoding
contextMap = contextMap
};
JObject ansObj = Utils.CreateCloudStackObject(CloudStackTypes.StartupStorageCommand, ansContent);
cmdArray.Add(ansObj);