本文整理汇总了C#中XenAPI.VM.Home方法的典型用法代码示例。如果您正苦于以下问题:C# VM.Home方法的具体用法?C# VM.Home怎么用?C# VM.Home使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenAPI.VM
的用法示例。
在下文中一共展示了VM.Home方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VMDestroyAction
public VMDestroyAction(VM vm, List<VBD> deleteDisks, List<VM> deleteSnapshots)
: base(vm.Connection, String.Format(Messages.ACTION_VM_DESTROYING_TITLE, vm.Name, vm.Home() == null ? Helpers.GetName(vm.Connection) : Helpers.GetName(vm.Home())))
{
VM = vm;
Host = vm.Home();
Pool = Helpers.GetPoolOfOne(vm.Connection);
_deleteDisks = deleteDisks;
_deleteSnapshots = deleteSnapshots;
}
示例2: MoveVMDialog
public MoveVMDialog(VM vm)
{
InitializeComponent();
this.vm = vm;
srPicker1.ItemSelectionNotNull += srPicker1_ItemSelectionNotNull;
srPicker1.ItemSelectionNull += srPicker1_ItemSelectionNull;
srPicker1.DoubleClickOnRow += srPicker1_DoubleClickOnRow;
srPicker1.SrHint.Visible = false;
Host affinity = vm.Home();
srPicker1.Usage = SrPicker.SRPickerType.MoveOrCopy;
//this has to be set after ImportTemplate, otherwise the usage will be reset to VM
var vdis = (from VBD vbd in vm.Connection.ResolveAll(vm.VBDs)
where vbd.IsOwner
let vdi = vm.Connection.Resolve(vbd.VDI)
where vdi != null
select vdi).ToArray();
srPicker1.SetExistingVDIs(vdis);
srPicker1.Connection = vm.Connection;
srPicker1.DiskSize = vm.TotalVMSize;
srPicker1.SetAffinity(affinity);
srPicker1.srListBox.Invalidate();
srPicker1.selectDefaultSROrAny();
EnableMoveButton();
}
示例3: VMShutdownAction
protected VMShutdownAction(VM vm,string title)
: base(vm.Connection, title)
{
this.Description = Messages.ACTION_PREPARING;
this.VM = vm;
this.Host = vm.Home();
this.Pool = Core.Helpers.GetPool(vm.Connection);
}
示例4: VMToTemplateAction
public VMToTemplateAction(VM vm)
: base(vm.Connection, string.Format(Messages.ACTION_VM_TEMPLATIZING_TITLE, vm.Name))
{
this.Description = Messages.ACTION_PREPARING;
this.VM = vm;
this.Host = vm.Home();
this.Pool = Core.Helpers.GetPool(vm.Connection);
}
示例5: CopyVMDialog
public CopyVMDialog(VM vm)
{
InitializeComponent();
this.MinimumSize = this.Size;
IsRealVm = !vm.is_a_template;
TheVM = vm;
srPicker1.Usage = SrPicker.SRPickerType.MoveOrCopy;
srPicker1.ItemSelectionNotNull += srPicker1_ItemSelectionNotNull;
srPicker1.ItemSelectionNull += srPicker1_ItemSelectionNull;
Host affinity = TheVM.Home();
srPicker1.Connection = TheVM.Connection;
srPicker1.DiskSize = vm.TotalVMSize;
srPicker1.SrHint.Text = IsRealVm ? Messages.COPY_VM_SELECT_SR : Messages.COPY_TEMPLATE_SELECT_SR;
srPicker1.SetAffinity(affinity);
Pool pool = Helpers.GetPoolOfOne(vm.Connection);
if (pool != null)
srPicker1.DefaultSR = vm.Connection.Resolve(pool.default_SR);
NameTextBox.Text = GetDefaultCopyName(TheVM);
Text = IsRealVm ? Messages.COPY_VM : Messages.COPY_TEMPLATE;
bool allow_copy = !vm.is_a_template || vm.allowed_operations.Contains(vm_operations.copy);
CopyRadioButton.Enabled = allow_copy && vm.HasAtLeastOneDisk;
FastClonePanel.Enabled = !allow_copy || vm.AnyDiskFastClonable || !vm.HasAtLeastOneDisk;
if (!FastClonePanel.Enabled)
{
CloneRadioButton.Checked = false;
}
toolTipContainer1.SetToolTip(Messages.FAST_CLONE_UNAVAILABLE);
if (vm.is_a_template && !(vm.AnyDiskFastClonable || allow_copy))
{
CloneRadioButton.Text = Messages.COPY_VM_CLONE_TEMPLATE_SLOW;
FastCloneDescription.Text = Messages.COPY_VM_SLOW_CLONE_DESCRIPTION;
}
else
{
FastCloneDescription.Text = !vm.is_a_template ? Messages.COPY_VM_FAST_CLONE_DESCRIPTION : Messages.COPY_TEMPLATE_FAST_CLONE_DESCRIPTION;
}
if (!CloneRadioButton.Enabled)
CopyRadioButton.Checked = true;
if (vm.DescriptionType != VM.VmDescriptionType.None)
DescriptionTextBox.Text = vm.Description;
srPicker1.srListBox.Invalidate();
srPicker1.selectDefaultSROrAny();
}
示例6: VMCloneAction
public VMCloneAction(VM vm, string name, string description)
: base(vm.Connection, string.Format(Messages.CREATEVM_CLONE, name, vm.Name))
{
this.Description = Messages.ACTION_PREPARING;
this.VM = vm;
this.Host = vm.Home();
this.Pool = Core.Helpers.GetPool(vm.Connection);
if (vm.is_a_template)
this.Template = vm;
_cloneName = name;
_cloneDescription = description;
ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList);
ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList);
ApiMethodsToRoleCheck.Add("vm.clone");
ApiMethodsToRoleCheck.Add("vm.set_name_description");
}
示例7: VMRebootAction
public VMRebootAction(VM vm)
: base(vm.Connection, string.Format(Messages.ACTION_VM_REBOOTING_TITLE, vm.Name, vm.Home() == null ? Helpers.GetName(vm.Connection) : vm.Home().Name))
{
this.Description = Messages.ACTION_PREPARING;
this.VM = vm;
this.Host = vm.Home();
this.Pool = Core.Helpers.GetPool(vm.Connection);
}
示例8: VMWanted
private bool VMWanted(VM vm, Host host)
{
return vm.is_a_real_vm && vm.Show(Properties.Settings.Default.ShowHiddenVMs) && vm.Home() == host;
}
示例9: VmCpuFeaturesIncompatibleWithHost
public static bool VmCpuFeaturesIncompatibleWithHost(Host targetHost, VM vm)
{
// check the CPU feature compatibility for Dundee and higher hosts
if (!Helpers.DundeeOrGreater(targetHost))
return false;
Host home = vm.Home();
if (home != null && !Helpers.DundeeOrGreater(home))
return false;
if (home == null && !Helpers.DundeeOrGreater(vm.Connection))
return false;
// only for running or suspended VMs
if (vm.power_state != vm_power_state.Running && vm.power_state != vm_power_state.Suspended)
return false;
if (vm.last_boot_CPU_flags == null || !vm.last_boot_CPU_flags.ContainsKey("vendor") || !vm.last_boot_CPU_flags.ContainsKey("features")
|| targetHost.cpu_info == null || !targetHost.cpu_info.ContainsKey("vendor"))
return false;
if (vm.last_boot_CPU_flags["vendor"] != targetHost.cpu_info["vendor"])
return true;
if (vm.IsHVM && targetHost.cpu_info.ContainsKey("features_hvm"))
return PoolJoinRules.FewerFeatures(targetHost.cpu_info["features_hvm"], vm.last_boot_CPU_flags["features"]);
if (!vm.IsHVM && targetHost.cpu_info.ContainsKey("features_pv"))
return PoolJoinRules.FewerFeatures(targetHost.cpu_info["features_pv"], vm.last_boot_CPU_flags["features"]);
return false;
}
示例10: CanExecute
protected override bool CanExecute(VM vm)
{
if (vm != null && !vm.is_a_template && !vm.Locked)
{
if (vm.power_state == vm_power_state.Running && HelpersGUI.HasRunningTasks(vm))
{
return true;
}
else
{
return vm.allowed_operations != null && vm.allowed_operations.Contains(vm_operations.hard_reboot) && EnabledTargetExists(vm.Home(), vm.Connection);
}
}
return false;
}
示例11: NewDiskDialog
public NewDiskDialog(IXenConnection connection, VM vm)
: this(connection, vm, null, vm.Home(), true, 0, new List<VDI>())
{
}
示例12: VMCleanShutdown
public VMCleanShutdown(VM vm)
: base(vm, string.Format(Messages.ACTION_VM_SHUTTING_DOWN_TITLE, vm.Name, vm.Home() == null ? Helpers.GetName(vm.Connection) : vm.Home().Name))
{
}
示例13: VMStartAbstractAction
protected VMStartAbstractAction(VM vm, string title, Action<VM, bool> warningDialogHAInvalidConfig, Action<VMStartAbstractAction, Failure> startDiagnosisForm)
: base(vm.Connection, title)
{
this.Description = Messages.ACTION_PREPARING;
this.VM = vm;
_WarningDialogHAInvalidConfig = warningDialogHAInvalidConfig;
_StartDiagnosisForm = startDiagnosisForm;
this.Host = vm.Home();
this.Pool = Core.Helpers.GetPool(vm.Connection);
AddCommonAPIMethodsToRoleCheck();
}