public AssignVMsToPolicyAction(VMPP vmpp, List<XenRef<VM>> selectedVMs)
     : base(vmpp.Connection, Messages.ASSIGN_PROTECTION_POLICY_NOAMP)
 {
     _vmpp = vmpp;
     _selectedVMs = selectedVMs;
     Pool = Helpers.GetPool(vmpp.Connection);
 }
Exemplo n.º 2
0
        private static void Download_VMPP(Session session, List <ObjectChange> changes)
        {
            Dictionary <XenRef <VMPP>, VMPP> records = VMPP.get_all_records(session);

            foreach (KeyValuePair <XenRef <VMPP>, VMPP> entry in records)
            {
                changes.Add(new ObjectChange(typeof(VMPP), entry.Key.opaque_ref, entry.Value));
            }
        }
Exemplo n.º 3
0
 public CreateVMPP( VMPP record, List<VM> vms, bool runNow)
     : base(record.Connection, Messages.CREATE_POLICY)
 {
     _record = record;
     _vms = vms;
     _runNow = runNow;
     Pool = Helpers.GetPool(record.Connection);
     ApiMethodsToRoleCheck.Add("VMPP.async_create");
     ApiMethodsToRoleCheck.Add("VM.set_protection_policy");
     ApiMethodsToRoleCheck.Add("VMPP.protect_now");
 }
Exemplo n.º 4
0
 public void RefreshTab(VMPP vmpp)
 {
     _vmpp = vmpp;
     if (_vmpp == null)
     {
         labelHistory.Text = "";
         comboBox1.Enabled = false;
     }
     else
     {
         comboBox1.Enabled = true;
         RefreshGrid(_vmpp.RecentAlerts);
     }
 }
Exemplo n.º 5
0
 public void set_is_enabled(Session session, string _policy, bool _is_enabled)
 {
     VMPP.set_is_policy_enabled(session, _policy, _is_enabled);
 }
 public RemoveVMsFromPolicyAction(VMPP vmpp, List<XenRef<VM>> selectedVMs)
     : base(vmpp.Connection, selectedVMs.Count == 1 ?
     string.Format(Messages.REMOVE_VM_FROM_POLICY, vmpp.Connection.Resolve(selectedVMs[0]), vmpp.Name)
     : string.Format(Messages.REMOVE_VMS_FROM_POLICY, vmpp.Name))
 {
     _selectedVMs = selectedVMs;
     Pool = Helpers.GetPool(vmpp.Connection);
 }
Exemplo n.º 7
0
 public ChangePolicyEnabledAction(VMPP vmpp)
     : base(vmpp.Connection, string.Format(Messages.CHANGE_POLICY_STATUS, vmpp.Name))
 {
     _vmpp = vmpp;
     Pool = Helpers.GetPool(vmpp.Connection);
 }
Exemplo n.º 8
0
        protected override void FinishWizard()
        {
            var vmpp = new VMPP
                           {
                               name_label = xenTabPagePolicy.PolicyName,
                               name_description = xenTabPagePolicy.PolicyDescription,
                               backup_type = xenTabPageSnapshotType.BackupType,
                               backup_frequency = xenTabPageSnapshotFrequency.Frequency,
                               backup_schedule = xenTabPageSnapshotFrequency.Schedule,
                               backup_retention_value = xenTabPageSnapshotFrequency.BackupRetention,
                               archive_frequency = xenTabPageArchive.ArchiveFrequency,
                               archive_target_config = xenTabPageArchive.ArchiveConfig,
                               archive_target_type = xenTabPageArchive.ArchiveTargetType,
                               archive_schedule = xenTabPageArchive.Schedule,
                               is_alarm_enabled = xenTabPageEmail.EmailEnabled,
                               alarm_config = xenTabPageEmail.EmailSettings,
                               is_policy_enabled = xenTabPageVMsPage.SelectedVMs.Count == 0 ? false : true,
                               Connection = Pool.Connection
                           };

            var action = new CreateVMPP(vmpp, xenTabPageVMsPage.SelectedVMs, xenTabPageFinish.RunNow);
            action.RunAsync();
            base.FinishWizard();
        }
        protected override void ProcessRecord()
        {
            GetSession();
            if (Record == null && HashTable == null)
            {
                Record                        = new XenAPI.VMPP();
                Record.name_label             = NameLabel;
                Record.name_description       = NameDescription;
                Record.is_policy_enabled      = IsPolicyEnabled;
                Record.backup_type            = BackupType;
                Record.backup_retention_value = BackupRetentionValue;
                Record.backup_frequency       = BackupFrequency;
                Record.backup_schedule        = CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(BackupSchedule);
                Record.archive_target_type    = ArchiveTargetType;
                Record.archive_target_config  = CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(ArchiveTargetConfig);
                Record.archive_frequency      = ArchiveFrequency;
                Record.archive_schedule       = CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(ArchiveSchedule);
                Record.is_alarm_enabled       = IsAlarmEnabled;
                Record.alarm_config           = CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(AlarmConfig);
            }
            else if (Record == null)
            {
                Record = new XenAPI.VMPP(HashTable);
            }

            if (!ShouldProcess(session.Url, "VMPP.create"))
            {
                return;
            }

            RunApiCall(() =>
            {
                var contxt = _context as XenServerCmdletDynamicParameters;

                if (contxt != null && contxt.Async)
                {
                    taskRef = XenAPI.VMPP.async_create(session, Record);

                    if (PassThru)
                    {
                        XenAPI.Task taskObj = null;
                        if (taskRef != "OpaqueRef:NULL")
                        {
                            taskObj            = XenAPI.Task.get_record(session, taskRef.opaque_ref);
                            taskObj.opaque_ref = taskRef.opaque_ref;
                        }

                        WriteObject(taskObj, true);
                    }
                }
                else
                {
                    string objRef = XenAPI.VMPP.create(session, Record);

                    if (PassThru)
                    {
                        XenAPI.VMPP obj = null;

                        if (objRef != "OpaqueRef:NULL")
                        {
                            obj            = XenAPI.VMPP.get_record(session, objRef);
                            obj.opaque_ref = objRef;
                        }

                        WriteObject(obj, true);
                    }
                }
            });

            UpdateSessions();
        }
Exemplo n.º 10
0
 public PolicyRow(VMPP policy)
 {
     Cells.Add(_name);
     Cells.Add(_status);
     Cells.Add(_numVMs);
     Cells.Add(_nextRunTime);
     Cells.Add(_nextArchiveRuntime);
     Cells.Add(_lastResult);
     VMPP = policy;
     RefreshRow();
 }
Exemplo n.º 11
0
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     if (_clone != null && clone == null)
     {
         RefreshDailyEnabled(_clone.backup_frequency);
         RefreshEnablementCheckBoxes();
     }
     else
     {
         _clone = (VMPP)clone;
         RefreshTab(_clone);
     }
 }
Exemplo n.º 12
0
 private void RefreshTab(VMPP vmpp)
 {
     textBoxName.Text = vmpp.Name;
     textBoxDescription.Text = vmpp.Description;
     labelwizard.Visible = false;
 }
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     _copy = (VMPP)clone;
     RefreshTab(_copy);
 }
Exemplo n.º 14
0
 public string run_now(Session session, string _policy)
 {
     return(VMPP.protect_now(session, _policy));
 }
Exemplo n.º 15
0
 public RunPolicyNowAction( VMPP vmpp)
     : base(vmpp.Connection, string.Format(Messages.RUN_POLICY, vmpp.Name))
 {
     _vmpp = vmpp;
     Pool = Helpers.GetPool(vmpp.Connection);
 }
Exemplo n.º 16
0
 public void do_destroy(Session session, string _policy)
 {
     VMPP.destroy(session, _policy);
 }
Exemplo n.º 17
0
 public static DateTime GetWeeklyDate(DateTime time, int hour, int min, List <DayOfWeek> listDaysOfWeek)
 {
     return(VMPP.GetWeeklyDate(time, hour, min, listDaysOfWeek));
 }
Exemplo n.º 18
0
 private static DateTime GetHourlyDate(DateTime time, int min)
 {
     return(VMPP.GetHourlyDate(time, min));
 }
Exemplo n.º 19
0
 private static DateTime GetDailyDate(DateTime time, int min, int hour)
 {
     return(VMPP.GetDailyDate(time, min, hour));
 }
Exemplo n.º 20
0
        private void RefreshTab(VMPP vmpp)
        {
            sectionLabelSchedule.LineColor = sectionLabelDest.LineColor =
                                             PropertiesDialog == null ? SystemColors.Window : SystemColors.ActiveBorder;

            switch (vmpp.archive_frequency)
            {
                case vmpp_archive_frequency.always_after_backup:
                    radioButtonArchiveASAP.Checked = true;
                    break;
                case vmpp_archive_frequency.daily:

                    radioButtonArchiveDaily.Checked = true;
                    dateTimePickerDaily.Value = new DateTime(1970, 1, 1, Convert.ToInt32(vmpp.archive_schedule["hour"]),
                                                           Convert.ToInt32(vmpp.archive_schedule["min"]), 0);
                    break;
                case vmpp_archive_frequency.weekly:

                    radioButtonArchiveWeekly.Checked = true;
                    dateTimePickerWeekly.Value = new DateTime(1970, 1, 1, Convert.ToInt32(vmpp.archive_schedule["hour"]),
                                                             Convert.ToInt32(vmpp.archive_schedule["min"]), 0);
                    daysWeekCheckboxes1.Days = vmpp.archive_schedule["days"];

                    break;
                case vmpp_archive_frequency.never:
                    radioButtonDoNotArchive.Checked = true;
                    break;
            }
            if (vmpp.archive_frequency != vmpp_archive_frequency.never)
            {
                if (vmpp.archive_target_type == vmpp_archive_target_type.nfs)
                {
                    textBoxPath.Text = vmpp.archive_target_config_location;
                }
                else
                {
                    textBoxPath.Text = vmpp.archive_target_config_location;
                }
                if (vmpp.archive_target_type == vmpp_archive_target_type.cifs)
                {
                    if (vmpp.archive_target_config_username != "")
                    {
                        checkBoxCredentials.Checked = true;

                        textBoxUser.Text = vmpp.archive_target_config_username;
                        textBoxPassword.Text = vmpp.archive_target_config_password_value;
                    }
                }
            }

            RefreshDailyEnabled(vmpp.backup_frequency);
            RefreshEnablementCheckBoxes();
        }
Exemplo n.º 21
0
 private void RefreshTab(VMPP vmpp)
 {
     switch (vmpp.backup_type)
     {
         case vmpp_backup_type.checkpoint:
             radioButtonDiskAndMemory.Checked = true;
             break;
         case vmpp_backup_type.snapshot:
             radioButtonDiskOnly.Checked = true;
             break;
     }
     EnableShapshotTypes(vmpp.Connection);
 }
Exemplo n.º 22
0
 public XenRef <Task> async_task_create(Session session)
 {
     return(VMPP.async_create(session, (VMPP)this));
 }
        private void RefreshTab(VMPP vmpp)
        {
            if (ParentForm != null)
            {
                var parentFormType = ParentForm.GetType();

                if (parentFormType == typeof(XenWizardBase))
                    sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.Window;
                else if (parentFormType == typeof(PropertiesDialog))
                    sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.ActiveBorder;
            }

            switch (vmpp.backup_frequency)
            {
                case vmpp_backup_frequency.hourly:
                    radioButtonHourly.Checked = true;
                    SetHourlyMinutes(Convert.ToDecimal(vmpp.backup_schedule_min));
                    break;
                case vmpp_backup_frequency.daily:
                    radioButtonDaily.Checked = true;
                    dateTimePickerDaily.Value = new DateTime(1970, 1, 1, Convert.ToInt32(vmpp.backup_schedule_hour),
                                                                 Convert.ToInt32(vmpp.backup_schedule_min), 0);
                    break;
                case vmpp_backup_frequency.weekly:
                    radioButtonWeekly.Checked = true;
                    dateTimePickerWeekly.Value = new DateTime(1970, 1, 1, Convert.ToInt32(vmpp.backup_schedule_hour),
                                                                 Convert.ToInt32(vmpp.backup_schedule_min), 0);
                    daysWeekCheckboxes.Days = vmpp.backup_schedule_days;
                    break;
            }

            numericUpDownRetention.Value = vmpp.backup_retention_value;
        }
Exemplo n.º 24
0
 public GetVMPPAlertsAction(VMPP vmpp,int hoursfromNow)
     : base(vmpp.Connection, "", true)
 {
     VMPP = vmpp;
     _hoursFromNow = hoursfromNow;
 }
Exemplo n.º 25
0
 private void RefreshTab(VMPP vmpp)
 {
     checkBox1.Checked = vmpp.is_alarm_enabled;
     if (vmpp.is_alarm_enabled)
     {
         textBoxSMTP.Text = vmpp.alarm_config_smtp_server;
         textBoxPort.Text = vmpp.alarm_config_smtp_port;
         textBoxEmailAddress.Text = vmpp.alarm_config_email_address;
     }
 }
Exemplo n.º 26
0
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     _clone = (VMPP)clone;
     Pool = Helpers.GetPoolOfOne(_clone.Connection);
     RefreshTab(_clone);
 }
Exemplo n.º 27
0
        private void RefreshButtons()
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                currentSelected = (VMPP)((PolicyRow)dataGridView1.SelectedRows[0]).VMPP;
                buttonEnable.Text = currentSelected.is_policy_enabled ? Messages.DISABLE : Messages.ENABLE;
                buttonEnable.Enabled = currentSelected.VMs.Count == 0 && !currentSelected.is_policy_enabled ? false : true;
                buttonProperties.Enabled = true;
                buttonRunNow.Enabled = currentSelected.is_policy_enabled && !currentSelected.is_backup_running && !currentSelected.is_archive_running;

            }
            else
            {
                currentSelected = null;
                buttonProperties.Enabled = buttonEnable.Enabled = buttonRunNow.Enabled = false;
                policyHistory1.Clear();
            }
            policyHistory1.RefreshTab(currentSelected);
            buttonDelete.Enabled = (dataGridView1.SelectedRows.Count != 0);
        }
Exemplo n.º 28
0
 protected override void ProcessRecord()
 {
     XenAPI.Session session = XenObject as XenAPI.Session;
     if (session != null)
     {
         WriteObject(new XenRef <XenAPI.Session>(session));
         return;
     }
     XenAPI.Auth auth = XenObject as XenAPI.Auth;
     if (auth != null)
     {
         WriteObject(new XenRef <XenAPI.Auth>(auth));
         return;
     }
     XenAPI.Subject subject = XenObject as XenAPI.Subject;
     if (subject != null)
     {
         WriteObject(new XenRef <XenAPI.Subject>(subject));
         return;
     }
     XenAPI.Role role = XenObject as XenAPI.Role;
     if (role != null)
     {
         WriteObject(new XenRef <XenAPI.Role>(role));
         return;
     }
     XenAPI.Task task = XenObject as XenAPI.Task;
     if (task != null)
     {
         WriteObject(new XenRef <XenAPI.Task>(task));
         return;
     }
     XenAPI.Event evt = XenObject as XenAPI.Event;
     if (evt != null)
     {
         WriteObject(new XenRef <XenAPI.Event>(evt));
         return;
     }
     XenAPI.Pool pool = XenObject as XenAPI.Pool;
     if (pool != null)
     {
         WriteObject(new XenRef <XenAPI.Pool>(pool));
         return;
     }
     XenAPI.Pool_patch pool_patch = XenObject as XenAPI.Pool_patch;
     if (pool_patch != null)
     {
         WriteObject(new XenRef <XenAPI.Pool_patch>(pool_patch));
         return;
     }
     XenAPI.Pool_update pool_update = XenObject as XenAPI.Pool_update;
     if (pool_update != null)
     {
         WriteObject(new XenRef <XenAPI.Pool_update>(pool_update));
         return;
     }
     XenAPI.VM vm = XenObject as XenAPI.VM;
     if (vm != null)
     {
         WriteObject(new XenRef <XenAPI.VM>(vm));
         return;
     }
     XenAPI.VM_metrics vm_metrics = XenObject as XenAPI.VM_metrics;
     if (vm_metrics != null)
     {
         WriteObject(new XenRef <XenAPI.VM_metrics>(vm_metrics));
         return;
     }
     XenAPI.VM_guest_metrics vm_guest_metrics = XenObject as XenAPI.VM_guest_metrics;
     if (vm_guest_metrics != null)
     {
         WriteObject(new XenRef <XenAPI.VM_guest_metrics>(vm_guest_metrics));
         return;
     }
     XenAPI.VMPP vmpp = XenObject as XenAPI.VMPP;
     if (vmpp != null)
     {
         WriteObject(new XenRef <XenAPI.VMPP>(vmpp));
         return;
     }
     XenAPI.VMSS vmss = XenObject as XenAPI.VMSS;
     if (vmss != null)
     {
         WriteObject(new XenRef <XenAPI.VMSS>(vmss));
         return;
     }
     XenAPI.VM_appliance vm_appliance = XenObject as XenAPI.VM_appliance;
     if (vm_appliance != null)
     {
         WriteObject(new XenRef <XenAPI.VM_appliance>(vm_appliance));
         return;
     }
     XenAPI.DR_task dr_task = XenObject as XenAPI.DR_task;
     if (dr_task != null)
     {
         WriteObject(new XenRef <XenAPI.DR_task>(dr_task));
         return;
     }
     XenAPI.Host host = XenObject as XenAPI.Host;
     if (host != null)
     {
         WriteObject(new XenRef <XenAPI.Host>(host));
         return;
     }
     XenAPI.Host_crashdump host_crashdump = XenObject as XenAPI.Host_crashdump;
     if (host_crashdump != null)
     {
         WriteObject(new XenRef <XenAPI.Host_crashdump>(host_crashdump));
         return;
     }
     XenAPI.Host_patch host_patch = XenObject as XenAPI.Host_patch;
     if (host_patch != null)
     {
         WriteObject(new XenRef <XenAPI.Host_patch>(host_patch));
         return;
     }
     XenAPI.Host_metrics host_metrics = XenObject as XenAPI.Host_metrics;
     if (host_metrics != null)
     {
         WriteObject(new XenRef <XenAPI.Host_metrics>(host_metrics));
         return;
     }
     XenAPI.Host_cpu host_cpu = XenObject as XenAPI.Host_cpu;
     if (host_cpu != null)
     {
         WriteObject(new XenRef <XenAPI.Host_cpu>(host_cpu));
         return;
     }
     XenAPI.Network network = XenObject as XenAPI.Network;
     if (network != null)
     {
         WriteObject(new XenRef <XenAPI.Network>(network));
         return;
     }
     XenAPI.VIF vif = XenObject as XenAPI.VIF;
     if (vif != null)
     {
         WriteObject(new XenRef <XenAPI.VIF>(vif));
         return;
     }
     XenAPI.VIF_metrics vif_metrics = XenObject as XenAPI.VIF_metrics;
     if (vif_metrics != null)
     {
         WriteObject(new XenRef <XenAPI.VIF_metrics>(vif_metrics));
         return;
     }
     XenAPI.PIF pif = XenObject as XenAPI.PIF;
     if (pif != null)
     {
         WriteObject(new XenRef <XenAPI.PIF>(pif));
         return;
     }
     XenAPI.PIF_metrics pif_metrics = XenObject as XenAPI.PIF_metrics;
     if (pif_metrics != null)
     {
         WriteObject(new XenRef <XenAPI.PIF_metrics>(pif_metrics));
         return;
     }
     XenAPI.Bond bond = XenObject as XenAPI.Bond;
     if (bond != null)
     {
         WriteObject(new XenRef <XenAPI.Bond>(bond));
         return;
     }
     XenAPI.VLAN vlan = XenObject as XenAPI.VLAN;
     if (vlan != null)
     {
         WriteObject(new XenRef <XenAPI.VLAN>(vlan));
         return;
     }
     XenAPI.SM sm = XenObject as XenAPI.SM;
     if (sm != null)
     {
         WriteObject(new XenRef <XenAPI.SM>(sm));
         return;
     }
     XenAPI.SR sr = XenObject as XenAPI.SR;
     if (sr != null)
     {
         WriteObject(new XenRef <XenAPI.SR>(sr));
         return;
     }
     XenAPI.LVHD lvhd = XenObject as XenAPI.LVHD;
     if (lvhd != null)
     {
         WriteObject(new XenRef <XenAPI.LVHD>(lvhd));
         return;
     }
     XenAPI.VDI vdi = XenObject as XenAPI.VDI;
     if (vdi != null)
     {
         WriteObject(new XenRef <XenAPI.VDI>(vdi));
         return;
     }
     XenAPI.VBD vbd = XenObject as XenAPI.VBD;
     if (vbd != null)
     {
         WriteObject(new XenRef <XenAPI.VBD>(vbd));
         return;
     }
     XenAPI.VBD_metrics vbd_metrics = XenObject as XenAPI.VBD_metrics;
     if (vbd_metrics != null)
     {
         WriteObject(new XenRef <XenAPI.VBD_metrics>(vbd_metrics));
         return;
     }
     XenAPI.PBD pbd = XenObject as XenAPI.PBD;
     if (pbd != null)
     {
         WriteObject(new XenRef <XenAPI.PBD>(pbd));
         return;
     }
     XenAPI.Crashdump crashdump = XenObject as XenAPI.Crashdump;
     if (crashdump != null)
     {
         WriteObject(new XenRef <XenAPI.Crashdump>(crashdump));
         return;
     }
     XenAPI.VTPM vtpm = XenObject as XenAPI.VTPM;
     if (vtpm != null)
     {
         WriteObject(new XenRef <XenAPI.VTPM>(vtpm));
         return;
     }
     XenAPI.Console console = XenObject as XenAPI.Console;
     if (console != null)
     {
         WriteObject(new XenRef <XenAPI.Console>(console));
         return;
     }
     XenAPI.User user = XenObject as XenAPI.User;
     if (user != null)
     {
         WriteObject(new XenRef <XenAPI.User>(user));
         return;
     }
     XenAPI.Data_source data_source = XenObject as XenAPI.Data_source;
     if (data_source != null)
     {
         WriteObject(new XenRef <XenAPI.Data_source>(data_source));
         return;
     }
     XenAPI.Blob blob = XenObject as XenAPI.Blob;
     if (blob != null)
     {
         WriteObject(new XenRef <XenAPI.Blob>(blob));
         return;
     }
     XenAPI.Message message = XenObject as XenAPI.Message;
     if (message != null)
     {
         WriteObject(new XenRef <XenAPI.Message>(message));
         return;
     }
     XenAPI.Secret secret = XenObject as XenAPI.Secret;
     if (secret != null)
     {
         WriteObject(new XenRef <XenAPI.Secret>(secret));
         return;
     }
     XenAPI.Tunnel tunnel = XenObject as XenAPI.Tunnel;
     if (tunnel != null)
     {
         WriteObject(new XenRef <XenAPI.Tunnel>(tunnel));
         return;
     }
     XenAPI.PCI pci = XenObject as XenAPI.PCI;
     if (pci != null)
     {
         WriteObject(new XenRef <XenAPI.PCI>(pci));
         return;
     }
     XenAPI.PGPU pgpu = XenObject as XenAPI.PGPU;
     if (pgpu != null)
     {
         WriteObject(new XenRef <XenAPI.PGPU>(pgpu));
         return;
     }
     XenAPI.GPU_group gpu_group = XenObject as XenAPI.GPU_group;
     if (gpu_group != null)
     {
         WriteObject(new XenRef <XenAPI.GPU_group>(gpu_group));
         return;
     }
     XenAPI.VGPU vgpu = XenObject as XenAPI.VGPU;
     if (vgpu != null)
     {
         WriteObject(new XenRef <XenAPI.VGPU>(vgpu));
         return;
     }
     XenAPI.VGPU_type vgpu_type = XenObject as XenAPI.VGPU_type;
     if (vgpu_type != null)
     {
         WriteObject(new XenRef <XenAPI.VGPU_type>(vgpu_type));
         return;
     }
     XenAPI.PVS_site pvs_site = XenObject as XenAPI.PVS_site;
     if (pvs_site != null)
     {
         WriteObject(new XenRef <XenAPI.PVS_site>(pvs_site));
         return;
     }
     XenAPI.PVS_server pvs_server = XenObject as XenAPI.PVS_server;
     if (pvs_server != null)
     {
         WriteObject(new XenRef <XenAPI.PVS_server>(pvs_server));
         return;
     }
     XenAPI.PVS_proxy pvs_proxy = XenObject as XenAPI.PVS_proxy;
     if (pvs_proxy != null)
     {
         WriteObject(new XenRef <XenAPI.PVS_proxy>(pvs_proxy));
         return;
     }
     XenAPI.PVS_cache_storage pvs_cache_storage = XenObject as XenAPI.PVS_cache_storage;
     if (pvs_cache_storage != null)
     {
         WriteObject(new XenRef <XenAPI.PVS_cache_storage>(pvs_cache_storage));
         return;
     }
     XenAPI.Feature feature = XenObject as XenAPI.Feature;
     if (feature != null)
     {
         WriteObject(new XenRef <XenAPI.Feature>(feature));
         return;
     }
     XenAPI.SDN_controller sdn_controller = XenObject as XenAPI.SDN_controller;
     if (sdn_controller != null)
     {
         WriteObject(new XenRef <XenAPI.SDN_controller>(sdn_controller));
         return;
     }
     XenAPI.Vdi_nbd_server_info vdi_nbd_server_info = XenObject as XenAPI.Vdi_nbd_server_info;
     if (vdi_nbd_server_info != null)
     {
         WriteObject(new XenRef <XenAPI.Vdi_nbd_server_info>(vdi_nbd_server_info));
         return;
     }
     XenAPI.PUSB pusb = XenObject as XenAPI.PUSB;
     if (pusb != null)
     {
         WriteObject(new XenRef <XenAPI.PUSB>(pusb));
         return;
     }
     XenAPI.USB_group usb_group = XenObject as XenAPI.USB_group;
     if (usb_group != null)
     {
         WriteObject(new XenRef <XenAPI.USB_group>(usb_group));
         return;
     }
     XenAPI.VUSB vusb = XenObject as XenAPI.VUSB;
     if (vusb != null)
     {
         WriteObject(new XenRef <XenAPI.VUSB>(vusb));
         return;
     }
 }