mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Rename XendRoot to XendOptions.
Signed-off-by: John Levon <john.levon@sun.com>
This commit is contained in:
1 parent
292c6bcd6a
commit
2dd9828c75
17 files changed
+63
-63
No files matched your search
@@ -20,7 +20,7 @@
|
||||
"""
|
||||
import os
|
||||
|
||||
import XendRoot
|
||||
import XendOptions
|
||||
|
||||
|
||||
def network(op):
|
||||
@@ -30,7 +30,7 @@ def network(op):
|
||||
"""
|
||||
if op not in ['start', 'stop']:
|
||||
raise ValueError('Invalid operation: ' + op)
|
||||
script = XendRoot.instance().get_network_script()
|
||||
script = XendOptions.instance().get_network_script()
|
||||
if script:
|
||||
script.insert(1, op)
|
||||
os.spawnv(os.P_WAIT, script[0], script)
|
||||
@@ -32,7 +32,7 @@ import threading
|
||||
import xen.lowlevel.xc
|
||||
|
||||
|
||||
from xen.xend import XendRoot, XendCheckpoint, XendDomainInfo
|
||||
from xen.xend import XendOptions, XendCheckpoint, XendDomainInfo
|
||||
from xen.xend.PrettyPrint import prettyprint
|
||||
from xen.xend.XendConfig import XendConfig
|
||||
from xen.xend.XendError import XendError, XendInvalidDomain, VmError
|
||||
@@ -51,7 +51,7 @@ from xen.util import mkdir, security
|
||||
from xen.xend import uuid
|
||||
|
||||
xc = xen.lowlevel.xc.xc()
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
__all__ = [ "XendDomain" ]
|
||||
|
||||
@@ -214,7 +214,7 @@ class XendDomain:
|
||||
@rtype: String
|
||||
@return: Path.
|
||||
"""
|
||||
dom_path = xroot.get_xend_domains_path()
|
||||
dom_path = xoptions.get_xend_domains_path()
|
||||
if domuuid:
|
||||
dom_path = os.path.join(dom_path, domuuid)
|
||||
return dom_path
|
||||
@@ -361,7 +361,7 @@ class XendDomain:
|
||||
|
||||
def _setDom0CPUCount(self):
|
||||
"""Sets the number of VCPUs dom0 has. Retreived from the
|
||||
Xend configuration, L{XendRoot}.
|
||||
Xend configuration, L{XendOptions}.
|
||||
|
||||
@requires: Expects to be protected by domains_lock.
|
||||
@rtype: None
|
||||
@@ -369,7 +369,7 @@ class XendDomain:
|
||||
dom0 = self.privilegedDomain()
|
||||
|
||||
# get max number of vcpus to use for dom0 from config
|
||||
target = int(xroot.get_dom0_vcpus())
|
||||
target = int(xoptions.get_dom0_vcpus())
|
||||
log.debug("number of vcpus to use is %d", target)
|
||||
|
||||
# target == 0 means use all processors
|
||||
@@ -1164,7 +1164,7 @@ class XendDomain:
|
||||
dominfo.checkLiveMigrateMemory()
|
||||
|
||||
if port == 0:
|
||||
port = xroot.get_xend_relocation_port()
|
||||
port = xoptions.get_xend_relocation_port()
|
||||
try:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect((dst, port))
|
||||
|
||||
@@ -38,7 +38,7 @@ from xen.util.blkif import blkdev_uname_to_file
|
||||
from xen.util import security
|
||||
|
||||
from xen.xend import balloon, sxp, uuid, image, arch, osdep
|
||||
from xen.xend import XendRoot, XendNode, XendConfig
|
||||
from xen.xend import XendOptions, XendNode, XendConfig
|
||||
|
||||
from xen.xend.XendConfig import scrub_password
|
||||
from xen.xend.XendBootloader import bootloader
|
||||
@@ -54,7 +54,7 @@ MIGRATE_TIMEOUT = 30.0
|
||||
BOOTLOADER_LOOPBACK_DEVICE = '/dev/xvdp'
|
||||
|
||||
xc = xen.lowlevel.xc.xc()
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
log = logging.getLogger("xend.XendDomainInfo")
|
||||
#log.setLevel(logging.TRACE)
|
||||
@@ -739,7 +739,7 @@ class XendDomainInfo:
|
||||
'domid': str(self.domid),
|
||||
'vm': self.vmpath,
|
||||
'name': self.info['name_label'],
|
||||
'console/limit': str(xroot.get_console_limit() * 1024),
|
||||
'console/limit': str(xoptions.get_console_limit() * 1024),
|
||||
'memory/target': str(self.info['memory_static_min'] * 1024)
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ class XendDomainInfo:
|
||||
self.info['name_label'], self.domid)
|
||||
self._writeVm(LAST_SHUTDOWN_REASON, 'crash')
|
||||
|
||||
if xroot.get_enable_dump():
|
||||
if xoptions.get_enable_dump():
|
||||
try:
|
||||
self.dumpCore()
|
||||
except XendError:
|
||||
|
||||
@@ -24,7 +24,7 @@ from xen.util import Brctl
|
||||
|
||||
from xen.xend import uuid
|
||||
from xen.xend.XendError import XendError, NetworkAlreadyConnected
|
||||
from xen.xend.XendRoot import instance as xendroot
|
||||
from xen.xend.XendOptions import instance as xendoptions
|
||||
from xen.xend.XendStorageRepository import XendStorageRepository
|
||||
from xen.xend.XendLogging import log
|
||||
from xen.xend.XendPIF import *
|
||||
@@ -45,7 +45,7 @@ class XendNode:
|
||||
"""
|
||||
|
||||
self.xc = xen.lowlevel.xc.xc()
|
||||
self.state_store = XendStateStore(xendroot().get_xend_state_path())
|
||||
self.state_store = XendStateStore(xendoptions().get_xend_state_path())
|
||||
|
||||
# load host state from XML file
|
||||
saved_host = self.state_store.load_state('host')
|
||||
|
||||
File renamed without changes.
@@ -24,7 +24,7 @@ import types
|
||||
from encode import *
|
||||
from xen.xend import sxp
|
||||
|
||||
from xen.xend import XendRoot
|
||||
from xen.xend import XendOptions
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
@@ -34,7 +34,7 @@ HTTP_ACCEPTED = 202
|
||||
HTTP_NO_CONTENT = 204
|
||||
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
|
||||
class XendError(RuntimeError):
|
||||
@@ -218,7 +218,7 @@ class UnixXendClientProtocol(HttpXendClientProtocol):
|
||||
|
||||
def __init__(self, path=None):
|
||||
if path is None:
|
||||
path = xroot.get_xend_unix_path()
|
||||
path = xoptions.get_xend_unix_path()
|
||||
self.path = path
|
||||
|
||||
def makeConnection(self, _):
|
||||
|
||||
@@ -22,7 +22,7 @@ import time
|
||||
import xen.lowlevel.xc
|
||||
|
||||
import XendDomain
|
||||
import XendRoot
|
||||
import XendOptions
|
||||
from XendLogging import log
|
||||
from XendError import VmError
|
||||
|
||||
@@ -107,11 +107,11 @@ def free(need_mem):
|
||||
# usage, so we recheck the required alloc each time around the loop, but
|
||||
# track the last used value so that we don't trigger too many watches.
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
xc = xen.lowlevel.xc.xc()
|
||||
|
||||
try:
|
||||
dom0_min_mem = xroot.get_dom0_min_mem() * 1024
|
||||
dom0_min_mem = xoptions.get_dom0_min_mem() * 1024
|
||||
|
||||
retries = 0
|
||||
sleep_time = SLEEP_TIME_GROWTH
|
||||
|
||||
@@ -461,14 +461,14 @@ class HVMImageHandler(ImageHandler):
|
||||
vnclisten = imageConfig.get('vnclisten')
|
||||
|
||||
if not(vnclisten):
|
||||
vnclisten = (xen.xend.XendRoot.instance().
|
||||
vnclisten = (xen.xend.XendOptions.instance().
|
||||
get_vnclisten_address())
|
||||
if vnclisten:
|
||||
ret += ['-vnclisten', vnclisten]
|
||||
|
||||
vncpasswd = vncpasswd_vmconfig
|
||||
if vncpasswd is None:
|
||||
vncpasswd = (xen.xend.XendRoot.instance().
|
||||
vncpasswd = (xen.xend.XendOptions.instance().
|
||||
get_vncpasswd_default())
|
||||
if vncpasswd is None:
|
||||
raise VmError('vncpasswd is not set up in ' +
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
from threading import Event
|
||||
import types
|
||||
|
||||
from xen.xend import sxp, XendRoot
|
||||
from xen.xend import sxp, XendOptions
|
||||
from xen.xend.XendError import VmError
|
||||
from xen.xend.XendLogging import log
|
||||
|
||||
@@ -50,7 +50,7 @@ xenbusState = {
|
||||
'Closed' : 6,
|
||||
}
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
xenbusState.update(dict(zip(xenbusState.values(), xenbusState.keys())))
|
||||
|
||||
@@ -324,7 +324,7 @@ class DevController:
|
||||
Make sure that the migration has finished and only
|
||||
then return from the call.
|
||||
"""
|
||||
tool = xroot.get_external_migration_tool()
|
||||
tool = xoptions.get_external_migration_tool()
|
||||
if tool:
|
||||
log.info("Calling external migration tool for step %d" % step)
|
||||
fd = os.popen("%s -type %s -step %d -host %s -domname %s" %
|
||||
@@ -341,7 +341,7 @@ class DevController:
|
||||
""" Recover from device migration. The given step was the
|
||||
last one that was successfully executed.
|
||||
"""
|
||||
tool = xroot.get_external_migration_tool()
|
||||
tool = xoptions.get_external_migration_tool()
|
||||
if tool:
|
||||
log.info("Calling external migration tool")
|
||||
fd = os.popen("%s -type %s -step %d -host %s -domname %s -recover" %
|
||||
|
||||
@@ -25,7 +25,7 @@ class SrvRoot(SrvDir):
|
||||
"""Server sub-components. Each entry is (name, class), where
|
||||
'name' is the entry name and 'class' is the name of its class.
|
||||
"""
|
||||
#todo Get this list from the XendRoot config.
|
||||
#todo Get this list from the XendOptions config.
|
||||
subdirs = [
|
||||
('node', 'SrvNode' ),
|
||||
('domain', 'SrvDomainDir' ),
|
||||
|
||||
@@ -48,7 +48,7 @@ from threading import Thread
|
||||
|
||||
from xen.web.httpserver import HttpServer, UnixHttpServer
|
||||
|
||||
from xen.xend import XendNode, XendRoot, XendAPI
|
||||
from xen.xend import XendNode, XendOptions, XendAPI
|
||||
from xen.xend import Vifctl
|
||||
from xen.xend.XendLogging import log
|
||||
from xen.xend.XendClient import XEN_API_SOCKET
|
||||
@@ -57,7 +57,7 @@ from xen.web.SrvDir import SrvDir
|
||||
from SrvRoot import SrvRoot
|
||||
from XMLRPCServer import XMLRPCServer
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
|
||||
class XendServers:
|
||||
@@ -165,7 +165,7 @@ class XendServers:
|
||||
log.info("Restarting all XML-RPC and Xen-API servers...")
|
||||
self.cleaningUp = False
|
||||
self.reloadingConfig = False
|
||||
xroot.set_config()
|
||||
xoptions.set_config()
|
||||
new_servers = [x for x in self.servers
|
||||
if isinstance(x, HttpServer)]
|
||||
self.servers = new_servers
|
||||
@@ -174,16 +174,16 @@ class XendServers:
|
||||
break
|
||||
|
||||
def _loadConfig(servers, root, reload):
|
||||
if not reload and xroot.get_xend_http_server():
|
||||
if not reload and xoptions.get_xend_http_server():
|
||||
servers.add(HttpServer(root,
|
||||
xroot.get_xend_address(),
|
||||
xroot.get_xend_port()))
|
||||
if not reload and xroot.get_xend_unix_server():
|
||||
path = xroot.get_xend_unix_path()
|
||||
xoptions.get_xend_address(),
|
||||
xoptions.get_xend_port()))
|
||||
if not reload and xoptions.get_xend_unix_server():
|
||||
path = xoptions.get_xend_unix_path()
|
||||
log.info('unix path=' + path)
|
||||
servers.add(UnixHttpServer(root, path))
|
||||
|
||||
api_cfg = xroot.get_xen_api_server()
|
||||
api_cfg = xoptions.get_xen_api_server()
|
||||
if api_cfg:
|
||||
try:
|
||||
addrs = [(str(x[0]).split(':'),
|
||||
@@ -218,10 +218,10 @@ def _loadConfig(servers, root, reload):
|
||||
except TypeError, exn:
|
||||
log.error('Xen-API server configuration %s is invalid.', api_cfg)
|
||||
|
||||
if xroot.get_xend_tcp_xmlrpc_server():
|
||||
if xoptions.get_xend_tcp_xmlrpc_server():
|
||||
servers.add(XMLRPCServer(XendAPI.AUTH_PAM, False, True))
|
||||
|
||||
if xroot.get_xend_unix_xmlrpc_server():
|
||||
if xoptions.get_xend_unix_xmlrpc_server():
|
||||
servers.add(XMLRPCServer(XendAPI.AUTH_PAM, False))
|
||||
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ import os
|
||||
import random
|
||||
import re
|
||||
|
||||
from xen.xend import XendRoot
|
||||
from xen.xend import XendOptions
|
||||
from xen.xend.server.DevController import DevController
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
def randomMAC():
|
||||
"""Generate a random MAC address.
|
||||
@@ -138,8 +138,8 @@ class NetifController(DevController):
|
||||
def getDeviceDetails(self, config):
|
||||
"""@see DevController.getDeviceDetails"""
|
||||
|
||||
script = os.path.join(xroot.network_script_dir,
|
||||
config.get('script', xroot.get_vif_script()))
|
||||
script = os.path.join(xoptions.network_script_dir,
|
||||
config.get('script', xoptions.get_vif_script()))
|
||||
typ = config.get('type')
|
||||
bridge = config.get('bridge')
|
||||
mac = config.get('mac')
|
||||
@@ -190,7 +190,7 @@ class NetifController(DevController):
|
||||
(script, ip, bridge, mac, typ, vifname, rate, uuid) = devinfo
|
||||
|
||||
if script:
|
||||
network_script_dir = xroot.network_script_dir + os.sep
|
||||
network_script_dir = xoptions.network_script_dir + os.sep
|
||||
result['script'] = script.replace(network_script_dir, "")
|
||||
if ip:
|
||||
result['ip'] = ip
|
||||
|
||||
@@ -24,7 +24,7 @@ from xen.web import protocol, tcp, unix
|
||||
|
||||
from xen.xend import sxp
|
||||
from xen.xend import XendDomain
|
||||
from xen.xend import XendRoot
|
||||
from xen.xend import XendOptions
|
||||
from xen.xend.XendError import XendError
|
||||
from xen.xend.XendLogging import log
|
||||
|
||||
@@ -114,15 +114,15 @@ class RelocationProtocol(protocol.Protocol):
|
||||
|
||||
|
||||
def listenRelocation():
|
||||
xroot = XendRoot.instance()
|
||||
if xroot.get_xend_unix_server():
|
||||
xoptions = XendOptions.instance()
|
||||
if xoptions.get_xend_unix_server():
|
||||
path = '/var/lib/xend/relocation-socket'
|
||||
unix.UnixListener(path, RelocationProtocol)
|
||||
if xroot.get_xend_relocation_server():
|
||||
port = xroot.get_xend_relocation_port()
|
||||
interface = xroot.get_xend_relocation_address()
|
||||
if xoptions.get_xend_relocation_server():
|
||||
port = xoptions.get_xend_relocation_port()
|
||||
interface = xoptions.get_xend_relocation_address()
|
||||
|
||||
hosts_allow = xroot.get_xend_relocation_hosts_allow()
|
||||
hosts_allow = xoptions.get_xend_relocation_hosts_allow()
|
||||
if hosts_allow == '':
|
||||
hosts_allow = None
|
||||
else:
|
||||
|
||||
@@ -2,9 +2,9 @@ import os
|
||||
import re
|
||||
import unittest
|
||||
|
||||
import xen.xend.XendRoot
|
||||
import xen.xend.XendOptions
|
||||
|
||||
xen.xend.XendRoot.XendRoot.config_default = '/dev/null'
|
||||
xen.xend.XendOptions.XendOptions.config_default = '/dev/null'
|
||||
|
||||
from xen.xend.server import netif
|
||||
|
||||
@@ -13,7 +13,7 @@ FAKE_DOMID = 42
|
||||
FAKE_DEVID = 63
|
||||
|
||||
|
||||
xroot = xen.xend.XendRoot.instance()
|
||||
xoptions = xen.xend.XendOptions.instance()
|
||||
|
||||
|
||||
class test_controllers(unittest.TestCase):
|
||||
@@ -36,8 +36,8 @@ class test_controllers(unittest.TestCase):
|
||||
|
||||
self.assertEqual(backdets['handle'], str(FAKE_DEVID))
|
||||
self.assertEqual(backdets['script'],
|
||||
os.path.join(xroot.network_script_dir,
|
||||
xroot.get_vif_script()))
|
||||
os.path.join(xoptions.network_script_dir,
|
||||
xoptions.get_vif_script()))
|
||||
self.assertValidMac(backdets['mac'], expectedMac)
|
||||
|
||||
self.assertEqual(frontdets['handle'], str(FAKE_DEVID))
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
"""Support for virtual TPM interfaces."""
|
||||
|
||||
from xen.xend import XendRoot
|
||||
from xen.xend import XendOptions
|
||||
from xen.xend.XendLogging import log
|
||||
from xen.xend.XendError import XendError
|
||||
from xen.xend.XendConstants import DEV_MIGRATE_TEST, VTPM_DELETE_SCRIPT
|
||||
@@ -29,7 +29,7 @@ from xen.xend.server.DevController import DevController
|
||||
import os
|
||||
import re
|
||||
|
||||
xroot = XendRoot.instance()
|
||||
xoptions = XendOptions.instance()
|
||||
|
||||
def destroy_vtpmstate(name):
|
||||
if os.path.exists(VTPM_DELETE_SCRIPT):
|
||||
@@ -88,7 +88,7 @@ class TPMifController(DevController):
|
||||
def migrate(self, deviceConfig, network, dst, step, domName):
|
||||
"""@see DevContoller.migrate"""
|
||||
if network:
|
||||
tool = xroot.get_external_migration_tool()
|
||||
tool = xoptions.get_external_migration_tool()
|
||||
if tool != '':
|
||||
log.info("Request to network-migrate device to %s. step=%d.",
|
||||
dst, step)
|
||||
@@ -116,7 +116,7 @@ class TPMifController(DevController):
|
||||
def recover_migrate(self, deviceConfig, network, dst, step, domName):
|
||||
"""@see DevContoller.recover_migrate"""
|
||||
if network:
|
||||
tool = xroot.get_external_migration_tool()
|
||||
tool = xoptions.get_external_migration_tool()
|
||||
if tool != '':
|
||||
log.info("Request to recover network-migrated device. last good step=%d.",
|
||||
step)
|
||||
|
||||
@@ -52,7 +52,7 @@ class VfbifController(DevController):
|
||||
if config.has_key("vncpasswd"):
|
||||
passwd = config["vncpasswd"]
|
||||
else:
|
||||
passwd = xen.xend.XendRoot.instance().get_vncpasswd_default()
|
||||
passwd = xen.xend.XendOptions.instance().get_vncpasswd_default()
|
||||
if passwd:
|
||||
self.vm.storeVm("vncpasswd", passwd)
|
||||
log.debug("Stored a VNC password for vfb access")
|
||||
@@ -66,7 +66,7 @@ class VfbifController(DevController):
|
||||
elif config.has_key("vncdisplay"):
|
||||
args += ["--vncport", "%d" % (5900 + int(config["vncdisplay"]))]
|
||||
vnclisten = config.get("vnclisten",
|
||||
xen.xend.XendRoot.instance().get_vnclisten_address())
|
||||
xen.xend.XendOptions.instance().get_vnclisten_address())
|
||||
args += [ "--listen", vnclisten ]
|
||||
spawn_detached(args[0], args + std_args, os.environ)
|
||||
elif t == "sdl":
|
||||
|
||||
@@ -3,9 +3,9 @@ import os.path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import xen.xend.XendRoot
|
||||
import xen.xend.XendOptions
|
||||
|
||||
xen.xend.XendRoot.XendRoot.config_default = '/dev/null'
|
||||
xen.xend.XendOptions.XendOptions.config_default = '/dev/null'
|
||||
|
||||
import xen.xm.create
|
||||
|
||||
|
||||