mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-12-22 16:36:03 +01:00
b87a711b5f
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
177 lines
7.2 KiB
C#
177 lines
7.2 KiB
C#
/*
|
|
* 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 partial class Relation
|
|
{
|
|
public readonly String field;
|
|
public readonly String manyType;
|
|
public readonly String manyField;
|
|
|
|
public Relation(String field, String manyType, String manyField)
|
|
{
|
|
this.field = field;
|
|
this.manyField = manyField;
|
|
this.manyType = manyType;
|
|
}
|
|
|
|
public static Dictionary<Type, Relation[]> GetRelations()
|
|
{
|
|
Dictionary<Type, Relation[]> relations = new Dictionary<Type, Relation[]>();
|
|
|
|
relations.Add(typeof(Proxy_Pool), new Relation[] {
|
|
new Relation("metadata_VDIs", "VDI", "metadata_of_pool"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_SR), new Relation[] {
|
|
new Relation("VDIs", "VDI", "SR"),
|
|
new Relation("PBDs", "PBD", "SR"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_GPU_group), new Relation[] {
|
|
new Relation("VGPUs", "VGPU", "GPU_group"),
|
|
new Relation("PGPUs", "PGPU", "GPU_group"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Session), new Relation[] {
|
|
new Relation("tasks", "task", "session"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Subject), new Relation[] {
|
|
new Relation("roles", "subject", "roles"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Bond), new Relation[] {
|
|
new Relation("slaves", "PIF", "bond_slave_of"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Role), new Relation[] {
|
|
new Relation("subroles", "role", "subroles"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Pool_patch), new Relation[] {
|
|
new Relation("host_patches", "host_patch", "pool_patch"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_VM_appliance), new Relation[] {
|
|
new Relation("VMs", "VM", "appliance"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_PIF), new Relation[] {
|
|
new Relation("tunnel_transport_PIF_of", "tunnel", "transport_PIF"),
|
|
new Relation("tunnel_access_PIF_of", "tunnel", "access_PIF"),
|
|
new Relation("VLAN_slave_of", "VLAN", "tagged_PIF"),
|
|
new Relation("bond_master_of", "Bond", "master"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_PVS_site), new Relation[] {
|
|
new Relation("cache_storage", "PVS_cache_storage", "site"),
|
|
new Relation("proxies", "PVS_proxy", "site"),
|
|
new Relation("servers", "PVS_server", "site"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_DR_task), new Relation[] {
|
|
new Relation("introduced_SRs", "SR", "introduced_by"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Network), new Relation[] {
|
|
new Relation("PIFs", "PIF", "network"),
|
|
new Relation("VIFs", "VIF", "network"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_Task), new Relation[] {
|
|
new Relation("subtasks", "task", "subtask_of"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_PGPU), new Relation[] {
|
|
new Relation("resident_VGPUs", "VGPU", "resident_on"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_VGPU_type), new Relation[] {
|
|
new Relation("enabled_on_GPU_groups", "GPU_group", "enabled_VGPU_types"),
|
|
new Relation("supported_on_GPU_groups", "GPU_group", "supported_VGPU_types"),
|
|
new Relation("enabled_on_PGPUs", "PGPU", "enabled_VGPU_types"),
|
|
new Relation("supported_on_PGPUs", "PGPU", "supported_VGPU_types"),
|
|
new Relation("VGPUs", "VGPU", "type"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_VDI), new Relation[] {
|
|
new Relation("crash_dumps", "crashdump", "VDI"),
|
|
new Relation("VBDs", "VBD", "VDI"),
|
|
new Relation("snapshots", "VDI", "snapshot_of"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_VMPP), new Relation[] {
|
|
new Relation("VMs", "VM", "protection_policy"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_VM), new Relation[] {
|
|
new Relation("attached_PCIs", "PCI", "attached_VMs"),
|
|
new Relation("VGPUs", "VGPU", "VM"),
|
|
new Relation("consoles", "console", "VM"),
|
|
new Relation("VTPMs", "VTPM", "VM"),
|
|
new Relation("VIFs", "VIF", "VM"),
|
|
new Relation("crash_dumps", "crashdump", "VM"),
|
|
new Relation("VBDs", "VBD", "VM"),
|
|
new Relation("children", "VM", "parent"),
|
|
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[] {
|
|
new Relation("features", "Feature", "host"),
|
|
new Relation("PGPUs", "PGPU", "host"),
|
|
new Relation("PCIs", "PCI", "host"),
|
|
new Relation("patches", "host_patch", "host"),
|
|
new Relation("crashdumps", "host_crashdump", "host"),
|
|
new Relation("host_CPUs", "host_cpu", "host"),
|
|
new Relation("resident_VMs", "VM", "resident_on"),
|
|
new Relation("PIFs", "PIF", "host"),
|
|
new Relation("PBDs", "PBD", "host"),
|
|
});
|
|
|
|
relations.Add(typeof(Proxy_VMSS), new Relation[] {
|
|
new Relation("VMs", "VM", "snapshot_schedule"),
|
|
});
|
|
|
|
|
|
return relations;
|
|
}
|
|
}
|
|
}
|