libxl: drop device_model_info
PATCH 1/1 libxl: drop device_model_info
This is the first portion of my previous "libxl: drop device_model_info, better defaults support, stubdoms by default" series. Specifically it is the "drop device_model_info" bit (plus some incidental bits & bobs).
I've split it to make it all a bit more manageable and to allow it to be reviewed while I address some other concerns with the latter bits of the other series.
This comes after "libxl: tweak the cpupool interface slightly" which I sent this morning in my queue but I think the only relation is a tiny bit of overlap of the context in patch #2. It also comes after "libxl:
remove _libxl_json_internal.h from libxl_json.h" but I beleive there is no overlap there.
Ian.
PATCH 1/1 libxl: remove comment support from IDL
# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336697 0
# Node ID 63146f3cd17e526c53496adeeddf5da90f13d2bc # Parent 80c94293e87d80c7f375ac330d46333c65d0005d
libxl: remove comment support from IDL
People typically don't look for comments in generated source and the syntax for specifying them in the IDL makes things harder to follow.
Instead just use source code comments in the IDL itself.
I dropped a bunch of "foo bool # enable or disable foo" type comments. A lot of the remainder still aren't terribly useful though.
No change to the generate code other than the comments being removed.
tools/libxl/gentypes.py +0 -23
@@ -5,19 +5,6 @@ import re import libxltypes -def format_comment(level, comment): - indent = reduce(lambda x,y: x + " ", range(level), "") - s = "%s/*\n" % indent - s += "%s * " % indent - comment = comment.replace("\n", "\n%s * " % indent) - x = re.compile(r'^%s \* $' % indent, re.MULTILINE) - comment = x.sub("%s *" % indent, comment) - s += comment - s += "\n" - s += "%s */" % indent - s += "\n" - return s - def libxl_C_instance_of(ty, instancename): if isinstance(ty, libxltypes.Aggregate) and ty.typename is None: if instancename is None:
@@ -30,17 +17,12 @@ def libxl_C_instance_of(ty, instancename def libxl_C_type_define(ty, indent = ""): s = "" if isinstance(ty, libxltypes.Enumeration): - if ty.comment is not None: - s += format_comment(0, ty.comment) - if ty.typename is None: s += "enum {\n" else: s += "typedef enum %s {\n" % ty.typename for v in ty.values: - if v.comment is not None: - s += format_comment(4, v.comment) x = "%s = %d" % (v.name, v.value) x = x.replace("\n", "\n ") s += " " + x + ",\n"
@@ -50,17 +32,12 @@ def libxl_C_type_define(ty, indent = "") s += "} %s" % ty.typename elif isinstance(ty, libxltypes.Aggregate): - if ty.comment is not None: - s += format_comment(0, ty.comment) - if ty.typename is None: s += "%s {\n" % ty.kind else: s += "typedef %s %s {\n" % (ty.kind, ty.typename) for f in ty.fields: - if f.comment is not None: - s += format_comment(4, f.comment) x = libxl_C_instance_of(f.type, f.name) if f.const: x = "const " + x
tools/libxl/libxl_types.idl +87 -79
225 lines not on this page · raw message
tools/libxl/libxltypes.py +5 -17
@@ -22,7 +22,6 @@ def _get_default_namespace(): class Type(object): def __init__(self, typename, **kwargs): - self.comment = kwargs.setdefault('comment', None) self.namespace = kwargs.setdefault('namespace', _get_default_namespace()) self.dir = kwargs.setdefault('dir', DIR_BOTH)
@@ -120,7 +119,6 @@ class EnumerationValue(object): self.rawname = str.upper(enum.rawname) + "_" + self.valuename self.name = str.upper(enum.namespace) + self.rawname self.value = value - self.comment = kwargs.setdefault("comment", None) class Enumeration(Type): def __init__(self, typename, values, **kwargs):
@@ -129,16 +127,9 @@ class Enumeration(Type): self.values = [] for v in values: - # (value, name[, comment=None]) - if len(v) == 2: - (num,name) = v - comment = None - elif len(v) == 3: - num,name,comment = v - else: - raise "" + # (value, name) + (num,name) = v self.values.append(EnumerationValue(self, num, name, - comment=comment, typename=self.rawname)) def lookup(self, name): for v in self.values:
@@ -152,7 +143,6 @@ class Field(object): self.type = type self.name = name self.const = kwargs.setdefault('const', False) - self.comment = kwargs.setdefault('comment', None) self.enumname = kwargs.setdefault('enumname', None) class Aggregate(Type):
@@ -164,19 +154,17 @@ class Aggregate(Type): self.fields = [] for f in fields: - # (name, type[, const=False[, comment=None]]) + # (name, type[, const=False]) if len(f) == 2: n,t = f const = False - comment = None elif len(f) == 3: n,t,const = f - comment = None else: - n,t,const,comment = f + raise ValueError if n is None: raise ValueError - self.fields.append(Field(t,n,const=const,comment=comment)) + self.fields.append(Field(t,n,const=const)) # Returns a tuple (stem, field-expr) #
PATCH 1/1 libxl: use keyword arguments for field definitions in aggregate types
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID 7a22673b930e5cc9dce8a1b43df4c4ca8daf49aa
# Parent 63146f3cd17e526c53496adeeddf5da90f13d2bc
libxl: use keyword arguments for field definitions in aggregate types.
The original code is not so bad now that the comments are gone but this is still a bit cleaner.
No change in the generated code.
tools/libxl/libxl_types.idl +1 -1
@@ -196,7 +196,7 @@ libxl_domain_build_info = Struct("domain ("bootloader_args", libxl_string_list), ("cmdline", string), ("ramdisk", libxl_file_reference), - ("features", string, True), + ("features", string, {'const': True}), # Use host's E820 for PCI passthrough. ("e820_host", bool), ])),
tools/libxl/libxltypes.py +4 -4
@@ -154,17 +154,17 @@ class Aggregate(Type): self.fields = [] for f in fields: - # (name, type[, const=False]) + # (name, type[, {kw args}]) if len(f) == 2: n,t = f - const = False + kw = {} elif len(f) == 3: - n,t,const = f + n,t,kw = f else: raise ValueError if n is None: raise ValueError - self.fields.append(Field(t,n,const=const)) + self.fields.append(Field(t,n,**kw)) # Returns a tuple (stem, field-expr) #
PATCH 1/1 ocaml: use libxl IDL type helpers for C argument passing
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID a44bd706400238c6f5e309c3925fa90718b80576 # Parent 7a22673b930e5cc9dce8a1b43df4c4ca8daf49aa
ocaml: use libxl IDL type helpers for C argument passing
Makes handling of nested structs more correct.
Only change to the generated code right now is that the FOO_Val (C->ocamlC) function for Enumeration types now takes the C argument by value instead of reference.
tools/ocaml/libs/xl/genwrap.py +10 -17
@@ -112,11 +112,6 @@ def gen_ocaml_ml(ty, interface, indent=" return s.replace("\n", "\n%s" % indent) def c_val(ty, c, o, indent="", parent = None): - if ty.passby == libxltypes.PASS_BY_REFERENCE: - makeref = "" - else: - makeref = "&" - s = indent if isinstance(ty,libxltypes.UInt): if ty.width in [8, 16]:
@@ -148,17 +143,18 @@ def c_val(ty, c, o, indent="", parent = elif isinstance(ty, libxltypes.Aggregate) and (parent is None): n = 0 for f in ty.fields: - s += "%s\n" % c_val(f.type, "%s->%s" % (c, f.name), "Field(%s, %d)" % (o,n), parent="%s->" % (c)) + (nparent,fexpr) = ty.member(c, f, parent is None) + s += "%s\n" % c_val(f.type, fexpr, "Field(%s, %d)" % (o,n), parent=nparent) n = n + 1 else: - s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, makeref + c, o) + s += "%s_val(gc, lg, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=libxltypes.PASS_BY_REFERENCE), o) return s.replace("\n", "\n%s" % indent) def gen_c_val(ty, indent=""): s = "/* Convert caml value to %s */\n" % ty.rawname - s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s *c_val, value v)\n" % (ty.rawname, ty.typename) + s += "static int %s_val (caml_gc *gc, struct caml_logger *lg, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=libxltypes.PASS_BY_REFERENCE)) s += "{\n" s += "\tCAMLparam1(v);\n" s += "\n"
@@ -171,11 +167,6 @@ def gen_c_val(ty, indent=""): return s.replace("\n", "\n%s" % indent) def ocaml_Val(ty, o, c, indent="", parent = None): - if ty.passby == libxltypes.PASS_BY_REFERENCE: - makeref = "" - else: - makeref = "&" - s = indent if isinstance(ty,libxltypes.UInt): if ty.width in [8, 16]:
@@ -198,7 +189,7 @@ def ocaml_Val(ty, o, c, indent="", paren s += "%s = %s;" % (o, fn % { "c": c }) elif isinstance(ty,libxltypes.Enumeration) and (parent is None): n = 0 - s += "switch(*%s) {\n" % c + s += "switch(%s) {\n" % c for e in ty.values: s += " case %s: %s = Int_val(%d); break;\n" % (e.name, o, n) n += 1
@@ -212,20 +203,22 @@ def ocaml_Val(ty, o, c, indent="", paren n = 0 for f in ty.fields: + (nparent,fexpr) = ty.member(c, f, parent is None) + s += "\n" - s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, "%s->%s" % (c,f.name), parent="%s->" % c) + s += "\t%s\n" % ocaml_Val(f.type, "%s_field" % ty.rawname, ty.pass_arg(fexpr, c), parent=nparent) s += "\tStore_field(%s, %d, %s);\n" % (o, n, "%s_field" % ty.rawname) n = n + 1 s += "}" else: - s += "%s = Val_%s(gc, lg, %s);" % (o, ty.rawname, makeref + c) + s += "%s = Val_%s(gc, lg, %s);" % (o, ty.rawname, ty.pass_arg(c, parent is None)) return s.replace("\n", "\n%s" % indent).rstrip(indent) def gen_Val_ocaml(ty, indent=""): s = "/* Convert %s to a caml value */\n" % ty.rawname - s += "static value Val_%s (caml_gc *gc, struct caml_logger *lg, %s *%s_c)\n" % (ty.rawname, ty.typename, ty.rawname) + s += "static value Val_%s (caml_gc *gc, struct caml_logger *lg, %s)\n" % (ty.rawname, ty.make_arg(ty.rawname+"_c")) s += "{\n" s += "\tCAMLparam0();\n" s += "\tCAMLlocal1(%s_ocaml);\n" % ty.rawname
PATCH 1/1 libxl: define libxl_vnc_info to hold all info about the vnc info
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID 83418dbcfc0ab05da8dc1774e66deeb421eae003
# Parent a44bd706400238c6f5e309c3925fa90718b80576
libxl: define libxl_vnc_info to hold all info about the vnc info
Reduces duplication in libxl_vfb and libxl_device_model.
Updated bindings but the python ones in particular are unlikely to be useful until a user presents itself and fixes them up.
tools/libxl/libxl.c +13 -10
@@ -1943,11 +1943,11 @@ int libxl_device_vfb_init(libxl_ctx *ctxmemset (vfb,0x00 ,sizeof (libxl_device_vfb)); vfb->display =NULL ; vfb->xauthority =NULL ; - vfb->vnc =1 ; - vfb->vncpasswd =NULL ; - vfb->vnclisten =strdup ("127.0.0.1" ); - vfb->vncdisplay =0 ; - vfb->vncunused =1 ; + vfb->vnc.enable =1 ; + vfb->vnc.passwd =NULL ; + vfb->vnc.listen =strdup ("127.0.0.1" ); + vfb->vnc.display =0 ; + vfb->vnc.findunused =1 ; vfb->keymap =NULL ; vfb->sdl =0 ; vfb->opengl =0 ;
@@ -1993,11 +1993,14 @@ int libxl_device_vfb_add(libxl_ctx *ctx,flexarray_append_pair (back,"online" ,"1" );flexarray_append_pair (back,"state" ,libxl__sprintf (gc,"%d" ,1 ));flexarray_append_pair (back,"domain" ,libxl__domid_to_name (gc, domid)); -flexarray_append_pair (back,"vnc" ,libxl__sprintf (gc,"%d" , vfb->vnc)); -flexarray_append_pair (back,"vnclisten" , vfb->vnclisten); -flexarray_append_pair (back,"vncpasswd" , vfb->vncpasswd); -flexarray_append_pair (back,"vncdisplay" ,libxl__sprintf (gc,"%d" , vfb->vncdisplay)); -flexarray_append_pair (back,"vncunused" ,libxl__sprintf (gc,"%d" , vfb->vncunused)); +flexarray_append_pair (back,"vnc" , +libxl__sprintf (gc,"%d" , vfb->vnc.enable)); +flexarray_append_pair (back,"vnclisten" , vfb->vnc.listen); +flexarray_append_pair (back,"vncpasswd" , vfb->vnc.passwd); +flexarray_append_pair (back,"vncdisplay" , +libxl__sprintf (gc,"%d" , vfb->vnc.display)); +flexarray_append_pair (back,"vncunused" , +libxl__sprintf (gc,"%d" , vfb->vnc.findunused));flexarray_append_pair (back,"sdl" ,libxl__sprintf (gc,"%d" , vfb->sdl));flexarray_append_pair (back,"opengl" ,libxl__sprintf (gc,"%d" , vfb->opengl));if (vfb->xauthority) {
tools/libxl/libxl_create.c +4 -4
@@ -126,10 +126,10 @@ int libxl_init_dm_info(libxl_ctx *ctx, dm_info->vcpu_avail = b_info->cur_vcpus; dm_info->stdvga =0 ; - dm_info->vnc =1 ; - dm_info->vnclisten =strdup ("127.0.0.1" ); - dm_info->vncdisplay =0 ; - dm_info->vncunused =1 ; + dm_info->vnc.enable =1 ; + dm_info->vnc.listen =strdup ("127.0.0.1" ); + dm_info->vnc.display =0 ; + dm_info->vnc.findunused =1 ; dm_info->keymap =NULL ; dm_info->sdl =0 ; dm_info->opengl =0 ;
tools/libxl/libxl_dm.c +33 -37
147 lines not on this page · raw message
tools/libxl/libxl_types.idl +12 -14
@@ -95,6 +95,16 @@ libxl_tsc_mode = Enumeration("tsc_mode", # # Complex libxl types # +libxl_vnc_info = Struct("vnc_info", [ + ("enable", bool), + # "address:port" that should be listened on + ("listen", string), + ("passwd", string), + ("display", integer), + # If set then try to find an unused port + ("findunused", bool), + ]) + libxl_dominfo = Struct("dominfo",[ ("uuid", libxl_uuid), ("domid", libxl_domid),
@@ -222,14 +232,7 @@ libxl_device_model_info = Struct("device # size of the videoram in MB ("videoram", integer), ("stdvga", bool), - ("vnc", bool), - # "address:port" that should be listened on for the VNC server - ("vnclisten", string), - ("vncpasswd", string), - # VNC display number - ("vncdisplay", integer), - # If set then try to find an unused port for the VNC server - ("vncunused", bool), + ("vnc", libxl_vnc_info), # keyboard layout, default is en-us keyboard ("keymap", string), ("sdl", bool),
@@ -268,12 +271,7 @@ libxl_device_model_info = Struct("device libxl_device_vfb = Struct("device_vfb", [ ("backend_domid", libxl_domid), ("devid", integer), - ("vnc", bool), - # address:port that should be listened on for the VNC server if vnc is set - ("vnclisten", string), - ("vncpasswd", string), - ("vncdisplay", integer), - ("vncunused", bool), + ("vnc", libxl_vnc_info), # set keyboard layout, default is en-us keyboard ("keymap", string), ("sdl", bool),
tools/libxl/xl_cmdimpl.c +20 -20
@@ -366,10 +366,10 @@ static void printf_info(int domid,printf ("\t\t\t(device_model %s)\n" , dm_info->device_model ? :"default" );printf ("\t\t\t(videoram %d)\n" , dm_info->videoram);printf ("\t\t\t(stdvga %d)\n" , dm_info->stdvga); -printf ("\t\t\t(vnc %d)\n" , dm_info->vnc); -printf ("\t\t\t(vnclisten %s)\n" , dm_info->vnclisten); -printf ("\t\t\t(vncdisplay %d)\n" , dm_info->vncdisplay); -printf ("\t\t\t(vncunused %d)\n" , dm_info->vncunused); +printf ("\t\t\t(vnc %d)\n" , dm_info->vnc.enable); +printf ("\t\t\t(vnclisten %s)\n" , dm_info->vnc.listen); +printf ("\t\t\t(vncdisplay %d)\n" , dm_info->vnc.display); +printf ("\t\t\t(vncunused %d)\n" , dm_info->vnc.findunused);printf ("\t\t\t(keymap %s)\n" , dm_info->keymap);printf ("\t\t\t(sdl %d)\n" , dm_info->sdl);printf ("\t\t\t(gfx_passthru %d)\n" , dm_info->gfx_passthru);
@@ -456,10 +456,10 @@ static void printf_info(int domid,printf ("\t\t\t(backend_domid %d)\n" , d_config->vfbs[i].backend_domid);printf ("\t\t\t(frontend_domid %d)\n" , domid);printf ("\t\t\t(devid %d)\n" , d_config->vfbs[i].devid); -printf ("\t\t\t(vnc %d)\n" , d_config->vfbs[i].vnc); -printf ("\t\t\t(vnclisten %s)\n" , d_config->vfbs[i].vnclisten); -printf ("\t\t\t(vncdisplay %d)\n" , d_config->vfbs[i].vncdisplay); -printf ("\t\t\t(vncunused %d)\n" , d_config->vfbs[i].vncunused); +printf ("\t\t\t(vnc %d)\n" , d_config->vfbs[i].vnc.enable); +printf ("\t\t\t(vnclisten %s)\n" , d_config->vfbs[i].vnc.listen); +printf ("\t\t\t(vncdisplay %d)\n" , d_config->vfbs[i].vnc.display); +printf ("\t\t\t(vncunused %d)\n" , d_config->vfbs[i].vnc.findunused);printf ("\t\t\t(keymap %s)\n" , d_config->vfbs[i].keymap);printf ("\t\t\t(sdl %d)\n" , d_config->vfbs[i].sdl);printf ("\t\t\t(opengl %d)\n" , d_config->vfbs[i].opengl);
@@ -961,17 +961,17 @@ skip:break ; *p2 ='\0' ;if (!strcmp (p,"vnc" )) { - vfb->vnc =atoi (p2 +1 ); + vfb->vnc.enable =atoi (p2 +1 ); }else if (!strcmp (p,"vnclisten" )) { -free (vfb->vnclisten); - vfb->vnclisten =strdup (p2 +1 ); +free (vfb->vnc.listen); + vfb->vnc.listen =strdup (p2 +1 ); }else if (!strcmp (p,"vncpasswd" )) { -free (vfb->vncpasswd); - vfb->vncpasswd =strdup (p2 +1 ); +free (vfb->vnc.passwd); + vfb->vnc.passwd =strdup (p2 +1 ); }else if (!strcmp (p,"vncdisplay" )) { - vfb->vncdisplay =atoi (p2 +1 ); + vfb->vnc.display =atoi (p2 +1 ); }else if (!strcmp (p,"vncunused" )) { - vfb->vncunused =atoi (p2 +1 ); + vfb->vnc.findunused =atoi (p2 +1 ); }else if (!strcmp (p,"keymap" )) {free (vfb->keymap); vfb->keymap =strdup (p2 +1 );
@@ -1178,13 +1178,13 @@ skip_vfb:if (!xlu_cfg_get_long (config,"stdvga" , &l,0 )) dm_info->stdvga = l;if (!xlu_cfg_get_long (config,"vnc" , &l,0 )) - dm_info->vnc = l; -xlu_cfg_replace_string (config,"vnclisten" , &dm_info->vnclisten,0 ); -xlu_cfg_replace_string (config,"vncpasswd" , &dm_info->vncpasswd,0 ); + dm_info->vnc.enable = l; +xlu_cfg_replace_string (config,"vnclisten" , &dm_info->vnc.listen,0 ); +xlu_cfg_replace_string (config,"vncpasswd" , &dm_info->vnc.passwd,0 );if (!xlu_cfg_get_long (config,"vncdisplay" , &l,0 )) - dm_info->vncdisplay = l; + dm_info->vnc.display = l;if (!xlu_cfg_get_long (config,"vncunused" , &l,0 )) - dm_info->vncunused = l; + dm_info->vnc.findunused = l;xlu_cfg_replace_string (config,"keymap" , &dm_info->keymap,0 );if (!xlu_cfg_get_long (config,"sdl" , &l,0 )) dm_info->sdl = l;
tools/python/genwrap.py +9 -1
@@ -4,7 +4,7 @@ import sys,os import libxltypes -(TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING) = range(4) +(TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_STRING, TYPE_AGGREGATE) = range(5) def py_type(ty): if ty == libxltypes.bool:
@@ -16,6 +16,8 @@ def py_type(ty): return TYPE_INT else: return TYPE_UINT + if isinstance(ty, libxltypes.Aggregate): + return TYPE_AGGREGATE if ty == libxltypes.string: return TYPE_STRING return None
@@ -66,6 +68,9 @@ def py_attrib_get(ty, f): l.append(' return genwrap__ull_get(self->obj.%s);'%f.name) elif t == TYPE_STRING: l.append(' return genwrap__string_get(&self->obj.%s);'%f.name) + elif t == TYPE_AGGREGATE: + l.append(' PyErr_SetString(PyExc_NotImplementedError, "Getting %s");'%ty.typename) + l.append(' return NULL;') else: tn = f.type.typename l.append(' return attrib__%s_get((%s *)&self->obj.%s);'%(fsanitize(tn), tn, f.name))
@@ -92,6 +97,9 @@ def py_attrib_set(ty, f): l.append(' return ret;') elif t == TYPE_STRING: l.append(' return genwrap__string_set(v, &self->obj.%s);'%f.name) + elif t == TYPE_AGGREGATE: + l.append(' PyErr_SetString(PyExc_NotImplementedError, "Setting %s");'%ty.typename) + l.append(' return -1;') else: tn = f.type.typename l.append(' return attrib__%s_set(v, (%s *)&self->obj.%s);'%(fsanitize(tn), tn, f.name))
PATCH 1/1 libxl: define libxl_spice_info to hold all info about the spice server
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID e241db296cbfa86557cd5cfaf7bb870e455dedad
# Parent 83418dbcfc0ab05da8dc1774e66deeb421eae003
libxl: define libxl_spice_info to hold all info about the spice server
tools/libxl/libxl_dm.c +11 -11
@@ -290,39 +290,39 @@ static char ** libxl__build_device_modelif (info->sdl) {flexarray_append (dm_args,"-sdl" ); } -if (info->spice) { +if (info->spice.enable) {char *spiceoptions =NULL ; -if (!info->spiceport && !info->spicetls_port) { +if (!info->spice.port && !info->spice.tls_port) {LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"at least one of the spiceport or tls_port must be provided" );return NULL ; } -if (!info->spicedisable_ticketing) { -if (!info->spicepasswd) { +if (!info->spice.disable_ticketing) { +if (!info->spice.passwd) {LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"spice ticketing is enabled but missing password" );return NULL ; } -else if (!info->spicepasswd[0 ]) { +else if (!info->spice.passwd[0 ]) {LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"spice password can't be empty" );return NULL ; } } spiceoptions =libxl__sprintf (gc,"port=%d,tls-port=%d" , - info->spiceport, info->spicetls_port); -if (info->spicehost) + info->spice.port, info->spice.tls_port); +if (info->spice.host) spiceoptions =libxl__sprintf (gc, -"%s,addr=%s" , spiceoptions, info->spicehost); -if (info->spicedisable_ticketing) +"%s,addr=%s" , spiceoptions, info->spice.host); +if (info->spice.disable_ticketing) spiceoptions =libxl__sprintf (gc,"%s,disable-ticketing" , spiceoptions);else spiceoptions =libxl__sprintf (gc, -"%s,password=%s" , spiceoptions, info->spicepasswd); +"%s,password=%s" , spiceoptions, info->spice.passwd); spiceoptions =libxl__sprintf (gc,"%s,agent-mouse=%s" , spiceoptions, - info->spiceagent_mouse ?"on" :"off" ); + info->spice.agent_mouse ?"on" :"off" );flexarray_append (dm_args,"-spice" );flexarray_append (dm_args, spiceoptions);
tools/libxl/libxl_types.idl +21 -10
@@ -105,6 +105,26 @@ libxl_vnc_info = Struct("vnc_info", [ ("findunused", bool), ]) +libxl_spice_info = Struct("spice_info", [ + ("enable", bool), + # At least one of spice port or spicetls_post must be given + ("port", integer), + ("tls_port", integer), + # Interface to bind to + ("host", string), + # enable client connection with no password + ("disable_ticketing", bool), + ("passwd", string), + ("agent_mouse", bool), + ]) + +libxl_sdl_info = Struct("sdl_info", [ + ("enable", bool), + ("opengl", bool), + ("display", string), + ("xauthority", string), + ]) + libxl_dominfo = Struct("dominfo",[ ("uuid", libxl_uuid), ("domid", libxl_domid),
@@ -237,16 +257,7 @@ libxl_device_model_info = Struct("device ("keymap", string), ("sdl", bool), ("opengl", bool), # (requires sdl enabled) - ("spice", bool), - # At least one of spice port or spicetls_post must be given - ("spiceport", integer), - ("spicetls_port", integer), - # Interface to bind to - ("spicehost", string), - # enable client connection with no password - ("spicedisable_ticketing", bool), - ("spicepasswd", string), - ("spiceagent_mouse", bool), + ("spice", libxl_spice_info), ("nographic", bool), ("gfx_passthru", bool), ("serial", string),
tools/libxl/xl_cmdimpl.c +15 -14
@@ -380,13 +380,13 @@ static void printf_info(int domid,printf ("\t\t\t(usb %d)\n" , dm_info->usb);printf ("\t\t\t(usbdevice %s)\n" , dm_info->usbdevice);printf ("\t\t\t(acpi %d)\n" , dm_info->acpi); -printf ("\t\t\t(spice %d)\n" , dm_info->spice); -printf ("\t\t\t(spiceport %d)\n" , dm_info->spiceport); -printf ("\t\t\t(spicetls_port %d)\n" , dm_info->spicetls_port); -printf ("\t\t\t(spicehost %s)\n" , dm_info->spicehost); +printf ("\t\t\t(spice %d)\n" , dm_info->spice.enable); +printf ("\t\t\t(spiceport %d)\n" , dm_info->spice.port); +printf ("\t\t\t(spicetls_port %d)\n" , dm_info->spice.tls_port); +printf ("\t\t\t(spicehost %s)\n" , dm_info->spice.host);printf ("\t\t\t(spicedisable_ticketing %d)\n" , - dm_info->spicedisable_ticketing); -printf ("\t\t\t(spiceagent_mouse %d)\n" , dm_info->spiceagent_mouse); + dm_info->spice.disable_ticketing); +printf ("\t\t\t(spiceagent_mouse %d)\n" , dm_info->spice.agent_mouse);printf ("\t\t)\n" );break ;case LIBXL_DOMAIN_TYPE_PV :
@@ -1191,19 +1191,20 @@ skip_vfb:if (!xlu_cfg_get_long (config,"opengl" , &l,0 )) dm_info->opengl = l;if (!xlu_cfg_get_long (config,"spice" , &l,0 )) - dm_info->spice = l; + dm_info->spice.enable = l;if (!xlu_cfg_get_long (config,"spiceport" , &l,0 )) - dm_info->spiceport = l; + dm_info->spice.port = l;if (!xlu_cfg_get_long (config,"spicetls_port" , &l,0 )) - dm_info->spicetls_port = l; -xlu_cfg_replace_string (config,"spicehost" , &dm_info->spicehost,0 ); + dm_info->spice.tls_port = l; +xlu_cfg_replace_string (config,"spicehost" , &dm_info->spice.host,0 );if (!xlu_cfg_get_long (config,"spicedisable_ticketing" , &l,0 )) - dm_info->spicedisable_ticketing = l; -xlu_cfg_replace_string (config,"spicepasswd" , &dm_info->spicepasswd,0 ); + dm_info->spice.disable_ticketing = l; +xlu_cfg_replace_string (config,"spicepasswd" , + &dm_info->spice.passwd,0 );if (!xlu_cfg_get_long (config,"spiceagent_mouse" , &l,0 )) - dm_info->spiceagent_mouse = l; + dm_info->spice.agent_mouse = l;else - dm_info->spiceagent_mouse =1 ; + dm_info->spice.agent_mouse =1 ;if (!xlu_cfg_get_long (config,"nographic" , &l,0 )) dm_info->nographic = l;if (!xlu_cfg_get_long (config,"gfx_passthru" , &l,0 ))
PATCH 1/1 libxl: define libxl_sdl_info to hold all info about the SDL config
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID 16d23a64e9c79955405c44c07f2e39cfb0ad238a
# Parent e241db296cbfa86557cd5cfaf7bb870e455dedad
libxl: define libxl_sdl_info to hold all info about the SDL config
tools/libxl/libxl.c +14 -11
@@ -1941,16 +1941,16 @@ out:int libxl_device_vfb_init (libxl_ctx *ctx,libxl_device_vfb *vfb) {memset (vfb,0x00 ,sizeof (libxl_device_vfb)); - vfb->display =NULL ; - vfb->xauthority =NULL ; vfb->vnc.enable =1 ; vfb->vnc.passwd =NULL ; vfb->vnc.listen =strdup ("127.0.0.1" ); vfb->vnc.display =0 ; vfb->vnc.findunused =1 ; vfb->keymap =NULL ; - vfb->sdl =0 ; - vfb->opengl =0 ; + vfb->sdl.enable =0 ; + vfb->sdl.opengl =0 ; + vfb->sdl.display =NULL ; + vfb->sdl.xauthority =NULL ;return 0 ; }
@@ -2001,16 +2001,19 @@ int libxl_device_vfb_add(libxl_ctx *ctx, libxl__sprintf(gc, "%d", vfb->vnc.display));flexarray_append_pair (back,"vncunused" ,libxl__sprintf (gc,"%d" , vfb->vnc.findunused)); -flexarray_append_pair (back,"sdl" ,libxl__sprintf (gc,"%d" , vfb->sdl)); -flexarray_append_pair (back,"opengl" ,libxl__sprintf (gc,"%d" , vfb->opengl)); -if (vfb->xauthority) { -flexarray_append_pair (back,"xauthority" , vfb->xauthority); +flexarray_append_pair (back,"sdl" , +libxl__sprintf (gc,"%d" , vfb->sdl.enable)); +flexarray_append_pair (back,"opengl" , +libxl__sprintf (gc,"%d" , vfb->sdl.opengl)); +if (vfb->sdl.xauthority) { +flexarray_append_pair (back,"xauthority" , vfb->sdl.xauthority); } -if (vfb->display) { -flexarray_append_pair (back,"display" , vfb->display); +if (vfb->sdl.display) { +flexarray_append_pair (back,"display" , vfb->sdl.display); } -flexarray_append_pair (front,"backend-id" ,libxl__sprintf (gc,"%d" , vfb->backend_domid)); +flexarray_append_pair (front,"backend-id" , +libxl__sprintf (gc,"%d" , vfb->backend_domid));flexarray_append_pair (front,"state" ,libxl__sprintf (gc,"%d" ,1 )); libxl__device_generic_add(gc, &device,
tools/libxl/libxl_create.c +2 -2
@@ -131,8 +131,8 @@ int libxl_init_dm_info(libxl_ctx *ctx, dm_info->vnc.display =0 ; dm_info->vnc.findunused =1 ; dm_info->keymap =NULL ; - dm_info->sdl =0 ; - dm_info->opengl =0 ; + dm_info->sdl.enable =0 ; + dm_info->sdl.opengl =0 ; dm_info->nographic =0 ; dm_info->serial =NULL ; dm_info->boot =strdup ("cda" );
tools/libxl/libxl_dm.c +7 -7
@@ -120,16 +120,17 @@ static char ** libxl__build_device_modelflexarray_append (dm_args,"-vncunused" ); } } -if (info->sdl) { +if (info->sdl.enable) {flexarray_append (dm_args,"-sdl" ); -if (!info->opengl) { +if (!info->sdl.opengl) {flexarray_append (dm_args,"-disable-opengl" ); } +/* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */ }if (info->keymap) {flexarray_vappend (dm_args,"-k" , info->keymap,NULL ); } -if (info->nographic && (!info->sdl && !info->vnc.enable)) { +if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {flexarray_append (dm_args,"-nographic" ); }if (info->serial) {
@@ -287,8 +288,9 @@ static char ** libxl__build_device_modellibxl__sprintf (gc,"%s:%d%s" , listen, display, info->vnc.findunused ? ",to=99" : "")); } -if (info->sdl) { +if (info->sdl.enable) {flexarray_append (dm_args,"-sdl" ); +/* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */ }if (info->spice.enable) {char *spiceoptions =NULL ;
@@ -335,7 +337,7 @@ static char ** libxl__build_device_modelif (info->keymap) {flexarray_vappend (dm_args,"-k" , info->keymap,NULL ); } -if (info->nographic && (!info->sdl && !info->vnc.enable)) { +if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) {flexarray_append (dm_args,"-nographic" ); }if (info->serial) {
@@ -526,7 +528,6 @@ static int libxl__vfb_and_vkb_from_devic vfb->vnc = info->vnc; vfb->keymap = info->keymap; vfb->sdl = info->sdl; - vfb->opengl = info->opengl; vkb->backend_domid =0 ; vkb->devid =0 ;
@@ -981,7 +982,6 @@ static int libxl__build_xenpv_qemu_args(if (vfb->keymap) info->keymap =libxl__strdup (gc, vfb->keymap); info->sdl = vfb->sdl; - info->opengl = vfb->opengl; }else info->nographic =1 ; info->domid = domid;
tools/libxl/libxl_types.idl +2 -6
@@ -255,8 +255,7 @@ libxl_device_model_info = Struct("device ("vnc", libxl_vnc_info), # keyboard layout, default is en-us keyboard ("keymap", string), - ("sdl", bool), - ("opengl", bool), # (requires sdl enabled) + ("sdl", libxl_sdl_info), ("spice", libxl_spice_info), ("nographic", bool), ("gfx_passthru", bool),
@@ -283,12 +282,9 @@ libxl_device_vfb = Struct("device_vfb", ("backend_domid", libxl_domid), ("devid", integer), ("vnc", libxl_vnc_info), + ("sdl", libxl_sdl_info), # set keyboard layout, default is en-us keyboard ("keymap", string), - ("sdl", bool), - ("opengl", bool), # (if enabled requires sdl enabled) - ("display", string), - ("xauthority", string), ]) libxl_device_vkb = Struct("device_vkb", [
tools/libxl/xl_cmdimpl.c +14 -14
@@ -371,9 +371,9 @@ static void printf_info(int domid,printf ("\t\t\t(vncdisplay %d)\n" , dm_info->vnc.display);printf ("\t\t\t(vncunused %d)\n" , dm_info->vnc.findunused);printf ("\t\t\t(keymap %s)\n" , dm_info->keymap); -printf ("\t\t\t(sdl %d)\n" , dm_info->sdl); +printf ("\t\t\t(sdl %d)\n" , dm_info->sdl.enable);printf ("\t\t\t(gfx_passthru %d)\n" , dm_info->gfx_passthru); -printf ("\t\t\t(opengl %d)\n" , dm_info->opengl); +printf ("\t\t\t(opengl %d)\n" , dm_info->sdl.opengl);printf ("\t\t\t(nographic %d)\n" , dm_info->nographic);printf ("\t\t\t(serial %s)\n" , dm_info->serial);printf ("\t\t\t(boot %s)\n" , dm_info->boot);
@@ -461,10 +461,10 @@ static void printf_info(int domid,printf ("\t\t\t(vncdisplay %d)\n" , d_config->vfbs[i].vnc.display);printf ("\t\t\t(vncunused %d)\n" , d_config->vfbs[i].vnc.findunused);printf ("\t\t\t(keymap %s)\n" , d_config->vfbs[i].keymap); -printf ("\t\t\t(sdl %d)\n" , d_config->vfbs[i].sdl); -printf ("\t\t\t(opengl %d)\n" , d_config->vfbs[i].opengl); -printf ("\t\t\t(display %s)\n" , d_config->vfbs[i].display); -printf ("\t\t\t(xauthority %s)\n" , d_config->vfbs[i].xauthority); +printf ("\t\t\t(sdl %d)\n" , d_config->vfbs[i].sdl.enable); +printf ("\t\t\t(opengl %d)\n" , d_config->vfbs[i].sdl.opengl); +printf ("\t\t\t(display %s)\n" , d_config->vfbs[i].sdl.display); +printf ("\t\t\t(xauthority %s)\n" , d_config->vfbs[i].sdl.xauthority);printf ("\t\t)\n" );printf ("\t)\n" ); }
@@ -976,15 +976,15 @@ skip:free (vfb->keymap); vfb->keymap =strdup (p2 +1 ); }else if (!strcmp (p,"sdl" )) { - vfb->sdl =atoi (p2 +1 ); + vfb->sdl.enable =atoi (p2 +1 ); }else if (!strcmp (p,"opengl" )) { - vfb->opengl =atoi (p2 +1 ); + vfb->sdl.opengl =atoi (p2 +1 ); }else if (!strcmp (p,"display" )) { -free (vfb->display); - vfb->display =strdup (p2 +1 ); +free (vfb->sdl.display); + vfb->sdl.display =strdup (p2 +1 ); }else if (!strcmp (p,"xauthority" )) { -free (vfb->xauthority); - vfb->xauthority =strdup (p2 +1 ); +free (vfb->sdl.xauthority); + vfb->sdl.xauthority =strdup (p2 +1 ); } }while ((p =strtok (NULL ,"," )) !=NULL ); skip_vfb:
@@ -1187,9 +1187,9 @@ skip_vfb: dm_info->vnc.findunused = l;xlu_cfg_replace_string (config,"keymap" , &dm_info->keymap,0 );if (!xlu_cfg_get_long (config,"sdl" , &l,0 )) - dm_info->sdl = l; + dm_info->sdl.enable = l;if (!xlu_cfg_get_long (config,"opengl" , &l,0 )) - dm_info->opengl = l; + dm_info->sdl.opengl = l;if (!xlu_cfg_get_long (config,"spice" , &l,0 )) dm_info->spice.enable = l;if (!xlu_cfg_get_long (config,"spiceport" , &l,0 ))
PATCH 1/1 libxl: plumb libxl_domain_config down into device model creation
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID c03b3c71a923216fe50882770a72b3cc9f433a85
# Parent 16d23a64e9c79955405c44c07f2e39cfb0ad238a
libxl: plumb libxl_domain_config down into device model creation.
Creating the device model derives lots of bits from the guest configuration.
tools/libxl/libxl_create.c +3 -2
@@ -568,7 +568,7 @@ static int do_domain_create(libxl__gc *glibxl_device_vkb_dispose (&vkb); dm_info->domid = domid; - ret =libxl__create_device_model (gc, dm_info, + ret =libxl__create_device_model (gc, d_config, dm_info, d_config->disks, d_config->num_disks, d_config->vifs, d_config->num_vifs, &dm_starting);
@@ -615,7 +615,8 @@ static int do_domain_create(libxl__gc *g xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm; -libxl__create_xenpv_qemu (gc, domid, &xenpv_dm_info, +libxl__create_xenpv_qemu (gc, domid, + d_config, &xenpv_dm_info, d_config->vfbs, &dm_starting); }break ;
tools/libxl/libxl_dm.c +58 -50
199 lines not on this page · raw message
tools/libxl/libxl_internal.h +3 -1
@@ -493,11 +493,13 @@ _hidden int libxl__domain_build(libxl__g _hidden const char *libxl__domain_device_model(libxl__gc *gc,libxl_device_model_info *info); _hidden int libxl__create_device_model(libxl__gc *gc, +libxl_domain_config *guest_config,libxl_device_model_info *info, -libxl_device_disk *disk,int num_disks, +libxl_device_disk *disks,int num_disks,libxl_device_nic *vifs,int num_vifs,libxl__spawner_starting **starting_r); _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid, +libxl_domain_config *guest_config,libxl_device_model_info *dm_info,libxl_device_vfb *vfb,libxl__spawner_starting **starting_r);
tools/libxl/libxl_uuid.c +2 -2
@@ -35,7 +35,7 @@ int libxl_uuid_from_string(libxl_uuid *ureturn uuid_parse (in, uuid->uuid); } -void libxl_uuid_copy (libxl_uuid *dst,libxl_uuid *src) +void libxl_uuid_copy (libxl_uuid *dst,const libxl_uuid *src) {uuid_copy (dst->uuid, src->uuid); }
@@ -82,7 +82,7 @@ int libxl_uuid_from_string(libxl_uuid *u }#undef LIBXL__UUID_PTRS -void libxl_uuid_copy (libxl_uuid *dst,libxl_uuid *src) +void libxl_uuid_copy (libxl_uuid *dst,const libxl_uuid *src) {memcpy (dst->uuid, src->uuid,sizeof (dst->uuid)); }
tools/libxl/libxl_uuid.h +1 -1
@@ -56,7 +56,7 @@ typedef struct {int libxl_uuid_is_nil (libxl_uuid *uuid);void libxl_uuid_generate (libxl_uuid *uuid);int libxl_uuid_from_string (libxl_uuid *uuid,const char *in); -void libxl_uuid_copy (libxl_uuid *dst,libxl_uuid *src); +void libxl_uuid_copy (libxl_uuid *dst,const libxl_uuid *src);void libxl_uuid_clear (libxl_uuid *uuid);int libxl_uuid_compare (libxl_uuid *uuid1,libxl_uuid *uuid2);uint8_t *libxl_uuid_bytearray (libxl_uuid *uuid);
PATCH 1/1 libxl: now that dm creation takes domain_config stop passing down devices
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336697 0
# Node ID e6287c6308bd2ef1fb6440ee2be4f0d5492566f9
# Parent c03b3c71a923216fe50882770a72b3cc9f433a85
libxl: now that dm creation takes domain_config stop passing down devices.
tools/libxl/libxl_create.c +1 -4
@@ -569,8 +569,6 @@ static int do_domain_create(libxl__gc *g dm_info->domid = domid; ret =libxl__create_device_model (gc, d_config, dm_info, - d_config->disks, d_config->num_disks, - d_config->vifs, d_config->num_vifs, &dm_starting);if (ret <0 ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -616,8 +614,7 @@ static int do_domain_create(libxl__gc *g xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;libxl__create_xenpv_qemu (gc, domid, - d_config, &xenpv_dm_info, - d_config->vfbs, &dm_starting); + d_config, &xenpv_dm_info, &dm_starting); }break ; }
tools/libxl/libxl_dm.c +38 -45
180 lines not on this page · raw message
tools/libxl/libxl_internal.h +0 -3
@@ -495,13 +495,10 @@ _hidden const char *libxl__domain_device _hidden int libxl__create_device_model(libxl__gc *gc,libxl_domain_config *guest_config,libxl_device_model_info *info, -libxl_device_disk *disks,int num_disks, -libxl_device_nic *vifs,int num_vifs,libxl__spawner_starting **starting_r); _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,libxl_domain_config *guest_config,libxl_device_model_info *dm_info, -libxl_device_vfb *vfb,libxl__spawner_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl_device_console *consoles,
PATCH 1/1 libxl: remove redundant info from dm info
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID ceec8103098f611789c4fe6405b7f681d8b21f0e # Parent e6287c6308bd2ef1fb6440ee2be4f0d5492566f9
libxl: remove redundant info from dm info.
Remove "target_ram", "acpi", "vcpus" and "vcpu_avail" from device model info and use domain_build_info instead. These must all be consistently specified to both the domain and the device model, there is no need (and a great deal of danger) in exposing a way for a user of libxl to set them differently.
tools/libxl/libxl_create.c +0 -4
@@ -119,11 +119,7 @@ int libxl_init_dm_info(libxl_ctx *ctx, dm_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; dm_info->device_model_stubdomain = false; dm_info->device_model =NULL ; - dm_info->target_ram =libxl__sizekb_to_mb (b_info->target_memkb); dm_info->videoram =libxl__sizekb_to_mb (b_info->video_memkb); - dm_info->acpi = b_info->u.hvm.acpi; - dm_info->vcpus = b_info->max_vcpus; - dm_info->vcpu_avail = b_info->cur_vcpus; dm_info->stdvga =0 ; dm_info->vnc.enable =1 ;
tools/libxl/libxl_dm.c +22 -11
@@ -78,6 +78,7 @@ static char ** libxl__build_device_modelconst libxl_domain_config *guest_config, const libxl_device_model_info *info) { + const libxl_domain_build_info *b_info = &guest_config->b_info;const libxl_device_nic *vifs = guest_config->vifs;const int num_vifs = guest_config->num_vifs;int i;
@@ -159,14 +160,18 @@ static char ** libxl__build_device_modelif (info->soundhw) {flexarray_vappend (dm_args,"-soundhw" , info->soundhw,NULL ); } -if (info->acpi) { +if (b_info->u.hvm.acpi) {flexarray_append (dm_args,"-acpi" ); } -if (info->vcpus >1 ) { -flexarray_vappend (dm_args,"-vcpus" ,libxl__sprintf (gc,"%d" , info->vcpus),NULL ); +if (b_info->max_vcpus >1 ) { +flexarray_vappend (dm_args,"-vcpus" , +libxl__sprintf (gc,"%d" , b_info->max_vcpus), +NULL ); } -if (info->vcpu_avail) { -flexarray_vappend (dm_args,"-vcpu_avail" ,libxl__sprintf (gc,"0x%x" , info->vcpu_avail),NULL ); +if (b_info->cur_vcpus) { +flexarray_vappend (dm_args,"-vcpu_avail" , +libxl__sprintf (gc,"0x%x" , b_info->cur_vcpus), +NULL ); }for (i =0 ; i < num_vifs; i++) {if (vifs[i].nictype ==LIBXL_NIC_TYPE_IOEMU ) {
@@ -234,6 +239,7 @@ static char ** libxl__build_device_model const libxl_device_model_info *info) {libxl_ctx *ctx =libxl__gc_owner (gc); +const libxl_domain_build_info *b_info = &guest_config->b_info;const libxl_device_disk *disks = guest_config->disks;const libxl_device_nic *vifs = guest_config->vifs;const int num_disks = guest_config->num_disks;
@@ -366,15 +372,18 @@ static char ** libxl__build_device_modelif (info->soundhw) {flexarray_vappend (dm_args,"-soundhw" , info->soundhw,NULL ); } -if (!info->acpi) { +if (!b_info->u.hvm.acpi) {flexarray_append (dm_args,"-no-acpi" ); } -if (info->vcpus >1 ) { +if (b_info->max_vcpus >1 ) {flexarray_append (dm_args,"-smp" ); -if (info->vcpu_avail) -flexarray_append (dm_args,libxl__sprintf (gc,"%d,maxcpus=%d" , info->vcpus, info->vcpu_avail)); +if (b_info->cur_vcpus) +flexarray_append (dm_args,libxl__sprintf (gc,"%d,maxcpus=%d" , + b_info->max_vcpus, + b_info->cur_vcpus));else -flexarray_append (dm_args,libxl__sprintf (gc,"%d" , info->vcpus)); +flexarray_append (dm_args,libxl__sprintf (gc,"%d" , + b_info->max_vcpus)); }for (i =0 ; i < num_vifs; i++) {if (vifs[i].nictype ==LIBXL_NIC_TYPE_IOEMU ) {
@@ -432,7 +441,9 @@ static char ** libxl__build_device_model/* RAM Size */ flexarray_append (dm_args,"-m" ); -flexarray_append (dm_args,libxl__sprintf (gc,"%d" , info->target_ram)); +flexarray_append (dm_args, +libxl__sprintf (gc,"%d" , +libxl__sizekb_to_mb (b_info->target_memkb)));if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) {for (i =0 ; i < num_disks; i++) {
tools/libxl/libxl_types.idl +0 -4
@@ -248,7 +248,6 @@ libxl_device_model_info = Struct("device ("device_model", string), ("saved_state", string), ("type", libxl_domain_type), - ("target_ram", uint32), # size of the videoram in MB ("videoram", integer), ("stdvga", bool),
@@ -265,9 +264,6 @@ libxl_device_model_info = Struct("device # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse ("usbdevice", string), ("soundhw", string), - ("acpi", bool), - ("vcpus", integer), # max number of vcpus - ("vcpu_avail", integer), # vcpus actually available ("xen_platform_pci", bool), # extra parameters pass directly to qemu, NULL terminated ("extra", libxl_string_list),
tools/libxl/xl_cmdimpl.c +0 -1
@@ -379,7 +379,6 @@ static void printf_info(int domid,printf ("\t\t\t(boot %s)\n" , dm_info->boot);printf ("\t\t\t(usb %d)\n" , dm_info->usb);printf ("\t\t\t(usbdevice %s)\n" , dm_info->usbdevice); -printf ("\t\t\t(acpi %d)\n" , dm_info->acpi);printf ("\t\t\t(spice %d)\n" , dm_info->spice.enable);printf ("\t\t\t(spiceport %d)\n" , dm_info->spice.port);printf ("\t\t\t(spicetls_port %d)\n" , dm_info->spice.tls_port);
PATCH 1/1 libxl: drop dm_info.dom_name
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID e5bc9888a14f19b625489b6b2cd7206c9f3be262 # Parent ceec8103098f611789c4fe6405b7f681d8b21f0e
libxl: drop dm_info.dom_name
This is always the same as the c_info name which we now have available.
tools/libxl/libxl_create.c +0 -1
@@ -115,7 +115,6 @@ int libxl_init_dm_info(libxl_ctx *ctx,libxl_uuid_generate (&dm_info->uuid); - dm_info->dom_name =strdup (c_info->name); dm_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; dm_info->device_model_stubdomain = false; dm_info->device_model =NULL ;
tools/libxl/libxl_dm.c +10 -8
@@ -78,6 +78,7 @@ static char ** libxl__build_device_modelconst libxl_domain_config *guest_config, const libxl_device_model_info *info) { + const libxl_domain_create_info *c_info = &guest_config->c_info;const libxl_domain_build_info *b_info = &guest_config->b_info;const libxl_device_nic *vifs = guest_config->vifs;const int num_vifs = guest_config->num_vifs;
@@ -91,8 +92,8 @@ static char ** libxl__build_device_modelflexarray_vappend (dm_args, dm,"-d" ,libxl__sprintf (gc,"%d" , info->domid),NULL ); -if (info->dom_name) -flexarray_vappend (dm_args,"-domain-name" , info->dom_name,NULL ); +if (c_info->name) +flexarray_vappend (dm_args,"-domain-name" , c_info->name,NULL );if (info->vnc.enable) {char *vncarg;
@@ -239,6 +240,7 @@ static char ** libxl__build_device_model const libxl_device_model_info *info) {libxl_ctx *ctx =libxl__gc_owner (gc); +const libxl_domain_create_info *c_info = &guest_config->c_info;const libxl_domain_build_info *b_info = &guest_config->b_info;const libxl_device_disk *disks = guest_config->disks;const libxl_device_nic *vifs = guest_config->vifs;
@@ -268,8 +270,8 @@ static char ** libxl__build_device_modelflexarray_append (dm_args,"-xen-attach" ); } -if (info->dom_name) { -flexarray_vappend (dm_args,"-name" , info->dom_name,NULL ); +if (c_info->name) { +flexarray_vappend (dm_args,"-name" , c_info->name,NULL ); }if (info->vnc.enable) {int display =0 ;
@@ -793,6 +795,7 @@ int libxl__create_device_model(libxl__gc libxl_device_model_info *info, libxl__spawner_starting **starting_r) { +const libxl_domain_create_info *c_info = &guest_config->c_info;libxl_ctx *ctx =libxl__gc_owner (gc);char *path, *logfile;int logfile_w, null;
@@ -835,7 +838,9 @@ int libxl__create_device_model(libxl__gcxs_mkdir (ctx->xsh,XBT_NULL , path);libxl__xs_write (gc,XBT_NULL ,libxl__sprintf (gc,"%s/disable_pf" , path),"%d" , !info->xen_platform_pci); -libxl_create_logfile (ctx,libxl__sprintf (gc,"qemu-dm-%s" , info->dom_name), &logfile); +libxl_create_logfile (ctx, +libxl__sprintf (gc,"qemu-dm-%s" , c_info->name), + &logfile); logfile_w =open (logfile,O_WRONLY |O_CREAT |O_APPEND ,0644 );free (logfile); null =open ("/dev/null" ,O_RDONLY );
@@ -981,8 +986,6 @@ static int libxl__build_xenpv_qemu_args( libxl_device_vfb *vfb, libxl_device_model_info *info) { -libxl_ctx *ctx =libxl__gc_owner (gc); -if (vfb !=NULL ) { info->vnc.enable = vfb->vnc.enable;if (vfb->vnc.listen)
@@ -997,7 +1000,6 @@ static int libxl__build_xenpv_qemu_args( }else info->nographic =1 ; info->domid = domid; - info->dom_name =libxl_domid_to_name (ctx, domid);return 0 ; }
tools/libxl/libxl_types.idl +0 -1
@@ -241,7 +241,6 @@ libxl_device_model_info = Struct("device # uuid is used only with stubdom, and must be different from the # domain uuid ("uuid", libxl_uuid), - ("dom_name", string), ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", bool), # you set device_model you must set device_model_version too
PATCH 1/1 libxl: use vfb[0] directly for xenpv device model
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID d3882dfe0aa93b5be6ce1ae85cf9e07f4146b620 # Parent e5bc9888a14f19b625489b6b2cd7206c9f3be262
libxl: use vfb[0] directly for xenpv device model
Rather than laundering it via dm info.
tools/libxl/libxl_dm.c +62 -47
@@ -73,6 +73,30 @@ static const char *libxl__domain_bios(li } } +static const libxl_vnc_info *dm_vnc (const libxl_domain_config *guest_config, +const libxl_device_model_info *info) +{ +const libxl_vnc_info *vnc =NULL ; +if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { + vnc = &info->vnc; + }else if (guest_config->num_vfbs >0 ) { + vnc = &guest_config->vfbs[0 ].vnc; + } +return vnc && vnc->enable ? vnc :NULL ; +} + +static const libxl_sdl_info *dm_sdl (const libxl_domain_config *guest_config, +const libxl_device_model_info *info) +{ +const libxl_sdl_info *sdl =NULL ; +if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { + sdl = &info->sdl; + }else if (guest_config->num_vfbs >0 ) { + sdl = &guest_config->vfbs[0 ].sdl; + } +return sdl && sdl->enable ? sdl :NULL ; +} + static char ** libxl__build_device_model_args_old(libxl__gc *gc, const char *dm, const libxl_domain_config *guest_config,
@@ -81,6 +105,8 @@ static char ** libxl__build_device_modelconst libxl_domain_create_info *c_info = &guest_config->c_info;const libxl_domain_build_info *b_info = &guest_config->b_info;const libxl_device_nic *vifs = guest_config->vifs; +const libxl_vnc_info *vnc =dm_vnc (guest_config, info); +const libxl_sdl_info *sdl =dm_sdl (guest_config, info);const int num_vifs = guest_config->num_vifs;int i;flexarray_t *dm_args;
@@ -95,45 +121,45 @@ static char ** libxl__build_device_modelif (c_info->name)flexarray_vappend (dm_args,"-domain-name" , c_info->name,NULL ); -if (info->vnc.enable) { +if (vnc) {char *vncarg; -if (info->vnc.display) { -if (info->vnc.listen &&strchr (info->vnc.listen,':' ) ==NULL ) { +if (vnc->display) { +if (vnc->listen &&strchr (vnc->listen,':' ) ==NULL ) { vncarg =libxl__sprintf (gc,"%s:%d" , - info->vnc.listen, - info->vnc.display); + vnc->listen, + vnc->display); }else { - vncarg =libxl__sprintf (gc,"127.0.0.1:%d" , info->vnc.display); + vncarg =libxl__sprintf (gc,"127.0.0.1:%d" , vnc->display); } - }else if (info->vnc.listen) { -if (strchr (info->vnc.listen,':' ) !=NULL ) { - vncarg = info->vnc.listen; + }else if (vnc->listen) { +if (strchr (vnc->listen,':' ) !=NULL ) { + vncarg = vnc->listen; }else { - vncarg =libxl__sprintf (gc,"%s:0" , info->vnc.listen); + vncarg =libxl__sprintf (gc,"%s:0" , vnc->listen); } }else { vncarg ="127.0.0.1:0" ; } -if (info->vnc.passwd && (info->vnc.passwd[0 ] !='\0' )) +if (vnc->passwd && (vnc->passwd[0 ] !='\0' )) vncarg =libxl__sprintf (gc,"%s,password" , vncarg);flexarray_append (dm_args,"-vnc" );flexarray_append (dm_args, vncarg); -if (info->vnc.findunused) { +if (vnc->findunused) {flexarray_append (dm_args,"-vncunused" ); } } -if (info->sdl.enable) { +if (sdl) {flexarray_append (dm_args,"-sdl" ); -if (!info->sdl.opengl) { +if (!sdl->opengl) {flexarray_append (dm_args,"-disable-opengl" ); } -/* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */ +/* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */ }if (info->keymap) {flexarray_vappend (dm_args,"-k" , info->keymap,NULL ); } -if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) { +if (info->nographic && (!sdl && !vnc)) {flexarray_append (dm_args,"-nographic" ); }if (info->serial) {
@@ -246,6 +272,8 @@ static char ** libxl__build_device_modelconst libxl_device_nic *vifs = guest_config->vifs;const int num_disks = guest_config->num_disks;const int num_vifs = guest_config->num_vifs; +const libxl_vnc_info *vnc =dm_vnc (guest_config, info); +const libxl_sdl_info *sdl =dm_sdl (guest_config, info);flexarray_t *dm_args;int i;
@@ -273,36 +301,36 @@ static char ** libxl__build_device_modelif (c_info->name) {flexarray_vappend (dm_args,"-name" , c_info->name,NULL ); } -if (info->vnc.enable) { +if (vnc) {int display =0 ;const char *listen ="127.0.0.1" ; -if (info->vnc.passwd && info->vnc.passwd[0 ]) { +if (vnc->passwd && vnc->passwd[0 ]) {assert (!"missing code for supplying vnc password to qemu" ); }flexarray_append (dm_args,"-vnc" ); -if (info->vnc.display) { - display = info->vnc.display; -if (info->vnc.listen &&strchr (info->vnc.listen,':' ) ==NULL ) { - listen = info->vnc.listen; +if (vnc->display) { + display = vnc->display; +if (vnc->listen &&strchr (vnc->listen,':' ) ==NULL ) { + listen = vnc->listen; } - }else if (info->vnc.listen) { - listen = info->vnc.listen; + }else if (vnc->listen) { + listen = vnc->listen; }if (strchr (listen,':' ) !=NULL )flexarray_append (dm_args,libxl__sprintf (gc,"%s%s" , listen, - info->vnc.findunused ?",to=99" :"" )); + vnc->findunused ?",to=99" :"" ));else flexarray_append (dm_args,libxl__sprintf (gc,"%s:%d%s" , listen, display, - info->vnc.findunused ?",to=99" :"" )); + vnc->findunused ?",to=99" :"" )); } -if (info->sdl.enable) { +if (sdl) {flexarray_append (dm_args,"-sdl" ); -/* XXX info->sdl.{display,xauthority} into $DISPLAY/$XAUTHORITY */ +/* XXX sdl->{display,xauthority} into $DISPLAY/$XAUTHORITY */ }if (info->spice.enable) {char *spiceoptions =NULL ;
@@ -349,7 +377,7 @@ static char ** libxl__build_device_modelif (info->keymap) {flexarray_vappend (dm_args,"-k" , info->keymap,NULL ); } -if (info->nographic && (!info->sdl.enable && !info->vnc.enable)) { +if (info->nographic && (!sdl && !vnc)) {flexarray_append (dm_args,"-nographic" ); }if (info->serial) {
@@ -795,8 +823,9 @@ int libxl__create_device_model(libxl__gc libxl_device_model_info *info, libxl__spawner_starting **starting_r) { +libxl_ctx *ctx =libxl__gc_owner (gc);const libxl_domain_create_info *c_info = &guest_config->c_info; -libxl_ctx *ctx =libxl__gc_owner (gc); +const libxl_vnc_info *vnc =dm_vnc (guest_config, info);char *path, *logfile;int logfile_w, null;int rc;
@@ -865,7 +894,7 @@ int libxl__create_device_model(libxl__gc goto out_close; } -if (info->vnc.passwd) { +if (vnc && vnc->passwd) { retry_transaction:/* Find uuid and the write the vnc password to xenstore for qemu. */ t =xs_transaction_start (ctx->xsh);
@@ -874,7 +903,7 @@ retry_transaction:/* Now write the vncpassword into it. */ pass_stuff =libxl__calloc (gc,3 ,sizeof (char *)); pass_stuff[0 ] ="vncpasswd" ; - pass_stuff[1 ] = info->vnc.passwd; + pass_stuff[1 ] = vnc->passwd;libxl__xs_writev (gc,t,vm_path,pass_stuff);if (!xs_transaction_end (ctx->xsh, t,0 ))if (errno ==EAGAIN )
@@ -983,22 +1012,8 @@ out:static int libxl__build_xenpv_qemu_args (libxl__gc *gc,uint32_t domid, -libxl_device_vfb *vfb,libxl_device_model_info *info) { -if (vfb !=NULL ) { - info->vnc.enable = vfb->vnc.enable; -if (vfb->vnc.listen) - info->vnc.listen =libxl__strdup (gc, vfb->vnc.listen); - info->vnc.display = vfb->vnc.display; - info->vnc.findunused = vfb->vnc.findunused; -if (vfb->vnc.passwd) - info->vnc.passwd = vfb->vnc.passwd; -if (vfb->keymap) - info->keymap =libxl__strdup (gc, vfb->keymap); - info->sdl = vfb->sdl; - }else - info->nographic =1 ; info->domid = domid;return 0 ; }
@@ -1045,7 +1060,7 @@ int libxl__create_xenpv_qemu(libxl__gc * libxl_device_model_info *info, libxl__spawner_starting **starting_r) { -libxl__build_xenpv_qemu_args (gc, domid, &guest_config->vfbs[0 ], info); +libxl__build_xenpv_qemu_args (gc, domid, info);libxl__create_device_model (gc, guest_config, info, starting_r);return 0 ; }
PATCH 1/1 libxl: move HVM emulated GFX support into b_info->u.hvm
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID 188443bf7392231d675ee195e2e72314c8568f8a # Parent d3882dfe0aa93b5be6ce1ae85cf9e07f4146b620
libxl: move HVM emulated GFX support into b_info->u.hvm
tools/libxl/libxl_create.c +10 -10
@@ -93,6 +93,16 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.timer_mode =1 ; b_info->u.hvm.nested_hvm =0 ; b_info->u.hvm.no_incr_generationid =0 ; + + b_info->u.hvm.stdvga =0 ; + b_info->u.hvm.vnc.enable =1 ; + b_info->u.hvm.vnc.listen =strdup ("127.0.0.1" ); + b_info->u.hvm.vnc.display =0 ; + b_info->u.hvm.vnc.findunused =1 ; + b_info->u.hvm.keymap =NULL ; + b_info->u.hvm.sdl.enable =0 ; + b_info->u.hvm.sdl.opengl =0 ; + b_info->u.hvm.nographic =0 ;break ;case LIBXL_DOMAIN_TYPE_PV : b_info->u.pv.slack_memkb =8 *1024 ;
@@ -118,17 +128,7 @@ int libxl_init_dm_info(libxl_ctx *ctx, dm_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; dm_info->device_model_stubdomain = false; dm_info->device_model =NULL ; - dm_info->videoram =libxl__sizekb_to_mb (b_info->video_memkb); - dm_info->stdvga =0 ; - dm_info->vnc.enable =1 ; - dm_info->vnc.listen =strdup ("127.0.0.1" ); - dm_info->vnc.display =0 ; - dm_info->vnc.findunused =1 ; - dm_info->keymap =NULL ; - dm_info->sdl.enable =0 ; - dm_info->sdl.opengl =0 ; - dm_info->nographic =0 ; dm_info->serial =NULL ; dm_info->boot =strdup ("cda" ); dm_info->usb =0 ;
tools/libxl/libxl_dm.c +103 -62
264 lines not on this page · raw message
tools/libxl/libxl_types.idl +7 -9
@@ -219,6 +219,13 @@ libxl_domain_build_info = Struct("domain ("timer_mode", integer), ("nested_hvm", bool), ("no_incr_generationid", bool), + ("nographic", bool), + ("stdvga", bool), + ("vnc", libxl_vnc_info), + # keyboard layout, default is en-us keyboard + ("keymap", string), + ("sdl", libxl_sdl_info), + ("spice", libxl_spice_info), ])), ("pv", Struct(None, [("kernel", libxl_file_reference), ("slack_memkb", uint32),
@@ -247,15 +254,6 @@ libxl_device_model_info = Struct("device ("device_model", string), ("saved_state", string), ("type", libxl_domain_type), - # size of the videoram in MB - ("videoram", integer), - ("stdvga", bool), - ("vnc", libxl_vnc_info), - # keyboard layout, default is en-us keyboard - ("keymap", string), - ("sdl", libxl_sdl_info), - ("spice", libxl_spice_info), - ("nographic", bool), ("gfx_passthru", bool), ("serial", string), ("boot", string),
tools/libxl/xl_cmdimpl.c +36 -35
102 lines not on this page · raw message
PATCH 1/1 libxl: HVM device configuration info build_info->u.hvm
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID 6caa4c9b20e176884050310999c5a5eb4c555a41 # Parent 188443bf7392231d675ee195e2e72314c8568f8a
libxl: HVM device configuration info build_info->u.hvm
tools/libxl/libxl_create.c +5 -5
@@ -103,6 +103,11 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->u.hvm.sdl.enable =0 ; b_info->u.hvm.sdl.opengl =0 ; b_info->u.hvm.nographic =0 ; + b_info->u.hvm.serial =NULL ; + b_info->u.hvm.boot =strdup ("cda" ); + b_info->u.hvm.usb =0 ; + b_info->u.hvm.usbdevice =NULL ; + b_info->u.hvm.xen_platform_pci =1 ;break ;case LIBXL_DOMAIN_TYPE_PV : b_info->u.pv.slack_memkb =8 *1024 ;
@@ -129,11 +134,6 @@ int libxl_init_dm_info(libxl_ctx *ctx, dm_info->device_model_stubdomain = false; dm_info->device_model =NULL ; - dm_info->serial =NULL ; - dm_info->boot =strdup ("cda" ); - dm_info->usb =0 ; - dm_info->usbdevice =NULL ; - dm_info->xen_platform_pci =1 ;return 0 ; }
tools/libxl/libxl_dm.c +28 -22
100 lines not on this page · raw message
tools/libxl/libxl_types.idl +10 -7
@@ -226,6 +226,16 @@ libxl_domain_build_info = Struct("domain ("keymap", string), ("sdl", libxl_sdl_info), ("spice", libxl_spice_info), + + ("serial", string), + ("boot", string), + ("usb", bool), + # usbdevice: + # - "tablet" for absolute mouse, + # - "mouse" for PS/2 protocol relative mouse + ("usbdevice", string), + ("soundhw", string), + ("xen_platform_pci", bool), ])), ("pv", Struct(None, [("kernel", libxl_file_reference), ("slack_memkb", uint32),
@@ -255,13 +265,6 @@ libxl_device_model_info = Struct("device ("saved_state", string), ("type", libxl_domain_type), ("gfx_passthru", bool), - ("serial", string), - ("boot", string), - ("usb", bool), - # usbdevice: "tablet" for absolute mouse, "mouse" for PS/2 protocol relative mouse - ("usbdevice", string), - ("soundhw", string), - ("xen_platform_pci", bool), # extra parameters pass directly to qemu, NULL terminated ("extra", libxl_string_list), # extra parameters pass directly to qemu for PV guest, NULL terminated
tools/libxl/xl_cmdimpl.c +10 -10
@@ -382,10 +382,10 @@ static void printf_info(int domid,printf ("\t\t\t(device_model %s)\n" , dm_info->device_model ? :"default" );printf ("\t\t\t(gfx_passthru %d)\n" , dm_info->gfx_passthru); -printf ("\t\t\t(serial %s)\n" , dm_info->serial); -printf ("\t\t\t(boot %s)\n" , dm_info->boot); -printf ("\t\t\t(usb %d)\n" , dm_info->usb); -printf ("\t\t\t(usbdevice %s)\n" , dm_info->usbdevice); +printf ("\t\t\t(serial %s)\n" , b_info->u.hvm.serial); +printf ("\t\t\t(boot %s)\n" , b_info->u.hvm.boot); +printf ("\t\t\t(usb %d)\n" , b_info->u.hvm.usb); +printf ("\t\t\t(usbdevice %s)\n" , b_info->u.hvm.usbdevice);printf ("\t\t)\n" );break ;case LIBXL_DOMAIN_TYPE_PV :
@@ -1209,14 +1209,14 @@ skip_vfb: b_info->u.hvm.nographic = l;if (!xlu_cfg_get_long (config,"gfx_passthru" , &l,0 )) dm_info->gfx_passthru = l; -xlu_cfg_replace_string (config,"serial" , &dm_info->serial,0 ); -xlu_cfg_replace_string (config,"boot" , &dm_info->boot,0 ); +xlu_cfg_replace_string (config,"serial" , &b_info->u.hvm.serial,0 ); +xlu_cfg_replace_string (config,"boot" , &b_info->u.hvm.boot,0 );if (!xlu_cfg_get_long (config,"usb" , &l,0 )) - dm_info->usb = l; -xlu_cfg_replace_string (config,"usbdevice" , &dm_info->usbdevice,0 ); -xlu_cfg_replace_string (config,"soundhw" , &dm_info->soundhw,0 ); + b_info->u.hvm.usb = l; +xlu_cfg_replace_string (config,"usbdevice" , &b_info->u.hvm.usbdevice,0 ); +xlu_cfg_replace_string (config,"soundhw" , &b_info->u.hvm.soundhw,0 );if (!xlu_cfg_get_long (config,"xen_platform_pci" , &l,0 )) - dm_info->xen_platform_pci = l; + b_info->u.hvm.xen_platform_pci = l; } dm_info->type = c_info->type;
PATCH 1/1 libxl: move gfx_passthru setting to b_info->u.hvm
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID b8a133e35c9100d301a19c217ee275b0a01ae55c # Parent 6caa4c9b20e176884050310999c5a5eb4c555a41
libxl: move gfx_passthru setting to b_info->u.hvm
Although xl parsed this value for both PV and HVM domains (and then a second time for HVM domains) inside libxl it only impacts HVM guests so I think this is the right place for it.
tools/libxl/libxl_dm.c +2 -2
@@ -240,7 +240,7 @@ static char ** libxl__build_device_modelif ( ioemu_vifs ==0 ) {flexarray_vappend (dm_args,"-net" ,"none" ,NULL ); } -if (info->gfx_passthru) { +if (b_info->u.hvm.gfx_passthru) {flexarray_append (dm_args,"-gfx_passthru" ); } }else {
@@ -480,7 +480,7 @@ static char ** libxl__build_device_modelflexarray_append (dm_args,"-net" );flexarray_append (dm_args,"none" ); } -if (info->gfx_passthru) { +if (b_info->u.hvm.gfx_passthru) {flexarray_append (dm_args,"-gfx_passthru" ); } }else {
tools/libxl/libxl_types.idl +2 -1
@@ -227,6 +227,8 @@ libxl_domain_build_info = Struct("domain ("sdl", libxl_sdl_info), ("spice", libxl_spice_info), + ("gfx_passthru", bool), + ("serial", string), ("boot", string), ("usb", bool),
@@ -264,7 +266,6 @@ libxl_device_model_info = Struct("device ("device_model", string), ("saved_state", string), ("type", libxl_domain_type), - ("gfx_passthru", bool), # extra parameters pass directly to qemu, NULL terminated ("extra", libxl_string_list), # extra parameters pass directly to qemu for PV guest, NULL terminated
tools/libxl/xl_cmdimpl.c +2 -5
@@ -381,7 +381,7 @@ static void printf_info(int domid,printf ("\t\t\t(spiceagent_mouse %d)\n" , b_info->u.hvm.spice.agent_mouse);printf ("\t\t\t(device_model %s)\n" , dm_info->device_model ? :"default" ); -printf ("\t\t\t(gfx_passthru %d)\n" , dm_info->gfx_passthru); +printf ("\t\t\t(gfx_passthru %d)\n" , b_info->u.hvm.gfx_passthru);printf ("\t\t\t(serial %s)\n" , b_info->u.hvm.serial);printf ("\t\t\t(boot %s)\n" , b_info->u.hvm.boot);printf ("\t\t\t(usb %d)\n" , b_info->u.hvm.usb);
@@ -732,9 +732,6 @@ static void parse_config_data(const charif (!xlu_cfg_get_long (config,"videoram" , &l,0 )) b_info->video_memkb = l *1024 ; -if (!xlu_cfg_get_long (config,"gfx_passthru" , &l,0 )) - dm_info->gfx_passthru = l; -switch (c_info->type) {case LIBXL_DOMAIN_TYPE_HVM :if (!xlu_cfg_get_string (config,"kernel" , &buf,0 ))
@@ -1208,7 +1205,7 @@ skip_vfb:if (!xlu_cfg_get_long (config,"nographic" , &l,0 )) b_info->u.hvm.nographic = l;if (!xlu_cfg_get_long (config,"gfx_passthru" , &l,0 )) - dm_info->gfx_passthru = l; + b_info->u.hvm.gfx_passthru = l;xlu_cfg_replace_string (config,"serial" , &b_info->u.hvm.serial,0 );xlu_cfg_replace_string (config,"boot" , &b_info->u.hvm.boot,0 );if (!xlu_cfg_get_long (config,"usb" , &l,0 ))
PATCH 1/1 libxl: Remove libxl_device_model_info.type
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID e5f62c6ec77ce933d4f5f92758e7d4aa5a7a6369 # Parent b8a133e35c9100d301a19c217ee275b0a01ae55c
libxl: Remove libxl_device_model_info.type.
This is the type of the target guest which is part of the guest config.
tools/libxl/libxl_create.c +0 -1
@@ -602,7 +602,6 @@ static int do_domain_create(libxl__gc *gmemset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); xenpv_dm_info.device_model_version = d_config->dm_info.device_model_version; - xenpv_dm_info.type = d_config->dm_info.type; xenpv_dm_info.device_model = d_config->dm_info.device_model; xenpv_dm_info.extra = d_config->dm_info.extra; xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv;
tools/libxl/libxl_dm.c +10 -10
@@ -77,7 +77,7 @@ static const libxl_vnc_info *dm_vnc(cons const libxl_device_model_info *info) {const libxl_vnc_info *vnc =NULL ; -if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { +if (guest_config->b_info.type ==LIBXL_DOMAIN_TYPE_HVM ) { vnc = &guest_config->b_info.u.hvm.vnc; }else if (guest_config->num_vfbs >0 ) { vnc = &guest_config->vfbs[0 ].vnc;
@@ -89,7 +89,7 @@ static const libxl_sdl_info *dm_sdl(cons const libxl_device_model_info *info) {const libxl_sdl_info *sdl =NULL ; -if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { +if (guest_config->b_info.type ==LIBXL_DOMAIN_TYPE_HVM ) { sdl = &guest_config->b_info.u.hvm.sdl; }else if (guest_config->num_vfbs >0 ) { sdl = &guest_config->vfbs[0 ].sdl;
@@ -100,7 +100,7 @@ static const libxl_sdl_info *dm_sdl(consstatic const char *dm_keymap (const libxl_domain_config *guest_config,const libxl_device_model_info *info) { -if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { +if (guest_config->b_info.type ==LIBXL_DOMAIN_TYPE_HVM ) {return guest_config->b_info.u.hvm.keymap; }else if (guest_config->num_vfbs >0 ) {return guest_config->vfbs[0 ].keymap;
@@ -171,7 +171,7 @@ static char ** libxl__build_device_modelif (keymap) {flexarray_vappend (dm_args,"-k" , keymap,NULL ); } -if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { +if (b_info->type ==LIBXL_DOMAIN_TYPE_HVM ) {int ioemu_vifs =0 ;if (b_info->u.hvm.serial) {
@@ -254,7 +254,7 @@ static char ** libxl__build_device_modelfor (i =0 ; info->extra && info->extra[i] !=NULL ; i++)flexarray_append (dm_args, info->extra[i]);flexarray_append (dm_args,"-M" ); -switch (info->type) { +switch (b_info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" );for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++)
@@ -353,7 +353,7 @@ static char ** libxl__build_device_modelflexarray_append (dm_args,"-mon" );flexarray_append (dm_args,"chardev=libxl-cmd,mode=control" ); -if (info->type ==LIBXL_DOMAIN_TYPE_PV ) { +if (b_info->type ==LIBXL_DOMAIN_TYPE_PV ) {flexarray_append (dm_args,"-xen-attach" ); }
@@ -400,7 +400,7 @@ static char ** libxl__build_device_modelflexarray_vappend (dm_args,"-k" , keymap,NULL ); } -if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { +if (b_info->type ==LIBXL_DOMAIN_TYPE_HVM ) {int ioemu_vifs =0 ;if (b_info->u.hvm.serial) {
@@ -498,7 +498,7 @@ static char ** libxl__build_device_modelfor (i =0 ; info->extra && info->extra[i] !=NULL ; i++)flexarray_append (dm_args, info->extra[i]);flexarray_append (dm_args,"-M" ); -switch (info->type) { +switch (b_info->type) {case LIBXL_DOMAIN_TYPE_PV :flexarray_append (dm_args,"xenpv" );for (i =0 ; info->extra_pv && info->extra_pv[i] !=NULL ; i++)
@@ -517,7 +517,7 @@ static char ** libxl__build_device_modellibxl__sprintf (gc,"%d" , libxl__sizekb_to_mb(b_info->target_memkb))); -if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { +if (b_info->type ==LIBXL_DOMAIN_TYPE_HVM ) {for (i =0 ; i < num_disks; i++) {int disk, part; int dev_number =
@@ -700,6 +700,7 @@ static int libxl__create_stubdom(libxl__libxl_uuid_copy (&dm_config.c_info.uuid, &info->uuid);memset (&dm_config.b_info,0x00 ,sizeof (libxl_domain_build_info)); + dm_config.b_info.type = dm_config.c_info.type; dm_config.b_info.max_vcpus =1 ; dm_config.b_info.max_memkb =32 *1024 ; dm_config.b_info.target_memkb = dm_config.b_info.max_memkb;
@@ -828,7 +829,6 @@ retry_transaction:memset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); xenpv_dm_info.device_model_version = info->device_model_version; - xenpv_dm_info.type =LIBXL_DOMAIN_TYPE_PV ; xenpv_dm_info.device_model = info->device_model; xenpv_dm_info.extra = info->extra; xenpv_dm_info.extra_pv = info->extra_pv;
tools/libxl/libxl_types.idl +0 -1
@@ -265,7 +265,6 @@ libxl_device_model_info = Struct("device # you set device_model you must set device_model_version too ("device_model", string), ("saved_state", string), - ("type", libxl_domain_type), # extra parameters pass directly to qemu, NULL terminated ("extra", libxl_string_list), # extra parameters pass directly to qemu for PV guest, NULL terminated
tools/libxl/xl_cmdimpl.c +0 -2
@@ -1216,8 +1216,6 @@ skip_vfb: b_info->u.hvm.xen_platform_pci = l; } - dm_info->type = c_info->type; -xlu_cfg_destroy (config); }
PATCH 1/1 libxl: remove uuid from device model info
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID 1f5af57bd77645f1e2e235b4cf786025aae4c73f # Parent e5f62c6ec77ce933d4f5f92758e7d4aa5a7a6369
libxl: remove uuid from device model info.
This should be managed by libxl and need not be exposed to the user.
tools/libxl/libxl_create.c +0 -2
@@ -128,8 +128,6 @@ int libxl_init_dm_info(libxl_ctx *ctx, {memset (dm_info,'\0' ,sizeof (*dm_info)); -libxl_uuid_generate (&dm_info->uuid); - dm_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; dm_info->device_model_stubdomain = false; dm_info->device_model =NULL ;
tools/libxl/libxl_dm.c +1 -1
@@ -697,7 +697,7 @@ static int libxl__create_stubdom(libxl__ dm_config.c_info.type =LIBXL_DOMAIN_TYPE_PV ; dm_config.c_info.name =libxl__sprintf (gc,"%s-dm" ,libxl__domid_to_name (gc, info->domid)); -libxl_uuid_copy (&dm_config.c_info.uuid, &info->uuid); +libxl_uuid_generate (&dm_config.c_info.uuid);memset (&dm_config.b_info,0x00 ,sizeof (libxl_domain_build_info)); dm_config.b_info.type = dm_config.c_info.type;
tools/libxl/libxl_types.idl +0 -3
@@ -257,9 +257,6 @@ libxl_domain_build_info = Struct("domain libxl_device_model_info = Struct("device_model_info",[ ("domid", libxl_domid), - # uuid is used only with stubdom, and must be different from the - # domain uuid - ("uuid", libxl_uuid), ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", bool), # you set device_model you must set device_model_version too
PATCH 1/1 libxl: move device model selection variables to b_info
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID 3101b9483229b61afe4945949832c04abe323a59 # Parent 1f5af57bd77645f1e2e235b4cf786025aae4c73f
libxl: move device model selection variables to b_info.
Currently we have one set of device model version (and associated) variables. However we can actually have two device models (stub device model + non-stub PV device model) which need not necessarily be the same version. Perhaps this needs more thought.
tools/libxl/libxl.c +1 -1
@@ -2378,7 +2378,7 @@ int libxl_domain_need_memory(libxl_ctx *switch (b_info->type) {case LIBXL_DOMAIN_TYPE_HVM : *need_memkb += b_info->shadow_memkb +LIBXL_HVM_EXTRA_MEMORY ; -if (dm_info->device_model_stubdomain) +if (b_info->device_model_stubdomain) *need_memkb +=32 *1024 ;break ;case LIBXL_DOMAIN_TYPE_PV :
tools/libxl/libxl_create.c +10 -13
@@ -77,6 +77,12 @@ int libxl_init_build_info(libxl_ctx *ctx b_info->cpuid =NULL ; b_info->shadow_memkb =0 ; b_info->type = c_info->type; + + b_info->device_model_version = +LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; + b_info->device_model_stubdomain = false; + b_info->device_model =NULL ; +switch (b_info->type) {case LIBXL_DOMAIN_TYPE_HVM : b_info->video_memkb =8 *1024 ;
@@ -128,9 +134,6 @@ int libxl_init_dm_info(libxl_ctx *ctx, {memset (dm_info,'\0' ,sizeof (*dm_info)); - dm_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; - dm_info->device_model_stubdomain = false; - dm_info->device_model =NULL ;return 0 ; }
@@ -456,14 +459,14 @@ retry_transaction: }static int store_libxl_entry (libxl__gc *gc,uint32_t domid, -libxl_device_model_info *dm_info) +libxl_domain_build_info *b_info) {char *path =NULL ; path =libxl__xs_libxl_path (gc, domid); path =libxl__sprintf (gc,"%s/dm-version" , path);return libxl__xs_write (gc,XBT_NULL , path,"%s" , -libxl_device_model_version_to_string (dm_info->device_model_version)); +libxl_device_model_version_to_string (b_info->device_model_version)); } static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
@@ -522,7 +525,7 @@ static int do_domain_create(libxl__gc *g goto error_out; } -store_libxl_entry (gc, domid, dm_info); +store_libxl_entry (gc, domid, &d_config->b_info);for (i =0 ; i < d_config->num_disks; i++) { ret =libxl_device_disk_add (ctx, domid, &d_config->disks[i]);
@@ -598,12 +601,6 @@ static int do_domain_create(libxl__gc *gif (need_qemu) {/* only copy those useful configs */ memset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); - xenpv_dm_info.device_model_version = - d_config->dm_info.device_model_version; - xenpv_dm_info.device_model = d_config->dm_info.device_model; - xenpv_dm_info.extra = d_config->dm_info.extra; - xenpv_dm_info.extra_pv = d_config->dm_info.extra_pv; - xenpv_dm_info.extra_hvm = d_config->dm_info.extra_hvm;libxl__create_xenpv_qemu (gc, domid, d_config, &xenpv_dm_info, &dm_starting);
@@ -616,7 +613,7 @@ static int do_domain_create(libxl__gc *g }if (dm_starting) { -if (dm_info->device_model_version +if (d_config->b_info.device_model_version ==LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ) {libxl__qmp_initializations (ctx, domid); }
tools/libxl/libxl_dm.c +31 -26
152 lines not on this page · raw message
tools/libxl/libxl_dom.c +2 -2
@@ -299,7 +299,7 @@ static const char *libxl__domain_firmwarif (info->u.hvm.firmware) firmware = info->u.hvm.firmware;else { -switch (dm_info->device_model_version) +switch (info->device_model_version) {case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL : firmware ="hvmloader" ;
@@ -309,7 +309,7 @@ static const char *libxl__domain_firmwarbreak ;default :LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"invalid device model version %d" , - dm_info->device_model_version); + info->device_model_version);return NULL ;break ; }
tools/libxl/libxl_internal.h +1 -1
@@ -491,7 +491,7 @@ _hidden int libxl__domain_build(libxl__g/* for device model creation */ _hidden const char *libxl__domain_device_model(libxl__gc *gc, -libxl_device_model_info *info); +const libxl_domain_build_info *info); _hidden int libxl__create_device_model(libxl__gc *gc, libxl_domain_config *guest_config, libxl_device_model_info *info,
tools/libxl/libxl_types.idl +13 -10
@@ -204,6 +204,19 @@ libxl_domain_build_info = Struct("domain ("disable_migrate", bool), ("cpuid", libxl_cpuid_policy_list), ("type", libxl_domain_type), + + ("device_model_version", libxl_device_model_version), + ("device_model_stubdomain", bool), + # you set device_model you must set device_model_version too + ("device_model", string), + + # extra parameters pass directly to qemu, NULL terminated + ("extra", libxl_string_list), + # extra parameters pass directly to qemu for PV guest, NULL terminated + ("extra_pv", libxl_string_list), + # extra parameters pass directly to qemu for HVM guest, NULL terminated + ("extra_hvm", libxl_string_list), + ("u", KeyedUnion(None, libxl_domain_type, "type", [("hvm", Struct(None, [("firmware", string), ("pae", bool),
@@ -257,17 +270,7 @@ libxl_domain_build_info = Struct("domain libxl_device_model_info = Struct("device_model_info",[ ("domid", libxl_domid), - ("device_model_version", libxl_device_model_version), - ("device_model_stubdomain", bool), - # you set device_model you must set device_model_version too - ("device_model", string), ("saved_state", string), - # extra parameters pass directly to qemu, NULL terminated - ("extra", libxl_string_list), - # extra parameters pass directly to qemu for PV guest, NULL terminated - ("extra_pv", libxl_string_list), - # extra parameters pass directly to qemu for HVM guest, NULL terminated - ("extra_hvm", libxl_string_list), ], )
tools/libxl/xl_cmdimpl.c +7 -7
@@ -380,7 +380,7 @@ static void printf_info(int domid, b_info->u.hvm.spice.disable_ticketing);printf ("\t\t\t(spiceagent_mouse %d)\n" , b_info->u.hvm.spice.agent_mouse); -printf ("\t\t\t(device_model %s)\n" , dm_info->device_model ? :"default" ); +printf ("\t\t\t(device_model %s)\n" , b_info->device_model ? :"default" );printf ("\t\t\t(gfx_passthru %d)\n" , b_info->u.hvm.gfx_passthru);printf ("\t\t\t(serial %s)\n" , b_info->u.hvm.serial);printf ("\t\t\t(boot %s)\n" , b_info->u.hvm.boot);
@@ -1133,27 +1133,27 @@ skip_vfb:xlu_cfg_replace_string (config,"device_model_override" , - &dm_info->device_model,0 ); + &b_info->device_model,0 );if (!xlu_cfg_get_string (config,"device_model_version" , &buf,0 )) {if (!strcmp (buf,"qemu-xen-traditional" )) { - dm_info->device_model_version + b_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ; }else if (!strcmp (buf,"qemu-xen" )) { - dm_info->device_model_version + b_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN ; }else {fprintf (stderr,"Unknown device_model_version \"%s\" specified\n" , buf);exit (1 ); } - }else if (dm_info->device_model) + }else if (b_info->device_model)fprintf (stderr,"WARNING: device model override given without specific DM version\n" );if (!xlu_cfg_get_long (config,"device_model_stubdomain_override" , &l,0 )) - dm_info->device_model_stubdomain = l; + b_info->device_model_stubdomain = l;#define parse_extra_args (type) \ e = xlu_cfg_get_list_as_string_list(config, "device_model_args"#type, \ - &dm_info->extra##type, 0); \ + &b_info->extra##type, 0); \ if (e && e != ESRCH) { \ fprintf(stderr,"xl: Unable to parse device_model_args"#type".\n");\ exit(-ERROR_FAIL); \
PATCH 1/1 libxl: move "saved_state" to libxl__domain_build_state
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID 4ef7e58d38791a1bbcb982e6f948ab1f0c805d5f # Parent 3101b9483229b61afe4945949832c04abe323a59
libxl: move "saved_state" to libxl__domain_build_state.
This is internal to the library and need not be exposed to the user.
tools/libxl/libxl_create.c +7 -10
@@ -275,9 +275,8 @@ static int domain_restore(libxl__gc *gc,if (ret) goto out; - dm_info->saved_state =NULL ;if (info->type ==LIBXL_DOMAIN_TYPE_HVM ) { - ret =asprintf (&dm_info->saved_state, + ret =asprintf (&state->saved_state,XC_DEVICE_MODEL_RESTORE_FILE ".%d" , domid); ret = (ret <0 ) ?ERROR_FAIL :0 ; }
@@ -509,13 +508,11 @@ static int do_domain_create(libxl__gc *g } } +memset (&state,0 ,sizeof (state)); +if ( restore_fd >=0 ) { ret =domain_restore (gc, &d_config->b_info, domid, restore_fd, &state, dm_info); }else { -if (dm_info->saved_state) { -free (dm_info->saved_state); - dm_info->saved_state =NULL ; - } ret =libxl__domain_build (gc, &d_config->b_info, dm_info, domid, &state); }
@@ -565,7 +562,7 @@ static int do_domain_create(libxl__gc *g dm_info->domid = domid; ret =libxl__create_device_model (gc, d_config, dm_info, - &dm_starting); + &state, &dm_starting);if (ret <0 ) {LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"failed to create device model: %d" , ret);
@@ -602,8 +599,8 @@ static int do_domain_create(libxl__gc *g/* only copy those useful configs */ memset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); -libxl__create_xenpv_qemu (gc, domid, - d_config, &xenpv_dm_info, &dm_starting); +libxl__create_xenpv_qemu (gc, domid, d_config, + &xenpv_dm_info, &state, &dm_starting); }break ; }
@@ -617,7 +614,7 @@ static int do_domain_create(libxl__gc *g == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {libxl__qmp_initializations (ctx, domid); } - ret =libxl__confirm_device_model_startup (gc, dm_info, dm_starting); + ret =libxl__confirm_device_model_startup (gc, &state, dm_starting);if (ret <0 ) {LIBXL__LOG (ctx,LIBXL__LOG_ERROR ,"device model did not start: %d" , ret);
tools/libxl/libxl_dm.c +34 -27
190 lines not on this page · raw message
tools/libxl/libxl_internal.h +6 -1
@@ -247,7 +247,10 @@ typedef struct {uint32_t console_port;unsigned long console_mfn; +unsigned long vm_generationid_addr; + +char *saved_state; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
@@ -495,10 +498,12 @@ _hidden const char *libxl__domain_device _hidden int libxl__create_device_model(libxl__gc *gc,libxl_domain_config *guest_config,libxl_device_model_info *info, +libxl__domain_build_state *state,libxl__spawner_starting **starting_r); _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,libxl_domain_config *guest_config,libxl_device_model_info *dm_info, +libxl__domain_build_state *state,libxl__spawner_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, int nr_consoles, libxl_device_console *consoles,
@@ -508,7 +513,7 @@ _hidden int libxl__need_xenpv_qemu(libxl* return pass *starting_r (which will be non-0) to * libxl__confirm_device_model_startup or libxl__detach_device_model. */ _hidden int libxl__confirm_device_model_startup(libxl__gc *gc, -libxl_device_model_info *dm_info, +libxl__domain_build_state *state,libxl__spawner_starting *starting); _hidden int libxl__detach_device_model(libxl__gc *gc, libxl__spawner_starting *starting); _hidden int libxl__wait_for_device_model(libxl__gc *gc,
tools/libxl/libxl_types.idl +0 -2
@@ -269,8 +269,6 @@ libxl_domain_build_info = Struct("domain # Device Model Information libxl_device_model_info = Struct("device_model_info",[ ("domid", libxl_domid), - - ("saved_state", string), ], )
PATCH 1/1 libxl: remove libxl_device_model_info
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1327336698 0
# Node ID 62bffbc5495b3e897d6fbb654453f2335556e06e # Parent 4ef7e58d38791a1bbcb982e6f948ab1f0c805d5f
libxl: remove libxl_device_model_info.
All that is left here is the target domain's domid which we can pass around as a parameter.
tools/libxl/libxl.c +1 -1
@@ -2370,7 +2370,7 @@ out: }int libxl_domain_need_memory (libxl_ctx *ctx,libxl_domain_build_info *b_info, -libxl_device_model_info *dm_info,uint32_t *need_memkb) +uint32_t *need_memkb) {GC_INIT (ctx);int rc =ERROR_INVAL ;
tools/libxl/libxl.h +1 -6
@@ -230,7 +230,6 @@ enum { typedef struct { libxl_domain_create_info c_info; libxl_domain_build_info b_info; - libxl_device_model_info dm_info; int num_disks, num_vifs, num_pcidevs, num_vfbs, num_vkbs;
@@ -258,10 +257,6 @@ int libxl_init_create_info(libxl_ctx *ctint libxl_init_build_info (libxl_ctx *ctx,libxl_domain_build_info *b_info,libxl_domain_create_info *c_info); -int libxl_init_dm_info (libxl_ctx *ctx, -libxl_device_model_info *dm_info, -libxl_domain_create_info *c_info, -libxl_domain_build_info *b_info);typedef int (*libxl_console_ready )(libxl_ctx *ctx,uint32_t domid,void *priv);int libxl_domain_create_new (libxl_ctx *ctx,libxl_domain_config *d_config,libxl_console_ready cb,void *priv,uint32_t *domid);int libxl_domain_create_restore (libxl_ctx *ctx,libxl_domain_config *d_config,libxl_console_ready cb,void *priv,uint32_t *domid,int restore_fd);
@@ -359,7 +354,7 @@ int libxl_set_memory_target(libxl_ctx *cint libxl_get_memory_target (libxl_ctx *ctx,uint32_t domid,uint32_t *out_target);/* how much free memory in the system a domain needs to be built */ int libxl_domain_need_memory (libxl_ctx *ctx,libxl_domain_build_info *b_info, -libxl_device_model_info *dm_info,uint32_t *need_memkb); +uint32_t *need_memkb);/* how much free memory is available in the system */ int libxl_get_free_memory (libxl_ctx *ctx,uint32_t *memkb);/* wait for a given amount of memory to be free in the system */
tools/libxl/libxl_create.c +6 -27
@@ -48,7 +48,6 @@ void libxl_domain_config_dispose(libxl_dlibxl_domain_create_info_dispose (&d_config->c_info);libxl_domain_build_info_dispose (&d_config->b_info); -libxl_device_model_info_dispose (&d_config->dm_info); }int libxl_init_create_info (libxl_ctx *ctx,libxl_domain_create_info *c_info)
@@ -127,17 +126,6 @@ int libxl_init_build_info(libxl_ctx *ctxreturn 0 ; } -int libxl_init_dm_info (libxl_ctx *ctx, -libxl_device_model_info *dm_info, -libxl_domain_create_info *c_info, -libxl_domain_build_info *b_info) -{ -memset (dm_info,'\0' ,sizeof (*dm_info)); - - -return 0 ; -} -static int init_console_info (libxl_device_console *console,int dev_num) {memset (console,0x00 ,sizeof (libxl_device_console));
@@ -151,7 +139,6 @@ static int init_console_info(libxl_devicint libxl__domain_build (libxl__gc *gc,libxl_domain_build_info *info, -libxl_device_model_info *dm_info,uint32_t domid,libxl__domain_build_state *state) {
@@ -167,7 +154,7 @@ int libxl__domain_build(libxl__gc *gc,switch (info->type) {case LIBXL_DOMAIN_TYPE_HVM : - ret =libxl__build_hvm (gc, domid, info, dm_info, state); + ret =libxl__build_hvm (gc, domid, info, state);if (ret) goto out;
@@ -221,8 +208,7 @@ out:static int domain_restore (libxl__gc *gc,libxl_domain_build_info *info,uint32_t domid,int fd, -libxl__domain_build_state *state, -libxl_device_model_info *dm_info) +libxl__domain_build_state *state) {libxl_ctx *ctx =libxl__gc_owner (gc);char **vments =NULL , **localents =NULL ;
@@ -474,7 +460,6 @@ static int do_domain_create(libxl__gc *g {libxl_ctx *ctx =libxl__gc_owner (gc);libxl__spawner_starting *dm_starting =0 ; -libxl_device_model_info *dm_info = &d_config->dm_info;libxl__domain_build_state state;uint32_t domid;int i, ret;
@@ -511,9 +496,9 @@ static int do_domain_create(libxl__gc *gmemset (&state,0 ,sizeof (state));if ( restore_fd >=0 ) { - ret =domain_restore (gc, &d_config->b_info, domid, restore_fd, &state, dm_info); + ret =domain_restore (gc, &d_config->b_info, domid, restore_fd, &state); }else { - ret =libxl__domain_build (gc, &d_config->b_info, dm_info, domid, &state); + ret =libxl__domain_build (gc, &d_config->b_info, domid, &state); }if (ret) {
@@ -560,8 +545,7 @@ static int do_domain_create(libxl__gc *glibxl_device_vkb_add (ctx, domid, &vkb);libxl_device_vkb_dispose (&vkb); - dm_info->domid = domid; - ret =libxl__create_device_model (gc, d_config, dm_info, + ret =libxl__create_device_model (gc, domid, d_config, &state, &dm_starting);if (ret <0 ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
@@ -574,7 +558,6 @@ static int do_domain_create(libxl__gc *g {int need_qemu =0 ;libxl_device_console console; -libxl_device_model_info xenpv_dm_info;for (i =0 ; i < d_config->num_vfbs; i++) {libxl_device_vfb_add (ctx, domid, &d_config->vfbs[i]);
@@ -596,11 +579,7 @@ static int do_domain_create(libxl__gc *glibxl_device_console_dispose (&console);if (need_qemu) { -/* only copy those useful configs */ -memset ((void *)&xenpv_dm_info,0 ,sizeof (libxl_device_model_info)); - -libxl__create_xenpv_qemu (gc, domid, d_config, - &xenpv_dm_info, &state, &dm_starting); +libxl__create_xenpv_qemu (gc, domid, d_config, &state, &dm_starting); }break ; }
tools/libxl/libxl_dm.c +79 -83
419 lines not on this page · raw message
tools/libxl/libxl_dom.c +2 -4
@@ -290,8 +290,7 @@ static int hvm_build_set_params(xc_inter }static const char *libxl__domain_firmware (libxl__gc *gc, -libxl_domain_build_info *info, -libxl_device_model_info *dm_info) +libxl_domain_build_info *info) {libxl_ctx *ctx =libxl__gc_owner (gc);const char *firmware;
@@ -319,12 +318,11 @@ static const char *libxl__domain_firmwarint libxl__build_hvm (libxl__gc *gc,uint32_t domid,libxl_domain_build_info *info, -libxl_device_model_info *dm_info,libxl__domain_build_state *state) {libxl_ctx *ctx =libxl__gc_owner (gc);int ret, rc =ERROR_FAIL ; -const char *firmware =libxl__domain_firmware (gc, info, dm_info); +const char *firmware =libxl__domain_firmware (gc, info);if (!firmware) goto out;
tools/libxl/libxl_internal.h +4 -5
@@ -263,7 +263,6 @@ _hidden int libxl__build_pv(libxl__gc *g libxl_domain_build_info *info, libxl__domain_build_state *state); _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,libxl_domain_build_info *info, -libxl_device_model_info *dm_info,libxl__domain_build_state *state); _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
@@ -485,10 +484,11 @@ _hidden void libxl__exec(int stdinfd, in const char *arg0, char **args); // logs errors, never returns/* from xl_create */ -_hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid); +_hidden int libxl__domain_make(libxl__gc *gc, +libxl_domain_create_info *info, +uint32_t *domid); _hidden int libxl__domain_build(libxl__gc *gc,libxl_domain_build_info *info, -libxl_device_model_info *dm_info,uint32_t domid,libxl__domain_build_state *state);
@@ -496,13 +496,12 @@ _hidden int libxl__domain_build(libxl__g _hidden const char *libxl__domain_device_model(libxl__gc *gc,const libxl_domain_build_info *info); _hidden int libxl__create_device_model(libxl__gc *gc, +int domid,libxl_domain_config *guest_config, -libxl_device_model_info *info,libxl__domain_build_state *state,libxl__spawner_starting **starting_r); _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,libxl_domain_config *guest_config, -libxl_device_model_info *dm_info,libxl__domain_build_state *state,libxl__spawner_starting **starting_r); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
tools/libxl/libxl_types.idl +0 -6
@@ -266,12 +266,6 @@ libxl_domain_build_info = Struct("domain ], ) -# Device Model Information -libxl_device_model_info = Struct("device_model_info",[ - ("domid", libxl_domid), - ], -) - libxl_device_vfb = Struct("device_vfb", [ ("backend_domid", libxl_domid), ("devid", integer),
tools/libxl/xl_cmdimpl.c +9 -15
@@ -289,8 +289,7 @@ static void dolog(const char *file, int }static void printf_info (int domid, -libxl_domain_config *d_config, -libxl_device_model_info *dm_info) +libxl_domain_config *d_config) {int i;libxl_dominfo info;
@@ -571,8 +570,7 @@ static void split_string_into_string_lisstatic void parse_config_data (const char *configfile_filename_report,const char *configfile_data,int configfile_len, -libxl_domain_config *d_config, -libxl_device_model_info *dm_info) +libxl_domain_config *d_config) {const char *buf;long l;
@@ -1110,9 +1108,6 @@ skip_vfb:break ; } -/* init dm from c and b */ -if (libxl_init_dm_info (ctx, dm_info, c_info, b_info)) -exit (1 );/* parse device model arguments, this works for pv, hvm and stubdom */ if (!xlu_cfg_get_string (config,"device_model" , &buf,0 )) { fprintf(stderr,
@@ -1363,7 +1358,7 @@ struct domain_create {int no_incr_generationid; }; -static int freemem (libxl_domain_build_info *b_info,libxl_device_model_info *dm_info) +static int freemem (libxl_domain_build_info *b_info) {int rc, retries =3 ;uint32_t need_memkb, free_memkb;
@@ -1371,7 +1366,7 @@ static int freemem(libxl_domain_build_inif (!autoballoon)return 0 ; - rc =libxl_domain_need_memory (ctx, b_info, dm_info, &need_memkb); + rc =libxl_domain_need_memory (ctx, b_info, &need_memkb);if (rc <0 )return rc;
@@ -1554,7 +1549,7 @@ static int create_domain(struct domain_cif (!dom_info->quiet)printf ("Parsing config file %s\n" , config_file); -parse_config_data (config_file, config_data, config_len, &d_config, &d_config.dm_info); +parse_config_data (config_file, config_data, config_len, &d_config);if (migrate_fd >=0 ) {if (d_config.c_info.name) {
@@ -1579,7 +1574,7 @@ static int create_domain(struct domain_c dom_info->no_incr_generationid;if (debug || dom_info->dryrun) -printf_info (-1 , &d_config, &d_config.dm_info); +printf_info (-1 , &d_config); ret =0 ;if (dom_info->dryrun)
@@ -1592,7 +1587,7 @@ start:if (rc <0 ) goto error_out; - ret =freemem (&d_config.b_info, &d_config.dm_info); + ret =freemem (&d_config.b_info);if (ret <0 ) {fprintf (stderr,"failed to free memory for the domain\n" ); ret =ERROR_FAIL ;
@@ -2336,7 +2331,6 @@ static void list_domains_details(const lchar *config_file;uint8_t *data;int i, len, rc; -libxl_device_model_info dm_info;for (i =0 ; i < nb_domain; i++) {/* no detailed info available on dom0 */
@@ -2347,8 +2341,8 @@ static void list_domains_details(const lcontinue ;CHK_ERRNO (asprintf (&config_file,"<domid %d data>" , info[i].domid));memset (&d_config,0x00 ,sizeof (d_config)); -parse_config_data (config_file, (char *)data, len, &d_config, &dm_info); -printf_info (info[i].domid, &d_config, &dm_info); +parse_config_data (config_file, (char *)data, len, &d_config); +printf_info (info[i].domid, &d_config);libxl_domain_config_dispose (&d_config);free (data);free (config_file);
PATCH 1/1 libxl: only write "disable_pf" key to xenstore when it makes sense
In reply to Ian Campbell# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1327336698 0
# Node ID 5f20c5ddd4e42242bfb32b85652c5957c40ba320
# Parent 62bffbc5495b3e897d6fbb654453f2335556e06e
libxl: only write "disable_pf" key to xenstore when it makes sense
This key is only used by the traditional qemu-dm when servicing an HVM domain.
tools/libxl/libxl_dm.c +6 -2
@@ -929,8 +929,12 @@ int libxl__create_device_model(libxl__gc path =libxl__sprintf (gc,"/local/domain/0/device-model/%d" , domid);xs_mkdir (ctx->xsh,XBT_NULL , path); -libxl__xs_write (gc,XBT_NULL ,libxl__sprintf (gc,"%s/disable_pf" , path), -"%d" , !b_info->u.hvm.xen_platform_pci); + +if (b_info->type ==LIBXL_DOMAIN_TYPE_HVM && + b_info->device_model_version + ==LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL ) +libxl__xs_write (gc,XBT_NULL ,libxl__sprintf (gc,"%s/disable_pf" , path), +"%d" , !b_info->u.hvm.xen_platform_pci); libxl_create_logfile(ctx, libxl__sprintf(gc, "qemu-dm-%s", c_info->name),
Re: [PATCH 03 of 20] ocaml: use libxl IDL type helpers for C argument passing
In reply to Ian CampbellIan Campbell writes ("[PATCH 03 of 20] ocaml: use libxl IDL type helpers for C argument passing"):
Quoted 1 line
ocaml: use libxl IDL type helpers for C argument passing
Re: [PATCH 08 of 20] libxl: now that dm creation takes domain_config stop passing down devices
In reply to Ian CampbellIan Campbell writes ("[PATCH 08 of 20] libxl: now that dm creation takes domain_config stop passing down devices"):
Quoted 1 line
libxl: now that dm creation takes
domain_configstop passing down devices.
Re: [PATCH 17 of 20] libxl: move device model selection variables to b_info
In reply to Ian CampbellIan Campbell writes ("[PATCH 17 of 20] libxl: move device model selection variables to b_info"):
Quoted 6 lines
libxl: move device model selection variables to
b_info.Currently we have one set of device model version (and associated) variables. However we can actually have two device models (stub device model + non-stub PV device model) which need not necessarily be the same version. Perhaps this needs more thought.
Your explanation here isn't entirely clear I think. AFAICT from reading the code, both before and after this patch we assume that both device models are of the same version and there is only one version knob to twiddle in the config file.
But I didn't peer into the whole thing in detail...
Ian.
Re: [PATCH 17 of 20] libxl: move device model selection variables to b_info
Quoted 8 lines · Ian Jackson
Ian Campbell writes ("[PATCH 17 of 20] libxl: move device model selection variables to
b_info"):Quoted 6 lines
libxl: move device model selection variables to
b_info.Currently we have one set of device model version (and associated) variables. However we can actually have two device models (stub device model + non-stub PV device model) which need not necessarily be the same version. Perhaps this needs more thought.
Quoted 4 lines
Your explanation here isn't entirely clear I think. AFAICT from reading the code, both before and after this patch we assume that both device models are of the same version and there is only one version knob to twiddle in the config file.
That's right. I have just moved where that one nob was. The comment was (now I look at it, misleadingly worded,) musing on whether we should have two nobs or not and/or how that would look.
Ian.