From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Dague Subject: Re: Rename all dying domains to be prefixed with Zombie. This allows a new domain Date: Thu, 6 Oct 2005 09:47:23 -0400 Message-ID: <20051006134723.GC19844@underhill.no-ip.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1808234195==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1808234195== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qbvjkv9qwOGw/5Fx" Content-Disposition: inline --Qbvjkv9qwOGw/5Fx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable So what happens if: * Dom1 is told to die * It doesn't because it can't free a physical resource (i.e. disk) * It gets renamed to Zombie-Dom1 * User tries to recreate Dom1 * New Dom1 grabs physical resource that was keeping Dom1 from dying Doesn't that provide for the possibility of 2 writers to a device that only can support 1, and all heck breaking loose? (Note, I hope I'm wrong here) It seems that this just moves the race to somewhere more dangerous. -Sean On Thu, Oct 06, 2005 at 10:16:12AM +0000, Xen patchbot -unstable wrote: > Diffstat output: >=20 > XendDomainInfo.py | 33 ++++++++++++++++++++++----------- > 1 files changed, 22 insertions(+), 11 deletions(-) >=20 > # HG changeset patch > # User emellor@ewan > # Node ID 0bc466c255605d0efeb4803626b72415839b9e6c > # Parent 1cfe0875658d5f83d38a5d96abe7a66e0d5db508 > Rename all dying domains to be prefixed with Zombie. This allows a new d= omain > to be created with the same name, fixing the race condition inside XendDo= main > that caused bug #278. >=20 > Move the state_set(TERMINATED) call onto the end of cleanupDomain rather = than > destroyDomain, so that this flag is set when XendDomain cleans up a domain > that was killed without going through Xend. >=20 > Remove is_terminated, as this check is no longer necessary, since we are = using > Zombie prefixes instead. >=20 > Signed-off-by: Ewan Mellor >=20 > diff -r 1cfe0875658d -r 0bc466c25560 tools/python/xen/xend/XendDomainInfo= =2Epy > --- a/tools/python/xen/xend/XendDomainInfo.py Thu Oct 6 10:04:49 2005 > +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Oct 6 10:09:14 2005 > @@ -97,6 +97,7 @@ > DOMROOT =3D '/local/domain/' > VMROOT =3D '/vm/' > =20 > +ZOMBIE_PREFIX =3D 'Zombie-' > =20 > xc =3D xen.lowlevel.xc.new() > xroot =3D XendRoot.instance() > @@ -997,8 +998,6 @@ > dominfo =3D domain_by_name(name) > if not dominfo: > return > - if dominfo.is_terminated(): > - return > if self.domid is None: > raise VmError("VM name '%s' already in use by domain %d" % > (name, dominfo.domid)) > @@ -1100,6 +1099,14 @@ > except: > log.exception("Removing domain path failed.") > =20 > + try: > + if not self.info['name'].startswith(ZOMBIE_PREFIX): > + self.info['name'] =3D self.generateZombieName() > + except: > + log.exception("Renaming Zombie failed.") > + > + self.state_set(STATE_VM_TERMINATED) > + > =20 > def cleanupVm(self): > """Cleanup VM resources. Idempotent. Nothrow guarantee.""" > @@ -1123,23 +1130,15 @@ > log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid)) > =20 > self.cleanupDomain() > - =20 > + > try: > if self.domid is not None: > xc.domain_destroy(dom=3Dself.domid) > except: > log.exception("XendDomainInfo.destroy: xc.domain_destroy fai= led.") > =20 > - self.state_set(STATE_VM_TERMINATED) > - > =20 > ## private: > - > - def is_terminated(self): > - """Check if a domain has been terminated. > - """ > - return self.state =3D=3D STATE_VM_TERMINATED > - > =20 > def release_devices(self): > """Release all domain's devices. Nothrow guarantee.""" > @@ -1353,6 +1352,18 @@ > n +=3D 1 > =20 > =20 > + def generateZombieName(self): > + n =3D 0 > + name =3D ZOMBIE_PREFIX + self.info['name'] > + while True: > + try: > + self.check_name(name) > + return name > + except VmError: > + n +=3D 1 > + name =3D "%s%d-%s" % (ZOMBIE_PREFIX, n, self.info['name'= ]) > + > + > def configure_bootloader(self): > if not self.info['bootloader']: > return >=20 > _______________________________________________ > Xen-changelog mailing list > Xen-changelog@lists.xensource.com > http://lists.xensource.com/xen-changelog >=20 --=20 __________________________________________________________________ Sean Dague Mid-Hudson Valley sean at dague dot net Linux Users Group http://dague.net http://mhvlug.org There is no silver bullet. Plus, werewolves make better neighbors than zombies, and they tend to keep the vampire population down. __________________________________________________________________ --Qbvjkv9qwOGw/5Fx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFDRSrrSamXem9TdyYRAin0AJ4vi2wcHaGNjciOxVFnf7oM2mufNgCgk2Zq WfVR7TLT5GKwOpier0xXIl0= =fklw -----END PGP SIGNATURE----- --Qbvjkv9qwOGw/5Fx-- --===============1808234195== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1808234195==--