}
+static int
+virDomainDefPostParseInternal(virDomainDefPtr def,
+ virCapsPtr caps ATTRIBUTE_UNUSED)
+{
+ /* verify init path for container based domains */
+ if (STREQ(def->os.type, "exe") && !def->os.init) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("init binary must be specified"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
virDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
virDomainDefPtr def,
&data)) < 0)
return ret;
+
+ if ((ret = virDomainDefPostParseInternal(def, caps)) < 0)
+ return ret;
+
return 0;
}
if (STREQ(def->os.type, "exe")) {
def->os.init = virXPathString("string(./os/init[1])", ctxt);
- if (!def->os.init) {
- if (caps->defaultInitPath) {
- def->os.init = strdup(caps->defaultInitPath);
- if (!def->os.init) {
- goto no_memory;
- }
- } else {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("init binary must be specified"));
- goto error;
- }
- }
def->os.cmdline = virXPathString("string(./os/cmdline[1])", ctxt);
if ((n = virXPathNodeSet("./os/initarg", ctxt, &nodes)) < 0) {
}
}
+
+static int
+openvzDomainDefPostParse(virDomainDefPtr def,
+ virCapsPtr caps ATTRIBUTE_UNUSED,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ /* fill the init path */
+ if (STREQ(def->os.type, "exe") && !def->os.init) {
+ if (!(def->os.init = strdup("/sbin/init"))) {
+ virReportOOMError();
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+virDomainDefParserConfig openvzDomainDefParserConfig = {
+ .domainPostParseCallback = openvzDomainDefPostParse,
+};
+
+
/* generate arguments to create OpenVZ container
return -1 - error
0 - OK
if (!(driver->caps = openvzCapsInit()))
goto cleanup;
- if (!(driver->xmlopt = virDomainXMLOptionNew(NULL, NULL, NULL)))
+ if (!(driver->xmlopt = virDomainXMLOptionNew(&openvzDomainDefParserConfig,
+ NULL, NULL)))
goto cleanup;
if (openvzLoadDomains(driver) < 0)