ia64/xen-unstable
changeset 6835:5cbb2ecce16a
Move id back into main domain dir and rename to domid.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author | cl349@firebug.cl.cam.ac.uk |
---|---|
date | Wed Sep 14 15:10:22 2005 +0000 (2005-09-14) |
parents | e2f0a6fdb7d9 |
children | 2277377dfc3a |
files | tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/netif.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py |
line diff
1.1 --- a/tools/python/xen/xend/XendCheckpoint.py Wed Sep 14 14:43:34 2005 +0000 1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py Wed Sep 14 15:10:22 2005 +0000 1.3 @@ -49,7 +49,7 @@ def save(xd, fd, dominfo, live): 1.4 # simply uses the defaults compiled into libxenguest; see the comments 1.5 # and/or code in xc_linux_save() for more information. 1.6 cmd = [PATH_XC_SAVE, str(xc.handle()), str(fd), 1.7 - str(dominfo.id), "0", "0", str(int(live)) ] 1.8 + str(dominfo.domid), "0", "0", str(int(live)) ] 1.9 log.info("[xc_save] " + join(cmd)) 1.10 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 1.11 1.12 @@ -69,10 +69,10 @@ def save(xd, fd, dominfo, live): 1.13 if fd == child.fromchild.fileno(): 1.14 l = child.fromchild.readline() 1.15 if l.rstrip() == "suspend": 1.16 - log.info("suspending %d" % dominfo.id) 1.17 - xd.domain_shutdown(dominfo.id, reason='suspend') 1.18 + log.info("suspending %d" % dominfo.domid) 1.19 + xd.domain_shutdown(dominfo.domid, reason='suspend') 1.20 dominfo.state_wait("suspended") 1.21 - log.info("suspend %d done" % dominfo.id) 1.22 + log.info("suspend %d done" % dominfo.domid) 1.23 child.tochild.write("done\n") 1.24 child.tochild.flush() 1.25 if filter(lambda (fd, event): event & select.POLLHUP, r): 1.26 @@ -84,7 +84,7 @@ def save(xd, fd, dominfo, live): 1.27 raise XendError("xc_save failed: %s" % lasterr) 1.28 1.29 dominfo.setStoreChannel(None) 1.30 - xd.domain_destroy(dominfo.id) 1.31 + xd.domain_destroy(dominfo.domid) 1.32 return None 1.33 1.34 def restore(xd, fd): 1.35 @@ -126,7 +126,7 @@ def restore(xd, fd): 1.36 console_evtchn = 0 1.37 1.38 cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd), 1.39 - str(dominfo.id), str(nr_pfns), 1.40 + str(dominfo.domid), str(nr_pfns), 1.41 str(store_evtchn), str(console_evtchn)] 1.42 log.info("[xc_restore] " + join(cmd)) 1.43 child = xPopen3(cmd, True, -1, [fd, xc.handle()]) 1.44 @@ -154,7 +154,7 @@ def restore(xd, fd): 1.45 if dominfo.store_channel: 1.46 dominfo.setStoreRef(int(m.group(2))) 1.47 if dominfo.store_mfn >= 0: 1.48 - IntroduceDomain(dominfo.id, 1.49 + IntroduceDomain(dominfo.domid, 1.50 dominfo.store_mfn, 1.51 dominfo.store_channel.port1, 1.52 dominfo.path)
2.1 --- a/tools/python/xen/xend/XendDomain.py Wed Sep 14 14:43:34 2005 +0000 2.2 +++ b/tools/python/xen/xend/XendDomain.py Wed Sep 14 15:10:22 2005 +0000 2.3 @@ -134,15 +134,17 @@ class XendDomain: 2.4 continue 2.5 db = domdb.addChild("xend") 2.6 try: 2.7 - domid = int(db.id) 2.8 + domid = int(domdb["domid"].getData()) 2.9 except: 2.10 + log.info("fuck off") 2.11 domid = None 2.12 # XXX if domid in self.domains, then something went wrong 2.13 if (domid is None) or (domid in self.domains): 2.14 domdb.delete() 2.15 elif domid in doms: 2.16 try: 2.17 - self._new_domain(domdb["uuid"].getData(), db, doms[domid]) 2.18 + self._new_domain(domdb["uuid"].getData(), domid, db, 2.19 + doms[domid]) 2.20 except Exception, ex: 2.21 log.exception("Error recreating domain info: id=%d", domid) 2.22 self._delete_domain(domid) 2.23 @@ -158,15 +160,15 @@ class XendDomain: 2.24 def close(self): 2.25 pass 2.26 2.27 - def _new_domain(self, uuid, db, info): 2.28 + def _new_domain(self, uuid, domid, db, info): 2.29 """Create a domain entry from saved info. 2.30 2.31 @param db: saved info from the db 2.32 @param info: domain info from xen 2.33 @return: domain 2.34 """ 2.35 - dominfo = XendDomainInfo.recreate(uuid, db, info) 2.36 - self.domains[dominfo.id] = dominfo 2.37 + dominfo = XendDomainInfo.recreate(uuid, domid, db, info) 2.38 + self.domains[dominfo.domid] = dominfo 2.39 return dominfo 2.40 2.41 def _add_domain(self, info, notify=True): 2.42 @@ -177,15 +179,15 @@ class XendDomain: 2.43 """ 2.44 # Remove entries under the wrong id. 2.45 for i, d in self.domains.items(): 2.46 - if i != d.id: 2.47 + if i != d.domid: 2.48 del self.domains[i] 2.49 self.dbmap.delete(d.uuid) 2.50 - if info.id in self.domains: 2.51 + if info.domid in self.domains: 2.52 notify = False 2.53 - self.domains[info.id] = info 2.54 + self.domains[info.domid] = info 2.55 info.exportToDB(save=True) 2.56 if notify: 2.57 - eserver.inject('xend.domain.create', [info.name, info.id]) 2.58 + eserver.inject('xend.domain.create', [info.name, info.domid]) 2.59 2.60 def _delete_domain(self, id, notify=True): 2.61 """Remove a domain from the tables. 2.62 @@ -204,14 +206,14 @@ class XendDomain: 2.63 info.cleanup() 2.64 info.delete() 2.65 if notify: 2.66 - eserver.inject('xend.domain.died', [info.name, info.id]) 2.67 + eserver.inject('xend.domain.died', [info.name, info.domid]) 2.68 # XXX this should not be needed 2.69 for domdb in self.dbmap.values(): 2.70 if not domdb.has_key("xend"): 2.71 continue 2.72 db = domdb.addChild("xend") 2.73 try: 2.74 - domid = int(db.id) 2.75 + domid = int(domdb["domid"].getData()) 2.76 except: 2.77 domid = None 2.78 if (domid is None) or (domid == id): 2.79 @@ -267,13 +269,13 @@ class XendDomain: 2.80 # Update entries for existing domains. 2.81 do_domain_restarts = False 2.82 for d in self.domains.values(): 2.83 - info = doms.get(d.id) 2.84 + info = doms.get(d.domid) 2.85 if info: 2.86 d.update(info) 2.87 elif d.restart_pending(): 2.88 do_domain_restarts = True 2.89 else: 2.90 - self._delete_domain(d.id) 2.91 + self._delete_domain(d.domid) 2.92 if cleanup and do_domain_restarts: 2.93 scheduler.now(self.domain_restarts) 2.94 2.95 @@ -304,20 +306,20 @@ class XendDomain: 2.96 2.97 @param dominfo: domain object 2.98 """ 2.99 - log.info("Restarting domain: name=%s id=%s", dominfo.name, dominfo.id) 2.100 + log.info("Restarting domain: name=%s id=%s", dominfo.name, dominfo.domid) 2.101 eserver.inject("xend.domain.restart", 2.102 - [dominfo.name, dominfo.id, "begin"]) 2.103 + [dominfo.name, dominfo.domid, "begin"]) 2.104 try: 2.105 dominfo.restart() 2.106 - log.info('Restarted domain name=%s id=%s', dominfo.name, dominfo.id) 2.107 + log.info('Restarted domain name=%s id=%s', dominfo.name, dominfo.domid) 2.108 eserver.inject("xend.domain.restart", 2.109 - [dominfo.name, dominfo.id, "success"]) 2.110 - self.domain_unpause(dominfo.id) 2.111 + [dominfo.name, dominfo.domid, "success"]) 2.112 + self.domain_unpause(dominfo.domid) 2.113 except Exception, ex: 2.114 log.exception("Exception restarting domain: name=%s id=%s", 2.115 - dominfo.name, dominfo.id) 2.116 + dominfo.name, dominfo.domid) 2.117 eserver.inject("xend.domain.restart", 2.118 - [dominfo.name, dominfo.id, "fail"]) 2.119 + [dominfo.name, dominfo.domid, "fail"]) 2.120 return dominfo 2.121 2.122 def domain_configure(self, vmconfig): 2.123 @@ -362,11 +364,11 @@ class XendDomain: 2.124 "Creating entry for unknown domain: id=%d uuid=%s", 2.125 id, uuid) 2.126 db = self.dbmap.addChild("%s/xend" % uuid) 2.127 - dominfo = XendDomainInfo.recreate(uuid, db, info) 2.128 - dominfo.setdom(id) 2.129 + dominfo = XendDomainInfo.recreate(uuid, id, db, info) 2.130 self._add_domain(dominfo) 2.131 return dominfo 2.132 except Exception, ex: 2.133 + raise 2.134 log.exception("Error creating domain info: id=%d", id) 2.135 return None 2.136 2.137 @@ -389,9 +391,9 @@ class XendDomain: 2.138 @param id: domain id 2.139 """ 2.140 dominfo = self.domain_lookup(id) 2.141 - eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.id]) 2.142 + eserver.inject('xend.domain.unpause', [dominfo.name, dominfo.domid]) 2.143 try: 2.144 - return xc.domain_unpause(dom=dominfo.id) 2.145 + return xc.domain_unpause(dom=dominfo.domid) 2.146 except Exception, ex: 2.147 raise XendError(str(ex)) 2.148 2.149 @@ -401,9 +403,9 @@ class XendDomain: 2.150 @param id: domain id 2.151 """ 2.152 dominfo = self.domain_lookup(id) 2.153 - eserver.inject('xend.domain.pause', [dominfo.name, dominfo.id]) 2.154 + eserver.inject('xend.domain.pause', [dominfo.name, dominfo.domid]) 2.155 try: 2.156 - return xc.domain_pause(dom=dominfo.id) 2.157 + return xc.domain_pause(dom=dominfo.domid) 2.158 except Exception, ex: 2.159 raise XendError(str(ex)) 2.160 2.161 @@ -419,8 +421,8 @@ class XendDomain: 2.162 @param reason: shutdown type: poweroff, reboot, suspend, halt 2.163 """ 2.164 dominfo = self.domain_lookup(id) 2.165 - self.domain_restart_schedule(dominfo.id, reason, force=True) 2.166 - eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.id, reason]) 2.167 + self.domain_restart_schedule(dominfo.domid, reason, force=True) 2.168 + eserver.inject('xend.domain.shutdown', [dominfo.name, dominfo.domid, reason]) 2.169 if reason == 'halt': 2.170 reason = 'poweroff' 2.171 val = dominfo.shutdown(reason) 2.172 @@ -444,7 +446,7 @@ class XendDomain: 2.173 if not dominfo.shutdown_pending: 2.174 # domain doesn't need shutdown 2.175 continue 2.176 - id = dominfo.id 2.177 + id = dominfo.domid 2.178 left = dominfo.shutdown_time_left(SHUTDOWN_TIMEOUT) 2.179 if left <= 0: 2.180 # Shutdown expired - destroy domain. 2.181 @@ -475,15 +477,15 @@ class XendDomain: 2.182 restart = (force and reason == 'reboot') or dominfo.restart_needed(reason) 2.183 if restart: 2.184 log.info('Scheduling restart for domain: name=%s id=%s', 2.185 - dominfo.name, dominfo.id) 2.186 + dominfo.name, dominfo.domid) 2.187 eserver.inject("xend.domain.restart", 2.188 - [dominfo.name, dominfo.id, "schedule"]) 2.189 + [dominfo.name, dominfo.domid, "schedule"]) 2.190 dominfo.restarting() 2.191 else: 2.192 log.info('Cancelling restart for domain: name=%s id=%s', 2.193 - dominfo.name, dominfo.id) 2.194 + dominfo.name, dominfo.domid) 2.195 eserver.inject("xend.domain.restart", 2.196 - [dominfo.name, dominfo.id, "cancel"]) 2.197 + [dominfo.name, dominfo.domid, "cancel"]) 2.198 dominfo.restart_cancel() 2.199 2.200 def domain_restarts(self): 2.201 @@ -493,8 +495,8 @@ class XendDomain: 2.202 for dominfo in self.domains.values(): 2.203 if not dominfo.restart_pending(): 2.204 continue 2.205 - print 'domain_restarts>', dominfo.name, dominfo.id 2.206 - info = doms.get(dominfo.id) 2.207 + print 'domain_restarts>', dominfo.name, dominfo.domid 2.208 + info = doms.get(dominfo.domid) 2.209 if info: 2.210 # Don't execute restart for domains still running. 2.211 print 'domain_restarts> still runnning: ', dominfo.name 2.212 @@ -511,7 +513,7 @@ class XendDomain: 2.213 try: 2.214 dominfo = self.domain_lookup(id) 2.215 log.info('Destroying domain: name=%s', dominfo.name) 2.216 - eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.id]) 2.217 + eserver.inject('xend.domain.destroy', [dominfo.name, dominfo.domid]) 2.218 val = dominfo.destroy() 2.219 except: 2.220 #todo 2.221 @@ -586,7 +588,7 @@ class XendDomain: 2.222 """ 2.223 dominfo = self.domain_lookup(id) 2.224 try: 2.225 - return xc.domain_pincpu(dominfo.id, vcpu, cpumap) 2.226 + return xc.domain_pincpu(dominfo.domid, vcpu, cpumap) 2.227 except Exception, ex: 2.228 raise XendError(str(ex)) 2.229 2.230 @@ -595,7 +597,7 @@ class XendDomain: 2.231 """ 2.232 dominfo = self.domain_lookup(id) 2.233 try: 2.234 - return xc.bvtsched_domain_set(dom=dominfo.id, mcuadv=mcuadv, 2.235 + return xc.bvtsched_domain_set(dom=dominfo.domid, mcuadv=mcuadv, 2.236 warpback=warpback, warpvalue=warpvalue, 2.237 warpl=warpl, warpu=warpu) 2.238 except Exception, ex: 2.239 @@ -606,7 +608,7 @@ class XendDomain: 2.240 """ 2.241 dominfo = self.domain_lookup(id) 2.242 try: 2.243 - return xc.bvtsched_domain_get(dominfo.id) 2.244 + return xc.bvtsched_domain_get(dominfo.domid) 2.245 except Exception, ex: 2.246 raise XendError(str(ex)) 2.247 2.248 @@ -616,7 +618,7 @@ class XendDomain: 2.249 """ 2.250 dominfo = self.domain_lookup(id) 2.251 try: 2.252 - return xc.sedf_domain_set(dominfo.id, period, slice, latency, extratime, weight) 2.253 + return xc.sedf_domain_set(dominfo.domid, period, slice, latency, extratime, weight) 2.254 except Exception, ex: 2.255 raise XendError(str(ex)) 2.256 2.257 @@ -625,7 +627,7 @@ class XendDomain: 2.258 """ 2.259 dominfo = self.domain_lookup(id) 2.260 try: 2.261 - return xc.sedf_domain_get(dominfo.id) 2.262 + return xc.sedf_domain_get(dominfo.domid) 2.263 except Exception, ex: 2.264 raise XendError(str(ex)) 2.265 2.266 @@ -715,7 +717,7 @@ class XendDomain: 2.267 """ 2.268 dominfo = self.domain_lookup(id) 2.269 try: 2.270 - return xc.shadow_control(dominfo.id, op) 2.271 + return xc.shadow_control(dominfo.domid, op) 2.272 except Exception, ex: 2.273 raise XendError(str(ex)) 2.274 2.275 @@ -729,7 +731,7 @@ class XendDomain: 2.276 dominfo = self.domain_lookup(id) 2.277 maxmem = int(mem) * 1024 2.278 try: 2.279 - return xc.domain_setmaxmem(dominfo.id, maxmem_kb = maxmem) 2.280 + return xc.domain_setmaxmem(dominfo.domid, maxmem_kb = maxmem) 2.281 except Exception, ex: 2.282 raise XendError(str(ex)) 2.283 2.284 @@ -761,12 +763,12 @@ class XendDomain: 2.285 @param id: domain 2.286 """ 2.287 dominfo = self.domain_lookup(id) 2.288 - corefile = "/var/xen/dump/%s.%s.core"% (dominfo.name, dominfo.id) 2.289 + corefile = "/var/xen/dump/%s.%s.core"% (dominfo.name, dominfo.domid) 2.290 try: 2.291 - xc.domain_dumpcore(dom=dominfo.id, corefile=corefile) 2.292 + xc.domain_dumpcore(dom=dominfo.domid, corefile=corefile) 2.293 except Exception, ex: 2.294 log.warning("Dumpcore failed, id=%s name=%s: %s", 2.295 - dominfo.id, dominfo.name, ex) 2.296 + dominfo.domid, dominfo.name, ex) 2.297 2.298 def instance(): 2.299 """Singleton constructor. Use this instead of the class constructor.
3.1 --- a/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 14:43:34 2005 +0000 3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Sep 14 15:10:22 2005 +0000 3.3 @@ -140,16 +140,15 @@ class XendDomainInfo: 3.4 3.5 create = classmethod(create) 3.6 3.7 - def recreate(cls, uuid, db, info): 3.8 + def recreate(cls, uuid, domid, db, info): 3.9 """Create the VM object for an existing domain. 3.10 3.11 @param db: domain db 3.12 @param info: domain info from xc 3.13 """ 3.14 - dom = info['dom'] 3.15 path = "/".join(db.getPath().split("/")[0:-2]) 3.16 vm = cls(uuid, path, db) 3.17 - vm.setdom(dom) 3.18 + vm.setDomid(domid) 3.19 try: 3.20 db.readDB() 3.21 except: pass 3.22 @@ -168,7 +167,7 @@ class XendDomainInfo: 3.23 finally: 3.24 vm.recreate = False 3.25 else: 3.26 - vm.setName("Domain-%d" % dom) 3.27 + vm.setName("Domain-%d" % domid) 3.28 3.29 vm.exportToDB(save=True) 3.30 return vm 3.31 @@ -190,7 +189,7 @@ class XendDomainInfo: 3.32 ssidref = int(sxp.child_value(config, 'ssidref')) 3.33 log.debug('restoring with ssidref='+str(ssidref)) 3.34 id = xc.domain_create(ssidref = ssidref) 3.35 - vm.setdom(id) 3.36 + vm.setDomid(id) 3.37 vm.clear_shutdown() 3.38 try: 3.39 vm.restore = True 3.40 @@ -203,7 +202,6 @@ class XendDomainInfo: 3.41 restore = classmethod(restore) 3.42 3.43 __exports__ = [ 3.44 - DBVar('id', ty='int'), 3.45 DBVar('name', ty='str'), 3.46 DBVar('config', ty='sxpr'), 3.47 DBVar('start_time', ty='float'), 3.48 @@ -225,7 +223,7 @@ class XendDomainInfo: 3.49 self.restore = 0 3.50 3.51 self.config = None 3.52 - self.id = None 3.53 + self.domid = None 3.54 self.cpu_weight = 1 3.55 self.start_time = None 3.56 self.name = None 3.57 @@ -281,16 +279,16 @@ class XendDomainInfo: 3.58 self.db.importFromDB(self, fields=self.__exports__) 3.59 self.store_channel = self.eventChannel("store/port") 3.60 3.61 - def setdom(self, dom): 3.62 + def setDomid(self, domid): 3.63 """Set the domain id. 3.64 3.65 @param dom: domain id 3.66 """ 3.67 - self.id = int(dom) 3.68 - #self.db.id = self.id 3.69 + self.domid = domid 3.70 + xstransact.Write(self.path, "domid", "%i" % self.domid) 3.71 3.72 def getDomain(self): 3.73 - return self.id 3.74 + return self.domid 3.75 3.76 def setName(self, name): 3.77 self.name = name 3.78 @@ -332,7 +330,7 @@ class XendDomainInfo: 3.79 def update(self, info=None): 3.80 """Update with info from xc.domain_getinfo(). 3.81 """ 3.82 - self.info = info or dom_get(self.id) 3.83 + self.info = info or dom_get(self.domid) 3.84 self.memory = self.info['mem_kb'] / 1024 3.85 self.ssidref = self.info['ssidref'] 3.86 3.87 @@ -352,7 +350,7 @@ class XendDomainInfo: 3.88 3.89 def __str__(self): 3.90 s = "<domain" 3.91 - s += " id=" + str(self.id) 3.92 + s += " id=" + str(self.domid) 3.93 s += " name=" + self.name 3.94 s += " memory=" + str(self.memory) 3.95 s += " ssidref=" + str(self.ssidref) 3.96 @@ -393,7 +391,7 @@ class XendDomainInfo: 3.97 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 3.98 3.99 front = { 'backend' : backpath, 3.100 - 'backend-id' : "%i" % backdom.id, 3.101 + 'backend-id' : "%i" % backdom.domid, 3.102 'virtual-device' : "%i" % devnum } 3.103 xstransact.Write(frontpath, front) 3.104 3.105 @@ -402,7 +400,7 @@ class XendDomainInfo: 3.106 back = { 'type' : type, 3.107 'params' : params, 3.108 'frontend' : frontpath, 3.109 - 'frontend-id' : "%i" % self.id } 3.110 + 'frontend-id' : "%i" % self.domid } 3.111 xstransact.Write(backpath, back) 3.112 3.113 return 3.114 @@ -435,7 +433,7 @@ class XendDomainInfo: 3.115 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 3.116 3.117 front = { 'backend' : backpath, 3.118 - 'backend-id' : "%i" % backdom.id, 3.119 + 'backend-id' : "%i" % backdom.domid, 3.120 'handle' : "%i" % devnum, 3.121 'mac' : mac } 3.122 xstransact.Write(frontpath, front) 3.123 @@ -445,7 +443,7 @@ class XendDomainInfo: 3.124 'mac' : mac, 3.125 'bridge' : bridge, 3.126 'frontend' : frontpath, 3.127 - 'frontend-id' : "%i" % self.id, 3.128 + 'frontend-id' : "%i" % self.domid, 3.129 'handle' : "%i" % devnum } 3.130 if ipaddr: 3.131 back['ip'] = ' '.join(ipaddr) 3.132 @@ -464,13 +462,13 @@ class XendDomainInfo: 3.133 frontpath = "%s/device/%s/%d" % (self.path, type, devnum) 3.134 3.135 front = { 'backend' : backpath, 3.136 - 'backend-id' : "%i" % backdom.id, 3.137 + 'backend-id' : "%i" % backdom.domid, 3.138 'handle' : "%i" % devnum } 3.139 xstransact.Write(frontpath, front) 3.140 3.141 back = { 'instance' : "%i" % devnum, 3.142 'frontend' : frontpath, 3.143 - 'frontend-id' : "%i" % self.id } 3.144 + 'frontend-id' : "%i" % self.domid } 3.145 xstransact.Write(backpath, back) 3.146 3.147 return 3.148 @@ -505,7 +503,7 @@ class XendDomainInfo: 3.149 3.150 def sxpr(self): 3.151 sxpr = ['domain', 3.152 - ['id', self.id], 3.153 + ['domid', self.domid], 3.154 ['name', self.name], 3.155 ['memory', self.memory], 3.156 ['ssidref', self.ssidref], 3.157 @@ -602,7 +600,7 @@ class XendDomainInfo: 3.158 return 3.159 if dominfo.is_terminated(): 3.160 return 3.161 - if not self.id or (dominfo.id != self.id): 3.162 + if not self.domid or (dominfo.domid != self.domid): 3.163 raise VmError('vm name clash: ' + name) 3.164 3.165 def construct(self, config): 3.166 @@ -653,8 +651,8 @@ class XendDomainInfo: 3.167 self.setMemoryTarget(self.memory * (1 << 20)) 3.168 self.ssidref = int(sxp.child_value(config, 'ssidref')) 3.169 cpu = sxp.child_value(config, 'cpu') 3.170 - if self.recreate and self.id and cpu is not None and int(cpu) >= 0: 3.171 - xc.domain_pincpu(self.id, 0, 1<<int(cpu)) 3.172 + if self.recreate and self.domid and cpu is not None and int(cpu) >= 0: 3.173 + xc.domain_pincpu(self.domid, 0, 1<<int(cpu)) 3.174 try: 3.175 image = sxp.child_value(self.config, 'image') 3.176 vcpus = sxp.child_value(image, 'vcpus') 3.177 @@ -684,17 +682,17 @@ class XendDomainInfo: 3.178 self.image.createImage() 3.179 self.exportToDB() 3.180 if self.store_channel and self.store_mfn >= 0: 3.181 - IntroduceDomain(self.id, self.store_mfn, self.store_channel.port1, 3.182 - self.path) 3.183 + IntroduceDomain(self.domid, self.store_mfn, 3.184 + self.store_channel.port1, self.path) 3.185 # get the configured value of vcpus and update store 3.186 self.configure_vcpus(self.vcpus) 3.187 3.188 def delete(self): 3.189 """Delete the vm's db. 3.190 """ 3.191 - if dom_get(self.id): 3.192 + if dom_get(self.domid): 3.193 return 3.194 - self.id = None 3.195 + self.domid = None 3.196 self.saveToDB(sync=True) 3.197 try: 3.198 # Todo: eventually will have to wait for devices to signal 3.199 @@ -710,10 +708,10 @@ class XendDomainInfo: 3.200 The domain will not finally go away unless all vm 3.201 devices have been released. 3.202 """ 3.203 - if self.id is None: 3.204 + if self.domid is None: 3.205 return 3.206 try: 3.207 - xc.domain_destroy(dom=self.id) 3.208 + xc.domain_destroy(dom=self.domid) 3.209 except Exception, err: 3.210 log.exception("Domain destroy failed: %s", self.name) 3.211 3.212 @@ -771,7 +769,7 @@ class XendDomainInfo: 3.213 def show(self): 3.214 """Print virtual machine info. 3.215 """ 3.216 - print "[VM dom=%d name=%s memory=%d ssidref=%d" % (self.id, self.name, self.memory, self.ssidref) 3.217 + print "[VM dom=%d name=%s memory=%d ssidref=%d" % (self.domid, self.name, self.memory, self.ssidref) 3.218 print "image:" 3.219 sxp.show(self.image) 3.220 print "]" 3.221 @@ -787,10 +785,10 @@ class XendDomainInfo: 3.222 cpu = int(sxp.child_value(self.config, 'cpu', '-1')) 3.223 except: 3.224 raise VmError('invalid cpu') 3.225 - id = self.image.initDomain(self.id, self.memory, self.ssidref, cpu, self.cpu_weight) 3.226 + id = self.image.initDomain(self.domid, self.memory, self.ssidref, cpu, self.cpu_weight) 3.227 log.debug('init_domain> Created domain=%d name=%s memory=%d', 3.228 id, self.name, self.memory) 3.229 - self.setdom(id) 3.230 + self.setDomid(id) 3.231 3.232 def eventChannel(self, path=None): 3.233 """Create an event channel to the domain. 3.234 @@ -804,7 +802,7 @@ class XendDomainInfo: 3.235 except: 3.236 # if anything goes wrong, assume the port was not yet set 3.237 pass 3.238 - ret = EventChannel.interdomain(0, self.id, port1=port, port2=0) 3.239 + ret = EventChannel.interdomain(0, self.domid, port1=port, port2=0) 3.240 xstransact.Write(self.path, path, "%i" % ret.port1) 3.241 return ret 3.242 3.243 @@ -1081,7 +1079,7 @@ class XendDomainInfo: 3.244 if ref and ref >= 0: 3.245 self.setStoreRef(ref) 3.246 try: 3.247 - IntroduceDomain(self.id, ref, self.store_channel.port1, 3.248 + IntroduceDomain(self.domid, ref, self.store_channel.port1, 3.249 self.path) 3.250 except RuntimeError, ex: 3.251 if ex.args[0] == errno.EISCONN: 3.252 @@ -1089,7 +1087,7 @@ class XendDomainInfo: 3.253 else: 3.254 raise 3.255 # get run-time value of vcpus and update store 3.256 - self.configure_vcpus(dom_get(self.id)['vcpus']) 3.257 + self.configure_vcpus(dom_get(self.domid)['vcpus']) 3.258 3.259 3.260 def vm_field_ignore(_, _1, _2, _3): 3.261 @@ -1110,7 +1108,7 @@ def vm_field_maxmem(vm, _1, val, _2): 3.262 maxmem = int(maxmem) 3.263 except: 3.264 raise VmError("invalid maxmem: " + str(maxmem)) 3.265 - xc.domain_setmaxmem(vm.id, maxmem_kb = maxmem * 1024) 3.266 + xc.domain_setmaxmem(vm.domid, maxmem_kb = maxmem * 1024) 3.267 3.268 3.269 #============================================================================
4.1 --- a/tools/python/xen/xend/server/SrvDomain.py Wed Sep 14 14:43:34 2005 +0000 4.2 +++ b/tools/python/xen/xend/server/SrvDomain.py Wed Sep 14 15:10:22 2005 +0000 4.3 @@ -41,21 +41,21 @@ class SrvDomain(SrvDir): 4.4 fn = FormFn(self.xd.domain_configure, 4.5 [['dom', 'int'], 4.6 ['config', 'sxpr']]) 4.7 - return fn(req.args, {'dom': self.dom.id}) 4.8 + return fn(req.args, {'dom': self.dom.domid}) 4.9 4.10 def op_unpause(self, op, req): 4.11 - val = self.xd.domain_unpause(self.dom.id) 4.12 + val = self.xd.domain_unpause(self.dom.domid) 4.13 return val 4.14 4.15 def op_pause(self, op, req): 4.16 - val = self.xd.domain_pause(self.dom.id) 4.17 + val = self.xd.domain_pause(self.dom.domid) 4.18 return val 4.19 4.20 def op_shutdown(self, op, req): 4.21 fn = FormFn(self.xd.domain_shutdown, 4.22 [['dom', 'int'], 4.23 ['reason', 'str']]) 4.24 - val = fn(req.args, {'dom': self.dom.id}) 4.25 + val = fn(req.args, {'dom': self.dom.domid}) 4.26 req.setResponseCode(http.ACCEPTED) 4.27 req.setHeader("Location", "%s/.." % req.prePathURL()) 4.28 return val 4.29 @@ -64,7 +64,7 @@ class SrvDomain(SrvDir): 4.30 fn = FormFn(self.xd.domain_sysrq, 4.31 [['dom', 'int'], 4.32 ['key', 'int']]) 4.33 - val = fn(req.args, {'dom' : self.dom.id}) 4.34 + val = fn(req.args, {'dom' : self.dom.domid}) 4.35 req.setResponseCode(http.ACCEPTED) 4.36 req.setHeader("Location", "%s/.." % req.prePathURL()) 4.37 return val 4.38 @@ -73,7 +73,7 @@ class SrvDomain(SrvDir): 4.39 fn = FormFn(self.xd.domain_destroy, 4.40 [['dom', 'int'], 4.41 ['reason', 'str']]) 4.42 - val = fn(req.args, {'dom': self.dom.id}) 4.43 + val = fn(req.args, {'dom': self.dom.domid}) 4.44 req.setHeader("Location", "%s/.." % req.prePathURL()) 4.45 return val 4.46 4.47 @@ -84,7 +84,7 @@ class SrvDomain(SrvDir): 4.48 fn = FormFn(self.xd.domain_save, 4.49 [['dom', 'int'], 4.50 ['file', 'str']]) 4.51 - val = fn(req.args, {'dom': self.dom.id}) 4.52 + val = fn(req.args, {'dom': self.dom.domid}) 4.53 return 0 4.54 4.55 def op_migrate(self, op, req): 4.56 @@ -96,14 +96,14 @@ class SrvDomain(SrvDir): 4.57 ['destination', 'str'], 4.58 ['live', 'int'], 4.59 ['resource', 'int']]) 4.60 - return fn(req.args, {'dom': self.dom.id}) 4.61 + return fn(req.args, {'dom': self.dom.domid}) 4.62 4.63 def op_pincpu(self, op, req): 4.64 fn = FormFn(self.xd.domain_pincpu, 4.65 [['dom', 'int'], 4.66 ['vcpu', 'int'], 4.67 ['cpumap', 'int']]) 4.68 - val = fn(req.args, {'dom': self.dom.id}) 4.69 + val = fn(req.args, {'dom': self.dom.domid}) 4.70 return val 4.71 4.72 def op_cpu_bvt_set(self, op, req): 4.73 @@ -114,7 +114,7 @@ class SrvDomain(SrvDir): 4.74 ['warpvalue', 'int'], 4.75 ['warpl', 'long'], 4.76 ['warpu', 'long']]) 4.77 - val = fn(req.args, {'dom': self.dom.id}) 4.78 + val = fn(req.args, {'dom': self.dom.domid}) 4.79 return val 4.80 4.81 4.82 @@ -126,28 +126,28 @@ class SrvDomain(SrvDir): 4.83 ['latency', 'int'], 4.84 ['extratime', 'int'], 4.85 ['weight', 'int']]) 4.86 - val = fn(req.args, {'dom': self.dom.id}) 4.87 + val = fn(req.args, {'dom': self.dom.domid}) 4.88 return val 4.89 4.90 def op_maxmem_set(self, op, req): 4.91 fn = FormFn(self.xd.domain_maxmem_set, 4.92 [['dom', 'int'], 4.93 ['memory', 'int']]) 4.94 - val = fn(req.args, {'dom': self.dom.id}) 4.95 + val = fn(req.args, {'dom': self.dom.domid}) 4.96 return val 4.97 4.98 def op_mem_target_set(self, op, req): 4.99 fn = FormFn(self.xd.domain_mem_target_set, 4.100 [['dom', 'int'], 4.101 ['target', 'int']]) 4.102 - val = fn(req.args, {'dom': self.dom.id}) 4.103 + val = fn(req.args, {'dom': self.dom.domid}) 4.104 return val 4.105 4.106 def op_devices(self, op, req): 4.107 fn = FormFn(self.xd.domain_devtype_ls, 4.108 [['dom', 'int'], 4.109 ['type', 'str']]) 4.110 - val = fn(req.args, {'dom': self.dom.id}) 4.111 + val = fn(req.args, {'dom': self.dom.domid}) 4.112 return val 4.113 4.114 def op_device(self, op, req): 4.115 @@ -155,7 +155,7 @@ class SrvDomain(SrvDir): 4.116 [['dom', 'int'], 4.117 ['type', 'str'], 4.118 ['idx', 'int']]) 4.119 - val = fn(req.args, {'dom': self.dom.id}) 4.120 + val = fn(req.args, {'dom': self.dom.domid}) 4.121 if val: 4.122 return val.sxpr() 4.123 else: 4.124 @@ -165,7 +165,7 @@ class SrvDomain(SrvDir): 4.125 fn = FormFn(self.xd.domain_device_create, 4.126 [['dom', 'int'], 4.127 ['config', 'sxpr']]) 4.128 - val = fn(req.args, {'dom': self.dom.id}) 4.129 + val = fn(req.args, {'dom': self.dom.domid}) 4.130 return val 4.131 4.132 def op_device_refresh(self, op, req): 4.133 @@ -173,7 +173,7 @@ class SrvDomain(SrvDir): 4.134 [['dom', 'int'], 4.135 ['type', 'str'], 4.136 ['idx', 'str']]) 4.137 - val = fn(req.args, {'dom': self.dom.id}) 4.138 + val = fn(req.args, {'dom': self.dom.domid}) 4.139 return val 4.140 4.141 def op_device_destroy(self, op, req): 4.142 @@ -181,7 +181,7 @@ class SrvDomain(SrvDir): 4.143 [['dom', 'int'], 4.144 ['type', 'str'], 4.145 ['idx', 'str']]) 4.146 - val = fn(req.args, {'dom': self.dom.id}) 4.147 + val = fn(req.args, {'dom': self.dom.domid}) 4.148 return val 4.149 4.150 def op_device_configure(self, op, req): 4.151 @@ -189,7 +189,7 @@ class SrvDomain(SrvDir): 4.152 [['dom', 'int'], 4.153 ['config', 'sxpr'], 4.154 ['idx', 'str']]) 4.155 - val = fn(req.args, {'dom': self.dom.id}) 4.156 + val = fn(req.args, {'dom': self.dom.domid}) 4.157 return val 4.158 4.159 def op_vif_limit_set(self, op, req): 4.160 @@ -198,7 +198,7 @@ class SrvDomain(SrvDir): 4.161 ['vif', 'int'], 4.162 ['credit', 'int'], 4.163 ['period', 'int']]) 4.164 - val = fn(req.args, {'dom': self.dom.id}) 4.165 + val = fn(req.args, {'dom': self.dom.domid}) 4.166 return val 4.167 4.168 def op_vcpu_hotplug(self, op, req): 4.169 @@ -206,7 +206,7 @@ class SrvDomain(SrvDir): 4.170 [['dom', 'int'], 4.171 ['vcpu', 'int'], 4.172 ['state', 'int']]) 4.173 - val = fn(req.args, {'dom': self.dom.id}) 4.174 + val = fn(req.args, {'dom': self.dom.domid}) 4.175 return val 4.176 4.177 def render_POST(self, req):
5.1 --- a/tools/python/xen/xend/server/SrvDomainDir.py Wed Sep 14 14:43:34 2005 +0000 5.2 +++ b/tools/python/xen/xend/server/SrvDomainDir.py Wed Sep 14 15:10:22 2005 +0000 5.3 @@ -154,7 +154,7 @@ class SrvDomainDir(SrvDir): 5.4 for d in domains: 5.5 req.write('<li><a href="%s%s"> Domain %s</a>' 5.6 % (url, d.name, d.name)) 5.7 - req.write('id=%s' % d.id) 5.8 + req.write('id=%s' % d.domid) 5.9 req.write('memory=%d'% d.memory) 5.10 req.write('ssidref=%d'% d.ssidref) 5.11 req.write('</li>')
6.1 --- a/tools/python/xen/xend/server/blkif.py Wed Sep 14 14:43:34 2005 +0000 6.2 +++ b/tools/python/xen/xend/server/blkif.py Wed Sep 14 15:10:22 2005 +0000 6.3 @@ -123,7 +123,7 @@ class BlkDev(Dev): 6.4 def init(self, recreate=False, reboot=False): 6.5 self.frontendDomain = self.getDomain() 6.6 backend = self.getBackend() 6.7 - self.backendId = backend.id 6.8 + self.backendId = backend.domid 6.9 6.10 def configure(self, config, change=False, recreate=False): 6.11 if change: 6.12 @@ -146,7 +146,7 @@ class BlkDev(Dev): 6.13 6.14 try: 6.15 xd = get_component('xen.xend.XendDomain') 6.16 - self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 6.17 + self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 6.18 except: 6.19 raise XendError('invalid backend domain') 6.20
7.1 --- a/tools/python/xen/xend/server/netif.py Wed Sep 14 14:43:34 2005 +0000 7.2 +++ b/tools/python/xen/xend/server/netif.py Wed Sep 14 15:10:22 2005 +0000 7.3 @@ -180,7 +180,7 @@ class NetDev(Dev): 7.4 else: 7.5 #todo: Code below will fail on xend restart when backend is not domain 0. 7.6 xd = get_component('xen.xend.XendDomain') 7.7 - self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 7.8 + self.backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 7.9 except: 7.10 raise XendError('invalid backend domain') 7.11 return self.config 7.12 @@ -206,7 +206,7 @@ class NetDev(Dev): 7.13 mtu = self._get_config_mtu(config) 7.14 7.15 xd = get_component('xen.xend.XendDomain') 7.16 - backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id 7.17 + backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).domid 7.18 7.19 if (mac is not None) and (mac != self.mac): 7.20 raise XendError("cannot change mac")
8.1 --- a/tools/python/xen/xm/create.py Wed Sep 14 14:43:34 2005 +0000 8.2 +++ b/tools/python/xen/xm/create.py Wed Sep 14 15:10:22 2005 +0000 8.3 @@ -750,7 +750,7 @@ def make_domain(opts, config): 8.4 server.xend_domain_destroy(dom) 8.5 opts.err("Failed to unpause domain %s" % dom) 8.6 opts.info("Started domain %s" % (dom)) 8.7 - return int(sxp.child_value(dominfo, 'id')) 8.8 + return int(sxp.child_value(dominfo, 'domid')) 8.9 8.10 def get_dom0_alloc(): 8.11 """Return current allocation memory of dom0 (in MB). Return 0 on error"""
9.1 --- a/tools/python/xen/xm/main.py Wed Sep 14 14:43:34 2005 +0000 9.2 +++ b/tools/python/xen/xm/main.py Wed Sep 14 15:10:22 2005 +0000 9.3 @@ -192,9 +192,9 @@ def xm_restore(args): 9.4 from xen.xend.XendClient import server 9.5 info = server.xend_domain_restore(savefile) 9.6 PrettyPrint.prettyprint(info) 9.7 - id = sxp.child_value(info, 'id') 9.8 + id = sxp.child_value(info, 'domid') 9.9 if id is not None: 9.10 - server.xend_domain_unpause(id) 9.11 + server.xend_domain_unpause(domid) 9.12 9.13 def xm_migrate(args): 9.14 # TODO: arg_check 9.15 @@ -242,7 +242,7 @@ def xm_list(args): 9.16 9.17 def parse_doms_info(info): 9.18 dominfo = {} 9.19 - dominfo['dom'] = int(sxp.child_value(info, 'id', '-1')) 9.20 + dominfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) 9.21 dominfo['name'] = sxp.child_value(info, 'name', '??') 9.22 dominfo['mem'] = int(sxp.child_value(info, 'memory', '0')) 9.23 dominfo['cpu'] = str(sxp.child_value(info, 'cpu', '0')) 9.24 @@ -265,7 +265,7 @@ def parse_doms_info(info): 9.25 for cpu in vcpu_to_cpu: 9.26 vcpuinfo = {} 9.27 vcpuinfo['name'] = sxp.child_value(info, 'name', '??') 9.28 - vcpuinfo['dom'] = int(sxp.child_value(info, 'id', '-1')) 9.29 + vcpuinfo['dom'] = int(sxp.child_value(info, 'domid', '-1')) 9.30 vcpuinfo['vcpu'] = int(count) 9.31 vcpuinfo['cpu'] = int(cpu) 9.32 vcpuinfo['cpumap'] = int(cpumap[count])&mask 9.33 @@ -395,7 +395,7 @@ def xm_vcpu_enable(args): 9.34 9.35 from xen.xend.XendClient import server 9.36 dom = server.xend_domain(name) 9.37 - id = sxp.child_value(dom, 'id') 9.38 + id = sxp.child_value(dom, 'domid') 9.39 server.xend_domain_vcpu_hotplug(id, vcpu, 1) 9.40 9.41 def xm_vcpu_disable(args): 9.42 @@ -406,7 +406,7 @@ def xm_vcpu_disable(args): 9.43 9.44 from xen.xend.XendClient import server 9.45 dom = server.xend_domain(name) 9.46 - id = sxp.child_value(dom, 'id') 9.47 + id = sxp.child_value(dom, 'domid') 9.48 server.xend_domain_vcpu_hotplug(id, vcpu, 0) 9.49 9.50 def xm_domid(args): 9.51 @@ -414,7 +414,7 @@ def xm_domid(args): 9.52 9.53 from xen.xend.XendClient import server 9.54 dom = server.xend_domain(name) 9.55 - print sxp.child_value(dom, 'id') 9.56 + print sxp.child_value(dom, 'domid') 9.57 9.58 def xm_domname(args): 9.59 name = args[0] 9.60 @@ -462,7 +462,7 @@ def xm_console(args): 9.61 dom = args[0] 9.62 from xen.xend.XendClient import server 9.63 info = server.xend_domain(dom) 9.64 - domid = int(sxp.child_value(info, 'id', '-1')) 9.65 + domid = int(sxp.child_value(info, 'domid', '-1')) 9.66 cmd = "/usr/libexec/xen/xenconsole %d" % domid 9.67 os.execvp('/usr/libexec/xen/xenconsole', cmd.split()) 9.68 console = sxp.child(info, "console")