diff --git a/.rootkeys b/.rootkeys index 0b14af45da..2de4168cb5 100644 --- a/.rootkeys +++ b/.rootkeys @@ -369,6 +369,15 @@ 40dc4076St6AmPTmQPrtQ6LGHPxGmw tools/python/xen/lowlevel/xu/__init__.py 40dc4076pVeE1kEEWzcUaNZin65kCA tools/python/xen/lowlevel/xu/domain_controller.h 40dc4076CwBYRTUQDdbdU1L6KcLgSw tools/python/xen/lowlevel/xu/xu.c +40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/sv/DomInfo.py +40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/sv/DomList.py +40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/sv/GenTabbed.py +40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/sv/HTMLBase.py +40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/sv/Main.py +40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/sv/NodeInfo.py +40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/sv/TabView.py +40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/sv/__init__.py +40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/sv/util.py 40d8915cyoVA0hJxiBFNymL7YvDaRg tools/python/xen/util/Brctl.py 40dfd40aGqGkiopOOgJxSF4iCbHM0Q tools/python/xen/util/__init__.py 4055ee4dwy4l0MghZosxoiu6zmhc9Q tools/python/xen/util/console_client.py @@ -417,33 +426,6 @@ 40c9c469yrm31i60pGKslTi2Zgpotg tools/python/xen/xend/server/messages.py 40c9c46925x-Rjb0Cv2f1-l2jZrPYg tools/python/xen/xend/server/netif.py 40c9c469ZqILEQ8x6yWy0_51jopiCg tools/python/xen/xend/server/params.py -40fcefb2qm13BbRZBydAatOavaS0fQ tools/python/xen/xend/sv/DomInfo.py -40fcefb2-RIU8GB67mJMRzybME9bxw tools/python/xen/xend/sv/DomList.py -40fcefb23FfQn-ZBCbcHqA0cPGqQxw tools/python/xen/xend/sv/GenTabbed.py -40fcefb2QZAn3u3sX-M7NXBjOv5HGg tools/python/xen/xend/sv/HTMLBase.py -40fcefb2vnfDbl4w_yCTedROPuqs0g tools/python/xen/xend/sv/Main.py -40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/python/xen/xend/sv/Main.rpy -40fcefb24h-04WaHag-Tg4nxWPhTig tools/python/xen/xend/sv/NodeInfo.py -40fcefb2Sif__6AqrANeBQZZfvP-6w tools/python/xen/xend/sv/TabView.py -40fcefb23s0sQlDfl4sPP0Un8oZGhg tools/python/xen/xend/sv/XendClientDeferred.py -40fcefb2DqteqCCZYDCvvh4Q5jBd0w tools/python/xen/xend/sv/__init__.py -40fcefb2Nhe-sT74KBB_3mYQg9Dl4Q tools/python/xen/xend/sv/images/internet copy.jpg -40fcefb2QmVa4xdjdnSTXEdF2fZCDA tools/python/xen/xend/sv/images/internet.jpg -40fcefb2g8Ez5jJIPHGN_KX7GtxV4w tools/python/xen/xend/sv/images/internet.psd -40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/python/xen/xend/sv/images/left-end-highlight.jpg -40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/python/xen/xend/sv/images/left-end-no-highlight.jpg -40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/python/xen/xend/sv/images/middle-highlight.jpg -40fcefb38OTgsUKHBpwshLLIsiIaCA tools/python/xen/xend/sv/images/middle-no-highlight.jpg -40fcefb32SPtrw36c4S6YGFlLvkKuw tools/python/xen/xend/sv/images/orb_01.jpg -40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/python/xen/xend/sv/images/orb_02.jpg -40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/python/xen/xend/sv/images/right-end-highlight.jpg -40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/python/xen/xend/sv/images/right-end-no-highlight.jpg -40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/python/xen/xend/sv/images/seperator-left-highlight.jpg -40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/python/xen/xend/sv/images/seperator-right-highlight.jpg -40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/python/xen/xend/sv/images/seperator.jpg -40fcefb3yMSrZvApO9ToIi-iQwnchA tools/python/xen/xend/sv/images/xen.png -40fcefb3zGC9XNBkSwTEobCoq8YClA tools/python/xen/xend/sv/inc/style.css -40fcefb4rnaZNjqsBu7A5V2rlLyqRw tools/python/xen/xend/sv/util.py 40c9c469LNxLVizOUpOjEaTKKCm8Aw tools/python/xen/xend/sxp.py 40d05079aFRp6NQdo5wIh5Ly31c0cg tools/python/xen/xm/__init__.py 40cf2937gKQcATgXKGtNeWb1PDH5nA tools/python/xen/xm/create.py @@ -452,6 +434,21 @@ 40cf2937isyS250zyd0Q2GuEDoNXfQ tools/python/xen/xm/main.py 40cf2937PSslwBliN1g7ofDy2H_RhA tools/python/xen/xm/opts.py 40cf2937Z8WCNOnO2FcWdubvEAF9QQ tools/python/xen/xm/shutdown.py +40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/sv/Main.rpy +40ffbcb66Dj5F-1kCK9BcgSqCWkt1w tools/sv/Makefile +40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/sv/images/left-end-highlight.jpg +40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/sv/images/left-end-no-highlight.jpg +40fcefb3BUT98zPzW8kAFKuxGdh4XA tools/sv/images/middle-highlight.jpg +40fcefb38OTgsUKHBpwshLLIsiIaCA tools/sv/images/middle-no-highlight.jpg +40fcefb32SPtrw36c4S6YGFlLvkKuw tools/sv/images/orb_01.jpg +40fcefb3Ok5qkX3iM7ZEPVkRInrUpg tools/sv/images/orb_02.jpg +40fcefb3JnT5XeKTuVF4yUMGOtuNZg tools/sv/images/right-end-highlight.jpg +40fcefb3-DuYOS7noo2W7b_0p7TOUg tools/sv/images/right-end-no-highlight.jpg +40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/sv/images/seperator-left-highlight.jpg +40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/sv/images/seperator-right-highlight.jpg +40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/sv/images/seperator.jpg +40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png +40fcefb3zGC9XNBkSwTEobCoq8YClA tools/sv/inc/style.css 403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile 40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats 4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8 diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c index f342466a8b..276a61f695 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c @@ -87,14 +87,11 @@ EXPORT_SYMBOL(i8253_lock); struct timer_opts *cur_timer = &timer_none; -/* These are peridically updated in shared_info, and then copied here. */ -static u32 shadow_tsc_stamp; -static u64 shadow_system_time; -static u32 shadow_time_version; -static struct timeval shadow_tv; +extern u64 shadow_system_time; +extern void __get_time_values_from_xen(void); /* Keep track of last time we did processing/updating of jiffies and xtime. */ -static u64 processed_system_time; /* System time (ns) at last processing. */ +u64 processed_system_time; /* System time (ns) at last processing. */ #define NS_PER_TICK (1000000000ULL/HZ) @@ -214,24 +211,6 @@ unsigned long long monotonic_clock(void) EXPORT_SYMBOL(monotonic_clock); -/* - * Reads a consistent set of time-base values from Xen, into a shadow data - * area. Must be called with the xtime_lock held for writing. - */ -static void __get_time_values_from_xen(void) -{ - do { - shadow_time_version = HYPERVISOR_shared_info->time_version2; - rmb(); - shadow_tv.tv_sec = HYPERVISOR_shared_info->wc_sec; - shadow_tv.tv_usec = HYPERVISOR_shared_info->wc_usec; - shadow_tsc_stamp = HYPERVISOR_shared_info->tsc_timestamp.tsc_bits; - shadow_system_time = HYPERVISOR_shared_info->system_time; - rmb(); - } - while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 ); -} - /* * timer_interrupt() needs to keep up the real-time clock, * as well as call the "do_timer()" routine every clocktick @@ -239,8 +218,6 @@ static void __get_time_values_from_xen(void) static inline void do_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - s64 delta; - unsigned long ticks = 0; #ifdef CONFIG_X86_IO_APIC if (timer_ack) { @@ -258,23 +235,8 @@ static inline void do_timer_interrupt(int irq, void *dev_id, } #endif - __get_time_values_from_xen(); - - delta = (s64)(shadow_system_time - processed_system_time); - if (delta < 0) { - printk("Timer ISR: Time went backwards: %lld\n", delta); - return; - } - - /* Process elapsed jiffies since last call. */ - while (delta >= NS_PER_TICK) { - ticks++; - delta -= NS_PER_TICK; - processed_system_time += NS_PER_TICK; - - if (regs) - do_timer_interrupt_hook(regs); - } + if (regs) + do_timer_interrupt_hook(regs); #if 0 /* XEN PRIV */ /* @@ -325,6 +287,8 @@ static inline void do_timer_interrupt(int irq, void *dev_id, */ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) { + s64 delta; + /* * Here we are in the timer irq handler. We just have irqs locally * disabled but we don't know if the timer_bh is running on the other @@ -334,10 +298,22 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) */ write_seqlock(&xtime_lock); + __get_time_values_from_xen(); + + delta = (s64)(shadow_system_time - processed_system_time); + if (delta < 0) { + printk("Timer ISR: Time went backwards: %lld\n", delta); + goto out; + } + + if (delta < NS_PER_TICK) + goto out; + cur_timer->mark_offset(); do_timer_interrupt(irq, NULL, regs); + out: write_sequnlock(&xtime_lock); return IRQ_HANDLED; } @@ -447,7 +423,7 @@ void __init time_init(void) #endif xtime.tv_sec = HYPERVISOR_shared_info->wc_sec; wall_to_monotonic.tv_sec = -xtime.tv_sec; - xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); + xtime.tv_nsec = HYPERVISOR_shared_info->wc_usec * 1000; wall_to_monotonic.tv_nsec = -xtime.tv_nsec; cur_timer = select_timer(); diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c index fb878535ff..eca23fd677 100644 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c @@ -34,12 +34,9 @@ int tsc_disable __initdata = 0; extern spinlock_t i8253_lock; static int use_tsc; -/* Number of usecs that the last interrupt was delayed */ -static int delay_at_last_interrupt; -static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ -static unsigned long last_tsc_high; /* msb 32 bits of Time Stamp Counter */ static unsigned long long monotonic_base; +static u32 monotonic_offset; static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED; /* convert from cycles(64bits) => nanoseconds (64bits) @@ -85,15 +82,19 @@ static unsigned long fast_gettimeoffset_quotient; /* These are peridically updated in shared_info, and then copied here. */ static u32 shadow_tsc_stamp; -static u64 shadow_system_time; +u64 shadow_system_time; static u32 shadow_time_version; static struct timeval shadow_tv; +static unsigned int rdtsc_bitshift; +extern u64 processed_system_time; + +#define NS_PER_TICK (1000000000ULL/HZ) /* * Reads a consistent set of time-base values from Xen, into a shadow data * area. Must be called with the xtime_lock held for writing. */ -static void __get_time_values_from_xen(void) +void __get_time_values_from_xen(void) { do { shadow_time_version = HYPERVISOR_shared_info->time_version2; @@ -120,16 +121,16 @@ static unsigned long get_offset_tsc(void) rdtsc(eax,edx); /* .. relative to previous jiffy (32 bits is enough) */ - eax -= last_tsc_low; /* tsc_low delta */ + eax -= (shadow_tsc_stamp << rdtsc_bitshift) & 0xffffffff; /* - * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient - * = (tsc_low delta) * (usecs_per_clock) - * = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy) + * Time offset = (tsc_low delta) * fast_gettimeoffset_quotient + * = (tsc_low delta) * (usecs_per_clock) + * = (tsc_low delta) * (usecs_per_jiffy / clocks_per_jiffy) * * Using a mull instead of a divl saves up to 31 clock cycles * in the critical path. - */ + */ __asm__("mull %2" :"=a" (eax), "=d" (edx) @@ -137,7 +138,7 @@ static unsigned long get_offset_tsc(void) "0" (eax)); /* our adjusted time offset in microseconds */ - return delay_at_last_interrupt + edx; + return edx; } static unsigned long long monotonic_clock_tsc(void) @@ -148,7 +149,7 @@ static unsigned long long monotonic_clock_tsc(void) /* atomically read monotonic base & last_offset */ do { seq = read_seqbegin(&monotonic_lock); - last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low; + last_offset = monotonic_offset << rdtsc_bitshift; base = monotonic_base; } while (read_seqretry(&monotonic_lock, seq)); @@ -186,122 +187,25 @@ unsigned long long sched_clock(void) static void mark_offset_tsc(void) { - unsigned long lost,delay; - unsigned long delta = last_tsc_low; -#if 0 - int count; - int countmp; - static int count1 = 0; -#endif - unsigned long long this_offset, last_offset; - static int lost_count = 0; - + s64 delta; + unsigned int ticks = 0; + write_seqlock(&monotonic_lock); - last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low; - /* - * It is important that these two operations happen almost at - * the same time. We do the RDTSC stuff first, since it's - * faster. To avoid any inconsistencies, we need interrupts - * disabled locally. - */ - /* - * Interrupts are just disabled locally since the timer irq - * has the SA_INTERRUPT flag set. -arca - */ - - /* read Pentium cycle counter */ + delta = (s64)(shadow_system_time - processed_system_time); - rdtsc(last_tsc_low, last_tsc_high); - -#if 0 - spin_lock(&i8253_lock); - outb_p(0x00, PIT_MODE); /* latch the count ASAP */ - - count = inb_p(PIT_CH0); /* read the latched count */ - count |= inb(PIT_CH0) << 8; - - /* - * VIA686a test code... reset the latch if count > max + 1 - * from timer_pit.c - cjb - */ - if (count > LATCH) { - outb_p(0x34, PIT_MODE); - outb_p(LATCH & 0xff, PIT_CH0); - outb(LATCH >> 8, PIT_CH0); - count = LATCH - 1; + /* Process elapsed jiffies since last call. */ + while (delta >= NS_PER_TICK) { + ticks++; + delta -= NS_PER_TICK; + processed_system_time += NS_PER_TICK; } + jiffies_64 += ticks - 1; - spin_unlock(&i8253_lock); - - if (pit_latch_buggy) { - /* get center value of last 3 time lutch */ - if ((count2 >= count && count >= count1) - || (count1 >= count && count >= count2)) { - count2 = count1; count1 = count; - } else if ((count1 >= count2 && count2 >= count) - || (count >= count2 && count2 >= count1)) { - countmp = count;count = count2; - count2 = count1;count1 = countmp; - } else { - count2 = count1; count1 = count; count = count1; - } - } -#endif - - /* lost tick compensation */ - delta = last_tsc_low - delta; - { - register unsigned long eax, edx; - eax = delta; - __asm__("mull %2" - :"=a" (eax), "=d" (edx) - :"rm" (fast_gettimeoffset_quotient), - "0" (eax)); - delta = edx; - } - delta += delay_at_last_interrupt; - lost = delta/(1000000/HZ); - delay = delta%(1000000/HZ); - if (lost >= 2) { - jiffies_64 += lost-1; - - /* sanity check to ensure we're not always losing ticks */ - if (lost_count++ > 100) { - printk(KERN_WARNING "Losing too many ticks!\n"); - printk(KERN_WARNING "TSC cannot be used as a timesource. \n"); - printk(KERN_WARNING "Possible reasons for this are:\n"); - printk(KERN_WARNING " You're running with Speedstep,\n"); - printk(KERN_WARNING " You don't have DMA enabled for your hard disk (see hdparm),\n"); - printk(KERN_WARNING " Incorrect TSC synchronization on an SMP system (see dmesg).\n"); - printk(KERN_WARNING "Falling back to a sane timesource now.\n"); - - clock_fallback(); - } - /* ... but give the TSC a fair chance */ - if (lost_count > 25) - cpufreq_delayed_get(); - } else - lost_count = 0; /* update the monotonic base value */ - this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low; - monotonic_base += cycles_2_ns(this_offset - last_offset); + monotonic_base = shadow_system_time; + monotonic_offset = shadow_tsc_stamp; write_sequnlock(&monotonic_lock); - -#if 0 - /* calculate delay_at_last_interrupt */ - count = ((LATCH-1) - count) * TICK_SIZE; - delay_at_last_interrupt = (count + LATCH/2) / LATCH; -#else - delay_at_last_interrupt = 0; -#endif - - /* catch corner case where tick rollover occured - * between tsc and pit reads (as noted when - * usec delta is > 90% # of usecs/tick) - */ - if (lost && abs(delay - delay_at_last_interrupt) > (900000/HZ)) - jiffies_64++; } static void delay_tsc(unsigned long loops) @@ -410,7 +314,7 @@ static unsigned long cpu_khz_ref = 0; static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, - void *data) + void *data) { struct cpufreq_freqs *freq = data; @@ -486,9 +390,12 @@ static int __init init_tsc(char* override) "0" (eax), "1" (edx)); } + rdtsc_bitshift = HYPERVISOR_shared_info->tsc_timestamp.tsc_bitshift; + set_cyc2ns_scale(cpu_khz/1000); __get_time_values_from_xen(); + processed_system_time = shadow_system_time; rdtscll(alarm); diff --git a/linux-2.6.7-xen-sparse/drivers/xen/net/network.c b/linux-2.6.7-xen-sparse/drivers/xen/net/network.c index 51646e9c8f..9381595a2d 100644 --- a/linux-2.6.7-xen-sparse/drivers/xen/net/network.c +++ b/linux-2.6.7-xen-sparse/drivers/xen/net/network.c @@ -275,6 +275,9 @@ static void network_alloc_rx_buffers(struct net_device *dev) } while ( (++i - np->rx_resp_cons) != NETIF_RX_RING_SIZE ); + if ( unlikely(nr_pfns == 0) ) + return; + /* * We may have allocated buffers which have entries outstanding in the page * update queue -- make sure we flush those first! diff --git a/tools/Makefile b/tools/Makefile index 58934639bb..e8cdd96672 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -16,6 +16,7 @@ install: all $(MAKE) -C xentrace install $(MAKE) -C python install $(MAKE) -C xfrd install + $(MAKE) -C sv install dist: $(TARGET) $(MAKE) prefix=`pwd`/../../install dist=yes install diff --git a/tools/python/setup.py b/tools/python/setup.py index 82d8a93bb4..7adae6cc94 100644 --- a/tools/python/setup.py +++ b/tools/python/setup.py @@ -42,7 +42,7 @@ setup(name = 'xen', 'xen.util', 'xen.xend', 'xen.xend.server', - 'xen.xend.sv', + 'xen.sv', 'xen.xm', ], ext_package = "xen.lowlevel", diff --git a/tools/python/xen/xend/sv/DomInfo.py b/tools/python/xen/sv/DomInfo.py similarity index 58% rename from tools/python/xen/xend/sv/DomInfo.py rename to tools/python/xen/sv/DomInfo.py index 3c5642a770..42abdee799 100755 --- a/tools/python/xen/xend/sv/DomInfo.py +++ b/tools/python/xen/sv/DomInfo.py @@ -1,20 +1,20 @@ -from HTMLBase import HTMLBase -from XendClientDeferred import server +from xen.xend.XendClient import aserver as server from xen.xend import PrettyPrint -from xen.xend.sv.util import * -from xen.xend.sv.GenTabbed import * +from xen.sv.HTMLBase import HTMLBase +from xen.sv.util import * +from xen.sv.GenTabbed import * class DomInfo( GenTabbed ): - def __init__( self, urlWriter, callback ): + def __init__( self, urlWriter ): self.dom = 0; def tabUrlWriter( tab ): return urlWriter( "mod=info&dom=%s%s" % ( self.dom, tab ) ) - GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ], callback ) + GenTabbed.__init__( self, tabUrlWriter, [ 'General', 'SXP', 'Devices' ], [ DomGenTab, DomSXPTab, NullTab ] ) def write_BODY( self, request ): dom = request.args.get('dom') @@ -43,7 +43,8 @@ class DomGenTab( GeneralTab ): GeneralTab.__init__( self, "General Domain Info", {}, titles ) - def write_BODY( self, request, callback ): + def write_BODY( self, request ): + dom = request.args.get('dom') if dom is None or len(dom) != 1: @@ -52,14 +53,9 @@ class DomGenTab( GeneralTab ): else: self.dom = dom[0] - deferred = getDomInfoHash( self.dom ) - deferred.addCallback( self.continue_BODY, request, callback ) - - def continue_BODY( self, dict, request, callback ): - - self.dict = dict + self.dict = getDomInfoHash( self.dom ) - GeneralTab.write_BODY( self, request, callback ) + GeneralTab.write_BODY( self, request ) class DomSXPTab( PreTab ): @@ -67,21 +63,8 @@ class DomSXPTab( PreTab ): self.dom = 0 PreTab.__init__( self, "" ) - def fn( self, x, request ): - class tmp: - def __init__( self ): - self.str = "" - def write( self, str ): - self.str = self.str + str - temp = tmp() - PrettyPrint.prettyprint( x, out=temp ) - self.source = temp.str - return request - - def fn2( self, request, callback ): - PreTab.write_BODY( self, request, callback ) - - def write_BODY( self, request, callback ): + + def write_BODY( self, request ): dom = request.args.get('dom') if dom is None or len(dom) != 1: @@ -90,10 +73,10 @@ class DomSXPTab( PreTab ): else: self.dom = dom[0] - deferred = server.xend_domain( self.dom ) + domInfo = server.xend_domain( self.dom ) - deferred.addCallback( self.fn, request ) - deferred.addCallback( self.fn2, callback ) - def errback( x ): - print ">err ", x - deferred.addErrback( errback ) \ No newline at end of file + self.source = sxp2string( domInfo ) + + PreTab.write_BODY( self, request ) + + diff --git a/tools/python/xen/sv/DomList.py b/tools/python/xen/sv/DomList.py new file mode 100755 index 0000000000..ee55957ba6 --- /dev/null +++ b/tools/python/xen/sv/DomList.py @@ -0,0 +1,62 @@ +from xen.xend.XendClient import server +from xen.xend import sxp + +from xen.sv.HTMLBase import HTMLBase +from xen.sv.util import * + +class DomList( HTMLBase ): + + isLeaf = True + + def __init__( self, urlWriter ): + HTMLBase.__init__(self) + self.urlWriter = urlWriter + + def write_BODY( self, request, head=True, long=True ): + + domains = server.xend_domains() + + request.write( "\n
Bad Tab
" ) self.finish_BODY( request ) else: - render_tab.write_BODY( request, self.finish_BODY ) + render_tab.write_BODY( request ) - def finish_BODY( self, request ): - request.write( "" ) - self.callback( request ) - class PreTab( HTMLBase ): def __init__( self, source ): HTMLBase.__init__( self ) self.source = source - def write_BODY( self, request, callback ): + def write_BODY( self, request ): request.write( "" )
request.write( self.source )
request.write( "%s
" % self.title ) @@ -87,17 +80,14 @@ class GeneralTab( HTMLBase ): writeAttr( niceName, attr ) request.write( "" ) - - callback( request ) - + class NullTab( HTMLBase ): def __init__( self ): HTMLBase.__init__( self ) self.title = "Null Tab" - def write_BODY( self, request, callback ): + def write_BODY( self, request ): request.write( "%s
" % self.title ) - callback( request ) - - \ No newline at end of file + + diff --git a/tools/python/xen/xend/sv/HTMLBase.py b/tools/python/xen/sv/HTMLBase.py similarity index 58% rename from tools/python/xen/xend/sv/HTMLBase.py rename to tools/python/xen/sv/HTMLBase.py index e127dedac6..4479d7e455 100755 --- a/tools/python/xen/xend/sv/HTMLBase.py +++ b/tools/python/xen/sv/HTMLBase.py @@ -1,27 +1,25 @@ -from twisted.web import server, resource -from twisted.internet import reactor +from twisted.web.resource import Resource + +class HTMLBase( Resource ): -class HTMLBase( resource.Resource ): - isLeaf = True - + def __init__( self ): - resource.Resource.__init__(self) - + Resource.__init__(self) + def render_GET( self, request ): self.write_TOP( request ) - return self.write_BODY( request, self.finish_render_GET ) - - def finish_render_GET( self, request ): + self.write_BODY( request ) self.write_BOTTOM( request ) request.finish() + return '' def write_BODY( self, request ): - request.write( "BODY" ) + request.write( "BODY" ) def write_TOP( self, request ): request.write( '