[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Move console tty/limit information into console directory in domain dir.
# HG changeset patch # User cl349@xxxxxxxxxxxxxxxxxxxx # Node ID a39b1fa10edc70d2ec446f5b181c7101ffeb2f93 # Parent 64ca0d3ea97fa7db2599c7e5fd8af1385dd2fcc3 Move console tty/limit information into console directory in domain dir. Also only store port number of console event channel. Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> diff -r 64ca0d3ea97f -r a39b1fa10edc tools/console/client/main.c --- a/tools/console/client/main.c Wed Sep 7 21:15:41 2005 +++ b/tools/console/client/main.c Wed Sep 7 21:24:34 2005 @@ -170,8 +170,7 @@ { 0 }, }; - char *str_pty; - char path[1024]; + char *str_pty, *path; int spty; unsigned int len = 0; struct xs_handle *xs; @@ -214,7 +213,13 @@ signal(SIGTERM, sighandler); - snprintf(path, sizeof(path), "/console/%d/tty", domid); + path = xs_get_domain_path(xs, domid); + if (path == NULL) + err(errno, "xs_get_domain_path()"); + path = realloc(path, strlen(path) + strlen("/console/tty") + 1); + if (path == NULL) + err(ENOMEM, "realloc"); + strcat(path, "/console/tty"); str_pty = xs_read(xs, path, &len); /* FIXME consoled currently does not assume domain-0 doesn't have a @@ -252,6 +257,7 @@ err(errno, "Could not open tty `%s'", str_pty); } free(str_pty); + free(path); init_term(STDIN_FILENO, &attr); console_loop(xc_handle, domid, spty); diff -r 64ca0d3ea97f -r a39b1fa10edc tools/console/daemon/io.c --- a/tools/console/daemon/io.c Wed Sep 7 21:15:41 2005 +++ b/tools/console/daemon/io.c Wed Sep 7 21:24:34 2005 @@ -144,6 +144,7 @@ { char *path; int master; + bool success; if ((master = getpt()) == -1 || grantpt(master) == -1 || unlockpt(master) == -1) { @@ -161,11 +162,17 @@ tcsetattr(master, TCSAFLUSH, &term); } - asprintf(&path, "/console/%d/tty", dom->domid); - xs_write(xs, path, slave, strlen(slave), O_CREAT); + success = asprintf(&path, "%s/tty", dom->conspath) != -1; + if (!success) + goto out; + success = xs_write(xs, path, slave, strlen(slave), O_CREAT); free(path); - - asprintf(&path, "/console/%d/limit", dom->domid); + if (!success) + goto out; + + success = asprintf(&path, "%s/limit", dom->conspath) != -1; + if (!success) + goto out; data = xs_read(xs, path, &len); if (data) { dom->buffer.max_capacity = strtoul(data, 0, 0); @@ -175,6 +182,9 @@ } return master; + out: + close(master); + return -1; } /* Takes tuples of names, scanf-style args, and void **, NULL terminated. */ @@ -218,7 +228,7 @@ err = xs_gather(xs, dom->conspath, "ring-ref", "%u", &ring_ref, - "console_channel/port1", "%i", &local_port, + "port", "%i", &local_port, NULL); if (err) goto out; @@ -289,20 +299,6 @@ } dom->domid = domid; - dom->tty_fd = domain_create_tty(dom); - dom->is_dead = false; - dom->buffer.data = 0; - dom->buffer.size = 0; - dom->buffer.capacity = 0; - dom->buffer.max_capacity = 0; - dom->next = NULL; - - dom->ring_ref = -1; - dom->local_port = -1; - dom->page = NULL; - dom->evtchn_fd = -1; - - dom->conspath = NULL; dom->conspath = xs_get_domain_path(xs, dom->domid); if (dom->conspath == NULL) @@ -314,6 +310,19 @@ dom->conspath = s; strcat(dom->conspath, "/console"); + dom->tty_fd = domain_create_tty(dom); + dom->is_dead = false; + dom->buffer.data = 0; + dom->buffer.size = 0; + dom->buffer.capacity = 0; + dom->buffer.max_capacity = 0; + dom->next = NULL; + + dom->ring_ref = -1; + dom->local_port = -1; + dom->page = NULL; + dom->evtchn_fd = -1; + if (!watch_domain(dom, true)) goto out; diff -r 64ca0d3ea97f -r a39b1fa10edc tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Wed Sep 7 21:15:41 2005 +++ b/tools/python/xen/xend/XendCheckpoint.py Wed Sep 7 21:24:34 2005 @@ -173,7 +173,6 @@ if m: dominfo.console_mfn = int(m.group(2)) dominfo.exportToDB(save=True, sync=True) - dominfo.publish_console() try: l = child.fromchild.readline() except: diff -r 64ca0d3ea97f -r a39b1fa10edc tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Sep 7 21:15:41 2005 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Sep 7 21:24:34 2005 @@ -298,15 +298,14 @@ self.store_channel.saveToDB(self.db.addChild("store_channel"), save=save) if self.console_channel: - self.console_channel.saveToDB(self.db.addChild("console/console_channel"), - save=save) + self.db['console/port'] = "%i" % self.console_channel.port1 if self.image: self.image.exportToDB(save=save, sync=sync) self.db.exportToDB(self, fields=self.__exports__, save=save, sync=sync) def importFromDB(self): self.db.importFromDB(self, fields=self.__exports__) - self.store_channel = self.eventChannel("store_channel") + self.store_channel = self.eventChannelOld("store_channel") def setdom(self, dom): """Set the domain id. @@ -654,7 +653,6 @@ self.configure_restart() self.construct_image() self.configure() - self.publish_console() self.exportToDB(save=True) except Exception, ex: # Catch errors, cleanup and re-raise. @@ -845,7 +843,7 @@ id, self.name, self.memory) self.setdom(id) - def eventChannel(self, key): + def eventChannelOld(self, key): """Create an event channel to the domain. If saved info is available recreate the channel. @@ -854,11 +852,27 @@ db = self.db.addChild(key) return EventChannel.restoreFromDB(db, 0, self.id) + def eventChannel(self, path=None, key=None): + """Create an event channel to the domain. + + @param path under which port is stored in db + """ + port = 0 + try: + if path and key: + if path: + db = self.db.addChild(path) + else: + db = self.db + port = int(db[key].getData()) + except: pass + return EventChannel.interdomain(0, self.id, port1=port, port2=0) + def create_channel(self): """Create the channels to the domain. """ - self.store_channel = self.eventChannel("store_channel") - self.console_channel = self.eventChannel("console/console_channel") + self.store_channel = self.eventChannelOld("store_channel") + self.console_channel = self.eventChannel("console", "port") def create_configured_devices(self): devices = sxp.children(self.config, 'device') @@ -1071,11 +1085,6 @@ backend = blkif.getBackend(0) backend.connect(recreate=self.recreate) - def publish_console(self): - db = DBMap(db=XenNode("/console/%d" % self.id)) - db['domain'] = self.db.getPath() - db.saveDB(save=True) - def configure_fields(self): """Process the vm configuration fields using the registered handlers. """ @@ -1143,7 +1152,7 @@ def dom0_init_store(self): if not self.store_channel: - self.store_channel = self.eventChannel("store_channel") + self.store_channel = self.eventChannelOld("store_channel") self.store_mfn = xc.init_store(self.store_channel.port2) if self.store_mfn >= 0: self.db.introduceDomain(self.id, self.store_mfn, _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |