Merge pull request #1156 from mcintyre94/CP-17848

Cp 17848: Packaging work so far to hand over
This commit is contained in:
Gabor Apati-Nagy 2016-09-14 10:41:39 +01:00 committed by GitHub
commit da2d7dcdd6
18 changed files with 1274 additions and 45 deletions

View File

@ -98,14 +98,14 @@ namespace XenAdmin.Wizards.PatchingWizard
AutomaticRadioButton.Enabled = true; AutomaticRadioButton.Enabled = true;
AutomaticRadioButton.Checked = true; AutomaticRadioButton.Checked = true;
break; break;
case UpdateType.NewSuppPack: case UpdateType.ISO:
AutomaticRadioButton.Enabled = true; AutomaticRadioButton.Enabled = true;
AutomaticRadioButton.Checked = true; AutomaticRadioButton.Checked = true;
textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeSuppPack(SelectedServers); textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeSuppPack(SelectedServers);
break; break;
} }
if (SelectedUpdateType == UpdateType.NewSuppPack || SelectedServers.Exists(server => !Helpers.ClearwaterOrGreater(server))) if (SelectedUpdateType == UpdateType.ISO || SelectedServers.Exists(server => !Helpers.ClearwaterOrGreater(server)))
{ {
removeUpdateFileCheckBox.Checked = false; removeUpdateFileCheckBox.Checked = false;
removeUpdateFileCheckBox.Visible = false; removeUpdateFileCheckBox.Visible = false;

View File

@ -135,13 +135,13 @@ namespace XenAdmin.Wizards.PatchingWizard
textBoxLog.Text = ManualTextInstructions; textBoxLog.Text = ManualTextInstructions;
List<AsyncAction> actions = new List<AsyncAction>(); List<AsyncAction> actions = new List<AsyncAction>();
if (SelectedUpdateType != UpdateType.NewSuppPack) if (SelectedUpdateType != UpdateType.ISO)
actionManualMode = new ApplyPatchAction(new List<Pool_patch> { Patch }, SelectedServers); actionManualMode = new ApplyPatchAction(new List<Pool_patch> { Patch }, SelectedServers);
else else
actionManualMode = new InstallSupplementalPackAction(SuppPackVdis, false); actionManualMode = new InstallSupplementalPackAction(SuppPackVdis, false);
actions.Add(actionManualMode); actions.Add(actionManualMode);
if (RemoveUpdateFile && SelectedUpdateType != UpdateType.NewSuppPack) if (RemoveUpdateFile && SelectedUpdateType != UpdateType.ISO)
{ {
foreach (Pool pool in SelectedPools) foreach (Pool pool in SelectedPools)
{ {
@ -166,7 +166,7 @@ namespace XenAdmin.Wizards.PatchingWizard
foreach (Pool pool in SelectedPools) foreach (Pool pool in SelectedPools)
{ {
Pool_patch poolPatch = null; Pool_patch poolPatch = null;
if (SelectedUpdateType != UpdateType.NewSuppPack) if (SelectedUpdateType != UpdateType.ISO)
{ {
List<Pool_patch> poolPatches = new List<Pool_patch>(pool.Connection.Cache.Pool_patches); List<Pool_patch> poolPatches = new List<Pool_patch>(pool.Connection.Cache.Pool_patches);
poolPatch = poolPatches.Find(delegate(Pool_patch otherPatch) poolPatch = poolPatches.Find(delegate(Pool_patch otherPatch)
@ -177,6 +177,31 @@ namespace XenAdmin.Wizards.PatchingWizard
}); });
} }
if (SelectedUpdateType == UpdateType.ISO && AllServersElyOrGreater())
{
// new ISOs
foreach (var hostVdiPair in SuppPackVdis)
{
var host = hostVdiPair.Key;
var vdi = hostVdiPair.Value;
var poolUpdate = Pool_update.introduce(pool.Connection.Session, vdi.opaque_ref);
try
{
Pool_update.apply(pool.Connection.Session, poolUpdate.opaque_ref, host.opaque_ref);
}
catch (Failure F)
{
}
finally
{
Pool_update.pool_clean(host.Connection.Session, poolUpdate);
}
}
}
List<Host> poolHosts = new List<Host>(pool.Connection.Cache.Hosts); List<Host> poolHosts = new List<Host>(pool.Connection.Cache.Hosts);
Host master = SelectedServers.Find(host => host.IsMaster() && poolHosts.Contains(host)); Host master = SelectedServers.Find(host => host.IsMaster() && poolHosts.Contains(host));
if (master != null && poolPatch != null && poolPatch.AppliedOn(master) == DateTime.MaxValue) if (master != null && poolPatch != null && poolPatch.AppliedOn(master) == DateTime.MaxValue)
@ -313,7 +338,7 @@ namespace XenAdmin.Wizards.PatchingWizard
private List<PlanAction> CompileActionList(Host host, Pool_patch patch) private List<PlanAction> CompileActionList(Host host, Pool_patch patch)
{ {
if (SelectedUpdateType == UpdateType.NewSuppPack) if (SelectedUpdateType == UpdateType.ISO)
return CompileSuppPackActionList(host); return CompileSuppPackActionList(host);
List<PlanAction> actions = new List<PlanAction>(); List<PlanAction> actions = new List<PlanAction>();
@ -405,7 +430,7 @@ namespace XenAdmin.Wizards.PatchingWizard
{ {
List<PlanAction> actions = new List<PlanAction>(); List<PlanAction> actions = new List<PlanAction>();
if (SelectedUpdateType != UpdateType.NewSuppPack || SuppPackVdis == null || !SuppPackVdis.ContainsKey(host)) if (SelectedUpdateType != UpdateType.ISO || SuppPackVdis == null || !SuppPackVdis.ContainsKey(host))
return actions; return actions;
List<XenRef<VM>> runningVMs = RunningVMs(host); List<XenRef<VM>> runningVMs = RunningVMs(host);
@ -422,6 +447,18 @@ namespace XenAdmin.Wizards.PatchingWizard
#endregion #endregion
private bool AllServersElyOrGreater()
{
foreach (var server in SelectedServers)
{
if (!Helpers.ElyOrGreater(server.Connection))
{
return false;
}
}
return true;
}
private void FinishedWithErrors(Exception exception) private void FinishedWithErrors(Exception exception)
{ {
labelTitle.Text = string.Format(Messages.UPDATE_WAS_NOT_COMPLETED, GetUpdateName()); labelTitle.Text = string.Format(Messages.UPDATE_WAS_NOT_COMPLETED, GetUpdateName());

View File

@ -184,7 +184,7 @@ namespace XenAdmin.Wizards.PatchingWizard
if (fileName.EndsWith(UpdateExtension)) if (fileName.EndsWith(UpdateExtension))
SelectedUpdateType = UpdateType.NewRetail; SelectedUpdateType = UpdateType.NewRetail;
else if (fileName.EndsWith(".iso")) else if (fileName.EndsWith(".iso"))
SelectedUpdateType = UpdateType.NewSuppPack; SelectedUpdateType = UpdateType.ISO;
else else
SelectedUpdateType = UpdateType.Existing; SelectedUpdateType = UpdateType.Existing;
} }
@ -401,13 +401,13 @@ namespace XenAdmin.Wizards.PatchingWizard
{ {
if (downloadUpdateRadioButton.Checked) if (downloadUpdateRadioButton.Checked)
{ {
return SelectedUpdateType == UpdateType.NewRetail || SelectedUpdateType == UpdateType.NewSuppPack return SelectedUpdateType == UpdateType.NewRetail || SelectedUpdateType == UpdateType.ISO
? ((PatchGridViewRow)dataGridViewPatches.SelectedRows[0]).PathPatch ? ((PatchGridViewRow)dataGridViewPatches.SelectedRows[0]).PathPatch
: null; : null;
} }
else if (selectFromDiskRadioButton.Checked) else if (selectFromDiskRadioButton.Checked)
{ {
return SelectedUpdateType == UpdateType.NewRetail || SelectedUpdateType == UpdateType.NewSuppPack return SelectedUpdateType == UpdateType.NewRetail || SelectedUpdateType == UpdateType.ISO
? fileNameTextBox.Text ? fileNameTextBox.Text
: null; : null;
} }
@ -675,5 +675,5 @@ namespace XenAdmin.Wizards.PatchingWizard
#endregion #endregion
} }
public enum UpdateType { NewRetail, Existing, NewSuppPack} public enum UpdateType { NewRetail, Existing, ISO}
} }

View File

@ -243,7 +243,7 @@ namespace XenAdmin.Wizards.PatchingWizard
return; return;
} }
if (type != UpdateType.NewSuppPack && !host.CanApplyHotfixes) if (type != UpdateType.ISO && !host.CanApplyHotfixes)
{ {
row.Enabled = false; row.Enabled = false;
row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNLICENSED; row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNLICENSED;
@ -256,7 +256,7 @@ namespace XenAdmin.Wizards.PatchingWizard
case UpdateType.Existing: case UpdateType.Existing:
disableNotApplicableHosts(row, selectedHosts, host); disableNotApplicableHosts(row, selectedHosts, host);
break; break;
case UpdateType.NewSuppPack: case UpdateType.ISO:
if (!host.CanInstallSuppPack) if (!host.CanInstallSuppPack)
{ {
row.Enabled = false; row.Enabled = false;

View File

@ -47,6 +47,12 @@ namespace XenAdmin.Wizards.PatchingWizard
get { return _patch; } get { return _patch; }
} }
private Pool_update _poolUpdate;
public Pool_update PoolUpdate
{
get { return _poolUpdate; }
}
public Dictionary<string, string> AllDownloadedPatches = new Dictionary<string, string>(); public Dictionary<string, string> AllDownloadedPatches = new Dictionary<string, string>();
public readonly List<VDI> AllCreatedSuppPackVdis = new List<VDI>(); public readonly List<VDI> AllCreatedSuppPackVdis = new List<VDI>();
public Dictionary<Host, VDI> SuppPackVdis = new Dictionary<Host, VDI>(); public Dictionary<Host, VDI> SuppPackVdis = new Dictionary<Host, VDI>();
@ -176,7 +182,7 @@ namespace XenAdmin.Wizards.PatchingWizard
SelectedExistingPatch); SelectedExistingPatch);
} }
break; break;
case UpdateType.NewSuppPack: case UpdateType.ISO:
if (CanUploadUpdateOnHost(SelectedNewPatchPath, selectedServer)) if (CanUploadUpdateOnHost(SelectedNewPatchPath, selectedServer))
{ {
action = new UploadSupplementalPackAction( action = new UploadSupplementalPackAction(
@ -423,6 +429,11 @@ namespace XenAdmin.Wizards.PatchingWizard
SuppPackVdis[vdiRef.Key] = action.Connection.Resolve(vdiRef.Value); SuppPackVdis[vdiRef.Key] = action.Connection.Resolve(vdiRef.Value);
AllCreatedSuppPackVdis.AddRange(SuppPackVdis.Values.Where(vdi => !AllCreatedSuppPackVdis.Contains(vdi))); AllCreatedSuppPackVdis.AddRange(SuppPackVdis.Values.Where(vdi => !AllCreatedSuppPackVdis.Contains(vdi)));
AddToUploadedUpdates(SelectedNewPatchPath, master); AddToUploadedUpdates(SelectedNewPatchPath, master);
if (AllServersElyOrGreater())
{
set_pool_update();
}
} }
if (action is DownloadAndUnzipXenServerPatchAction) if (action is DownloadAndUnzipXenServerPatchAction)
{ {
@ -439,6 +450,34 @@ namespace XenAdmin.Wizards.PatchingWizard
}); });
} }
private void set_pool_update()
{
if (SelectedUpdateType == UpdateType.ISO && AllServersElyOrGreater())
{
// new ISOs
foreach (var hostVdiPair in SuppPackVdis)
{
var host = hostVdiPair.Key;
var vdi = hostVdiPair.Value;
var poolUpdate = Pool_update.introduce(host.Connection.Session, vdi.opaque_ref);
_poolUpdate = host.Connection.Resolve(poolUpdate);
}
}
}
private bool AllServersElyOrGreater()
{
foreach (var server in SelectedServers)
{
if (!Helpers.ElyOrGreater(server.Connection))
{
return false;
}
}
return true;
}
private void multipleAction_Completed(object sender) private void multipleAction_Completed(object sender)
{ {
var action = sender as AsyncAction; var action = sender as AsyncAction;

View File

@ -175,7 +175,7 @@ namespace XenAdmin.Actions
long.TryParse(parameters["allocation_quantum"], out allocation_quantum); long.TryParse(parameters["allocation_quantum"], out allocation_quantum);
} }
LVHD.enable_thin_provisioning(Session, SR.opaque_ref, initial_allocation, allocation_quantum); LVHD.enable_thin_provisioning(Session, Host.opaque_ref, SR.opaque_ref, initial_allocation, allocation_quantum);
Description = string.Format(Messages.ACTION_SR_CONVERTED_TO_THIN, SR.NameWithLocation); Description = string.Format(Messages.ACTION_SR_CONVERTED_TO_THIN, SR.NameWithLocation);
break; break;

View File

@ -67,6 +67,7 @@ namespace XenAdmin.Network
private readonly ChangeableDictionary<XenRef<PIF_metrics>, PIF_metrics> _pif_metrics = new ChangeableDictionary<XenRef<PIF_metrics>, PIF_metrics>(); private readonly ChangeableDictionary<XenRef<PIF_metrics>, PIF_metrics> _pif_metrics = new ChangeableDictionary<XenRef<PIF_metrics>, PIF_metrics>();
private readonly ChangeableDictionary<XenRef<Pool>, Pool> _pool = new ChangeableDictionary<XenRef<Pool>, Pool>(); private readonly ChangeableDictionary<XenRef<Pool>, Pool> _pool = new ChangeableDictionary<XenRef<Pool>, Pool>();
private readonly ChangeableDictionary<XenRef<Pool_patch>, Pool_patch> _pool_patch = new ChangeableDictionary<XenRef<Pool_patch>, Pool_patch>(); private readonly ChangeableDictionary<XenRef<Pool_patch>, Pool_patch> _pool_patch = new ChangeableDictionary<XenRef<Pool_patch>, Pool_patch>();
private readonly ChangeableDictionary<XenRef<Pool_update>, Pool_update> _pool_update = new ChangeableDictionary<XenRef<Pool_update>, Pool_update>();
private readonly ChangeableDictionary<XenRef<Role>, Role> _role = new ChangeableDictionary<XenRef<Role>, Role>(); private readonly ChangeableDictionary<XenRef<Role>, Role> _role = new ChangeableDictionary<XenRef<Role>, Role>();
private readonly ChangeableDictionary<XenRef<SM>, SM> _sm = new ChangeableDictionary<XenRef<SM>, SM>(); private readonly ChangeableDictionary<XenRef<SM>, SM> _sm = new ChangeableDictionary<XenRef<SM>, SM>();
private readonly ChangeableDictionary<XenRef<SR>, SR> _sr = new ChangeableDictionary<XenRef<SR>, SR>(); private readonly ChangeableDictionary<XenRef<SR>, SR> _sr = new ChangeableDictionary<XenRef<SR>, SR>();

View File

@ -1772,6 +1772,9 @@ Authorized Roles: {1}</value>
<data name="VM_IS_TEMPLATE" xml:space="preserve"> <data name="VM_IS_TEMPLATE" xml:space="preserve">
<value>The operation attempted is not valid for templates</value> <value>The operation attempted is not valid for templates</value>
</data> </data>
<data name="VM_LACKS_FEATURE" xml:space="preserve">
<value>You attempted an operation on a VM which lacks the feature.</value>
</data>
<data name="VM_LACKS_FEATURE_SHUTDOWN" xml:space="preserve"> <data name="VM_LACKS_FEATURE_SHUTDOWN" xml:space="preserve">
<value>You attempted an operation which needs the cooperative shutdown feature on a VM which lacks it.</value> <value>You attempted an operation which needs the cooperative shutdown feature on a VM which lacks it.</value>
</data> </data>

View File

@ -36,6 +36,7 @@ using System.Net.Sockets;
using System.Text; using System.Text;
using System.Net.Security; using System.Net.Security;
using System.Security.Authentication; using System.Security.Authentication;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Runtime.Serialization; using System.Runtime.Serialization;
@ -106,6 +107,18 @@ namespace XenAPI
protected CancelledException(SerializationInfo info, StreamingContext context) : base(info, context) { } protected CancelledException(SerializationInfo info, StreamingContext context) : base(info, context) { }
} }
[Serializable]
public class ProxyServerAuthenticationException : Exception
{
public ProxyServerAuthenticationException() : base() { }
public ProxyServerAuthenticationException(string message) : base(message) { }
public ProxyServerAuthenticationException(string message, Exception exception) : base(message, exception) { }
protected ProxyServerAuthenticationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
public delegate bool FuncBool(); public delegate bool FuncBool();
public delegate void UpdateProgressDelegate(int percent); public delegate void UpdateProgressDelegate(int percent);
public delegate void DataCopiedDelegate(long bytes); public delegate void DataCopiedDelegate(long bytes);
@ -130,6 +143,10 @@ namespace XenAPI
WriteLine("", stream); WriteLine("", stream);
} }
// Stream.ReadByte() is used because using StreamReader in its place causes the reading to become stuck,
// as it seems the Stream object has trouble recognizing the end of the stream. This seems to be a common
// problem, of which a common solution is to read each byte until an EndOfStreamException is thrown, as is
// done here.
private static string ReadLine(Stream stream) private static string ReadLine(Stream stream)
{ {
System.Text.StringBuilder result = new StringBuilder(); System.Text.StringBuilder result = new StringBuilder();
@ -150,45 +167,90 @@ namespace XenAPI
/// </summary> /// </summary>
/// <param name="stream"></param> /// <param name="stream"></param>
/// <returns>True if a redirect has occurred - headers will need to be resent.</returns> /// <returns>True if a redirect has occurred - headers will need to be resent.</returns>
private static bool ReadHttpHeaders(ref Stream stream, IWebProxy proxy, bool nodelay, int timeout_ms) private static bool ReadHttpHeaders(ref Stream stream, IWebProxy proxy, bool nodelay, int timeout_ms, List<string> headers = null)
{ {
string response = ReadLine(stream); // read headers/fields
int code = getResultCode(response); string line = ReadLine(stream), initialLine = line, transferEncodingField = null;
if (string.IsNullOrEmpty(initialLine)) // sanity check
return false;
while (!string.IsNullOrWhiteSpace(line)) // IsNullOrWhiteSpace also checks for empty string
{
if (headers != null)
{
line = line.TrimEnd('\r', '\n');
headers.Add(line);
if (line == "Transfer-Encoding: Chunked")
transferEncodingField = line;
}
line = ReadLine(stream);
}
// read chunks
string entityBody = "";
if (!string.IsNullOrEmpty(transferEncodingField))
{
int lastChunkSize = -1;
do
{
string chunkSizeStr = ReadLine(stream);
chunkSizeStr = chunkSizeStr.TrimEnd('\r', '\n');
int chunkSize = int.Parse(chunkSizeStr, System.Globalization.NumberStyles.HexNumber);
byte[] bytes = new byte[chunkSize];
stream.Read(bytes, 0, chunkSize);
if (headers != null)
{
string str = System.Text.Encoding.ASCII.GetString(bytes);
string[] split = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
headers.AddRange(split);
entityBody += str;
}
line = ReadLine(stream); // empty line in the end of chunk
lastChunkSize = chunkSize;
}
while (lastChunkSize != 0);
if (headers != null)
{
entityBody = entityBody.TrimEnd('\r', '\n');
headers.Add(entityBody); // keep entityBody if it's needed for Digest authentication (when qop="auth-int")
}
}
else
{
// todo: handle other transfer types, in case "Transfer-Encoding: Chunked" isn't used
}
// handle server response
int code = getResultCode(initialLine);
switch (code) switch (code)
{ {
case 407: // authentication error; caller must handle this case
case 200: case 200:
break; break;
case 302: case 302:
string url = ""; string url = "";
while (true) foreach (string header in headers)
{ {
response = ReadLine(stream); if (header.StartsWith("Location: "))
if (response.StartsWith("Location: ")) {
url = response.Substring(10); url = header.Substring(10);
if (response.Equals("\r\n") || response.Equals("\n") || response.Equals(""))
break; break;
} }
}
Uri redirect = new Uri(url.Trim()); Uri redirect = new Uri(url.Trim());
stream.Close(); stream.Close();
stream = ConnectStream(redirect, proxy, nodelay, timeout_ms); stream = ConnectStream(redirect, proxy, nodelay, timeout_ms);
return true; // headers need to be sent again return true; // headers need to be sent again
default: default:
if (response.EndsWith("\r\n"))
response = response.Substring(0, response.Length - 2);
else if (response.EndsWith("\n"))
response = response.Substring(0, response.Length - 1);
stream.Close(); stream.Close();
throw new BadServerResponseException(string.Format("Received error code {0} from the server", response)); throw new BadServerResponseException(string.Format("Received error code {0} from the server", initialLine));
}
while (true)
{
string line = ReadLine(stream);
if (System.Text.RegularExpressions.Regex.Match(line, "^\\s*$").Success)
break;
} }
return false; return false;
@ -214,6 +276,20 @@ namespace XenAPI
return true; return true;
} }
/// <summary>
/// Returns a secure MD5 hash of the given input string.
/// </summary>
/// <param name="str">The string to hash.</param>
/// <returns>The secure hash as a hex string.</returns>
public static string MD5Hash(string str)
{
MD5 hasher = MD5.Create();
ASCIIEncoding enc = new ASCIIEncoding();
byte[] bytes = enc.GetBytes(str);
byte[] hash = hasher.ComputeHash(bytes);
return BitConverter.ToString(hash).Replace("-", "").ToLower();
}
public static long CopyStream(Stream inStream, Stream outStream, public static long CopyStream(Stream inStream, Stream outStream,
DataCopiedDelegate progressDelegate, FuncBool cancellingDelegate) DataCopiedDelegate progressDelegate, FuncBool cancellingDelegate)
{ {
@ -299,6 +375,12 @@ namespace XenAPI
return uri.Uri; return uri.Uri;
} }
private static string GetPartOrNull(string str, int partIndex)
{
string[] parts = str.Split(new char[] { ' ' }, partIndex + 2, StringSplitOptions.RemoveEmptyEntries);
return partIndex < parts.Length - 1 ? parts[partIndex] : null;
}
#endregion #endregion
private static NetworkStream ConnectSocket(Uri uri, bool nodelay, int timeout_ms) private static NetworkStream ConnectSocket(Uri uri, bool nodelay, int timeout_ms)
@ -348,11 +430,13 @@ namespace XenAPI
if (useProxy) if (useProxy)
{ {
string line = String.Format("CONNECT {0}:{1} HTTP/1.0", uri.Host, uri.Port); string line = String.Format("CONNECT {0}:{1} HTTP/1.0", uri.Host, uri.Port);
WriteLine(line, stream); WriteLine(line, stream);
WriteLine(stream); WriteLine(stream);
ReadHttpHeaders(ref stream, proxy, nodelay, timeout_ms); List<string> initialResponse = new List<string>();
ReadHttpHeaders(ref stream, proxy, nodelay, timeout_ms, initialResponse);
AuthenticateProxy(ref stream, uri, proxy, nodelay, timeout_ms, initialResponse, line);
} }
if (UseSSL(uri)) if (UseSSL(uri))
@ -373,6 +457,157 @@ namespace XenAPI
} }
} }
private static void AuthenticateProxy(ref Stream stream, Uri uri, IWebProxy proxy, bool nodelay, int timeout_ms, List<string> initialResponse, string header)
{
// perform authentication only if proxy requires it
List<string> fields = initialResponse.FindAll(str => str.StartsWith("Proxy-Authenticate:"));
if (fields.Count > 0)
{
// clean up (if initial server response specifies "Proxy-Connection: Close" then stream cannot be re-used)
string field = initialResponse.Find(str => str.StartsWith("Proxy-Connection: Close"));
if (!string.IsNullOrEmpty(field))
{
stream.Close();
Uri proxyURI = proxy.GetProxy(uri);
stream = ConnectSocket(proxyURI, nodelay, timeout_ms);
}
if (proxy.Credentials == null)
throw new BadServerResponseException(string.Format("Received error code {0} from the server", initialResponse[0]));
NetworkCredential credentials = proxy.Credentials.GetCredential(uri, null);
string basicField = fields.Find(str => str.StartsWith("Proxy-Authenticate: Basic"));
string digestField = fields.Find(str => str.StartsWith("Proxy-Authenticate: Digest"));
if (!string.IsNullOrEmpty(basicField))
{
string authenticationFieldReply = String.Format("Proxy-Authorization: Basic {0}",
Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials.UserName + ":" + credentials.Password)));
WriteLine(header, stream);
WriteLine(authenticationFieldReply, stream);
WriteLine(stream);
}
else if (!string.IsNullOrEmpty(digestField))
{
string authenticationFieldReply = string.Format(
"Proxy-Authorization: Digest username=\"{0}\", uri=\"{1}:{2}\"",
credentials.UserName, uri.Host, uri.Port);
string directiveString = digestField.Substring(27, digestField.Length - 27);
string[] directives = directiveString.Split(new string[] { ", ", "\"" }, StringSplitOptions.RemoveEmptyEntries);
string algorithm = null; // optional
string opaque = null; // optional
string qop = null; // optional
string realm = null;
string nonce = null;
for (int i = 0; i < directives.Length; ++i)
{
switch (directives[i])
{
case "stale=":
if (directives[++i].ToLower() == "true")
throw new ProxyServerAuthenticationException("Stale nonce in Digest authentication attempt.");
break;
case "realm=":
authenticationFieldReply += string.Format(", {0}\"{1}\"", directives[i], directives[++i]);
realm = directives[i];
break;
case "nonce=":
authenticationFieldReply += string.Format(", {0}\"{1}\"", directives[i], directives[++i]);
nonce = directives[i];
break;
case "opaque=":
authenticationFieldReply += string.Format(", {0}\"{1}\"", directives[i], directives[++i]);
opaque = directives[i];
break;
case "algorithm=":
authenticationFieldReply += string.Format(", {0}\"{1}\"", directives[i], directives[++i]);
algorithm = directives[i];
break;
case "qop=":
List<string> qops = new List<string>(directives[++i].Split(new char[] { ',' }));
if (qops.Count > 0)
{
if (qops.Contains("auth"))
qop = "auth";
else if (qops.Contains("auth-int"))
qop = "auth-int";
else
throw new ProxyServerAuthenticationException(
"Digest authentication's quality-of-protection directive of is not supported.");
authenticationFieldReply += string.Format(", qop=\"{0}\"", qop);
}
break;
default:
break;
}
}
string clientNonce = "X3nC3nt3r"; // todo: generate random string
if (qop != null)
authenticationFieldReply += string.Format(", cnonce=\"{0}\"", clientNonce);
string nonceCount = "00000001"; // todo: track nonces and their corresponding nonce counts
if (qop != null)
authenticationFieldReply += string.Format(", nc={0}", nonceCount);
string HA1 = "";
string scratch = string.Format("{0}:{1}:{2}", credentials.UserName, realm, credentials.Password);
if (algorithm == null || algorithm == "MD5")
HA1 = MD5Hash(scratch);
else
HA1 = MD5Hash(string.Format("{0}:{1}:{2}", MD5Hash(scratch), nonce, clientNonce));
string HA2 = "";
scratch = GetPartOrNull(header, 0);
scratch = string.Format("{0}:{1}:{2}", scratch ?? "CONNECT", uri.Host, uri.Port);
if (qop == null || qop == "auth")
HA2 = MD5Hash(scratch);
else
{
string entityBody = initialResponse[initialResponse.Count - 1]; // entity body should have been stored as last element of initialResponse
string str = string.Format("{0}:{1}", scratch, MD5Hash(entityBody));
HA2 = MD5Hash(str);
}
string response = "";
if (qop == null)
response = MD5Hash(string.Format("{0}:{1}:{2}", HA1, nonce, HA2));
else
response = MD5Hash(string.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nonceCount, clientNonce, qop, HA2));
authenticationFieldReply += string.Format(", response=\"{0}\"", response);
WriteLine(header, stream);
WriteLine(authenticationFieldReply, stream);
WriteLine(stream);
}
else
{
string authType = GetPartOrNull(fields[0], 1);
throw new ProxyServerAuthenticationException(
string.Format("Proxy server's {0} authentication method is not supported.", authType ?? "chosen"));
}
// handle authentication attempt response
List<string> authenticatedResponse = new List<string>();
ReadHttpHeaders(ref stream, proxy, nodelay, timeout_ms, authenticatedResponse);
if (authenticatedResponse.Count == 0)
throw new BadServerResponseException("No response from the proxy server after authentication attempt.");
switch (getResultCode(authenticatedResponse[0]))
{
case 200:
break;
case 407:
throw new ProxyServerAuthenticationException("Proxy server denied access due to wrong credentials.");
default:
throw new BadServerResponseException(string.Format(
"Received error code {0} from the server", authenticatedResponse[0]));
}
}
}
private static Stream DO_HTTP(Uri uri, IWebProxy proxy, bool nodelay, int timeout_ms, params string[] headers) private static Stream DO_HTTP(Uri uri, IWebProxy proxy, bool nodelay, int timeout_ms, params string[] headers)
{ {
Stream stream = ConnectStream(uri, proxy, nodelay, timeout_ms); Stream stream = ConnectStream(uri, proxy, nodelay, timeout_ms);

View File

@ -72,6 +72,7 @@ namespace XenAPI
XenRef<SR> crash_dump_sr, XenRef<SR> crash_dump_sr,
List<XenRef<Host_crashdump>> crashdumps, List<XenRef<Host_crashdump>> crashdumps,
List<XenRef<Host_patch>> patches, List<XenRef<Host_patch>> patches,
List<XenRef<Pool_update>> updates,
List<XenRef<PBD>> PBDs, List<XenRef<PBD>> PBDs,
List<XenRef<Host_cpu>> host_CPUs, List<XenRef<Host_cpu>> host_CPUs,
Dictionary<string, string> cpu_info, Dictionary<string, string> cpu_info,
@ -126,6 +127,7 @@ namespace XenAPI
this.crash_dump_sr = crash_dump_sr; this.crash_dump_sr = crash_dump_sr;
this.crashdumps = crashdumps; this.crashdumps = crashdumps;
this.patches = patches; this.patches = patches;
this.updates = updates;
this.PBDs = PBDs; this.PBDs = PBDs;
this.host_CPUs = host_CPUs; this.host_CPUs = host_CPUs;
this.cpu_info = cpu_info; this.cpu_info = cpu_info;
@ -192,6 +194,7 @@ namespace XenAPI
crash_dump_sr = update.crash_dump_sr; crash_dump_sr = update.crash_dump_sr;
crashdumps = update.crashdumps; crashdumps = update.crashdumps;
patches = update.patches; patches = update.patches;
updates = update.updates;
PBDs = update.PBDs; PBDs = update.PBDs;
host_CPUs = update.host_CPUs; host_CPUs = update.host_CPUs;
cpu_info = update.cpu_info; cpu_info = update.cpu_info;
@ -249,6 +252,7 @@ namespace XenAPI
crash_dump_sr = proxy.crash_dump_sr == null ? null : XenRef<SR>.Create(proxy.crash_dump_sr); crash_dump_sr = proxy.crash_dump_sr == null ? null : XenRef<SR>.Create(proxy.crash_dump_sr);
crashdumps = proxy.crashdumps == null ? null : XenRef<Host_crashdump>.Create(proxy.crashdumps); crashdumps = proxy.crashdumps == null ? null : XenRef<Host_crashdump>.Create(proxy.crashdumps);
patches = proxy.patches == null ? null : XenRef<Host_patch>.Create(proxy.patches); patches = proxy.patches == null ? null : XenRef<Host_patch>.Create(proxy.patches);
updates = proxy.updates == null ? null : XenRef<Pool_update>.Create(proxy.updates);
PBDs = proxy.PBDs == null ? null : XenRef<PBD>.Create(proxy.PBDs); PBDs = proxy.PBDs == null ? null : XenRef<PBD>.Create(proxy.PBDs);
host_CPUs = proxy.host_CPUs == null ? null : XenRef<Host_cpu>.Create(proxy.host_CPUs); host_CPUs = proxy.host_CPUs == null ? null : XenRef<Host_cpu>.Create(proxy.host_CPUs);
cpu_info = proxy.cpu_info == null ? null : Maps.convert_from_proxy_string_string(proxy.cpu_info); cpu_info = proxy.cpu_info == null ? null : Maps.convert_from_proxy_string_string(proxy.cpu_info);
@ -307,6 +311,7 @@ namespace XenAPI
result_.crash_dump_sr = (crash_dump_sr != null) ? crash_dump_sr : ""; result_.crash_dump_sr = (crash_dump_sr != null) ? crash_dump_sr : "";
result_.crashdumps = (crashdumps != null) ? Helper.RefListToStringArray(crashdumps) : new string[] {}; result_.crashdumps = (crashdumps != null) ? Helper.RefListToStringArray(crashdumps) : new string[] {};
result_.patches = (patches != null) ? Helper.RefListToStringArray(patches) : new string[] {}; result_.patches = (patches != null) ? Helper.RefListToStringArray(patches) : new string[] {};
result_.updates = (updates != null) ? Helper.RefListToStringArray(updates) : new string[] {};
result_.PBDs = (PBDs != null) ? Helper.RefListToStringArray(PBDs) : new string[] {}; result_.PBDs = (PBDs != null) ? Helper.RefListToStringArray(PBDs) : new string[] {};
result_.host_CPUs = (host_CPUs != null) ? Helper.RefListToStringArray(host_CPUs) : new string[] {}; result_.host_CPUs = (host_CPUs != null) ? Helper.RefListToStringArray(host_CPUs) : new string[] {};
result_.cpu_info = Maps.convert_to_proxy_string_string(cpu_info); result_.cpu_info = Maps.convert_to_proxy_string_string(cpu_info);
@ -369,6 +374,7 @@ namespace XenAPI
crash_dump_sr = Marshalling.ParseRef<SR>(table, "crash_dump_sr"); crash_dump_sr = Marshalling.ParseRef<SR>(table, "crash_dump_sr");
crashdumps = Marshalling.ParseSetRef<Host_crashdump>(table, "crashdumps"); crashdumps = Marshalling.ParseSetRef<Host_crashdump>(table, "crashdumps");
patches = Marshalling.ParseSetRef<Host_patch>(table, "patches"); patches = Marshalling.ParseSetRef<Host_patch>(table, "patches");
updates = Marshalling.ParseSetRef<Pool_update>(table, "updates");
PBDs = Marshalling.ParseSetRef<PBD>(table, "PBDs"); PBDs = Marshalling.ParseSetRef<PBD>(table, "PBDs");
host_CPUs = Marshalling.ParseSetRef<Host_cpu>(table, "host_CPUs"); host_CPUs = Marshalling.ParseSetRef<Host_cpu>(table, "host_CPUs");
cpu_info = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "cpu_info")); cpu_info = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "cpu_info"));
@ -433,6 +439,7 @@ namespace XenAPI
Helper.AreEqual2(this._crash_dump_sr, other._crash_dump_sr) && Helper.AreEqual2(this._crash_dump_sr, other._crash_dump_sr) &&
Helper.AreEqual2(this._crashdumps, other._crashdumps) && Helper.AreEqual2(this._crashdumps, other._crashdumps) &&
Helper.AreEqual2(this._patches, other._patches) && Helper.AreEqual2(this._patches, other._patches) &&
Helper.AreEqual2(this._updates, other._updates) &&
Helper.AreEqual2(this._PBDs, other._PBDs) && Helper.AreEqual2(this._PBDs, other._PBDs) &&
Helper.AreEqual2(this._host_CPUs, other._host_CPUs) && Helper.AreEqual2(this._host_CPUs, other._host_CPUs) &&
Helper.AreEqual2(this._cpu_info, other._cpu_info) && Helper.AreEqual2(this._cpu_info, other._cpu_info) &&
@ -826,6 +833,17 @@ namespace XenAPI
return XenRef<Host_patch>.Create(session.proxy.host_get_patches(session.uuid, (_host != null) ? _host : "").parse()); return XenRef<Host_patch>.Create(session.proxy.host_get_patches(session.uuid, (_host != null) ? _host : "").parse());
} }
/// <summary>
/// Get the updates field of the given host.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_host">The opaque_ref of the given host</param>
public static List<XenRef<Pool_update>> get_updates(Session session, string _host)
{
return XenRef<Pool_update>.Create(session.proxy.host_get_updates(session.uuid, (_host != null) ? _host : "").parse());
}
/// <summary> /// <summary>
/// Get the PBDs field of the given host. /// Get the PBDs field of the given host.
/// First published in XenServer 4.0. /// First published in XenServer 4.0.
@ -3008,6 +3026,25 @@ namespace XenAPI
} }
private List<XenRef<Host_patch>> _patches; private List<XenRef<Host_patch>> _patches;
/// <summary>
/// Set of updates
/// First published in .
/// </summary>
public virtual List<XenRef<Pool_update>> updates
{
get { return _updates; }
set
{
if (!Helper.AreEqual(value, _updates))
{
_updates = value;
Changed = true;
NotifyPropertyChanged("updates");
}
}
}
private List<XenRef<Pool_update>> _updates;
/// <summary> /// <summary>
/// physical blockdevices /// physical blockdevices
/// </summary> /// </summary>

View File

@ -148,12 +148,13 @@ namespace XenAPI
/// First published in XenServer Dundee. /// First published in XenServer Dundee.
/// </summary> /// </summary>
/// <param name="session">The session</param> /// <param name="session">The session</param>
/// <param name="_host">The LVHD Host to upgrade to being thin-provisioned.</param>
/// <param name="_sr">The LVHD SR to upgrade to being thin-provisioned.</param> /// <param name="_sr">The LVHD SR to upgrade to being thin-provisioned.</param>
/// <param name="_initial_allocation">The initial amount of space to allocate to a newly-created VDI in bytes</param> /// <param name="_initial_allocation">The initial amount of space to allocate to a newly-created VDI in bytes</param>
/// <param name="_allocation_quantum">The amount of space to allocate to a VDI when it needs to be enlarged in bytes</param> /// <param name="_allocation_quantum">The amount of space to allocate to a VDI when it needs to be enlarged in bytes</param>
public static void enable_thin_provisioning(Session session, string _sr, long _initial_allocation, long _allocation_quantum) public static string enable_thin_provisioning(Session session, string _host, string _sr, long _initial_allocation, long _allocation_quantum)
{ {
session.proxy.lvhd_enable_thin_provisioning(session.uuid, (_sr != null) ? _sr : "", _initial_allocation.ToString(), _allocation_quantum.ToString()).parse(); return (string)session.proxy.lvhd_enable_thin_provisioning(session.uuid, (_host != null) ? _host : "", (_sr != null) ? _sr : "", _initial_allocation.ToString(), _allocation_quantum.ToString()).parse();
} }
/// <summary> /// <summary>
@ -161,12 +162,13 @@ namespace XenAPI
/// First published in XenServer Dundee. /// First published in XenServer Dundee.
/// </summary> /// </summary>
/// <param name="session">The session</param> /// <param name="session">The session</param>
/// <param name="_host">The LVHD Host to upgrade to being thin-provisioned.</param>
/// <param name="_sr">The LVHD SR to upgrade to being thin-provisioned.</param> /// <param name="_sr">The LVHD SR to upgrade to being thin-provisioned.</param>
/// <param name="_initial_allocation">The initial amount of space to allocate to a newly-created VDI in bytes</param> /// <param name="_initial_allocation">The initial amount of space to allocate to a newly-created VDI in bytes</param>
/// <param name="_allocation_quantum">The amount of space to allocate to a VDI when it needs to be enlarged in bytes</param> /// <param name="_allocation_quantum">The amount of space to allocate to a VDI when it needs to be enlarged in bytes</param>
public static XenRef<Task> async_enable_thin_provisioning(Session session, string _sr, long _initial_allocation, long _allocation_quantum) public static XenRef<Task> async_enable_thin_provisioning(Session session, string _host, string _sr, long _initial_allocation, long _allocation_quantum)
{ {
return XenRef<Task>.Create(session.proxy.async_lvhd_enable_thin_provisioning(session.uuid, (_sr != null) ? _sr : "", _initial_allocation.ToString(), _allocation_quantum.ToString()).parse()); return XenRef<Task>.Create(session.proxy.async_lvhd_enable_thin_provisioning(session.uuid, (_host != null) ? _host : "", (_sr != null) ? _sr : "", _initial_allocation.ToString(), _allocation_quantum.ToString()).parse());
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,583 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using CookComputing.XmlRpc;
namespace XenAPI
{
/// <summary>
/// Pool-wide updates to the host software
/// First published in .
/// </summary>
public partial class Pool_update : XenObject<Pool_update>
{
public Pool_update()
{
}
public Pool_update(string uuid,
string name_label,
string name_description,
long installation_size,
string key,
List<update_after_apply_guidance> after_apply_guidance,
XenRef<VDI> vdi,
List<XenRef<Host>> hosts)
{
this.uuid = uuid;
this.name_label = name_label;
this.name_description = name_description;
this.installation_size = installation_size;
this.key = key;
this.after_apply_guidance = after_apply_guidance;
this.vdi = vdi;
this.hosts = hosts;
}
/// <summary>
/// Creates a new Pool_update from a Proxy_Pool_update.
/// </summary>
/// <param name="proxy"></param>
public Pool_update(Proxy_Pool_update proxy)
{
this.UpdateFromProxy(proxy);
}
public override void UpdateFrom(Pool_update update)
{
uuid = update.uuid;
name_label = update.name_label;
name_description = update.name_description;
installation_size = update.installation_size;
key = update.key;
after_apply_guidance = update.after_apply_guidance;
vdi = update.vdi;
hosts = update.hosts;
}
internal void UpdateFromProxy(Proxy_Pool_update proxy)
{
uuid = proxy.uuid == null ? null : (string)proxy.uuid;
name_label = proxy.name_label == null ? null : (string)proxy.name_label;
name_description = proxy.name_description == null ? null : (string)proxy.name_description;
installation_size = proxy.installation_size == null ? 0 : long.Parse((string)proxy.installation_size);
key = proxy.key == null ? null : (string)proxy.key;
after_apply_guidance = proxy.after_apply_guidance == null ? null : Helper.StringArrayToEnumList<update_after_apply_guidance>(proxy.after_apply_guidance);
vdi = proxy.vdi == null ? null : XenRef<VDI>.Create(proxy.vdi);
hosts = proxy.hosts == null ? null : XenRef<Host>.Create(proxy.hosts);
}
public Proxy_Pool_update ToProxy()
{
Proxy_Pool_update result_ = new Proxy_Pool_update();
result_.uuid = (uuid != null) ? uuid : "";
result_.name_label = (name_label != null) ? name_label : "";
result_.name_description = (name_description != null) ? name_description : "";
result_.installation_size = installation_size.ToString();
result_.key = (key != null) ? key : "";
result_.after_apply_guidance = (after_apply_guidance != null) ? Helper.ObjectListToStringArray(after_apply_guidance) : new string[] {};
result_.vdi = (vdi != null) ? vdi : "";
result_.hosts = (hosts != null) ? Helper.RefListToStringArray(hosts) : new string[] {};
return result_;
}
/// <summary>
/// Creates a new Pool_update from a Hashtable.
/// </summary>
/// <param name="table"></param>
public Pool_update(Hashtable table)
{
uuid = Marshalling.ParseString(table, "uuid");
name_label = Marshalling.ParseString(table, "name_label");
name_description = Marshalling.ParseString(table, "name_description");
installation_size = Marshalling.ParseLong(table, "installation_size");
key = Marshalling.ParseString(table, "key");
after_apply_guidance = Helper.StringArrayToEnumList<update_after_apply_guidance>(Marshalling.ParseStringArray(table, "after_apply_guidance"));
vdi = Marshalling.ParseRef<VDI>(table, "vdi");
hosts = Marshalling.ParseSetRef<Host>(table, "hosts");
}
public bool DeepEquals(Pool_update other)
{
if (ReferenceEquals(null, other))
return false;
if (ReferenceEquals(this, other))
return true;
return Helper.AreEqual2(this._uuid, other._uuid) &&
Helper.AreEqual2(this._name_label, other._name_label) &&
Helper.AreEqual2(this._name_description, other._name_description) &&
Helper.AreEqual2(this._installation_size, other._installation_size) &&
Helper.AreEqual2(this._key, other._key) &&
Helper.AreEqual2(this._after_apply_guidance, other._after_apply_guidance) &&
Helper.AreEqual2(this._vdi, other._vdi) &&
Helper.AreEqual2(this._hosts, other._hosts);
}
public override string SaveChanges(Session session, string opaqueRef, Pool_update server)
{
if (opaqueRef == null)
{
System.Diagnostics.Debug.Assert(false, "Cannot create instances of this type on the server");
return "";
}
else
{
throw new InvalidOperationException("This type has no read/write properties");
}
}
/// <summary>
/// Get a record containing the current state of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static Pool_update get_record(Session session, string _pool_update)
{
return new Pool_update((Proxy_Pool_update)session.proxy.pool_update_get_record(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Get a reference to the pool_update instance with the specified UUID.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_uuid">UUID of object to return</param>
public static XenRef<Pool_update> get_by_uuid(Session session, string _uuid)
{
return XenRef<Pool_update>.Create(session.proxy.pool_update_get_by_uuid(session.uuid, (_uuid != null) ? _uuid : "").parse());
}
/// <summary>
/// Get all the pool_update instances with the given label.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_label">label of object to return</param>
public static List<XenRef<Pool_update>> get_by_name_label(Session session, string _label)
{
return XenRef<Pool_update>.Create(session.proxy.pool_update_get_by_name_label(session.uuid, (_label != null) ? _label : "").parse());
}
/// <summary>
/// Get the uuid field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static string get_uuid(Session session, string _pool_update)
{
return (string)session.proxy.pool_update_get_uuid(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Get the name/label field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static string get_name_label(Session session, string _pool_update)
{
return (string)session.proxy.pool_update_get_name_label(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Get the name/description field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static string get_name_description(Session session, string _pool_update)
{
return (string)session.proxy.pool_update_get_name_description(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Get the installation_size field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static long get_installation_size(Session session, string _pool_update)
{
return long.Parse((string)session.proxy.pool_update_get_installation_size(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Get the key field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static string get_key(Session session, string _pool_update)
{
return (string)session.proxy.pool_update_get_key(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Get the after_apply_guidance field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static List<update_after_apply_guidance> get_after_apply_guidance(Session session, string _pool_update)
{
return Helper.StringArrayToEnumList<update_after_apply_guidance>(session.proxy.pool_update_get_after_apply_guidance(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Get the vdi field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static XenRef<VDI> get_vdi(Session session, string _pool_update)
{
return XenRef<VDI>.Create(session.proxy.pool_update_get_vdi(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Get the hosts field of the given pool_update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static List<XenRef<Host>> get_hosts(Session session, string _pool_update)
{
return XenRef<Host>.Create(session.proxy.pool_update_get_hosts(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Introduce update VDI
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vdi">The VDI which contains a software update.</param>
public static XenRef<Pool_update> introduce(Session session, string _vdi)
{
return XenRef<Pool_update>.Create(session.proxy.pool_update_introduce(session.uuid, (_vdi != null) ? _vdi : "").parse());
}
/// <summary>
/// Introduce update VDI
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vdi">The VDI which contains a software update.</param>
public static XenRef<Task> async_introduce(Session session, string _vdi)
{
return XenRef<Task>.Create(session.proxy.async_pool_update_introduce(session.uuid, (_vdi != null) ? _vdi : "").parse());
}
/// <summary>
/// Execute the precheck stage of the selected update on a host
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
/// <param name="_host">The host to run the prechecks on.</param>
public static void precheck(Session session, string _pool_update, string _host)
{
session.proxy.pool_update_precheck(session.uuid, (_pool_update != null) ? _pool_update : "", (_host != null) ? _host : "").parse();
}
/// <summary>
/// Execute the precheck stage of the selected update on a host
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
/// <param name="_host">The host to run the prechecks on.</param>
public static XenRef<Task> async_precheck(Session session, string _pool_update, string _host)
{
return XenRef<Task>.Create(session.proxy.async_pool_update_precheck(session.uuid, (_pool_update != null) ? _pool_update : "", (_host != null) ? _host : "").parse());
}
/// <summary>
/// Apply the selected update to a host
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
/// <param name="_host">The host to apply the update to.</param>
public static void apply(Session session, string _pool_update, string _host)
{
session.proxy.pool_update_apply(session.uuid, (_pool_update != null) ? _pool_update : "", (_host != null) ? _host : "").parse();
}
/// <summary>
/// Apply the selected update to a host
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
/// <param name="_host">The host to apply the update to.</param>
public static XenRef<Task> async_apply(Session session, string _pool_update, string _host)
{
return XenRef<Task>.Create(session.proxy.async_pool_update_apply(session.uuid, (_pool_update != null) ? _pool_update : "", (_host != null) ? _host : "").parse());
}
/// <summary>
/// Apply the selected update to all hosts in the pool
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static void pool_apply(Session session, string _pool_update)
{
session.proxy.pool_update_pool_apply(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Apply the selected update to all hosts in the pool
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static XenRef<Task> async_pool_apply(Session session, string _pool_update)
{
return XenRef<Task>.Create(session.proxy.async_pool_update_pool_apply(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Removes the update's files from all hosts in the pool, but does not revert the update
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static void pool_clean(Session session, string _pool_update)
{
session.proxy.pool_update_pool_clean(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Removes the update's files from all hosts in the pool, but does not revert the update
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static XenRef<Task> async_pool_clean(Session session, string _pool_update)
{
return XenRef<Task>.Create(session.proxy.async_pool_update_pool_clean(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Removes the update's files from all hosts in the pool, and removes the database entries. But does not revert the update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static void destroy(Session session, string _pool_update)
{
session.proxy.pool_update_destroy(session.uuid, (_pool_update != null) ? _pool_update : "").parse();
}
/// <summary>
/// Removes the update's files from all hosts in the pool, and removes the database entries. But does not revert the update.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool_update">The opaque_ref of the given pool_update</param>
public static XenRef<Task> async_destroy(Session session, string _pool_update)
{
return XenRef<Task>.Create(session.proxy.async_pool_update_destroy(session.uuid, (_pool_update != null) ? _pool_update : "").parse());
}
/// <summary>
/// Return a list of all the pool_updates known to the system.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
public static List<XenRef<Pool_update>> get_all(Session session)
{
return XenRef<Pool_update>.Create(session.proxy.pool_update_get_all(session.uuid).parse());
}
/// <summary>
/// Get all the pool_update Records at once, in a single XML RPC call
/// First published in .
/// </summary>
/// <param name="session">The session</param>
public static Dictionary<XenRef<Pool_update>, Pool_update> get_all_records(Session session)
{
return XenRef<Pool_update>.Create<Proxy_Pool_update>(session.proxy.pool_update_get_all_records(session.uuid).parse());
}
/// <summary>
/// Unique identifier/object reference
/// </summary>
public virtual string uuid
{
get { return _uuid; }
set
{
if (!Helper.AreEqual(value, _uuid))
{
_uuid = value;
Changed = true;
NotifyPropertyChanged("uuid");
}
}
}
private string _uuid;
/// <summary>
/// a human-readable name
/// </summary>
public virtual string name_label
{
get { return _name_label; }
set
{
if (!Helper.AreEqual(value, _name_label))
{
_name_label = value;
Changed = true;
NotifyPropertyChanged("name_label");
}
}
}
private string _name_label;
/// <summary>
/// a notes field containing human-readable description
/// </summary>
public virtual string name_description
{
get { return _name_description; }
set
{
if (!Helper.AreEqual(value, _name_description))
{
_name_description = value;
Changed = true;
NotifyPropertyChanged("name_description");
}
}
}
private string _name_description;
/// <summary>
/// Size of the update in bytes
/// </summary>
public virtual long installation_size
{
get { return _installation_size; }
set
{
if (!Helper.AreEqual(value, _installation_size))
{
_installation_size = value;
Changed = true;
NotifyPropertyChanged("installation_size");
}
}
}
private long _installation_size;
/// <summary>
/// GPG key of the update
/// </summary>
public virtual string key
{
get { return _key; }
set
{
if (!Helper.AreEqual(value, _key))
{
_key = value;
Changed = true;
NotifyPropertyChanged("key");
}
}
}
private string _key;
/// <summary>
/// What the client should do after this update has been applied.
/// </summary>
public virtual List<update_after_apply_guidance> after_apply_guidance
{
get { return _after_apply_guidance; }
set
{
if (!Helper.AreEqual(value, _after_apply_guidance))
{
_after_apply_guidance = value;
Changed = true;
NotifyPropertyChanged("after_apply_guidance");
}
}
}
private List<update_after_apply_guidance> _after_apply_guidance;
/// <summary>
/// VDI the update was uploaded to
/// </summary>
public virtual XenRef<VDI> vdi
{
get { return _vdi; }
set
{
if (!Helper.AreEqual(value, _vdi))
{
_vdi = value;
Changed = true;
NotifyPropertyChanged("vdi");
}
}
}
private XenRef<VDI> _vdi;
/// <summary>
/// The hosts that have applied this update.
/// </summary>
public virtual List<XenRef<Host>> hosts
{
get { return _hosts; }
set
{
if (!Helper.AreEqual(value, _hosts))
{
_hosts = value;
Changed = true;
NotifyPropertyChanged("hosts");
}
}
}
private List<XenRef<Host>> _hosts;
}
}

View File

@ -1168,6 +1168,106 @@ namespace XenAPI
Response<Object> Response<Object>
pool_patch_get_all_records(string session); pool_patch_get_all_records(string session);
[XmlRpcMethod("pool_update.get_record")]
Response<Proxy_Pool_update>
pool_update_get_record(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_by_uuid")]
Response<string>
pool_update_get_by_uuid(string session, string _uuid);
[XmlRpcMethod("pool_update.get_by_name_label")]
Response<string []>
pool_update_get_by_name_label(string session, string _label);
[XmlRpcMethod("pool_update.get_uuid")]
Response<string>
pool_update_get_uuid(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_name_label")]
Response<string>
pool_update_get_name_label(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_name_description")]
Response<string>
pool_update_get_name_description(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_installation_size")]
Response<string>
pool_update_get_installation_size(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_key")]
Response<string>
pool_update_get_key(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_after_apply_guidance")]
Response<string []>
pool_update_get_after_apply_guidance(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_vdi")]
Response<string>
pool_update_get_vdi(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_hosts")]
Response<string []>
pool_update_get_hosts(string session, string _pool_update);
[XmlRpcMethod("pool_update.introduce")]
Response<string>
pool_update_introduce(string session, string _vdi);
[XmlRpcMethod("Async.pool_update.introduce")]
Response<string>
async_pool_update_introduce(string session, string _vdi);
[XmlRpcMethod("pool_update.precheck")]
Response<string>
pool_update_precheck(string session, string _pool_update, string _host);
[XmlRpcMethod("Async.pool_update.precheck")]
Response<string>
async_pool_update_precheck(string session, string _pool_update, string _host);
[XmlRpcMethod("pool_update.apply")]
Response<string>
pool_update_apply(string session, string _pool_update, string _host);
[XmlRpcMethod("Async.pool_update.apply")]
Response<string>
async_pool_update_apply(string session, string _pool_update, string _host);
[XmlRpcMethod("pool_update.pool_apply")]
Response<string>
pool_update_pool_apply(string session, string _pool_update);
[XmlRpcMethod("Async.pool_update.pool_apply")]
Response<string>
async_pool_update_pool_apply(string session, string _pool_update);
[XmlRpcMethod("pool_update.pool_clean")]
Response<string>
pool_update_pool_clean(string session, string _pool_update);
[XmlRpcMethod("Async.pool_update.pool_clean")]
Response<string>
async_pool_update_pool_clean(string session, string _pool_update);
[XmlRpcMethod("pool_update.destroy")]
Response<string>
pool_update_destroy(string session, string _pool_update);
[XmlRpcMethod("Async.pool_update.destroy")]
Response<string>
async_pool_update_destroy(string session, string _pool_update);
[XmlRpcMethod("pool_update.get_all")]
Response<string []>
pool_update_get_all(string session);
[XmlRpcMethod("pool_update.get_all_records")]
Response<Object>
pool_update_get_all_records(string session);
[XmlRpcMethod("VM.get_record")] [XmlRpcMethod("VM.get_record")]
Response<Proxy_VM> Response<Proxy_VM>
vm_get_record(string session, string _vm); vm_get_record(string session, string _vm);
@ -1504,6 +1604,10 @@ namespace XenAPI
Response<bool> Response<bool>
vm_get_has_vendor_device(string session, string _vm); vm_get_has_vendor_device(string session, string _vm);
[XmlRpcMethod("VM.get_requires_reboot")]
Response<bool>
vm_get_requires_reboot(string session, string _vm);
[XmlRpcMethod("VM.set_name_label")] [XmlRpcMethod("VM.set_name_label")]
Response<string> Response<string>
vm_set_name_label(string session, string _vm, string _label); vm_set_name_label(string session, string _vm, string _label);
@ -1904,6 +2008,14 @@ namespace XenAPI
Response<string> Response<string>
async_vm_set_memory_limits(string session, string _vm, string _static_min, string _static_max, string _dynamic_min, string _dynamic_max); async_vm_set_memory_limits(string session, string _vm, string _static_min, string _static_max, string _dynamic_min, string _dynamic_max);
[XmlRpcMethod("VM.set_memory")]
Response<string>
vm_set_memory(string session, string _vm, string _value);
[XmlRpcMethod("Async.VM.set_memory")]
Response<string>
async_vm_set_memory(string session, string _vm, string _value);
[XmlRpcMethod("VM.set_memory_target_live")] [XmlRpcMethod("VM.set_memory_target_live")]
Response<string> Response<string>
vm_set_memory_target_live(string session, string _vm, string _target); vm_set_memory_target_live(string session, string _vm, string _target);
@ -2856,6 +2968,10 @@ namespace XenAPI
Response<string []> Response<string []>
host_get_patches(string session, string _host); host_get_patches(string session, string _host);
[XmlRpcMethod("host.get_updates")]
Response<string []>
host_get_updates(string session, string _host);
[XmlRpcMethod("host.get_PBDs")] [XmlRpcMethod("host.get_PBDs")]
Response<string []> Response<string []>
host_get_pbds(string session, string _host); host_get_pbds(string session, string _host);
@ -4084,6 +4200,14 @@ namespace XenAPI
Response<string> Response<string>
async_vif_unplug_force(string session, string _vif); async_vif_unplug_force(string session, string _vif);
[XmlRpcMethod("VIF.move")]
Response<string>
vif_move(string session, string _vif, string _network);
[XmlRpcMethod("Async.VIF.move")]
Response<string>
async_vif_move(string session, string _vif, string _network);
[XmlRpcMethod("VIF.set_locking_mode")] [XmlRpcMethod("VIF.set_locking_mode")]
Response<string> Response<string>
vif_set_locking_mode(string session, string _vif, string _value); vif_set_locking_mode(string session, string _vif, string _value);
@ -5190,11 +5314,11 @@ namespace XenAPI
[XmlRpcMethod("LVHD.enable_thin_provisioning")] [XmlRpcMethod("LVHD.enable_thin_provisioning")]
Response<string> Response<string>
lvhd_enable_thin_provisioning(string session, string _sr, string _initial_allocation, string _allocation_quantum); lvhd_enable_thin_provisioning(string session, string _host, string _sr, string _initial_allocation, string _allocation_quantum);
[XmlRpcMethod("Async.LVHD.enable_thin_provisioning")] [XmlRpcMethod("Async.LVHD.enable_thin_provisioning")]
Response<string> Response<string>
async_lvhd_enable_thin_provisioning(string session, string _sr, string _initial_allocation, string _allocation_quantum); async_lvhd_enable_thin_provisioning(string session, string _host, string _sr, string _initial_allocation, string _allocation_quantum);
[XmlRpcMethod("LVHD.get_all_records")] [XmlRpcMethod("LVHD.get_all_records")]
Response<Object> Response<Object>
@ -7012,6 +7136,19 @@ namespace XenAPI
public Object other_config; public Object other_config;
} }
[XmlRpcMissingMapping(MappingAction.Ignore)]
public class Proxy_Pool_update
{
public string uuid;
public string name_label;
public string name_description;
public string installation_size;
public string key;
public string [] after_apply_guidance;
public string vdi;
public string [] hosts;
}
[XmlRpcMissingMapping(MappingAction.Ignore)] [XmlRpcMissingMapping(MappingAction.Ignore)]
public class Proxy_VM public class Proxy_VM
{ {
@ -7092,6 +7229,7 @@ namespace XenAPI
public string generation_id; public string generation_id;
public string hardware_platform_version; public string hardware_platform_version;
public bool has_vendor_device; public bool has_vendor_device;
public bool requires_reboot;
} }
[XmlRpcMissingMapping(MappingAction.Ignore)] [XmlRpcMissingMapping(MappingAction.Ignore)]
@ -7200,6 +7338,7 @@ namespace XenAPI
public string crash_dump_sr; public string crash_dump_sr;
public string [] crashdumps; public string [] crashdumps;
public string [] patches; public string [] patches;
public string [] updates;
public string [] PBDs; public string [] PBDs;
public string [] host_CPUs; public string [] host_CPUs;
public Object cpu_info; public Object cpu_info;

View File

@ -143,6 +143,10 @@ namespace XenAPI
new Relation("snapshots", "VM", "snapshot_of"), new Relation("snapshots", "VM", "snapshot_of"),
}); });
relations.Add(typeof(Proxy_Pool_update), new Relation[] {
new Relation("hosts", "host", "updates"),
});
relations.Add(typeof(Proxy_Host), new Relation[] { relations.Add(typeof(Proxy_Host), new Relation[] {
new Relation("PGPUs", "PGPU", "host"), new Relation("PGPUs", "PGPU", "host"),
new Relation("PCIs", "PCI", "host"), new Relation("PCIs", "PCI", "host"),

View File

@ -834,6 +834,30 @@ namespace XenAPI
return XenRef<Task>.Create(session.proxy.async_vif_unplug_force(session.uuid, (_vif != null) ? _vif : "").parse()); return XenRef<Task>.Create(session.proxy.async_vif_unplug_force(session.uuid, (_vif != null) ? _vif : "").parse());
} }
/// <summary>
/// Move the specified VIF to the specified network, even while the VM is running
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vif">The opaque_ref of the given vif</param>
/// <param name="_network">The network to move it to</param>
public static void move(Session session, string _vif, string _network)
{
session.proxy.vif_move(session.uuid, (_vif != null) ? _vif : "", (_network != null) ? _network : "").parse();
}
/// <summary>
/// Move the specified VIF to the specified network, even while the VM is running
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vif">The opaque_ref of the given vif</param>
/// <param name="_network">The network to move it to</param>
public static XenRef<Task> async_move(Session session, string _vif, string _network)
{
return XenRef<Task>.Create(session.proxy.async_vif_move(session.uuid, (_vif != null) ? _vif : "", (_network != null) ? _network : "").parse());
}
/// <summary> /// <summary>
/// Set the locking mode for this VIF /// Set the locking mode for this VIF
/// First published in XenServer 6.1. /// First published in XenServer 6.1.

View File

@ -124,7 +124,8 @@ namespace XenAPI
long version, long version,
string generation_id, string generation_id,
long hardware_platform_version, long hardware_platform_version,
bool has_vendor_device) bool has_vendor_device,
bool requires_reboot)
{ {
this.uuid = uuid; this.uuid = uuid;
this.allowed_operations = allowed_operations; this.allowed_operations = allowed_operations;
@ -203,6 +204,7 @@ namespace XenAPI
this.generation_id = generation_id; this.generation_id = generation_id;
this.hardware_platform_version = hardware_platform_version; this.hardware_platform_version = hardware_platform_version;
this.has_vendor_device = has_vendor_device; this.has_vendor_device = has_vendor_device;
this.requires_reboot = requires_reboot;
} }
/// <summary> /// <summary>
@ -293,6 +295,7 @@ namespace XenAPI
generation_id = update.generation_id; generation_id = update.generation_id;
hardware_platform_version = update.hardware_platform_version; hardware_platform_version = update.hardware_platform_version;
has_vendor_device = update.has_vendor_device; has_vendor_device = update.has_vendor_device;
requires_reboot = update.requires_reboot;
} }
internal void UpdateFromProxy(Proxy_VM proxy) internal void UpdateFromProxy(Proxy_VM proxy)
@ -374,6 +377,7 @@ namespace XenAPI
generation_id = proxy.generation_id == null ? null : (string)proxy.generation_id; generation_id = proxy.generation_id == null ? null : (string)proxy.generation_id;
hardware_platform_version = proxy.hardware_platform_version == null ? 0 : long.Parse((string)proxy.hardware_platform_version); hardware_platform_version = proxy.hardware_platform_version == null ? 0 : long.Parse((string)proxy.hardware_platform_version);
has_vendor_device = (bool)proxy.has_vendor_device; has_vendor_device = (bool)proxy.has_vendor_device;
requires_reboot = (bool)proxy.requires_reboot;
} }
public Proxy_VM ToProxy() public Proxy_VM ToProxy()
@ -456,6 +460,7 @@ namespace XenAPI
result_.generation_id = (generation_id != null) ? generation_id : ""; result_.generation_id = (generation_id != null) ? generation_id : "";
result_.hardware_platform_version = hardware_platform_version.ToString(); result_.hardware_platform_version = hardware_platform_version.ToString();
result_.has_vendor_device = has_vendor_device; result_.has_vendor_device = has_vendor_device;
result_.requires_reboot = requires_reboot;
return result_; return result_;
} }
@ -542,6 +547,7 @@ namespace XenAPI
generation_id = Marshalling.ParseString(table, "generation_id"); generation_id = Marshalling.ParseString(table, "generation_id");
hardware_platform_version = Marshalling.ParseLong(table, "hardware_platform_version"); hardware_platform_version = Marshalling.ParseLong(table, "hardware_platform_version");
has_vendor_device = Marshalling.ParseBool(table, "has_vendor_device"); has_vendor_device = Marshalling.ParseBool(table, "has_vendor_device");
requires_reboot = Marshalling.ParseBool(table, "requires_reboot");
} }
public bool DeepEquals(VM other, bool ignoreCurrentOperations) public bool DeepEquals(VM other, bool ignoreCurrentOperations)
@ -629,7 +635,8 @@ namespace XenAPI
Helper.AreEqual2(this._version, other._version) && Helper.AreEqual2(this._version, other._version) &&
Helper.AreEqual2(this._generation_id, other._generation_id) && Helper.AreEqual2(this._generation_id, other._generation_id) &&
Helper.AreEqual2(this._hardware_platform_version, other._hardware_platform_version) && Helper.AreEqual2(this._hardware_platform_version, other._hardware_platform_version) &&
Helper.AreEqual2(this._has_vendor_device, other._has_vendor_device); Helper.AreEqual2(this._has_vendor_device, other._has_vendor_device) &&
Helper.AreEqual2(this._requires_reboot, other._requires_reboot);
} }
public override string SaveChanges(Session session, string opaqueRef, VM server) public override string SaveChanges(Session session, string opaqueRef, VM server)
@ -1743,6 +1750,17 @@ namespace XenAPI
return (bool)session.proxy.vm_get_has_vendor_device(session.uuid, (_vm != null) ? _vm : "").parse(); return (bool)session.proxy.vm_get_has_vendor_device(session.uuid, (_vm != null) ? _vm : "").parse();
} }
/// <summary>
/// Get the requires_reboot field of the given VM.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
public static bool get_requires_reboot(Session session, string _vm)
{
return (bool)session.proxy.vm_get_requires_reboot(session.uuid, (_vm != null) ? _vm : "").parse();
}
/// <summary> /// <summary>
/// Set the name/label field of the given VM. /// Set the name/label field of the given VM.
/// First published in XenServer 4.0. /// First published in XenServer 4.0.
@ -2957,6 +2975,30 @@ namespace XenAPI
return XenRef<Task>.Create(session.proxy.async_vm_set_memory_limits(session.uuid, (_vm != null) ? _vm : "", _static_min.ToString(), _static_max.ToString(), _dynamic_min.ToString(), _dynamic_max.ToString()).parse()); return XenRef<Task>.Create(session.proxy.async_vm_set_memory_limits(session.uuid, (_vm != null) ? _vm : "", _static_min.ToString(), _static_max.ToString(), _dynamic_min.ToString(), _dynamic_max.ToString()).parse());
} }
/// <summary>
/// Set the memory allocation of this VM. Sets all of memory_static_max, memory_dynamic_min, and memory_dynamic_max to the given value, and leaves memory_static_min untouched.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
/// <param name="_value">The new memory allocation (bytes).</param>
public static void set_memory(Session session, string _vm, long _value)
{
session.proxy.vm_set_memory(session.uuid, (_vm != null) ? _vm : "", _value.ToString()).parse();
}
/// <summary>
/// Set the memory allocation of this VM. Sets all of memory_static_max, memory_dynamic_min, and memory_dynamic_max to the given value, and leaves memory_static_min untouched.
/// First published in .
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vm">The opaque_ref of the given vm</param>
/// <param name="_value">The new memory allocation (bytes).</param>
public static XenRef<Task> async_set_memory(Session session, string _vm, long _value)
{
return XenRef<Task>.Create(session.proxy.async_vm_set_memory(session.uuid, (_vm != null) ? _vm : "", _value.ToString()).parse());
}
/// <summary> /// <summary>
/// Set the memory target for a running VM /// Set the memory target for a running VM
/// First published in XenServer 4.0. /// First published in XenServer 4.0.
@ -5302,5 +5344,24 @@ namespace XenAPI
} }
} }
private bool _has_vendor_device; private bool _has_vendor_device;
/// <summary>
/// Indicates whether a VM requires a reboot in order to update its configuration, e.g. its memory allocation.
/// First published in .
/// </summary>
public virtual bool requires_reboot
{
get { return _requires_reboot; }
set
{
if (!Helper.AreEqual(value, _requires_reboot))
{
_requires_reboot = value;
Changed = true;
NotifyPropertyChanged("requires_reboot");
}
}
}
private bool _requires_reboot;
} }
} }

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) Citrix Systems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
namespace XenAPI
{
public enum update_after_apply_guidance
{
restartHVM, restartPV, restartHost, restartXAPI, unknown
}
public static class update_after_apply_guidance_helper
{
public static string ToString(update_after_apply_guidance x)
{
switch (x)
{
case update_after_apply_guidance.restartHVM:
return "restartHVM";
case update_after_apply_guidance.restartPV:
return "restartPV";
case update_after_apply_guidance.restartHost:
return "restartHost";
case update_after_apply_guidance.restartXAPI:
return "restartXAPI";
default:
return "unknown";
}
}
}
}

View File

@ -352,8 +352,10 @@
<Compile Include="XenAPI\PGPU.cs" /> <Compile Include="XenAPI\PGPU.cs" />
<Compile Include="XenAPI\pgpu_dom0_access.cs" /> <Compile Include="XenAPI\pgpu_dom0_access.cs" />
<Compile Include="XenAPI\pool_allowed_operations.cs" /> <Compile Include="XenAPI\pool_allowed_operations.cs" />
<Compile Include="XenAPI\Pool_update.cs" />
<Compile Include="XenAPI\primary_address_type.cs" /> <Compile Include="XenAPI\primary_address_type.cs" />
<Compile Include="XenAPI\tristate_type.cs" /> <Compile Include="XenAPI\tristate_type.cs" />
<Compile Include="XenAPI\update_after_apply_guidance.cs" />
<Compile Include="XenAPI\VGPU.cs" /> <Compile Include="XenAPI\VGPU.cs" />
<Compile Include="XenAPI\VGPU_type.cs" /> <Compile Include="XenAPI\VGPU_type.cs" />
<Compile Include="XenAPI\vgpu_type_implementation.cs" /> <Compile Include="XenAPI\vgpu_type_implementation.cs" />