Revision e0cd6f5d

b/lib/constants.py
72 72
SSH_LOGIN_USER = _constants.SSH_LOGIN_USER
73 73
SSH_CONSOLE_USER = _constants.SSH_CONSOLE_USER
74 74

  
75
# cpu pinning separators and constants
76
CPU_PINNING_SEP = ":"
77
CPU_PINNING_ALL = "all"
78
# internal representation of "all"
79
CPU_PINNING_ALL_VAL = -1
80
# one "all" entry in a CPU list means CPU pinning is off
81
CPU_PINNING_OFF = [CPU_PINNING_ALL_VAL]
82

  
83
# A Xen-specific implementation detail - there is no way to actually say
84
# "use any cpu for pinning" in a Xen configuration file, as opposed to the
85
# command line, where you can say "xm vcpu-pin <domain> <vcpu> all".
86
# The workaround used in Xen is "0-63" (see source code function
87
# xm_vcpu_pin in <xen-source>/tools/python/xen/xm/main.py).
88
# To support future changes, the following constant is treated as a
89
# blackbox string that simply means use-any-cpu-for-pinning-under-xen.
90
CPU_PINNING_ALL_XEN = "0-63"
91

  
92
# A KVM-specific implementation detail - the following value is used
93
# to set CPU affinity to all processors (#0 through #31), per taskset
94
# man page.
95
# FIXME: This only works for machines with up to 32 CPU cores
96
CPU_PINNING_ALL_KVM = 0xFFFFFFFF
97

  
98
# Wipe
75
CPU_PINNING_SEP = _constants.CPU_PINNING_SEP
76
CPU_PINNING_ALL = _constants.CPU_PINNING_ALL
77
CPU_PINNING_ALL_VAL = _constants.CPU_PINNING_ALL_VAL
78
CPU_PINNING_OFF = _constants.CPU_PINNING_OFF
79

  
80
CPU_PINNING_ALL_XEN = _constants.CPU_PINNING_ALL_XEN
81

  
82
CPU_PINNING_ALL_KVM = _constants.CPU_PINNING_ALL_KVM
83

  
99 84
DD_CMD = _constants.DD_CMD
100 85
MAX_WIPE_CHUNK = _constants.MAX_WIPE_CHUNK
101 86
MIN_WIPE_CHUNK_PERCENT = _constants.MIN_WIPE_CHUNK_PERCENT
b/src/Ganeti/HsConstants.hs
231 231
sshConsoleUser :: String
232 232
sshConsoleUser = AutoConf.sshConsoleUser
233 233

  
234
-- * Cpu pinning separators and constants
235

  
236
cpuPinningSep :: String
237
cpuPinningSep = ":"
238

  
239
cpuPinningAll :: String
240
cpuPinningAll = "all"
241

  
242
-- | Internal representation of "all"
243
cpuPinningAllVal :: Int
244
cpuPinningAllVal = -1
245

  
246
-- | One "all" entry in a CPU list means CPU pinning is off
247
cpuPinningOff :: [Int]
248
cpuPinningOff = [cpuPinningAllVal]
249

  
250
-- | A Xen-specific implementation detail is that there is no way to
251
-- actually say "use any cpu for pinning" in a Xen configuration file,
252
-- as opposed to the command line, where you can say
253
-- @
254
-- xm vcpu-pin <domain> <vcpu> all
255
-- @
256
--
257
-- The workaround used in Xen is "0-63" (see source code function
258
-- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
259
--
260
-- To support future changes, the following constant is treated as a
261
-- blackbox string that simply means "use any cpu for pinning under
262
-- xen".
263
cpuPinningAllXen :: String
264
cpuPinningAllXen = "0-63"
265

  
266
-- | A KVM-specific implementation detail - the following value is
267
-- used to set CPU affinity to all processors (--0 through --31), per
268
-- taskset man page.
269
--
270
-- FIXME: This only works for machines with up to 32 CPU cores
271
cpuPinningAllKvm :: Int
272
cpuPinningAllKvm = 0xFFFFFFFF
273

  
234 274
-- * Wipe
235 275

  
236 276
ddCmd :: String

Also available in: Unified diff