mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
A minimal implementation of the Viridian (Hyper-V) guest interface. The only enlightenments advertised and supported are vAPIC MSRs and long-spin-wait notifications. The set of enlightenments can easily be extended in future, as they are found to provide a performance win, and configured via an extended HVM_PARAM_VIRIDIAN hvm parameter. Signed-off-by: Peter Johnston <peter.johnston@citrix.com> Signed-off-by: Tim Deegan <tim.deegan@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
137 lines
3.3 KiB
Python
137 lines
3.3 KiB
Python
#============================================================================
|
|
# 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"
|
|
}
|
|
REVERSE_DOMAIN_SHUTDOWN_REASONS = \
|
|
dict([(y, x) for x, y in DOMAIN_SHUTDOWN_REASONS.items()])
|
|
|
|
HVM_PARAM_CALLBACK_IRQ = 0
|
|
HVM_PARAM_STORE_PFN = 1
|
|
HVM_PARAM_STORE_EVTCHN = 2
|
|
HVM_PARAM_PAE_ENABLED = 4
|
|
HVM_PARAM_IOREQ_PFN = 5
|
|
HVM_PARAM_BUFIOREQ_PFN = 6
|
|
HVM_PARAM_NVRAM_FD = 7 # ia64
|
|
HVM_PARAM_VHPT_SIZE = 8 # ia64
|
|
HVM_PARAM_BUFPIOREQ_PFN = 9 # ia64
|
|
HVM_PARAM_VIRIDIAN = 9 # x86
|
|
HVM_PARAM_TIMER_MODE = 10
|
|
HVM_PARAM_HPET_ENABLED = 11
|
|
HVM_PARAM_ACPI_S_STATE = 14
|
|
|
|
restart_modes = [
|
|
"restart",
|
|
"destroy",
|
|
"preserve",
|
|
"rename-restart",
|
|
"coredump-destroy",
|
|
"coredump-restart"
|
|
]
|
|
|
|
DOM_STATES = [
|
|
'halted',
|
|
'paused',
|
|
'running',
|
|
'suspended',
|
|
'shutdown',
|
|
'crashed',
|
|
'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_CRASHED = XEN_API_VM_POWER_STATE_CRASHED
|
|
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 = (60.0 * 5)
|
|
|
|
ZOMBIE_PREFIX = 'Zombie-'
|
|
|
|
"""Minimum time between domain restarts in seconds."""
|
|
MINIMUM_RESTART_TIME = 20
|
|
|
|
RESTART_IN_PROGRESS = 'xend/restart_in_progress'
|
|
DUMPCORE_IN_PROGRESS = 'xend/dumpcore_in_progress'
|
|
LAST_SHUTDOWN_REASON = 'xend/last_shutdown_reason'
|
|
|
|
TRIGGER_NMI = 0
|
|
TRIGGER_RESET = 1
|
|
TRIGGER_INIT = 2
|
|
TRIGGER_S3RESUME = 3
|
|
|
|
TRIGGER_TYPE = {
|
|
"nmi" : TRIGGER_NMI,
|
|
"reset" : TRIGGER_RESET,
|
|
"init" : TRIGGER_INIT,
|
|
"s3resume": TRIGGER_S3RESUME
|
|
}
|
|
|
|
#
|
|
# Device migration stages (eg. XendDomainInfo, XendCheckpoint, server.tpmif)
|
|
#
|
|
|
|
DEV_MIGRATE_TEST = 0
|
|
DEV_MIGRATE_STEP1 = 1
|
|
DEV_MIGRATE_STEP2 = 2
|
|
DEV_MIGRATE_STEP3 = 3
|
|
|
|
#
|
|
# VTPM-related constants
|
|
#
|
|
|
|
VTPM_DELETE_SCRIPT = '/etc/xen/scripts/vtpm-delete'
|
|
|
|
#
|
|
# Xenstore Constants
|
|
#
|
|
|
|
XS_VMROOT = "/vm/"
|
|
|