Remove domain names from Xen. These are now stored only within xend.
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;
int xc_domain_create(int xc_handle,
unsigned int mem_kb,
- const char *name,
int cpu,
float cpu_weight,
u32 *pdomid);
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,
unsigned int initial_memkb);
int xc_domain_create(int xc_handle,
unsigned int mem_kb,
- const char *name,
int cpu,
float cpu_weight,
u32 *pdomid)
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 )
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++;
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,
u32 domid,
float weight)
/* 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;
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");
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");
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));
/* 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;
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. */
/* 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");
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);
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,
"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
));
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);
- return zero;
-}
-
static PyObject *pyxc_domain_setmaxmem(PyObject *self,
PyObject *args,
PyObject *kwds)
"Create a new domain.\n"
" dom [int, 0]: Domain identifier to use (allocated if zero).\n"
" mem_kb [int, 0]: Memory allocation, in kilobytes.\n"
- " name [str, '(anon)']: Informative textual name.\n\n"
"Returns: [int] new domain identifier; -1 on error.\n" },
{ "domain_pause",
" mem_kb [int]: Memory reservation, in kilobytes\n"
" maxmem_kb [int]: Maximum memory limit, in kilobytes\n"
" cpu_time [long]: CPU time consumed, in nanoseconds\n"
- " name [str]: Identifying name\n"
" shutdown_reason [int]: Numeric code from guest OS, explaining "
"reason why it shut itself down.\n" },
" op [int, 0]: operation\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
- { "domain_setname",
- (PyCFunction)pyxc_domain_setname,
- METH_VARARGS | METH_KEYWORDS, "\n"
- "Set domain informative textual name\n"
- " dom [int]: Identifier of domain.\n"
- " name [str]: Text string.\n\n"
- "Returns: [int] 0 on success; -1 on error.\n" },
-
{ "domain_setmaxmem",
(PyCFunction)pyxc_domain_setmaxmem,
METH_VARARGS | METH_KEYWORDS, "\n"
deferred.addCallback(cbok)
return deferred
- def domain_setname(self, dom, name):
- """Set the name of a domain.
- For internal use only.
-
- @param dom: domain id
- @param name: domain name
- """
- return xc.domain_setname(dom=dom, name=name)
-
def domain_restart(self, dominfo):
"""Restart a domain.
if config:
d = vm.construct(config)
else:
- vm.name = info['name']
+ vm.name = sxp.child_value(savedinfo, 'name')
d = defer.succeed(vm)
vm.recreate = 0
return d
self.cpu_weight = float(sxp.child_value(config, 'cpu_weight', '1'))
except:
raise VmError('invalid cpu weight')
- if self.restore and self.dom:
- xc.domain_setname(self.dom, self.name)
self.memory = int(sxp.child_value(config, 'memory'))
if self.memory is None:
raise VmError('missing memory size')
raise VmError('invalid cpu')
cpu_weight = self.cpu_weight
dom = xc.domain_create(dom= dom, mem_kb= memory * 1024,
- name= name, cpu= cpu, cpu_weight= cpu_weight)
+ cpu= cpu, cpu_weight= cpu_weight)
if dom <= 0:
raise VmError('Creating domain failed: name=%s memory=%d'
% (name, memory))
return 0;
}
-/** Allocate a free domain id. We try to reuse domain ids in a fairly low range,
- * only expanding the range when there are no free domain ids. This is to
- * keep domain ids in a range depending on the number that exist simultaneously,
+/*
+ * Allocate a free domain id. We try to reuse domain ids in a fairly low range,
+ * only expanding the range when there are no free domain ids. This is to keep
+ * domain ids in a range depending on the number that exist simultaneously,
* rather than incrementing domain ids in the full 32-bit range.
*/
static int allocate_domid(domid_t *pdom)
if ( (d = do_createdomain(dom, pro)) == NULL )
break;
- if ( op->u.createdomain.name[0] )
- {
- strncpy(d->name, op->u.createdomain.name, MAX_DOMAIN_NAME);
- d->name[MAX_DOMAIN_NAME - 1] = '\0';
- }
-
ret = alloc_new_dom_mem(d, op->u.createdomain.memory_kb);
if ( ret != 0 )
{
read_unlock_irqrestore(&tasklist_lock, flags);
op->u.getdomaininfo.domain = d->domain;
- strcpy(op->u.getdomaininfo.name, d->name);
op->u.getdomaininfo.flags =
(test_bit(DF_DYING, &d->flags) ? DOMFLAGS_DYING : 0) |
}
break;
- case DOM0_SETDOMAINNAME:
- {
- struct domain *d;
- ret = -ESRCH;
- d = find_domain_by_id( op->u.setdomainname.domain );
- if ( d != NULL )
- {
- strncpy(d->name, op->u.setdomainname.name, MAX_DOMAIN_NAME);
- put_domain(d);
- ret = 0;
- }
- }
- break;
-
case DOM0_SETDOMAININITIALMEM:
{
struct domain *d;
struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
{
- char buf[100];
struct domain *d, **pd;
unsigned long flags;
return NULL;
}
- /* We use a large intermediate to avoid overflow in sprintf. */
- sprintf(buf, "Domain-%u", dom_id);
- strncpy(d->name, buf, MAX_DOMAIN_NAME);
- d->name[MAX_DOMAIN_NAME-1] = '\0';
-
arch_do_createdomain(d);
sched_add_domain(d);
}
else
{
- sprintf(d->name, "Idle-%d", cpu);
sched_add_domain(d);
}
* This makes sure that old versions of dom0 tools will stop working in a
* well-defined way (rather than crashing the machine, for instance).
*/
-#define DOM0_INTERFACE_VERSION 0xAAAA0017
-
-#define MAX_DOMAIN_NAME 16
+#define DOM0_INTERFACE_VERSION 0xAAAA0019
/************************************************************************/
/* IN parameters. */
memory_t memory_kb; /* 0 */
MEMORY_PADDING;
- u8 name[MAX_DOMAIN_NAME]; /* 8 */
- u32 cpu; /* 24 */
- u32 __pad0; /* 28 */
+ u32 cpu; /* 8 */
+ u32 __pad0; /* 12 */
/* IN/OUT parameters. */
/* If 0, domain is allocated. If non-zero use it unless in use. */
- domid_t domain; /* 32 */
+ domid_t domain; /* 16 */
u16 __pad1;
/* OUT parameters. */
-} PACKED dom0_createdomain_t; /* 36 bytes */
+} PACKED dom0_createdomain_t; /* 20 bytes */
#define DOM0_DESTROYDOMAIN 9
typedef struct {
#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
#define DOMFLAGS_SHUTDOWNSHIFT 16
u32 flags; /* 4 */
- u8 name[MAX_DOMAIN_NAME]; /* 8 */
- full_execution_context_t *ctxt; /* 24 */ /* NB. IN/OUT variable. */
+ full_execution_context_t *ctxt; /* 8 */ /* NB. IN/OUT variable. */
MEMORY_PADDING;
- memory_t tot_pages; /* 32 */
+ memory_t tot_pages; /* 16 */
MEMORY_PADDING;
- memory_t max_pages; /* 40 */
+ memory_t max_pages; /* 24 */
MEMORY_PADDING;
- memory_t shared_info_frame; /* 48: MFN of shared_info struct */
+ memory_t shared_info_frame; /* 32: MFN of shared_info struct */
MEMORY_PADDING;
- u64 cpu_time; /* 56 */
-} PACKED dom0_getdomaininfo_t; /* 64 bytes */
+ u64 cpu_time; /* 40 */
+} PACKED dom0_getdomaininfo_t; /* 48 bytes */
#define DOM0_BUILDDOMAIN 13
typedef struct {
dom0_shadow_control_stats_t stats;
} PACKED dom0_shadow_control_t;
-
-#define DOM0_SETDOMAINNAME 26
-typedef struct {
- /* IN variables. */
- domid_t domain; /* 0 */
- u16 __pad;
- u8 name[MAX_DOMAIN_NAME]; /* 4 */
-} PACKED dom0_setdomainname_t; /* 20 bytes */
-
#define DOM0_SETDOMAININITIALMEM 27
typedef struct {
/* IN variables. */
dom0_pcidev_access_t pcidev_access;
dom0_sched_id_t sched_id;
dom0_shadow_control_t shadow_control;
- dom0_setdomainname_t setdomainname;
dom0_setdomaininitialmem_t setdomaininitialmem;
dom0_setdomainmaxmem_t setdomainmaxmem;
dom0_getpageframeinfo2_t getpageframeinfo2;
#define __SCHED_H__
#define STACK_SIZE (2*PAGE_SIZE)
-#define MAX_DOMAIN_NAME 16
#include <xen/config.h>
#include <xen/types.h>
*/
domid_t domain;
- char name[MAX_DOMAIN_NAME];
s_time_t create_time;
spinlock_t page_alloc_lock; /* protects all the following fields */
* "interesting" (i.e. have clear bits) */
/* Handy macro - number of bytes of the IO bitmap, per selector bit. */
-#define IOBMP_SELBIT_LWORDS ( IO_BITMAP_SIZE / 64 )
+#define IOBMP_SELBIT_LWORDS (IO_BITMAP_SIZE / 64)
unsigned long *io_bitmap; /* Pointer to task's IO bitmap or NULL */
unsigned long flags;