mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[XEND][XENAPI] Split Xend global constants out to its own file.
Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
1 parent
19ce2d7016
commit
965e9d0ac4
5 files changed
+175
-8
No files matched your search
@@ -0,0 +1,75 @@
|
||||
#============================================================================
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of version 2.1 of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#============================================================================
|
||||
# Copyright (C) 2006 XenSource Ltd.
|
||||
#============================================================================
|
||||
|
||||
#
|
||||
# Xen API Enums
|
||||
#
|
||||
|
||||
XEN_API_VM_POWER_STATE = (
|
||||
'Halted',
|
||||
'Paused',
|
||||
'Running',
|
||||
'Suspended',
|
||||
'ShuttingDown',
|
||||
'Unknown'
|
||||
)
|
||||
|
||||
XEN_API_VM_POWER_STATE_HALTED = 0
|
||||
XEN_API_VM_POWER_STATE_PAUSED = 1
|
||||
XEN_API_VM_POWER_STATE_RUNNING = 2
|
||||
XEN_API_VM_POWER_STATE_SUSPENDED = 3
|
||||
XEN_API_VM_POWER_STATE_SHUTTINGDOWN = 4
|
||||
XEN_API_VM_POWER_STATE_UNKNOWN = 5
|
||||
|
||||
XEN_API_CPU_FEATURE = (
|
||||
'FPU', 'VME', 'DE', 'PSE', 'TSC', 'MSR', 'PAE'
|
||||
'MCE', 'CX8', 'APIC', 'SEP', 'MTRR', 'PGE', 'MCA',
|
||||
'CMOV', 'PAT', 'PSE36', 'PN', 'CLFLSH', 'DTES',
|
||||
'ACPI', 'MMX', 'FXCR', 'XMM', 'XMM2', 'SELFSNOOP',
|
||||
'HT', 'ACC', 'IA64', 'SYSCALL', 'MP', 'NX', 'MMXEXT',
|
||||
'LM', '3DNOWEXT', '3DNOW', 'RECOVERY', 'LONGRUN',
|
||||
'LRTI', 'CXMMX', 'K6_MTRR', 'CYRIX_ARR', 'CENTAUR_MCR',
|
||||
'K8', 'K7', 'P3', 'P4', 'CONSTANT_TSC', 'FXSAVE_LEAK',
|
||||
'XMM3', 'MWAIT', 'DSCPL', 'EST', 'TM2', 'CID', 'CX16',
|
||||
'XTPR', 'XSTORE', 'XSTORE_EN', 'XCRYPT', 'XCRYPT_EN',
|
||||
'LAHF_LM', 'CMP_LEGACY'
|
||||
)
|
||||
|
||||
XEN_API_ON_NORMAL_EXIT = (
|
||||
'destroy',
|
||||
'restart',
|
||||
)
|
||||
|
||||
XEN_API_ON_CRASH_BEHAVIOUR = (
|
||||
'destroy',
|
||||
'coredump_and_destroy',
|
||||
'restart',
|
||||
'coredump_and_restart',
|
||||
'preserve',
|
||||
'rename_restart'
|
||||
)
|
||||
|
||||
XEN_API_BOOT_TYPE = (
|
||||
'bios',
|
||||
'grub',
|
||||
'kernel_external',
|
||||
'kernel_internal'
|
||||
)
|
||||
|
||||
XEN_API_VBD_MODE = ('RO', 'RW')
|
||||
|
||||
XEN_API_DRIVER_TYPE = ('ioemu', 'paravirtualised')
|
||||
@@ -18,8 +18,7 @@ import xen.lowlevel.xc
|
||||
from xen.xend import balloon, sxp
|
||||
from xen.xend.XendError import XendError
|
||||
from xen.xend.XendLogging import log
|
||||
from xen.xend.XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2
|
||||
from xen.xend.XendDomainInfo import DEV_MIGRATE_STEP3
|
||||
from xen.xend.XendConstants import *
|
||||
|
||||
SIGNATURE = "LinuxGuestRecord"
|
||||
XC_SAVE = "xc_save"
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
#============================================================================
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of version 2.1 of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#============================================================================
|
||||
# Copyright (C) 2006 XenSource Ltd.
|
||||
#============================================================================
|
||||
|
||||
from xen.xend.XendAPIConstants import *
|
||||
|
||||
#
|
||||
# Shutdown codes and reasons.
|
||||
#
|
||||
|
||||
DOMAIN_POWEROFF = 0
|
||||
DOMAIN_REBOOT = 1
|
||||
DOMAIN_SUSPEND = 2
|
||||
DOMAIN_CRASH = 3
|
||||
DOMAIN_HALT = 4
|
||||
|
||||
DOMAIN_SHUTDOWN_REASONS = {
|
||||
DOMAIN_POWEROFF: "poweroff",
|
||||
DOMAIN_REBOOT : "reboot",
|
||||
DOMAIN_SUSPEND : "suspend",
|
||||
DOMAIN_CRASH : "crash",
|
||||
DOMAIN_HALT : "halt"
|
||||
}
|
||||
|
||||
restart_modes = [
|
||||
"restart",
|
||||
"destroy",
|
||||
"preserve",
|
||||
"rename-restart"
|
||||
]
|
||||
|
||||
DOM_STATES = [
|
||||
'halted',
|
||||
'paused',
|
||||
'running',
|
||||
'suspended',
|
||||
'shutdown',
|
||||
'unknown',
|
||||
]
|
||||
|
||||
DOM_STATE_HALTED = XEN_API_VM_POWER_STATE_HALTED
|
||||
DOM_STATE_PAUSED = XEN_API_VM_POWER_STATE_PAUSED
|
||||
DOM_STATE_RUNNING = XEN_API_VM_POWER_STATE_RUNNING
|
||||
DOM_STATE_SUSPENDED = XEN_API_VM_POWER_STATE_SUSPENDED
|
||||
DOM_STATE_SHUTDOWN = XEN_API_VM_POWER_STATE_SHUTTINGDOWN
|
||||
DOM_STATE_UNKNOWN = XEN_API_VM_POWER_STATE_UNKNOWN
|
||||
|
||||
DOM_STATES_OLD = [
|
||||
'running',
|
||||
'blocked',
|
||||
'paused',
|
||||
'shutdown',
|
||||
'crashed',
|
||||
'dying'
|
||||
]
|
||||
|
||||
STATE_DOM_OK = 1
|
||||
STATE_DOM_SHUTDOWN = 2
|
||||
|
||||
SHUTDOWN_TIMEOUT = 30.0
|
||||
|
||||
ZOMBIE_PREFIX = 'Zombie-'
|
||||
|
||||
"""Minimum time between domain restarts in seconds."""
|
||||
MINIMUM_RESTART_TIME = 20
|
||||
|
||||
RESTART_IN_PROGRESS = 'xend/restart_in_progress'
|
||||
|
||||
#
|
||||
# Device migration stages (eg. XendDomainInfo, XendCheckpoint, server.tpmif)
|
||||
#
|
||||
|
||||
DEV_MIGRATE_TEST = 0
|
||||
DEV_MIGRATE_STEP1 = 1
|
||||
DEV_MIGRATE_STEP2 = 2
|
||||
DEV_MIGRATE_STEP3 = 3
|
||||
|
||||
#
|
||||
# Xenstore Constants
|
||||
#
|
||||
|
||||
XS_VMROOT = "/vm/"
|
||||
|
||||
@@ -412,7 +412,7 @@ class HVMImageHandler(ImageHandler):
|
||||
""" watch call back on node control/shutdown,
|
||||
if node changed, this function will be called
|
||||
"""
|
||||
from xen.xend.XendDomainInfo import shutdown_reasons
|
||||
from xen.xend.XendConstants import DOMAIN_SHUTDOWN_REASONS
|
||||
xd = xen.xend.XendDomain.instance()
|
||||
vm = xd.domain_lookup( self.vm.getDomid() )
|
||||
|
||||
|
||||
@@ -22,20 +22,17 @@
|
||||
"""
|
||||
|
||||
from xen.xend import sxp
|
||||
from xen.xend import XendRoot
|
||||
from xen.xend.XendLogging import log
|
||||
from xen.xend.XendError import XendError
|
||||
from xen.xend import XendRoot
|
||||
from xen.xend.XendDomainInfo import DEV_MIGRATE_TEST
|
||||
|
||||
from xen.xend.XendConstants import DEV_MIGRATE_TEST
|
||||
from xen.xend.server.DevController import DevController
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
|
||||
|
||||
class TPMifController(DevController):
|
||||
"""TPM interface controller. Handles all TPM devices for a domain.
|
||||
"""
|
||||
|
||||