[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEND][XENAPI] Split Xend global constants out to its own file.



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 59f3891b94b88da40c885ffd2d21232acbc3f598
# Parent  ddcf2632f448c61f6438928ede95b7f8a8f10bff
[XEND][XENAPI] Split Xend global constants out to its own file.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendAPIConstants.py |   75 +++++++++++++++++++++++
 tools/python/xen/xend/XendCheckpoint.py   |    3 
 tools/python/xen/xend/XendConstants.py    |   96 ++++++++++++++++++++++++++++++
 tools/python/xen/xend/image.py            |    2 
 tools/python/xen/xend/server/tpmif.py     |    7 --
 5 files changed, 175 insertions(+), 8 deletions(-)

diff -r ddcf2632f448 -r 59f3891b94b8 tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Thu Oct 05 17:29:19 2006 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py   Thu Oct 05 17:29:19 2006 +0100
@@ -18,8 +18,7 @@ from xen.xend import balloon, sxp
 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"
diff -r ddcf2632f448 -r 59f3891b94b8 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Oct 05 17:29:19 2006 +0100
+++ b/tools/python/xen/xend/image.py    Thu Oct 05 17:29:19 2006 +0100
@@ -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() )
 
diff -r ddcf2632f448 -r 59f3891b94b8 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py     Thu Oct 05 17:29:19 2006 +0100
+++ b/tools/python/xen/xend/server/tpmif.py     Thu Oct 05 17:29:19 2006 +0100
@@ -22,19 +22,16 @@
 """
 
 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.
diff -r ddcf2632f448 -r 59f3891b94b8 tools/python/xen/xend/XendAPIConstants.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/xend/XendAPIConstants.py Thu Oct 05 17:29:19 2006 +0100
@@ -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')
diff -r ddcf2632f448 -r 59f3891b94b8 tools/python/xen/xend/XendConstants.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/xend/XendConstants.py    Thu Oct 05 17:29:19 2006 +0100
@@ -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/"
+

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.