From: BitKeeper B. <ri...@su...> - 2004-10-21 16:02:29
|
ChangeSet 1.1414.1.2, 2004/10/21 16:10:27+01:00, ka...@fr... Remove domain names from Xen. These are now stored only within xend. tools/libxc/xc.h | 7 ----- tools/libxc/xc_domain.c | 16 ----------- tools/libxc/xc_linux_restore.c | 44 ++------------------------------ tools/libxc/xc_linux_save.c | 5 --- tools/python/xen/lowlevel/xc/xc.c | 44 +++----------------------------- tools/python/xen/xend/XendDomain.py | 9 ------ tools/python/xen/xend/XendDomainInfo.py | 6 +--- xen/common/dom0_ops.c | 28 ++------------------ xen/common/domain.c | 7 ----- xen/include/hypervisor-ifs/dom0_ops.h | 36 ++++++++------------------ xen/include/xen/sched.h | 4 -- 11 files changed, 27 insertions(+), 179 deletions(-) diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h --- a/tools/libxc/xc.h 2004-10-21 12:02:26 -04:00 +++ b/tools/libxc/xc.h 2004-10-21 12:02:26 -04:00 @@ -31,8 +31,6 @@ unsigned long nr_pages; unsigned long shared_info_frame; u64 cpu_time; -#define XC_DOMINFO_MAXNAME 16 - char name[XC_DOMINFO_MAXNAME]; unsigned long max_memkb; } xc_dominfo_t; @@ -46,7 +44,6 @@ int xc_domain_create(int xc_handle, unsigned int mem_kb, - const char *name, int cpu, float cpu_weight, u32 *pdomid); @@ -192,10 +189,6 @@ int xc_sched_id(int xc_handle, int *sched_id); - -int xc_domain_setname(int xc_handle, - u32 domid, - char *name); int xc_domain_setinitialmem(int xc_handle, u32 domid, diff -Nru a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c 2004-10-21 12:02:25 -04:00 +++ b/tools/libxc/xc_domain.c 2004-10-21 12:02:25 -04:00 @@ -10,7 +10,6 @@ int xc_domain_create(int xc_handle, unsigned int mem_kb, - const char *name, int cpu, float cpu_weight, u32 *pdomid) @@ -21,8 +20,6 @@ op.cmd = DOM0_CREATEDOMAIN; op.u.createdomain.domain = (domid_t)*pdomid; op.u.createdomain.memory_kb = mem_kb; - strncpy(op.u.createdomain.name, name, MAX_DOMAIN_NAME); - op.u.createdomain.name[MAX_DOMAIN_NAME-1] = '\0'; op.u.createdomain.cpu = cpu; if ( (err = do_dom0_op(xc_handle, &op)) == 0 ) @@ -113,8 +110,6 @@ info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT); info->shared_info_frame = op.u.getdomaininfo.shared_info_frame; info->cpu_time = op.u.getdomaininfo.cpu_time; - strncpy(info->name, op.u.getdomaininfo.name, XC_DOMINFO_MAXNAME); - info->name[XC_DOMINFO_MAXNAME-1] = '\0'; next_domid = (u16)op.u.getdomaininfo.domain + 1; info++; @@ -163,17 +158,6 @@ sizeof(xc_shadow_control_stats_t)); return (rc == 0) ? op.u.shadow_control.pages : rc; -} - -int xc_domain_setname(int xc_handle, - u32 domid, - char *name) -{ - dom0_op_t op; - op.cmd = DOM0_SETDOMAINNAME; - op.u.setdomainname.domain = (domid_t)domid; - strncpy(op.u.setdomainname.name, name, MAX_DOMAIN_NAME); - return do_dom0_op(xc_handle, &op); } int xc_domain_setcpuweight(int xc_handle, diff -Nru a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c --- a/tools/libxc/xc_linux_restore.c 2004-10-21 12:02:25 -04:00 +++ b/tools/libxc/xc_linux_restore.c 2004-10-21 12:02:25 -04:00 @@ -102,9 +102,6 @@ /* First 16 bytes of the state file must contain 'LinuxGuestRecord'. */ char signature[16]; - /* A copy of the domain's name. */ - char name[MAX_DOMAIN_NAME]; - /* A table containg the type of each PFN (/not/ MFN!). */ unsigned long *pfn_type = NULL; @@ -149,8 +146,7 @@ goto out; } - if ( xcio_read(ioctxt, name, sizeof(name)) || - xcio_read(ioctxt, &nr_pfns, sizeof(unsigned long)) || + if ( xcio_read(ioctxt, &nr_pfns, sizeof(unsigned long)) || xcio_read(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ) { xcio_error(ioctxt, "Error reading header"); @@ -163,17 +159,6 @@ goto out; } - for ( i = 0; i < MAX_DOMAIN_NAME; i++ ) - { - if ( name[i] == '\0' ) break; - if ( name[i] & 0x80 ) - { - xcio_error(ioctxt, "Random characters in domain name"); - goto out; - } - } - name[MAX_DOMAIN_NAME-1] = '\0'; - if ( nr_pfns > 1024*1024 ) { xcio_error(ioctxt, "Invalid state file -- pfn count out of range"); @@ -199,30 +184,9 @@ goto out; } -#if 0 - /* Set the domain's name to that from the restore file */ - if ( xc_domain_setname( xc_handle, dom, name ) ) - { - xcio_error(ioctxt, "Could not set domain name"); - goto out; - } - - /* Set the domain's initial memory allocation - to that from the restore file */ - - if ( xc_domain_setinitialmem(xc_handle, dom, - nr_pfns * (PAGE_SIZE / 1024)) ) - { - xcio_error(ioctxt, "Could not set domain %d initial memory. pfns=%d, %dKB", - dom, nr_pfns,nr_pfns * (PAGE_SIZE / 1024)); - goto out; - } -#endif - - - /* XXX create domain on CPU=-1 so that in future it auto load ballances by default */ - if ( xc_domain_create( xc_handle, nr_pfns * (PAGE_SIZE / 1024), - "", -1, 1, &dom ) ) + /* Create domain on CPU -1 so that it may auto load-balance in future. */ + if ( xc_domain_create(xc_handle, nr_pfns * (PAGE_SIZE / 1024), + -1, 1, &dom) ) { xcio_error(ioctxt, "Could not create domain. pfns=%d, %dKB", nr_pfns,nr_pfns * (PAGE_SIZE / 1024)); diff -Nru a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c --- a/tools/libxc/xc_linux_save.c 2004-10-21 12:02:26 -04:00 +++ b/tools/libxc/xc_linux_save.c 2004-10-21 12:02:26 -04:00 @@ -303,9 +303,6 @@ /* A copy of the CPU context of the guest. */ full_execution_context_t ctxt; - /* A copy of the domain's name. */ - char name[MAX_DOMAIN_NAME]; - /* A table containg the type of each PFN (/not/ MFN!). */ unsigned long *pfn_type = NULL; unsigned long *pfn_batch = NULL; @@ -359,7 +356,6 @@ xcio_error(ioctxt, "Could not get full domain info"); goto out; } - memcpy(name, op.u.getdomaininfo.name, sizeof(name)); shared_info_frame = op.u.getdomaininfo.shared_info_frame; /* A cheesy test to see whether the domain contains valid state. */ @@ -539,7 +535,6 @@ /* Start writing out the saved-domain record. */ if ( xcio_write(ioctxt, "LinuxGuestRecord", 16) || - xcio_write(ioctxt, name, sizeof(name)) || xcio_write(ioctxt, &nr_pfns, sizeof(unsigned long)) || xcio_write(ioctxt, pfn_to_mfn_frame_list, PAGE_SIZE) ){ xcio_error(ioctxt, "Error writing header"); diff -Nru a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c 2004-10-21 12:02:25 -04:00 +++ b/tools/python/xen/lowlevel/xc/xc.c 2004-10-21 12:02:25 -04:00 @@ -42,21 +42,19 @@ XcObject *xc = (XcObject *)self; unsigned int mem_kb = 0; - char *name = "(anon)"; int cpu = -1; float cpu_weight = 1; u32 dom = 0; int ret; - static char *kwd_list[] = { "dom", "mem_kb", "name", - "cpu", "cpu_weight", NULL }; + static char *kwd_list[] = { "dom", "mem_kb", "cpu", "cpu_weight", NULL }; - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iisif", kwd_list, - &dom, &mem_kb, &name, &cpu, &cpu_weight)) + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiif", kwd_list, + &dom, &mem_kb, &cpu, &cpu_weight)) return NULL; if ( (ret = xc_domain_create( - xc->xc_handle, mem_kb, name, cpu, cpu_weight, &dom)) < 0 ) + xc->xc_handle, mem_kb, cpu, cpu_weight, &dom)) < 0 ) return PyErr_SetFromErrno(xc_error); return PyInt_FromLong(dom); @@ -172,7 +170,7 @@ PyList_SetItem( list, i, Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i" - ",s:l,s:L,s:s,s:l,s:i}", + ",s:l,s:L,s:l,s:i}", "dom", info[i].domid, "cpu", info[i].cpu, "dying", info[i].dying, @@ -183,7 +181,6 @@ "running", info[i].running, "mem_kb", info[i].nr_pages*4, "cpu_time", info[i].cpu_time, - "name", info[i].name, "maxmem_kb", info[i].max_memkb, "shutdown_reason", info[i].shutdown_reason )); @@ -779,27 +776,6 @@ return Py_BuildValue("{s:L}", "slice", slice); } -static PyObject *pyxc_domain_setname(PyObject *self, - PyObject *args, - PyObject *kwds) -{ - XcObject *xc = (XcObject *)self; - u32 dom; - char *name; - - static char *kwd_list[] = { "dom", "name", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, - &dom, &name) ) - return NULL; - - if ( xc_domain_setname(xc->xc_handle, dom, name) != 0 ) - return PyErr_SetFromErrno(xc_error); - - Py_INCREF(zero); |