コード例 #1
0
ファイル: CreateVMAction.cs プロジェクト: ywwseu/xenadmin
        private void SetVMParams()
        {
            Description = Messages.SETTING_VM_PROPERTIES;
            XenAPI.VM.set_name_label(Session, VM.opaque_ref, NameLabel);
            XenAPI.VM.set_name_description(Session, VM.opaque_ref, NameDescription);
            ChangeVCPUSettingsAction vcpuAction = new ChangeVCPUSettingsAction(VM, VcpusMax, VcpusAtStartup);

            vcpuAction.RunExternal(Session);

            // set cores-per-socket
            Dictionary <string, string> platform = VM.platform == null ?
                                                   new Dictionary <string, string>() :
                                                   new Dictionary <string, string>(VM.platform);

            platform["cores-per-socket"] = CoresPerSocket.ToString();
            VM.set_platform(Session, VM.opaque_ref, platform);

            // Check these values have changed before setting them, as they are RBAC protected
            if (HomeServerChanged())
            {
                XenAPI.VM.set_affinity(Session, VM.opaque_ref, HomeServer != null ? HomeServer.opaque_ref : Helper.NullOpaqueRef);
            }

            if (Template.memory_dynamic_min != MemoryDynamicMin || Template.memory_dynamic_max != MemoryDynamicMax || Template.memory_static_max != MemoryStaticMax)
            {
                XenAPI.VM.set_memory_limits(Session, VM.opaque_ref, Template.memory_static_min, MemoryStaticMax, MemoryDynamicMin, MemoryDynamicMax);
            }
        }
コード例 #2
0
        private void SetVMParams()
        {
            Description = Messages.SETTING_VM_PROPERTIES;
            XenAPI.VM.set_name_label(Session, VM.opaque_ref, NameLabel);
            XenAPI.VM.set_name_description(Session, VM.opaque_ref, NameDescription);
            ChangeVCPUSettingsAction vcpuAction = new ChangeVCPUSettingsAction(VM, Vcpus);

            vcpuAction.RunExternal(Session);

            // Check these values have changed before setting them, as they are RBAC protected
            if (HomeServerChanged())
            {
                XenAPI.VM.set_affinity(Session, VM.opaque_ref, HomeServer != null ? HomeServer.opaque_ref : Helper.NullOpaqueRef);
            }

            if (Helpers.MidnightRideOrGreater(VM.Connection))
            {
                if (Template.memory_dynamic_min != MemoryDynamicMin || Template.memory_dynamic_max != MemoryDynamicMax || Template.memory_static_max != MemoryStaticMax)
                {
                    XenAPI.VM.set_memory_limits(Session, VM.opaque_ref, Template.memory_static_min, MemoryStaticMax, MemoryDynamicMin, MemoryDynamicMax);
                }
            }
            else
            {
                // For George and earlier hosts, we set them all the same.
                // The order of operations doesn't matter, because George didn't enforce the ordering of values.
                XenAPI.VM.set_memory_dynamic_min(Session, VM.opaque_ref, MemoryStaticMax);
                XenAPI.VM.set_memory_dynamic_max(Session, VM.opaque_ref, MemoryStaticMax);
                XenAPI.VM.set_memory_static_max(Session, VM.opaque_ref, MemoryStaticMax);
            }
        }
コード例 #3
0
        private void SetVMParams()
        {
            Description = Messages.SETTING_VM_PROPERTIES;
            XenAPI.VM.set_name_label(Session, VM.opaque_ref, NameLabel);
            XenAPI.VM.set_name_description(Session, VM.opaque_ref, NameDescription);
            ChangeVCPUSettingsAction vcpuAction = new ChangeVCPUSettingsAction(VM, Vcpus);
            vcpuAction.RunExternal(Session);

            // set cores-per-socket
            Dictionary<string, string> platform = VM.platform == null ?
                            new Dictionary<string, string>() :
                            new Dictionary<string, string>(VM.platform);
            platform["cores-per-socket"] = CoresPerSocket.ToString();
            VM.set_platform(Session, VM.opaque_ref, platform);

            // Check these values have changed before setting them, as they are RBAC protected
            if (HomeServerChanged())
                XenAPI.VM.set_affinity(Session, VM.opaque_ref, HomeServer != null ? HomeServer.opaque_ref : Helper.NullOpaqueRef);

            if (Helpers.MidnightRideOrGreater(VM.Connection))
            {
                if (Template.memory_dynamic_min != MemoryDynamicMin || Template.memory_dynamic_max != MemoryDynamicMax || Template.memory_static_max != MemoryStaticMax)
                    XenAPI.VM.set_memory_limits(Session, VM.opaque_ref, Template.memory_static_min, MemoryStaticMax, MemoryDynamicMin, MemoryDynamicMax);
            }
            else
            {
                // For George and earlier hosts, we set them all the same.
                // The order of operations doesn't matter, because George didn't enforce the ordering of values.
                XenAPI.VM.set_memory_dynamic_min(Session, VM.opaque_ref, MemoryStaticMax);
                XenAPI.VM.set_memory_dynamic_max(Session, VM.opaque_ref, MemoryStaticMax);
                XenAPI.VM.set_memory_static_max(Session, VM.opaque_ref, MemoryStaticMax);
            }
        }
コード例 #4
0
ファイル: CreateVMAction.cs プロジェクト: ushamandya/xenadmin
        private void SetVMParams()
        {
            Description = Messages.SETTING_VM_PROPERTIES;
            XenAPI.VM.set_name_label(Session, VM.opaque_ref, NameLabel);
            XenAPI.VM.set_name_description(Session, VM.opaque_ref, NameDescription);
            ChangeVCPUSettingsAction vcpuAction = new ChangeVCPUSettingsAction(VM, VcpusMax, VcpusAtStartup);
            vcpuAction.RunExternal(Session);

            // set cores-per-socket
            Dictionary<string, string> platform = VM.platform == null ?
                            new Dictionary<string, string>() :
                            new Dictionary<string, string>(VM.platform);
            platform["cores-per-socket"] = CoresPerSocket.ToString();
            VM.set_platform(Session, VM.opaque_ref, platform);

            // Check these values have changed before setting them, as they are RBAC protected
            if (HomeServerChanged())
                XenAPI.VM.set_affinity(Session, VM.opaque_ref, HomeServer != null ? HomeServer.opaque_ref : Helper.NullOpaqueRef);

            if (Template.memory_dynamic_min != MemoryDynamicMin || Template.memory_dynamic_max != MemoryDynamicMax || Template.memory_static_max != MemoryStaticMax)
                XenAPI.VM.set_memory_limits(Session, VM.opaque_ref, Template.memory_static_min, MemoryStaticMax, MemoryDynamicMin, MemoryDynamicMax);
        }