Skip to content

Commit e33558b

Browse files
author
Konstantina Chremmou
committed
Merge branch 'master' into json
# Conflicts: # csharp/templates/XenServer.csproj.mustache # powershell/common_functions.ml
2 parents 5727c9b + f7582a6 commit e33558b

14 files changed

+549
-416
lines changed

.travis.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
language: c
22
sudo: required
3-
dist: trusty
4-
before_install:
5-
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ trusty main universe"
6-
- sudo apt-get update -qq
7-
- sudo apt-get install libgcrypt20 liblzma5 libselinux1
8-
- wget "http://archive.ubuntu.com/ubuntu/ubuntu/pool/main/s/systemd/libsystemd0_219-7ubuntu3_amd64.deb"
9-
- wget "http://archive.ubuntu.com/ubuntu/ubuntu/pool/main/s/systemd/libsystemd-dev_219-7ubuntu3_amd64.deb"
10-
- sudo dpkg -i libsystemd0_219-7ubuntu3_amd64.deb libsystemd-dev_219-7ubuntu3_amd64.deb
3+
services: docker
114
install:
12-
- wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-opam.sh
5+
- wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-docker.sh
136
script:
14-
- cp xen-api-sdk.opam opam && ulimit -s 16384 && bash -ex .travis-opam.sh
7+
- bash -ex .travis-docker.sh
158
env:
169
global:
17-
- OCAML_VERSION=4.04
10+
- OCAML_VERSION=4.04.2
11+
- PACKAGE=xen-api-sdk
12+
- DISTRO="debian-stable"
1813
- TESTS=false
1914
- INSTALL=false
2015
matrix:

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ java: build
9898
cp java/LICENSE.Apache-2.0.txt _build/default/java/autogen
9999

100100
powershell: build
101-
mkdir -p _build/default/powershell/autogen/src
101+
mkdir -p _build/default/powershell/autogen/src/Properties
102102
mkdir -p _build/default/powershell/autogen/samples
103-
_build/default/powershell/gen_powershell_binding.exe -d _build/default/powershell/autogen
103+
_build/default/powershell/gen_powershell_binding.exe -d _build/default/powershell/autogen/src -t powershell/templates
104104
#source
105-
mv _build/default/powershell/autogen/*.cs _build/default/powershell/autogen/src
106105
cp powershell/src/*.cs _build/default/powershell/autogen/src
107-
sed -i -e 's/1\.0\.0\.0/$(SDK_VERSION)/g' -e 's/1000/$(SDK_VERSION).0/g' _build/default/powershell/autogen/src/AssemblyInfo.cs
106+
mv _build/default/powershell/autogen/src/AssemblyInfo.cs _build/default/powershell/autogen/src/Properties/AssemblyInfo.cs
107+
sed -i -e 's/1\.0\.0\.0/$(SDK_VERSION)/g' -e 's/1000/$(SDK_VERSION).0/g' _build/default/powershell/autogen/src/Properties/AssemblyInfo.cs
108108
#samples
109109
cp powershell/samples/*.ps1 _build/default/powershell/autogen/samples
110110
#other

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# XenAPI Software Development Kit
22

3+
[![Build Status](https://travis-ci.org/xapi-project/xen-api-sdk.svg?branch=master)](https://travis-ci.org/xapi-project/xen-api-sdk)
4+
[![Lines of Code](https://tokei.rs/b1/github/xapi-project/xen-api-sdk)](https://github.com/xapi-project/xen-api-sdk)
5+
36
This repository contains the generation code for the XenAPI Software Development
47
Kit (SDK) and its associated documentation and examples.
58

@@ -16,8 +19,8 @@ The generation code is written in [OCaml][1].
1619
Install [opam][2]. It is also recommended to install one of the listed external
1720
solvers (e.g. aspcud).
1821

19-
Ensure you are using version 4.02.3 of the OCaml compiler:
20-
`opam switch 4.02.3`
22+
Ensure you are using version 4.04.2 of the OCaml compiler:
23+
`opam switch 4.04.2`
2124

2225
and you have the package depext: `opam install depext`
2326

common/CommonFunctions.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ open Datamodel_types
3535

3636
type wireProtocol = XmlRpc | JsonRpc
3737

38+
let with_output filename f =
39+
let io = open_out filename in
40+
finally
41+
(fun () -> f io)
42+
(fun () -> close_out io)
43+
44+
3845
let rec list_distinct list =
3946
match list with
4047
| [] -> []

csharp/samples/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
using System.Collections.Generic;
3333
using System.Net;
3434
using XenAPI;
35-
using XenSdkSample;
3635

37-
namespace GetVmRecords
36+
37+
namespace XenSdkSample
3838
{
3939
public class Program
4040
{

csharp/samples/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// General Information about an assembly is controlled through the following
66
// set of attributes. Change these attribute values to modify the information
77
// associated with an assembly.
8-
[assembly: AssemblyTitle("GetVmRecords")]
8+
[assembly: AssemblyTitle("XenSdkSample")]
99
[assembly: AssemblyDescription("")]
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Citrix Systems, Inc.")]
12-
[assembly: AssemblyProduct("GetVmRecords")]
12+
[assembly: AssemblyProduct("XenSdkSample")]
1313
[assembly: AssemblyCopyright("Copyright © Citrix Systems, Inc.")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]

csharp/samples/VmPowerStates.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,17 @@ protected override void TestCore()
9797

9898
// here we need to delay for a bit until the suspend feauture is written
9999
// in the guest metrics; this check should be enough for most guests;
100-
// let's try a certain number of times with 5sec sleeps inbetween
101-
int max = 5;
100+
// let's try a certain number of times with sleeps of a few seconds inbetween
101+
int max = 20;
102+
int delay = 10;
102103
for (int i = 0; i < max; i++)
103104
{
104105
cloneVm = VM.get_record(_session, cloneVmRef);
105106
var metrics = VM_guest_metrics.get_record(_session, cloneVm.guest_metrics);
106107
if (metrics.other.ContainsKey("feature-suspend") && metrics.other["feature-suspend"] == "1")
107108
break;
108-
_logger.Log("Checked for feature-suspend count {0} out of {1}; will re-try in 5sec.", i + 1, max);
109-
Thread.Sleep(5000);
109+
_logger.Log("Checked for feature-suspend count {0} out of {1}; will re-try in {2}sec.", i + 1, max, delay);
110+
Thread.Sleep(delay * 1000);
110111
}
111112

112113
_logger.Log("Suspending VM...");

csharp/templates/XenServer.csproj.mustache

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>9.0.21022</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
86
<ProjectGuid>{83EAC000-F729-475D-AC1D-90DC0791DE8E}</ProjectGuid>
97
<OutputType>Library</OutputType>
108
<AppDesignerFolder>Properties</AppDesignerFolder>
119
<RootNamespace>XenAPI</RootNamespace>
1210
<AssemblyName>XenServer</AssemblyName>
13-
<FileUpgradeFlags>
14-
</FileUpgradeFlags>
15-
<OldToolsVersion>3.5</OldToolsVersion>
16-
<UpgradeBackupLocation>
17-
</UpgradeBackupLocation>
1811
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
19-
<TargetFrameworkProfile />
2012
</PropertyGroup>
2113
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2214
<DebugSymbols>true</DebugSymbols>
@@ -38,9 +30,9 @@
3830
<Prefer32Bit>false</Prefer32Bit>
3931
</PropertyGroup>
4032
<ItemGroup>
41-
<Reference Include="CookComputing.XmlRpcV2.dll">
33+
<Reference Include="CookComputing.XmlRpcV2">
4234
<SpecificVersion>False</SpecificVersion>
43-
<HintPath>..\CookComputing.XmlRpcV2.dll</HintPath>
35+
<HintPath>.\CookComputing.XmlRpcV2.dll</HintPath>
4436
</Reference>
4537
<Reference Include="Newtonsoft.Json.dll">
4638
<SpecificVersion>False</SpecificVersion>
@@ -51,6 +43,7 @@
5143
<Reference Include="System.Xml" />
5244
</ItemGroup>
5345
<ItemGroup>
46+
<Compile Include="Properties\AssemblyInfo.cs" />
5447
{{#api_members}}
5548
<Compile Include="{{api_member}}.cs" />
5649
{{/api_members}}
@@ -59,11 +52,6 @@
5952
<Compile Include="EventHelpers.cs" />
6053
<Compile Include="DeprecatedAttribute.cs" />
6154
<Compile Include="Failure.cs" />
62-
<Compile Include="FriendlyErrorNames.Designer.cs">
63-
<AutoGen>True</AutoGen>
64-
<DesignTime>True</DesignTime>
65-
<DependentUpon>FriendlyErrorNames.resx</DependentUpon>
66-
</Compile>
6755
<Compile Include="Helper.cs" />
6856
<Compile Include="HTTP.cs" />
6957
<Compile Include="IMockWebProxy.cs" />
@@ -72,7 +60,6 @@
7260
<Compile Include="JsonRpc.cs" />
7361
<Compile Include="JsonRpcClient.cs" />
7462
<Compile Include="Marshalling.cs" />
75-
<Compile Include="Properties\AssemblyInfo.cs" />
7663
<Compile Include="Response.cs" />
7764
<Compile Include="Session.cs" />
7865
<Compile Include="Subject2.cs" />
@@ -83,6 +70,11 @@
8370
<Compile Include="HTTP_actions.cs" />
8471
<Compile Include="Proxy.cs" />
8572
<Compile Include="Maps.cs" />
73+
<Compile Include="FriendlyErrorNames.Designer.cs">
74+
<AutoGen>True</AutoGen>
75+
<DesignTime>True</DesignTime>
76+
<DependentUpon>FriendlyErrorNames.resx</DependentUpon>
77+
</Compile>
8678
</ItemGroup>
8779
<ItemGroup>
8880
<EmbeddedResource Include="FriendlyErrorNames.resx">
@@ -92,8 +84,8 @@
9284
<LastGenOutput>FriendlyErrorNames.Designer.cs</LastGenOutput>
9385
</EmbeddedResource>
9486
</ItemGroup>
95-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
96-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
87+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
88+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
9789
Other similar extension points exist, see Microsoft.Common.targets.
9890
<Target Name="BeforeBuild">
9991
</Target>

powershell/README.dist

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ The XenServer PowerShell Module is dependent upon the following libraries:
4848
PowerShell Module.
4949

5050

51-
Folder structure
51+
Folder Structure
5252
----------------
5353

5454
The XenServer-SDK-@SDK_VERSION@.zip contains the following folders that are
5555
relevant to PowerShell users:
5656

5757
- XenServerPowerShell\XenServerPSModule: this is the XenServer PowerShell Module
5858
- XenServerPowerShell\src: contains the C# source code for the XenServer cmdlets
59+
shipped as a Visual Studio project.
5960
- XenServerPowerShell\samples: contains the sample scripts accompanying the module.
6061

6162

@@ -130,3 +131,20 @@ Getting Started
130131
PS> Connect-XenServer -Url https://<servername>
131132
PS> Get-XenVM
132133
PS> Disconnect-XenServer
134+
135+
136+
Building and Debugging the Source Code
137+
--------------------------------------
138+
139+
1. Copy CookComputing.XmlRpcV2.dll and XenServer.dll from the XenServerPSModule
140+
folder into the source code folder at the same level as the
141+
XenServerPowerShell.csproj file.
142+
143+
2. Open the project XenServerPowerShell.csproj in Visual Studio (2013 or greater).
144+
145+
3. You should now be ready to build the source code.
146+
147+
4. If in Debug mode, clicking Start will launch a PowerShell prompt as an
148+
external process, and import the compiled XenServerPowerShell.dll as a module
149+
(without, however, processing the scripts, types, and formats shipped within
150+
the XenServerPSModule). You should now be ready to debug the cmdlets.

0 commit comments

Comments
 (0)