direct-io.hg

changeset 3452:707455ee2ff6

bitkeeper revision 1.1159.217.20 (41ebdda5ZO9YBU_VHuSh0IwgcQe0Ng)

Merge arcadians.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into arcadians.cl.cam.ac.uk:/local/scratch-2/cl349/xen-unstable.bk-merge
author cl349@arcadians.cl.cam.ac.uk
date Mon Jan 17 15:45:41 2005 +0000 (2005-01-17)
parents 4abfb7f9fa7a 90f0ae7be1de
children 3c69b6ca4021
files tools/examples/xmexample1 tools/examples/xmexample2 tools/libxc/xc.h tools/libxc/xc_linux_build.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/examples/xmexample1	Mon Jan 17 13:34:55 2005 +0000
     1.2 +++ b/tools/examples/xmexample1	Mon Jan 17 15:45:41 2005 +0000
     1.3 @@ -25,6 +25,9 @@ name = "ExampleDomain"
     1.4  # Which CPU to start domain on? 
     1.5  #cpu = -1   # leave to Xen to pick
     1.6  
     1.7 +# Number of Virtual CPUS to use, default is 1
     1.8 +#vcpus = 1
     1.9 +
    1.10  #----------------------------------------------------------------------------
    1.11  # Define network interfaces.
    1.12  
     2.1 --- a/tools/examples/xmexample2	Mon Jan 17 13:34:55 2005 +0000
     2.2 +++ b/tools/examples/xmexample2	Mon Jan 17 15:45:41 2005 +0000
     2.3 @@ -55,6 +55,10 @@ name = "VM%d" % vmid
     2.4  #cpu = -1   # leave to Xen to pick
     2.5  cpu = vmid  # set based on vmid (mod number of CPUs)
     2.6  
     2.7 +# Number of Virtual CPUS to use, default is 1
     2.8 +#vcpus = 1
     2.9 +vcpus = 4 # make your domain a 4-way
    2.10 +
    2.11  #----------------------------------------------------------------------------
    2.12  # Define network interfaces.
    2.13  
     3.1 --- a/tools/libxc/xc.h	Mon Jan 17 13:34:55 2005 +0000
     3.2 +++ b/tools/libxc/xc.h	Mon Jan 17 15:45:41 2005 +0000
     3.3 @@ -197,7 +197,8 @@ int xc_linux_build(int xc_handle,
     3.4                     const char *ramdisk_name,
     3.5                     const char *cmdline,
     3.6                     unsigned int control_evtchn,
     3.7 -                   unsigned long flags);
     3.8 +                   unsigned long flags,
     3.9 +                   unsigned int vcpus);
    3.10  
    3.11  int
    3.12  xc_plan9_build (int xc_handle,
     4.1 --- a/tools/libxc/xc_linux_build.c	Mon Jan 17 13:34:55 2005 +0000
     4.2 +++ b/tools/libxc/xc_linux_build.c	Mon Jan 17 15:45:41 2005 +0000
     4.3 @@ -51,7 +51,8 @@ static int setup_guestos(int xc_handle,
     4.4                           const char *cmdline,
     4.5                           unsigned long shared_info_frame,
     4.6                           unsigned int control_evtchn,
     4.7 -                         unsigned long flags)
     4.8 +                         unsigned long flags,
     4.9 +                         unsigned int vcpus)
    4.10  {
    4.11      l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
    4.12      l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
    4.13 @@ -81,8 +82,6 @@ static int setup_guestos(int xc_handle,
    4.14      unsigned long vpt_end;
    4.15      unsigned long v_end;
    4.16  
    4.17 -    char *n_vcpus;
    4.18 -
    4.19      memset(&dsi, 0, sizeof(struct domain_setup_info));
    4.20  
    4.21      rc = parseelfimage(image, image_size, &dsi);
    4.22 @@ -291,11 +290,10 @@ static int setup_guestos(int xc_handle,
    4.23      /* Mask all upcalls... */
    4.24      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    4.25          shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    4.26 -    n_vcpus = getenv("XEN_VCPUS");
    4.27 -    if ( n_vcpus )
    4.28 -	shared_info->n_vcpu = atoi(n_vcpus);
    4.29 -    else
    4.30 -	shared_info->n_vcpu = 1;
    4.31 +
    4.32 +    shared_info->n_vcpu = vcpus;
    4.33 +    printf(" VCPUS:         %d\n", shared_info->n_vcpu);
    4.34 +
    4.35      munmap(shared_info, PAGE_SIZE);
    4.36  
    4.37      /* Send the page update requests down to the hypervisor. */
    4.38 @@ -324,7 +322,8 @@ int xc_linux_build(int xc_handle,
    4.39                     const char *ramdisk_name,
    4.40                     const char *cmdline,
    4.41                     unsigned int control_evtchn,
    4.42 -                   unsigned long flags)
    4.43 +                   unsigned long flags,
    4.44 +                   unsigned int vcpus)
    4.45  {
    4.46      dom0_op_t launch_op, op;
    4.47      int initrd_fd = -1;
    4.48 @@ -390,7 +389,7 @@ int xc_linux_build(int xc_handle,
    4.49                         &vstartinfo_start, &vkern_entry,
    4.50                         ctxt, cmdline,
    4.51                         op.u.getdomaininfo.shared_info_frame,
    4.52 -                       control_evtchn, flags) < 0 )
    4.53 +                       control_evtchn, flags, vcpus) < 0 )
    4.54      {
    4.55          ERROR("Error constructing guest OS");
    4.56          goto error_out;
     5.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Mon Jan 17 13:34:55 2005 +0000
     5.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Mon Jan 17 15:45:41 2005 +0000
     5.3 @@ -348,19 +348,19 @@ static PyObject *pyxc_linux_build(PyObje
     5.4  
     5.5      u32   dom;
     5.6      char *image, *ramdisk = NULL, *cmdline = "";
     5.7 -    int   control_evtchn, flags = 0;
     5.8 +    int   control_evtchn, flags = 0, vcpus = 1;
     5.9  
    5.10      static char *kwd_list[] = { "dom", "control_evtchn", 
    5.11 -                                "image", "ramdisk", "cmdline", "flags",
    5.12 +                                "image", "ramdisk", "cmdline", "flags", "vcpus",
    5.13                                  NULL };
    5.14  
    5.15 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssi", kwd_list, 
    5.16 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssii", kwd_list, 
    5.17                                        &dom, &control_evtchn, 
    5.18 -                                      &image, &ramdisk, &cmdline, &flags) )
    5.19 +                                      &image, &ramdisk, &cmdline, &flags, &vcpus) )
    5.20          return NULL;
    5.21  
    5.22      if ( xc_linux_build(xc->xc_handle, dom, image,
    5.23 -                        ramdisk, cmdline, control_evtchn, flags) != 0 )
    5.24 +                        ramdisk, cmdline, control_evtchn, flags, vcpus) != 0 )
    5.25          return PyErr_SetFromErrno(xc_error);
    5.26      
    5.27      Py_INCREF(zero);
    5.28 @@ -1023,6 +1023,7 @@ static PyMethodDef pyxc_methods[] = {
    5.29        " image   [str]:      Name of kernel image file. May be gzipped.\n"
    5.30        " ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
    5.31        " cmdline [str, n/a]: Kernel parameters, if any.\n\n"
    5.32 +      " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
    5.33        "Returns: [int] 0 on success; -1 on error.\n" },
    5.34  
    5.35      { "vmx_build", 
     6.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Jan 17 13:34:55 2005 +0000
     6.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Mon Jan 17 15:45:41 2005 +0000
     6.3 @@ -321,6 +321,7 @@ class XendDomainInfo:
     6.4          self.console_port = None
     6.5          self.savedinfo = None
     6.6          self.is_vmx = 0
     6.7 +        self.vcpus = 1
     6.8  
     6.9      def setdom(self, dom):
    6.10          """Set the domain id.
    6.11 @@ -448,6 +449,11 @@ class XendDomainInfo:
    6.12              cpu = sxp.child_value(config, 'cpu')
    6.13              if self.recreate and self.dom and cpu is not None:
    6.14                  xc.domain_pincpu(self.dom, int(cpu))
    6.15 +            try:
    6.16 +                image = sxp.child_value(self.config, 'image')
    6.17 +                self.vcpus = int(sxp.child_value(image, 'vcpus'))
    6.18 +            except:
    6.19 +                raise VmError('invalid vcpus value')
    6.20  
    6.21              self.init_domain()
    6.22              self.configure_console()
    6.23 @@ -746,12 +752,14 @@ class XendDomainInfo:
    6.24                        	ramdisk        = ramdisk,
    6.25                        	flags          = flags)
    6.26  	else:
    6.27 +        	log.warning('building dom with %d vcpus', self.vcpus)
    6.28          	err = buildfn(dom            = dom,
    6.29                 	      	image          = kernel,
    6.30                        	control_evtchn = self.console.getRemotePort(),
    6.31                        	cmdline        = cmdline,
    6.32                        	ramdisk        = ramdisk,
    6.33 -                      	flags          = flags)
    6.34 +                      	flags          = flags,
    6.35 +                      	vcpus          = self.vcpus)
    6.36          if err != 0:
    6.37              raise VmError('Building domain failed: type=%s dom=%d err=%d'
    6.38                            % (ostype, dom, err))
    6.39 @@ -1280,6 +1288,7 @@ add_config_handler('console',    vm_fiel
    6.40  add_config_handler('image',      vm_field_ignore)
    6.41  add_config_handler('device',     vm_field_ignore)
    6.42  add_config_handler('backend',    vm_field_ignore)
    6.43 +add_config_handler('vcpus',      vm_field_ignore)
    6.44  
    6.45  # Register other config handlers.
    6.46  add_config_handler('maxmem',     vm_field_maxmem)
     7.1 --- a/tools/python/xen/xm/create.py	Mon Jan 17 13:34:55 2005 +0000
     7.2 +++ b/tools/python/xen/xm/create.py	Mon Jan 17 15:45:41 2005 +0000
     7.3 @@ -109,6 +109,10 @@ gopts.var('cpu', val='CPU',
     7.4            fn=set_int, default=None,
     7.5            use="CPU to run the domain on.")
     7.6  
     7.7 +gopts.var('vcpus', val='VCPUS',
     7.8 +          fn=set_int, default=1,
     7.9 +          use="# of Virtual CPUS in domain.")
    7.10 +
    7.11  gopts.var('cpu_weight', val='WEIGHT',
    7.12            fn=set_float, default=None,
    7.13            use="""Set the new domain's cpu weight.
    7.14 @@ -245,7 +249,10 @@ def configure_image(config, vals):
    7.15          config_image.append(['root', cmdline_root])
    7.16      if vals.extra:
    7.17          config_image.append(['args', vals.extra])
    7.18 +    if vals.vcpus:
    7.19 +        config_image.append(['vcpus', vals.vcpus])
    7.20      config.append(['image', config_image ])
    7.21 +
    7.22      
    7.23  def configure_disks(config_devs, vals):
    7.24      """Create the config for disks (virtual block devices).