head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.10 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.8 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.6 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.4 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.2 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.1.0.4 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.2; locks; strict; comment @# @; 1.2 date 2009.01.13.13.48.33; author cegger; state dead; branches; next 1.1; 1.1 date 2008.10.08.19.13.41; author cegger; state Exp; branches 1.1.2.1; next ; 1.1.2.1 date 2008.10.08.19.13.41; author tron; state dead; branches; next 1.1.2.2; 1.1.2.2 date 2008.10.11.18.27.49; author tron; state Exp; branches; next ; desc @@ 1.2 log @Update to Xen 3.3.1. This is a mainenance release with a number of stability fixes. @ text @$NetBSD: patch-gc,v 1.1 2008/10/08 19:13:41 cegger Exp $ --- python/xen/xend/server/DevController.py.orig 2008-08-22 09:49:08.000000000 +0000 +++ python/xen/xend/server/DevController.py @@@@ -126,8 +126,11 @@@@ class DevController: log.debug( 'DevController: still waiting to write device entries.') + devpath = self.devicePath(devid) + t.remove(frontpath) t.remove(backpath) + t.remove(devpath) t.mkdir(backpath) t.set_permissions(backpath, @@@@ -142,6 +145,14 @@@@ class DevController: t.write2(frontpath, front) t.write2(backpath, back) + t.mkdir(devpath) + t.write2(devpath, { + 'backend' : backpath, + 'backend-id' : "%i" % backdom, + 'frontend' : frontpath, + 'frontend-id' : "%i" % self.vm.getDomid() + }) + if t.commit(): return devid @@@@ -254,11 +265,12 @@@@ class DevController: if force: frontpath = self.frontendPath(dev) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: xstransact.Remove(backpath) xstransact.Remove(frontpath) + # xstransact.Remove(self.devicePath()) ?? Below is the same ? self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev)) def configurations(self, transaction = None): @@@@ -302,9 +314,10 @@@@ class DevController: @@return: dict """ if transaction is None: - backdomid = xstransact.Read(self.frontendPath(devid), "backend-id") + backdomid = xstransact.Read(self.devicePath(devid), "backend-id") else: - backdomid = transaction.read(self.frontendPath(devid) + "/backend-id") + backdomid = transaction.read(self.devicePath(devid) + "/backend-id") + if backdomid is None: raise VmError("Device %s not connected" % devid) @@@@ -446,17 +459,22 @@@@ class DevController: else: raise VmError("Device %s not connected" % devid) + def readVm(self, devid, *args): + devpath = self.devicePath(devid) + if devpath: + return xstransact.Read(devpath, *args) + else: + raise VmError("Device config %s not found" % devid) + def readBackend(self, devid, *args): - frontpath = self.frontendPath(devid) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: return xstransact.Read(backpath, *args) else: raise VmError("Device %s not connected" % devid) def readBackendTxn(self, transaction, devid, *args): - frontpath = self.frontendPath(devid) - backpath = transaction.read(frontpath + "/backend") + backpath = self.readVm(devid, "backend") if backpath: paths = map(lambda x: backpath + "/" + x, args) return transaction.read(*paths) @@@@ -474,7 +492,7 @@@@ class DevController: """@@return The IDs of each of the devices currently configured for this instance's deviceClass. """ - fe = self.backendRoot() + fe = self.deviceRoot() if transaction: return map(lambda x: int(x.split('/')[-1]), transaction.list(fe)) @@@@ -483,8 +501,7 @@@@ class DevController: def writeBackend(self, devid, *args): - frontpath = self.frontendPath(devid) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: xstransact.Write(backpath, *args) @@@@ -549,9 +566,8 @@@@ class DevController: def waitForBackend(self, devid): - frontpath = self.frontendPath(devid) - # lookup a phantom + # lookup a phantom phantomPath = xstransact.Read(frontpath, 'phantom_vbd') if phantomPath is not None: log.debug("Waiting for %s's phantom %s.", devid, phantomPath) @@@@ -564,7 +580,7 @@@@ class DevController: if result['status'] != 'Connected': return (result['status'], err) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: @@@@ -629,17 +645,20 @@@@ class DevController: def frontendRoot(self): return "%s/device/%s" % (self.vm.getDomainPath(), self.deviceClass) - def backendRoot(self): - """Construct backend root path assuming backend is domain 0.""" - from xen.xend.XendDomain import DOM0_ID - from xen.xend.xenstore.xsutil import GetDomainPath - return "%s/backend/%s/%s" % (GetDomainPath(DOM0_ID), - self.deviceClass, self.vm.getDomid()) - def frontendMiscPath(self): return "%s/device-misc/%s" % (self.vm.getDomainPath(), self.deviceClass) + def deviceRoot(self): + """Return the /vm/device. Because backendRoot assumes the + backend domain is 0""" + return "%s/device/%s" % (self.vm.vmpath, self.deviceClass) + + def devicePath(self, devid): + """Return the /device entry of the given VM. We use it to store + backend/frontend locations""" + return "%s/device/%s/%s" % (self.vm.vmpath, + self.deviceClass, devid) def hotplugStatusCallback(statusPath, ev, result): log.debug("hotplugStatusCallback %s.", statusPath) @ 1.1 log @Apply changeset 18434 from upstream xen-3.3-testing tree. This fixes security issue http://secunia.com/advisories/32064/ @ text @d1 1 a1 1 $NetBSD$ @ 1.1.2.1 log @file patch-gc was added on branch pkgsrc-2008Q3 on 2008-10-11 18:27:49 +0000 @ text @d1 152 @ 1.1.2.2 log @Pullup ticket #2548 - requested by cegger xentools33: security patch Revisions pulled up: - sysutils/xentools33/Makefile 1.10 - sysutils/xentools33/distinfo 1.13 - sysutils/xentools33/patches/patch-ga 1.1 - sysutils/xentools33/patches/patch-gc 1.1 - sysutils/xentools33/patches/patch-gd 1.1 --- Module Name: pkgsrc Committed By: cegger Date: Wed Oct 8 19:13:41 UTC 2008 Modified Files: pkgsrc/sysutils/xentools33: Makefile distinfo Added Files: pkgsrc/sysutils/xentools33/patches: patch-ga patch-gb patch-gc patch-gd Log Message: Apply changeset 18434 from upstream xen-3.3-testing tree. This fixes security issue http://secunia.com/advisories/32064/ @ text @a0 152 $NetBSD: patch-gc,v 1.1 2008/10/08 19:13:41 cegger Exp $ --- python/xen/xend/server/DevController.py.orig 2008-08-22 09:49:08.000000000 +0000 +++ python/xen/xend/server/DevController.py @@@@ -126,8 +126,11 @@@@ class DevController: log.debug( 'DevController: still waiting to write device entries.') + devpath = self.devicePath(devid) + t.remove(frontpath) t.remove(backpath) + t.remove(devpath) t.mkdir(backpath) t.set_permissions(backpath, @@@@ -142,6 +145,14 @@@@ class DevController: t.write2(frontpath, front) t.write2(backpath, back) + t.mkdir(devpath) + t.write2(devpath, { + 'backend' : backpath, + 'backend-id' : "%i" % backdom, + 'frontend' : frontpath, + 'frontend-id' : "%i" % self.vm.getDomid() + }) + if t.commit(): return devid @@@@ -254,11 +265,12 @@@@ class DevController: if force: frontpath = self.frontendPath(dev) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: xstransact.Remove(backpath) xstransact.Remove(frontpath) + # xstransact.Remove(self.devicePath()) ?? Below is the same ? self.vm._removeVm("device/%s/%d" % (self.deviceClass, dev)) def configurations(self, transaction = None): @@@@ -302,9 +314,10 @@@@ class DevController: @@return: dict """ if transaction is None: - backdomid = xstransact.Read(self.frontendPath(devid), "backend-id") + backdomid = xstransact.Read(self.devicePath(devid), "backend-id") else: - backdomid = transaction.read(self.frontendPath(devid) + "/backend-id") + backdomid = transaction.read(self.devicePath(devid) + "/backend-id") + if backdomid is None: raise VmError("Device %s not connected" % devid) @@@@ -446,17 +459,22 @@@@ class DevController: else: raise VmError("Device %s not connected" % devid) + def readVm(self, devid, *args): + devpath = self.devicePath(devid) + if devpath: + return xstransact.Read(devpath, *args) + else: + raise VmError("Device config %s not found" % devid) + def readBackend(self, devid, *args): - frontpath = self.frontendPath(devid) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: return xstransact.Read(backpath, *args) else: raise VmError("Device %s not connected" % devid) def readBackendTxn(self, transaction, devid, *args): - frontpath = self.frontendPath(devid) - backpath = transaction.read(frontpath + "/backend") + backpath = self.readVm(devid, "backend") if backpath: paths = map(lambda x: backpath + "/" + x, args) return transaction.read(*paths) @@@@ -474,7 +492,7 @@@@ class DevController: """@@return The IDs of each of the devices currently configured for this instance's deviceClass. """ - fe = self.backendRoot() + fe = self.deviceRoot() if transaction: return map(lambda x: int(x.split('/')[-1]), transaction.list(fe)) @@@@ -483,8 +501,7 @@@@ class DevController: def writeBackend(self, devid, *args): - frontpath = self.frontendPath(devid) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: xstransact.Write(backpath, *args) @@@@ -549,9 +566,8 @@@@ class DevController: def waitForBackend(self, devid): - frontpath = self.frontendPath(devid) - # lookup a phantom + # lookup a phantom phantomPath = xstransact.Read(frontpath, 'phantom_vbd') if phantomPath is not None: log.debug("Waiting for %s's phantom %s.", devid, phantomPath) @@@@ -564,7 +580,7 @@@@ class DevController: if result['status'] != 'Connected': return (result['status'], err) - backpath = xstransact.Read(frontpath, "backend") + backpath = self.readVm(devid, "backend") if backpath: @@@@ -629,17 +645,20 @@@@ class DevController: def frontendRoot(self): return "%s/device/%s" % (self.vm.getDomainPath(), self.deviceClass) - def backendRoot(self): - """Construct backend root path assuming backend is domain 0.""" - from xen.xend.XendDomain import DOM0_ID - from xen.xend.xenstore.xsutil import GetDomainPath - return "%s/backend/%s/%s" % (GetDomainPath(DOM0_ID), - self.deviceClass, self.vm.getDomid()) - def frontendMiscPath(self): return "%s/device-misc/%s" % (self.vm.getDomainPath(), self.deviceClass) + def deviceRoot(self): + """Return the /vm/device. Because backendRoot assumes the + backend domain is 0""" + return "%s/device/%s" % (self.vm.vmpath, self.deviceClass) + + def devicePath(self, devid): + """Return the /device entry of the given VM. We use it to store + backend/frontend locations""" + return "%s/device/%s/%s" % (self.vm.vmpath, + self.deviceClass, devid) def hotplugStatusCallback(statusPath, ev, result): log.debug("hotplugStatusCallback %s.", statusPath) @