direct-io.hg
changeset 12876:918ea03857b9
merge with xen-unstable.hg
author | awilliam@xenbuild.aw |
---|---|
date | Tue Dec 05 10:01:15 2006 -0700 (2006-12-05) |
parents | ba7fca36fbd0 7df4d8cfba3b |
children | 9787cb7262e8 |
files |
line diff
1.1 --- a/buildconfigs/linux-defconfig_xen_ia64 Tue Dec 05 09:44:24 2006 -0700 1.2 +++ b/buildconfigs/linux-defconfig_xen_ia64 Tue Dec 05 10:01:15 2006 -0700 1.3 @@ -1548,6 +1548,8 @@ CONFIG_XEN_PCIDEV_BACKEND_SLOT=y 1.4 # CONFIG_XEN_TPMDEV_BACKEND is not set 1.5 CONFIG_XEN_BLKDEV_FRONTEND=y 1.6 CONFIG_XEN_NETDEV_FRONTEND=y 1.7 +CONFIG_XEN_FRAMEBUFFER=y 1.8 +CONFIG_XEN_KEYBOARD=y 1.9 # CONFIG_XEN_SCRUB_PAGES is not set 1.10 CONFIG_XEN_DISABLE_SERIAL=y 1.11 CONFIG_XEN_SYSFS=y
2.1 --- a/buildconfigs/linux-defconfig_xen_x86_32 Tue Dec 05 09:44:24 2006 -0700 2.2 +++ b/buildconfigs/linux-defconfig_xen_x86_32 Tue Dec 05 10:01:15 2006 -0700 2.3 @@ -3034,6 +3034,8 @@ CONFIG_XEN_NETDEV_LOOPBACK=y 2.4 # CONFIG_XEN_TPMDEV_BACKEND is not set 2.5 CONFIG_XEN_BLKDEV_FRONTEND=y 2.6 CONFIG_XEN_NETDEV_FRONTEND=y 2.7 +CONFIG_XEN_FRAMEBUFFER=y 2.8 +CONFIG_XEN_KEYBOARD=y 2.9 CONFIG_XEN_SCRUB_PAGES=y 2.10 CONFIG_XEN_DISABLE_SERIAL=y 2.11 CONFIG_XEN_SYSFS=y
3.1 --- a/buildconfigs/linux-defconfig_xen_x86_64 Tue Dec 05 09:44:24 2006 -0700 3.2 +++ b/buildconfigs/linux-defconfig_xen_x86_64 Tue Dec 05 10:01:15 2006 -0700 3.3 @@ -2866,6 +2866,8 @@ CONFIG_XEN_TPMDEV_BACKEND=m 3.4 # CONFIG_XEN_TPMDEV_CLOSE_IF_VTPM_FAILS is not set 3.5 CONFIG_XEN_BLKDEV_FRONTEND=y 3.6 CONFIG_XEN_NETDEV_FRONTEND=y 3.7 +CONFIG_XEN_FRAMEBUFFER=y 3.8 +CONFIG_XEN_KEYBOARD=y 3.9 CONFIG_XEN_SCRUB_PAGES=y 3.10 CONFIG_XEN_DISABLE_SERIAL=y 3.11 CONFIG_XEN_SYSFS=y
4.1 --- a/tools/examples/init.d/xend Tue Dec 05 09:44:24 2006 -0700 4.2 +++ b/tools/examples/init.d/xend Tue Dec 05 10:01:15 2006 -0700 4.3 @@ -36,7 +36,10 @@ case "$1" in 4.4 status) 4.5 xend status 4.6 ;; 4.7 - restart|reload|force-reload) 4.8 + reload) 4.9 + xend reload 4.10 + ;; 4.11 + restart|force-reload) 4.12 xend restart 4.13 await_daemons_up 4.14 ;;
5.1 --- a/tools/ioemu/hw/ide.c Tue Dec 05 09:44:24 2006 -0700 5.2 +++ b/tools/ioemu/hw/ide.c Tue Dec 05 10:01:15 2006 -0700 5.3 @@ -680,7 +680,7 @@ static void ide_set_sector(IDEState *s, 5.4 static void ide_sector_read(IDEState *s) 5.5 { 5.6 int64_t sector_num; 5.7 - int ret, n; 5.8 + int n; 5.9 5.10 s->status = READY_STAT | SEEK_STAT; 5.11 s->error = 0; /* not needed by IDE spec, but needed by Windows */ 5.12 @@ -695,7 +695,11 @@ static void ide_sector_read(IDEState *s) 5.13 #endif 5.14 if (n > s->req_nb_sectors) 5.15 n = s->req_nb_sectors; 5.16 - ret = bdrv_read(s->bs, sector_num, s->io_buffer, n); 5.17 + if (bdrv_read(s->bs, sector_num, s->io_buffer, n) != 0) { 5.18 + ide_abort_command(s); 5.19 + ide_set_irq(s); 5.20 + return; 5.21 + } 5.22 ide_transfer_start(s, s->io_buffer, 512 * n, ide_sector_read); 5.23 ide_set_irq(s); 5.24 ide_set_sector(s, sector_num + n); 5.25 @@ -721,7 +725,11 @@ static int ide_read_dma_cb(IDEState *s, 5.26 if (n > MAX_MULT_SECTORS) 5.27 n = MAX_MULT_SECTORS; 5.28 sector_num = ide_get_sector(s); 5.29 - bdrv_read(s->bs, sector_num, s->io_buffer, n); 5.30 + if (bdrv_read(s->bs, sector_num, s->io_buffer, n) != 0) { 5.31 + ide_abort_command(s); 5.32 + ide_set_irq(s); 5.33 + return 0; 5.34 + } 5.35 s->io_buffer_index = 0; 5.36 s->io_buffer_size = n * 512; 5.37 len = s->io_buffer_size; 5.38 @@ -767,7 +775,7 @@ static void ide_sector_write_timer_cb(vo 5.39 static void ide_sector_write(IDEState *s) 5.40 { 5.41 int64_t sector_num; 5.42 - int ret, n, n1; 5.43 + int n, n1; 5.44 5.45 s->status = READY_STAT | SEEK_STAT; 5.46 sector_num = ide_get_sector(s); 5.47 @@ -777,7 +785,11 @@ static void ide_sector_write(IDEState *s 5.48 n = s->nsector; 5.49 if (n > s->req_nb_sectors) 5.50 n = s->req_nb_sectors; 5.51 - ret = bdrv_write(s->bs, sector_num, s->io_buffer, n); 5.52 + if (bdrv_write(s->bs, sector_num, s->io_buffer, n) != 0) { 5.53 + ide_abort_command(s); 5.54 + ide_set_irq(s); 5.55 + return; 5.56 + } 5.57 s->nsector -= n; 5.58 if (s->nsector == 0) { 5.59 /* no more sector to write */ 5.60 @@ -823,8 +835,13 @@ static int ide_write_dma_cb(IDEState *s, 5.61 if (len == 0) { 5.62 n = s->io_buffer_size >> 9; 5.63 sector_num = ide_get_sector(s); 5.64 - bdrv_write(s->bs, sector_num, s->io_buffer, 5.65 - s->io_buffer_size >> 9); 5.66 + if (bdrv_write(s->bs, sector_num, s->io_buffer, 5.67 + s->io_buffer_size >> 9) != 0) { 5.68 + ide_abort_command(s); 5.69 + ide_set_irq(s); 5.70 + return 0; 5.71 + } 5.72 + 5.73 sector_num += n; 5.74 ide_set_sector(s, sector_num); 5.75 s->nsector -= n;
6.1 --- a/tools/ioemu/keymaps.c Tue Dec 05 09:44:24 2006 -0700 6.2 +++ b/tools/ioemu/keymaps.c Tue Dec 05 10:01:15 2006 -0700 6.3 @@ -36,8 +36,10 @@ static int get_keysym(const char *name) 6.4 #define MAX_EXTRA_COUNT 256 6.5 typedef struct { 6.6 uint16_t keysym2keycode[MAX_NORMAL_KEYCODE]; 6.7 + int keysym2numlock[MAX_NORMAL_KEYCODE]; 6.8 struct { 6.9 int keysym; 6.10 + int numlock; 6.11 uint16_t keycode; 6.12 } keysym2keycode_extra[MAX_EXTRA_COUNT]; 6.13 int extra_count; 6.14 @@ -50,6 +52,8 @@ static kbd_layout_t *parse_keyboard_layo 6.15 char file_name[1024]; 6.16 char line[1024]; 6.17 int len; 6.18 + int *keycode2numlock; 6.19 + int i; 6.20 6.21 snprintf(file_name, sizeof(file_name), 6.22 "%s/keymaps/%s", bios_dir, language); 6.23 @@ -63,6 +67,15 @@ static kbd_layout_t *parse_keyboard_layo 6.24 "Could not read keymap file: '%s'\n", file_name); 6.25 return 0; 6.26 } 6.27 + 6.28 + /* Allocate a temporary map tracking which keycodes change when numlock is 6.29 + set. Keycodes are 16 bit, so 65536 is safe. */ 6.30 + keycode2numlock = malloc(65536 * sizeof(int)); 6.31 + if (!keycode2numlock) { 6.32 + perror("Could not read keymap file"); 6.33 + return 0; 6.34 + } 6.35 + 6.36 for(;;) { 6.37 if (fgets(line, 1024, f) == NULL) 6.38 break; 6.39 @@ -86,13 +99,19 @@ static kbd_layout_t *parse_keyboard_layo 6.40 if (keysym == 0) { 6.41 // fprintf(stderr, "Warning: unknown keysym %s\n", line); 6.42 } else { 6.43 - const char *rest = end_of_keysym + 1; 6.44 - int keycode = strtol(rest, NULL, 0); 6.45 + char *rest = end_of_keysym + 1; 6.46 + int keycode = strtol(rest, &rest, 0); 6.47 + int numlock = (rest != NULL && 6.48 + strstr(rest, "numlock") != NULL); 6.49 + 6.50 + keycode2numlock[keycode] = numlock; 6.51 + 6.52 /* if(keycode&0x80) 6.53 keycode=(keycode<<8)^0x80e0; */ 6.54 if (keysym < MAX_NORMAL_KEYCODE) { 6.55 //fprintf(stderr,"Setting keysym %s (%d) to %d\n",line,keysym,keycode); 6.56 k->keysym2keycode[keysym] = keycode; 6.57 + k->keysym2numlock[keysym] = numlock; 6.58 } else { 6.59 if (k->extra_count >= MAX_EXTRA_COUNT) { 6.60 fprintf(stderr, 6.61 @@ -107,6 +126,8 @@ static kbd_layout_t *parse_keyboard_layo 6.62 keysym = keysym; 6.63 k->keysym2keycode_extra[k->extra_count]. 6.64 keycode = keycode; 6.65 + k->keysym2keycode_extra[k->extra_count]. 6.66 + numlock = numlock; 6.67 k->extra_count++; 6.68 } 6.69 } 6.70 @@ -115,6 +136,22 @@ static kbd_layout_t *parse_keyboard_layo 6.71 } 6.72 } 6.73 fclose(f); 6.74 + 6.75 + for (i = 0; i < MAX_NORMAL_KEYCODE; i++) { 6.76 + if (k->keysym2numlock[i] != 1) { 6.77 + k->keysym2numlock[i] = -keycode2numlock[k->keysym2keycode[i]]; 6.78 + } 6.79 + } 6.80 + 6.81 + for (i = 0; i < k->extra_count; i++) { 6.82 + if (k->keysym2keycode_extra[i].numlock != 1) { 6.83 + k->keysym2keycode_extra[i].numlock = 6.84 + -keycode2numlock[k->keysym2keycode_extra[i].keycode]; 6.85 + } 6.86 + } 6.87 + 6.88 + free(keycode2numlock); 6.89 + 6.90 return k; 6.91 } 6.92 6.93 @@ -143,3 +180,25 @@ static int keysym2scancode(void *kbd_lay 6.94 } 6.95 return 0; 6.96 } 6.97 + 6.98 +/** 6.99 + * Returns 1 if the given keysym requires numlock to be pressed, -1 if it 6.100 + * requires it to be cleared, and 0 otherwise. 6.101 + */ 6.102 +static int keysym2numlock(void *kbd_layout, int keysym) 6.103 +{ 6.104 + kbd_layout_t *k = kbd_layout; 6.105 + if (keysym < MAX_NORMAL_KEYCODE) { 6.106 + return k->keysym2numlock[keysym]; 6.107 + } else { 6.108 + int i; 6.109 +#ifdef XK_ISO_Left_Tab 6.110 + if (keysym == XK_ISO_Left_Tab) 6.111 + keysym = XK_Tab; 6.112 +#endif 6.113 + for (i = 0; i < k->extra_count; i++) 6.114 + if (k->keysym2keycode_extra[i].keysym == keysym) 6.115 + return k->keysym2keycode_extra[i].numlock; 6.116 + } 6.117 + return 0; 6.118 +}
7.1 --- a/tools/ioemu/vnc.c Tue Dec 05 09:44:24 2006 -0700 7.2 +++ b/tools/ioemu/vnc.c Tue Dec 05 10:01:15 2006 -0700 7.3 @@ -115,6 +115,7 @@ struct VncState 7.4 7.5 int ctl_keys; /* Ctrl+Alt starts calibration */ 7.6 int shift_keys; /* Shift / CapsLock keys */ 7.7 + int numlock; 7.8 }; 7.9 7.10 #define DIRTY_PIXEL_BITS 64 7.11 @@ -854,14 +855,40 @@ static void pointer_event(VncState *vs, 7.12 } 7.13 } 7.14 7.15 +static void press_key(VncState *vs, int keycode) 7.16 +{ 7.17 + kbd_put_keycode(keysym2scancode(vs->kbd_layout, keycode) & 0x7f); 7.18 + kbd_put_keycode(keysym2scancode(vs->kbd_layout, keycode) | 0x80); 7.19 +} 7.20 + 7.21 static void do_key_event(VncState *vs, int down, uint32_t sym) 7.22 { 7.23 sym &= 0xFFFF; 7.24 7.25 if (is_graphic_console()) { 7.26 int keycode; 7.27 + int numlock; 7.28 7.29 keycode = keysym2scancode(vs->kbd_layout, sym); 7.30 + numlock = keysym2numlock(vs->kbd_layout, sym); 7.31 + 7.32 + /* If the numlock state needs to change then simulate an additional 7.33 + keypress before sending this one. This will happen if the user 7.34 + toggles numlock away from the VNC window. 7.35 + */ 7.36 + if (numlock == 1) { 7.37 + if (!vs->numlock) { 7.38 + vs->numlock = 1; 7.39 + press_key(vs, XK_Num_Lock); 7.40 + } 7.41 + } 7.42 + else if (numlock == -1) { 7.43 + if (vs->numlock) { 7.44 + vs->numlock = 0; 7.45 + press_key(vs, XK_Num_Lock); 7.46 + } 7.47 + } 7.48 + 7.49 if (keycode & 0x80) 7.50 kbd_put_keycode(0xe0); 7.51 if (down) 7.52 @@ -932,6 +959,10 @@ static void do_key_event(VncState *vs, i 7.53 vs->shift_keys ^= 2; 7.54 break; 7.55 7.56 + case XK_Num_Lock: 7.57 + vs->numlock = !vs->numlock; 7.58 + break; 7.59 + 7.60 case XK_1 ... XK_9: 7.61 if ((vs->ctl_keys & 3) != 3) 7.62 break; 7.63 @@ -1355,6 +1386,7 @@ int vnc_display_init(DisplayState *ds, i 7.64 vs->lsock = -1; 7.65 vs->csock = -1; 7.66 vs->depth = 4; 7.67 + vs->numlock = 0; 7.68 7.69 vs->ds = ds; 7.70
8.1 --- a/tools/ioemu/vnc_keysym.h Tue Dec 05 09:44:24 2006 -0700 8.2 +++ b/tools/ioemu/vnc_keysym.h Tue Dec 05 10:01:15 2006 -0700 8.3 @@ -231,6 +231,19 @@ static name2keysym_t name2keysym[]={ 8.4 {"Home", 0xff50}, /* XK_Home */ 8.5 {"End", 0xff57}, /* XK_End */ 8.6 {"Scroll_Lock", 0xff14}, /* XK_Scroll_Lock */ 8.7 +{"KP_Home", 0xff95}, 8.8 +{"KP_Left", 0xff96}, 8.9 +{"KP_Up", 0xff97}, 8.10 +{"KP_Right", 0xff98}, 8.11 +{"KP_Down", 0xff99}, 8.12 +{"KP_Prior", 0xff9a}, 8.13 +{"KP_Page_Up", 0xff9a}, 8.14 +{"KP_Next", 0xff9b}, 8.15 +{"KP_Page_Down", 0xff9b}, 8.16 +{"KP_End", 0xff9c}, 8.17 +{"KP_Begin", 0xff9d}, 8.18 +{"KP_Insert", 0xff9e}, 8.19 +{"KP_Delete", 0xff9f}, 8.20 {"F1", 0xffbe}, /* XK_F1 */ 8.21 {"F2", 0xffbf}, /* XK_F2 */ 8.22 {"F3", 0xffc0}, /* XK_F3 */ 8.23 @@ -258,6 +271,7 @@ static name2keysym_t name2keysym[]={ 8.24 {"KP_8", 0xffb8}, /* XK_KP_8 */ 8.25 {"KP_9", 0xffb9}, /* XK_KP_9 */ 8.26 {"KP_Add", 0xffab}, /* XK_KP_Add */ 8.27 +{"KP_Separator", 0xffac},/* XK_KP_Separator */ 8.28 {"KP_Decimal", 0xffae}, /* XK_KP_Decimal */ 8.29 {"KP_Divide", 0xffaf}, /* XK_KP_Divide */ 8.30 {"KP_Enter", 0xff8d}, /* XK_KP_Enter */
9.1 --- a/tools/libxen/src/xen_common.c Tue Dec 05 09:44:24 2006 -0700 9.2 +++ b/tools/libxen/src/xen_common.c Tue Dec 05 10:01:15 2006 -0700 9.3 @@ -518,8 +518,14 @@ static void parse_into(xen_session *s, x 9.4 xmlChar *string = string_from_value(value_node, "string"); 9.5 if (string == NULL) 9.6 { 9.7 +#if PERMISSIVE 9.8 + fprintf(stderr, 9.9 + "Expected an Enum from the server, but didn't get one\n"); 9.10 + ((int *)value)[slot] = 0; 9.11 +#else 9.12 server_error( 9.13 s, "Expected an Enum from the server, but didn't get one"); 9.14 +#endif 9.15 } 9.16 else 9.17 { 9.18 @@ -567,8 +573,14 @@ static void parse_into(xen_session *s, x 9.19 xmlChar *string = string_from_value(value_node, "boolean"); 9.20 if (string == NULL) 9.21 { 9.22 +#if PERMISSIVE 9.23 + fprintf(stderr, 9.24 + "Expected a Bool from the server, but didn't get one\n"); 9.25 + ((bool *)value)[slot] = false; 9.26 +#else 9.27 server_error( 9.28 s, "Expected a Bool from the server, but didn't get one"); 9.29 +#endif 9.30 } 9.31 else 9.32 { 9.33 @@ -764,7 +776,6 @@ static void parse_into(xen_session *s, x 9.34 cur = cur->next; 9.35 } 9.36 9.37 -#if !PERMISSIVE 9.38 /* Check that we've filled all fields. */ 9.39 for (size_t i = 0; i < member_count; i++) 9.40 { 9.41 @@ -781,15 +792,20 @@ static void parse_into(xen_session *s, x 9.42 9.43 if (j == seen_count) 9.44 { 9.45 +#if PERMISSIVE 9.46 + fprintf(stderr, 9.47 + "Struct did not contain expected field %s.\n", 9.48 + mem->key); 9.49 +#else 9.50 server_error_2(s, 9.51 "Struct did not contain expected field", 9.52 mem->key); 9.53 free(result); 9.54 free(checklist); 9.55 return; 9.56 +#endif 9.57 } 9.58 } 9.59 -#endif 9.60 9.61 free(checklist); 9.62 ((void **)value)[slot] = result;
10.1 --- a/tools/libxen/src/xen_vm.c Tue Dec 05 09:44:24 2006 -0700 10.2 +++ b/tools/libxen/src/xen_vm.c Tue Dec 05 10:01:15 2006 -0700 10.3 @@ -85,28 +85,28 @@ static const struct_member xen_vm_record 10.4 { .key = "memory_static_min", 10.5 .type = &abstract_type_int, 10.6 .offset = offsetof(xen_vm_record, memory_static_min) }, 10.7 - { .key = "vcpus_policy", 10.8 + { .key = "VCPUs_policy", 10.9 .type = &abstract_type_string, 10.10 .offset = offsetof(xen_vm_record, vcpus_policy) }, 10.11 - { .key = "vcpus_params", 10.12 + { .key = "VCPUs_params", 10.13 .type = &abstract_type_string, 10.14 .offset = offsetof(xen_vm_record, vcpus_params) }, 10.15 - { .key = "vcpus_number", 10.16 + { .key = "VCPUs_number", 10.17 .type = &abstract_type_int, 10.18 .offset = offsetof(xen_vm_record, vcpus_number) }, 10.19 - { .key = "vcpus_utilisation", 10.20 + { .key = "VCPUs_utilisation", 10.21 .type = &abstract_type_int_float_map, 10.22 .offset = offsetof(xen_vm_record, vcpus_utilisation) }, 10.23 - { .key = "vcpus_features_required", 10.24 + { .key = "VCPUs_features_required", 10.25 .type = &xen_cpu_feature_set_abstract_type_, 10.26 .offset = offsetof(xen_vm_record, vcpus_features_required) }, 10.27 - { .key = "vcpus_features_can_use", 10.28 + { .key = "VCPUs_features_can_use", 10.29 .type = &xen_cpu_feature_set_abstract_type_, 10.30 .offset = offsetof(xen_vm_record, vcpus_features_can_use) }, 10.31 - { .key = "vcpus_features_force_on", 10.32 + { .key = "VCPUs_features_force_on", 10.33 .type = &xen_cpu_feature_set_abstract_type_, 10.34 .offset = offsetof(xen_vm_record, vcpus_features_force_on) }, 10.35 - { .key = "vcpus_features_force_off", 10.36 + { .key = "VCPUs_features_force_off", 10.37 .type = &xen_cpu_feature_set_abstract_type_, 10.38 .offset = offsetof(xen_vm_record, vcpus_features_force_off) }, 10.39 { .key = "actions_after_shutdown", 10.40 @@ -1124,7 +1124,7 @@ xen_vm_set_vcpus_policy(xen_session *ses 10.41 .u.string_val = policy } 10.42 }; 10.43 10.44 - xen_call_(session, "VM.set_vcpus_policy", param_values, 2, NULL, NULL); 10.45 + xen_call_(session, "VM.set_VCPUs_policy", param_values, 2, NULL, NULL); 10.46 return session->ok; 10.47 } 10.48 10.49 @@ -1140,7 +1140,7 @@ xen_vm_set_vcpus_params(xen_session *ses 10.50 .u.string_val = params } 10.51 }; 10.52 10.53 - xen_call_(session, "VM.set_vcpus_params", param_values, 2, NULL, NULL); 10.54 + xen_call_(session, "VM.set_VCPUs_params", param_values, 2, NULL, NULL); 10.55 return session->ok; 10.56 } 10.57 10.58 @@ -1156,7 +1156,7 @@ xen_vm_set_vcpus_features_force_on(xen_s 10.59 .u.set_val = (arbitrary_set *)force_on } 10.60 }; 10.61 10.62 - xen_call_(session, "VM.set_vcpus_features_force_on", param_values, 2, NULL, NULL); 10.63 + xen_call_(session, "VM.set_VCPUs_features_force_on", param_values, 2, NULL, NULL); 10.64 return session->ok; 10.65 } 10.66 10.67 @@ -1172,7 +1172,7 @@ xen_vm_set_vcpus_features_force_off(xen_ 10.68 .u.set_val = (arbitrary_set *)force_off } 10.69 }; 10.70 10.71 - xen_call_(session, "VM.set_vcpus_features_force_off", param_values, 2, NULL, NULL); 10.72 + xen_call_(session, "VM.set_VCPUs_features_force_off", param_values, 2, NULL, NULL); 10.73 return session->ok; 10.74 } 10.75
11.1 --- a/tools/misc/xend Tue Dec 05 09:44:24 2006 -0700 11.2 +++ b/tools/misc/xend Tue Dec 05 10:01:15 2006 -0700 11.3 @@ -109,7 +109,7 @@ def main(): 11.4 11.5 daemon = SrvDaemon.instance() 11.6 if not sys.argv[1:]: 11.7 - print 'usage: %s {start|stop|restart}' % sys.argv[0] 11.8 + print 'usage: %s {start|stop|reload|restart}' % sys.argv[0] 11.9 elif sys.argv[1] == 'start': 11.10 if os.uname()[0] != "SunOS": 11.11 start_xenstored() 11.12 @@ -123,6 +123,8 @@ def main(): 11.13 return daemon.start(trace=1) 11.14 elif sys.argv[1] == 'stop': 11.15 return daemon.stop() 11.16 + elif sys.argv[1] == 'reload': 11.17 + return daemon.reloadConfig() 11.18 elif sys.argv[1] == 'restart': 11.19 start_xenstored() 11.20 start_consoled()
12.1 --- a/tools/python/xen/xend/XendDomainInfo.py Tue Dec 05 09:44:24 2006 -0700 12.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Dec 05 10:01:15 2006 -0700 12.3 @@ -1709,8 +1709,10 @@ class XendDomainInfo: 12.4 12.5 dom = XendDomain.instance().domain_lookup_nr(name) 12.6 if dom and dom.info['uuid'] != self.info['uuid']: 12.7 - raise VmError("VM name '%s' already exists as domain %s" % 12.8 - (name, str(dom.domid))) 12.9 + raise VmError("VM name '%s' already exists%s" % 12.10 + (name, 12.11 + dom.domid is not None and 12.12 + ("as domain %s" % str(dom.domid)) or "")) 12.13 12.14 12.15 def update(self, info = None, refresh = True):
13.1 --- a/tools/python/xen/xend/server/SrvDaemon.py Tue Dec 05 09:44:24 2006 -0700 13.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py Tue Dec 05 10:01:15 2006 -0700 13.3 @@ -60,6 +60,14 @@ class Daemon: 13.4 return running 13.5 13.6 13.7 + def reloadConfig(self): 13.8 + """ 13.9 + """ 13.10 + pid = read_pid(XEND_PID_FILE) 13.11 + if find_process(pid, XEND_PROCESS_NAME): 13.12 + os.kill(pid, signal.SIGHUP) 13.13 + 13.14 + 13.15 def status(self): 13.16 """Returns the status of the xend daemon. 13.17 The return value is defined by the LSB:
14.1 --- a/tools/python/xen/xend/server/SrvServer.py Tue Dec 05 09:44:24 2006 -0700 14.2 +++ b/tools/python/xen/xend/server/SrvServer.py Tue Dec 05 10:01:15 2006 -0700 14.3 @@ -65,6 +65,7 @@ class XendServers: 14.4 def __init__(self): 14.5 self.servers = [] 14.6 self.cleaningUp = False 14.7 + self.reloadingConfig = False 14.8 14.9 def add(self, server): 14.10 self.servers.append(server) 14.11 @@ -78,6 +79,11 @@ class XendServers: 14.12 except: 14.13 pass 14.14 14.15 + def reloadConfig(self, signum = 0, frame = None): 14.16 + log.debug("SrvServer.reloadConfig()") 14.17 + self.reloadingConfig = True 14.18 + self.cleanup(signum, frame) 14.19 + 14.20 def start(self, status): 14.21 # Running the network script will spawn another process, which takes 14.22 # the status fd with it unless we set FD_CLOEXEC. Failing to do this 14.23 @@ -86,61 +92,80 @@ class XendServers: 14.24 fcntl.fcntl(status, fcntl.F_SETFD, fcntl.FD_CLOEXEC) 14.25 14.26 Vifctl.network('start') 14.27 - threads = [] 14.28 - for server in self.servers: 14.29 - thread = Thread(target=server.run, name=server.__class__.__name__) 14.30 - if isinstance(server, HttpServer): 14.31 - thread.setDaemon(True) 14.32 - thread.start() 14.33 - threads.append(thread) 14.34 - 14.35 - 14.36 - # check for when all threads have initialized themselves and then 14.37 - # close the status pipe 14.38 - 14.39 - threads_left = True 14.40 - while threads_left: 14.41 - threads_left = False 14.42 - 14.43 - for server in self.servers: 14.44 - if not server.ready: 14.45 - threads_left = True 14.46 - break 14.47 - 14.48 - if threads_left: 14.49 - time.sleep(.5) 14.50 - 14.51 - if status: 14.52 - status.write('0') 14.53 - status.close() 14.54 14.55 # Prepare to catch SIGTERM (received when 'xend stop' is executed) 14.56 # and call each server's cleanup if possible 14.57 signal.signal(signal.SIGTERM, self.cleanup) 14.58 + signal.signal(signal.SIGHUP, self.reloadConfig) 14.59 14.60 - # Interruptible Thread.join - Python Bug #1167930 14.61 - # Replaces: for t in threads: t.join() 14.62 - # Reason: The above will cause python signal handlers to be 14.63 - # blocked so we're not able to catch SIGTERM in any 14.64 - # way for cleanup 14.65 - runningThreads = threads 14.66 - while len(runningThreads) > 0: 14.67 - try: 14.68 - for t in threads: 14.69 - t.join(1.0) 14.70 - runningThreads = [t for t in threads 14.71 - if t.isAlive() and not t.isDaemon()] 14.72 - if self.cleaningUp and len(runningThreads) > 0: 14.73 - log.debug("Waiting for %s." % 14.74 - [x.getName() for x in runningThreads]) 14.75 - except: 14.76 - pass 14.77 + while True: 14.78 + threads = [] 14.79 + for server in self.servers: 14.80 + thread = Thread(target=server.run, name=server.__class__.__name__) 14.81 + if isinstance(server, HttpServer): 14.82 + thread.setDaemon(True) 14.83 + thread.start() 14.84 + threads.append(thread) 14.85 14.86 14.87 -def create(): 14.88 - root = SrvDir() 14.89 - root.putChild('xend', SrvRoot()) 14.90 - servers = XendServers() 14.91 + # check for when all threads have initialized themselves and then 14.92 + # close the status pipe 14.93 + 14.94 + retryCount = 0 14.95 + threads_left = True 14.96 + while threads_left: 14.97 + threads_left = False 14.98 + 14.99 + for server in self.servers: 14.100 + if not server.ready: 14.101 + threads_left = True 14.102 + break 14.103 + 14.104 + if threads_left: 14.105 + time.sleep(.5) 14.106 + retryCount += 1 14.107 + if retryCount > 60: 14.108 + for server in self.servers: 14.109 + if not server.ready: 14.110 + log.error("Server " + 14.111 + server.__class__.__name__ + 14.112 + " did not initialise!") 14.113 + break 14.114 + 14.115 + if status: 14.116 + status.write('0') 14.117 + status.close() 14.118 + status = None 14.119 + 14.120 + # Interruptible Thread.join - Python Bug #1167930 14.121 + # Replaces: for t in threads: t.join() 14.122 + # Reason: The above will cause python signal handlers to be 14.123 + # blocked so we're not able to catch SIGTERM in any 14.124 + # way for cleanup 14.125 + runningThreads = threads 14.126 + while len(runningThreads) > 0: 14.127 + try: 14.128 + for t in threads: 14.129 + t.join(1.0) 14.130 + runningThreads = [t for t in threads 14.131 + if t.isAlive() and not t.isDaemon()] 14.132 + if self.cleaningUp and len(runningThreads) > 0: 14.133 + log.debug("Waiting for %s." % 14.134 + [x.getName() for x in runningThreads]) 14.135 + except: 14.136 + pass 14.137 + 14.138 + if self.reloadingConfig: 14.139 + log.info("Restarting all servers...") 14.140 + self.cleaningUp = False 14.141 + self.reloadingConfig = False 14.142 + xroot.set_config() 14.143 + self.servers = [] 14.144 + _loadConfig(self) 14.145 + else: 14.146 + break 14.147 + 14.148 +def _loadConfig(servers): 14.149 if xroot.get_xend_http_server(): 14.150 servers.add(HttpServer(root, 14.151 xroot.get_xend_address(), 14.152 @@ -188,4 +213,11 @@ def create(): 14.153 14.154 if xroot.get_xend_unix_xmlrpc_server(): 14.155 servers.add(XMLRPCServer(XendAPI.AUTH_PAM)) 14.156 + 14.157 + 14.158 +def create(): 14.159 + root = SrvDir() 14.160 + root.putChild('xend', SrvRoot()) 14.161 + servers = XendServers() 14.162 + _loadConfig(servers) 14.163 return servers
15.1 --- a/tools/python/xen/xend/server/XMLRPCServer.py Tue Dec 05 09:44:24 2006 -0700 15.2 +++ b/tools/python/xen/xend/server/XMLRPCServer.py Tue Dec 05 10:01:15 2006 -0700 15.3 @@ -16,6 +16,8 @@ 15.4 # Copyright (C) 2006 XenSource Ltd. 15.5 #============================================================================ 15.6 15.7 +import errno 15.8 +import socket 15.9 import types 15.10 import xmlrpclib 15.11 from xen.util.xmlrpclib2 import UnixXMLRPCServer, TCPXMLRPCServer 15.12 @@ -105,20 +107,25 @@ class XMLRPCServer: 15.13 "; authentication has been disabled for this server." or 15.14 ".") 15.15 15.16 - if self.use_tcp: 15.17 - log.info("Opening TCP XML-RPC server on %s%d%s", 15.18 - self.host and '%s:' % self.host or 15.19 - 'all interfaces, port ', 15.20 - self.port, authmsg) 15.21 - self.server = TCPXMLRPCServer((self.host, self.port), 15.22 - self.hosts_allowed, 15.23 - logRequests = False) 15.24 - else: 15.25 - log.info("Opening Unix domain socket XML-RPC server on %s%s", 15.26 - self.path, authmsg) 15.27 - self.server = UnixXMLRPCServer(self.path, self.hosts_allowed, 15.28 - logRequests = False) 15.29 - 15.30 + try: 15.31 + if self.use_tcp: 15.32 + log.info("Opening TCP XML-RPC server on %s%d%s", 15.33 + self.host and '%s:' % self.host or 15.34 + 'all interfaces, port ', 15.35 + self.port, authmsg) 15.36 + self.server = TCPXMLRPCServer((self.host, self.port), 15.37 + self.hosts_allowed, 15.38 + logRequests = False) 15.39 + else: 15.40 + log.info("Opening Unix domain socket XML-RPC server on %s%s", 15.41 + self.path, authmsg) 15.42 + self.server = UnixXMLRPCServer(self.path, self.hosts_allowed, 15.43 + logRequests = False) 15.44 + except socket.error, exn: 15.45 + log.error('Cannot start server: %s!', exn.args[1]) 15.46 + ready = True 15.47 + running = False 15.48 + return 15.49 15.50 # Register Xen API Functions 15.51 # ------------------------------------------------------------------- 15.52 @@ -177,6 +184,11 @@ class XMLRPCServer: 15.53 15.54 def cleanup(self): 15.55 log.debug("XMLRPCServer.cleanup()") 15.56 + try: 15.57 + self.server.socket.close() 15.58 + except Exception, exn: 15.59 + log.exception(exn) 15.60 + pass 15.61 15.62 def shutdown(self): 15.63 self.running = False
16.1 --- a/tools/xm-test/lib/XmTestLib/XenManagedDomain.py Tue Dec 05 09:44:24 2006 -0700 16.2 +++ b/tools/xm-test/lib/XmTestLib/XenManagedDomain.py Tue Dec 05 10:01:15 2006 -0700 16.3 @@ -94,12 +94,13 @@ class XenManagedDomain(XenDomain): 16.4 #Only support PV for now. 16.5 self.type = "PV" 16.6 16.7 - def start(self, noConsole=False): 16.8 + def start(self, noConsole=False, startpaused=False): 16.9 #start the VM 16.10 server = self.server 16.11 if self.vm_uuid: 16.12 try: 16.13 - xapi.execute(server.VM.start, self.session, self.vm_uuid) 16.14 + xapi.execute(server.VM.start, self.session, self.vm_uuid, 16.15 + startpaused) 16.16 except: 16.17 raise DomainError("Could not start domain") 16.18 else:
17.1 --- a/xen/arch/x86/mm/shadow/common.c Tue Dec 05 09:44:24 2006 -0700 17.2 +++ b/xen/arch/x86/mm/shadow/common.c Tue Dec 05 10:01:15 2006 -0700 17.3 @@ -1246,7 +1246,7 @@ sh_gfn_to_mfn_foreign(struct domain *d, 17.4 /* Read another domain's p2m entries */ 17.5 { 17.6 mfn_t mfn; 17.7 - unsigned long addr = gpfn << PAGE_SHIFT; 17.8 + paddr_t addr = ((paddr_t)gpfn) << PAGE_SHIFT; 17.9 l2_pgentry_t *l2e; 17.10 l1_pgentry_t *l1e; 17.11 17.12 @@ -1274,7 +1274,16 @@ sh_gfn_to_mfn_foreign(struct domain *d, 17.13 #if CONFIG_PAGING_LEVELS >= 3 17.14 { 17.15 l3_pgentry_t *l3e = sh_map_domain_page(mfn); 17.16 - l3e += l3_table_offset(addr); 17.17 +#if CONFIG_PAGING_LEVELS == 3 17.18 + /* On PAE hosts the p2m has eight l3 entries, not four (see 17.19 + * shadow_set_p2m_entry()) so we can't use l3_table_offset. 17.20 + * Instead, just count the number of l3es from zero. It's safe 17.21 + * to do this because we already checked that the gfn is within 17.22 + * the bounds of the p2m. */ 17.23 + l3e += (((addr) & VADDR_MASK) >> L3_PAGETABLE_SHIFT); 17.24 +#else 17.25 + l3e += l3_table_offset(addr); 17.26 +#endif 17.27 if ( (l3e_get_flags(*l3e) & _PAGE_PRESENT) == 0 ) 17.28 { 17.29 sh_unmap_domain_page(l3e);