This commit is contained in:
cl349@firebug.cl.cam.ac.uk committed 2005-08-02 17:13:11 +00:00
commit d16ff05a08
42 files changed
+2610 -1190

No files matched your search

+5 -2
View File
@@ -24,8 +24,8 @@ def blkdev_name_to_number(name):
log.debug("exception looking up device number for %s: %s", name, ex)
pass
if re.match( '/dev/sd[a-p]([0-9]|1[0-5])', n):
return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:])
if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?', n):
return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]
@@ -33,6 +33,9 @@ def blkdev_name_to_number(name):
minor = ((ord(n[7:8]) - ord('a')) % 2) * 64 + int(n[8:] or 0)
return major * 256 + minor
if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n):
return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0)
# see if this is a hex device number
if re.match( '^(0x)?[0-9a-fA-F]+$', name ):
return string.atoi(name,16)
+16 -5
View File
@@ -152,6 +152,9 @@ class XendDomainInfo:
vm = cls(db)
vm.construct(config)
vm.saveToDB(sync=True)
# Flush info to xenstore immediately
vm.exportToDB()
return vm
create = classmethod(create)
@@ -172,6 +175,7 @@ class XendDomainInfo:
log.debug('config=' + prettyprintstring(config))
vm.memory = info['mem_kb']/1024
vm.target = info['mem_kb'] * 1024
if config:
try:
@@ -222,6 +226,7 @@ class XendDomainInfo:
DBVar('restart_state', ty='str'),
DBVar('restart_time', ty='float'),
DBVar('restart_count', ty='int'),
DBVar('target', ty='long', path="memory/target"),
]
def __init__(self, db):
@@ -240,6 +245,8 @@ class XendDomainInfo:
self.ssidref = None
self.image = None
self.target = None
self.channel = None
self.store_channel = None
self.store_mfn = None
@@ -315,6 +322,7 @@ class XendDomainInfo:
self.info = info
self.memory = self.info['mem_kb'] / 1024
self.ssidref = self.info['ssidref']
self.target = self.info['mem_kb'] * 1024
def state_set(self, state):
self.state_updated.acquire()
@@ -399,7 +407,8 @@ class XendDomainInfo:
['id', self.id],
['name', self.name],
['memory', self.memory],
['ssidref', self.ssidref] ]
['ssidref', self.ssidref],
['target', self.target] ]
if self.uuid:
sxpr.append(['uuid', self.uuid])
if self.info:
@@ -536,6 +545,7 @@ class XendDomainInfo:
self.memory = int(sxp.child_value(config, 'memory'))
if self.memory is None:
raise VmError('missing memory size')
self.target = self.memory * (1 << 20)
self.ssidref = int(sxp.child_value(config, 'ssidref'))
cpu = sxp.child_value(config, 'cpu')
if self.recreate and self.id and cpu is not None and int(cpu) >= 0:
@@ -947,11 +957,12 @@ class XendDomainInfo:
index[field_name] = field_index + 1
def mem_target_set(self, target):
"""Set domain memory target in pages.
"""Set domain memory target in bytes.
"""
if self.channel:
msg = messages.packMsg('mem_request_t', { 'target' : target * (1 << 8)} )
self.channel.writeRequest(msg)
if target:
self.target = target * (1 << 20)
# Commit to XenStore immediately
self.exportToDB()
def vcpu_hotplug(self, vcpu, state):
"""Disable or enable VCPU in domain.
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.